<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Howtos &#187; apache</title>
	<atom:link href="http://howto.isgoodness.com/tag/apache/feed/" rel="self" type="application/rss+xml" />
	<link>http://howto.isgoodness.com</link>
	<description>Stuffs that are worth to mention and worth to know</description>
	<lastBuildDate>Sun, 27 Feb 2011 16:19:32 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Limit http methods</title>
		<link>http://howto.isgoodness.com/2009/12/limit-http-methods/</link>
		<comments>http://howto.isgoodness.com/2009/12/limit-http-methods/#comments</comments>
		<pubDate>Sat, 26 Dec 2009 21:50:46 +0000</pubDate>
		<dc:creator>Van Nhu</dc:creator>
				<category><![CDATA[Apache]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[http methods]]></category>
		<category><![CDATA[limit access]]></category>

		<guid isPermaLink="false">http://howto.isgoodness.com/?p=398</guid>
		<description><![CDATA[I you have an apache server which you only use GET and POST methods I think it is better that you limit the access. Since there are many methods it is more convinient to use the opposite functions, limitExcept. Bellow is an example how it would look like. The limitExcept directive allows only GET and [...]]]></description>
			<content:encoded><![CDATA[<p>I you have an apache server which you only use GET and POST methods I think it is better that you <a href="http://httpd.apache.org/docs/2.0/mod/core.html#limit" target="_blank">limit</a> the access. Since there are many methods it is more convinient to use the opposite functions, <a href="http://httpd.apache.org/docs/2.0/mod/core.html#limitexcept" target="_blank">limitExcept</a>. Bellow is an example how it would look like. The limitExcept directive allows only GET and POST. All other request methods will be rejected.</p>

<div class="wp_syntax"><div class="code"><pre class="init" style="font-family:monospace;">NameVirtualHost xxx.xxx.xxx:80
&lt;VirtualHost xxx.xxx.xxx:80&gt;
        ServerName example.com
&nbsp;
        DocumentRoot /path/to/doc/root
        &lt;Directory /path/to/doc/root/&gt;
                &lt;LimitExcept POST GET&gt;
                         Require valid-user
                &lt;/LimitExcept&gt; 
                Options Indexes MultiViews FollowSymLinks
                Order Allow,Deny
                Allow from all
        &lt;/Directory&gt;
...
&lt;/VirtualHost&gt;</pre></div></div>

<p>If you want to deny from the access you can use &#8220;Deny from all&#8221; instead of &#8220;Require valid-user&#8221;</p>
]]></content:encoded>
			<wfw:commentRss>http://howto.isgoodness.com/2009/12/limit-http-methods/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Deny requests from specific ips, configured in virtual host</title>
		<link>http://howto.isgoodness.com/2009/12/deny-requests-from-specific-ips-configured-in-virtual-host/</link>
		<comments>http://howto.isgoodness.com/2009/12/deny-requests-from-specific-ips-configured-in-virtual-host/#comments</comments>
		<pubDate>Sat, 26 Dec 2009 20:32:40 +0000</pubDate>
		<dc:creator>Van Nhu</dc:creator>
				<category><![CDATA[Apache]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[proxy abuse]]></category>
		<category><![CDATA[virtual host]]></category>

		<guid isPermaLink="false">http://howto.isgoodness.com/?p=382</guid>
		<description><![CDATA[Bad thing has hapened to me this holliday. The server has been attacked from serveral ips or more precis they used my server as proxy for attacking other targets. Lucky for me that my server is not configured for this kind of attacks. However, they kept request my server and I wanted that apache would [...]]]></description>
			<content:encoded><![CDATA[<p>Bad thing has hapened to me this holliday. The server has been attacked from serveral ips or more precis they used my server as proxy for attacking other targets. Lucky for me that my server is not configured for this kind of attacks. However, they kept request my server and I wanted that apache would deny all requests from those ips. This one is really tricky. I have configured for denying all except some ips, such as local, but never configured for denying some ips and allow the rest. I started reading apache docs and tried to understand. The result is as following:</p>

<div class="wp_syntax"><div class="code"><pre class="init" style="font-family:monospace;">NameVirtualHost xxx.xxx.xxx:80
&lt;VirtualHost xxx.xxx.xxx:80&gt;
        ServerName example.com
&nbsp;
        DocumentRoot /path/to/doc/root
        &lt;Directory /path/to/doc/root/&gt;
                Options Indexes MultiViews FollowSymLinks
                Order Deny,Allow
                Deny from xx.xxx.xxx.xxx
                Deny from xxx.xxx.xxx.xxx
                Deny from ...
                # ips that not matched deny list will be permitted
        &lt;/Directory&gt;
...
&lt;/VirtualHost&gt;</pre></div></div>

<p>Be aware that you can not use &#8220;Allow from all&#8221; in the end since apache deny a request only if it does not match an allow condition. So we have a deny list to match against. Ips that are not matched ips in this list will be permitted.</p>
<p>It says that there are no good way to protect against this kind of attacks. I hope that I can get in touch with those ip-owners and hopefully they can help me.</p>
<p>Some good pages</p>
<p>http://wiki.apache.org/httpd/ProxyAbuse</p>
<p>http://httpd.apache.org/docs/2.2/mod/mod_authz_host.html</p>
]]></content:encoded>
			<wfw:commentRss>http://howto.isgoodness.com/2009/12/deny-requests-from-specific-ips-configured-in-virtual-host/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Howto enable ssl and create self-signed ssl certificate</title>
		<link>http://howto.isgoodness.com/2009/11/howto-enable-ssl-and-create-self-signed-ssl-certificate/</link>
		<comments>http://howto.isgoodness.com/2009/11/howto-enable-ssl-and-create-self-signed-ssl-certificate/#comments</comments>
		<pubDate>Sun, 15 Nov 2009 14:51:18 +0000</pubDate>
		<dc:creator>Van Nhu</dc:creator>
				<category><![CDATA[Apache]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[certificate]]></category>
		<category><![CDATA[https]]></category>
		<category><![CDATA[ssl]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://howto.isgoodness.com/?p=345</guid>
		<description><![CDATA[Enable ssl In my case it was simple. I just ran this line a2enmod ssl Generate self-signed ssl certificate Solution: http://www.akadia.com/services/ssh_test_certificate.html Just follow instruction carefully. Make sure that i step 2 you need to enter a correct &#8220;Common Name&#8221;, ie your domain. Step 5 and 6 also different for different distributions and installation &#8230; Summary [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Enable ssl</strong><br />
In my case it was simple. I just ran this line</p>

<div class="wp_syntax"><div class="code"><pre class="ini" style="font-family:monospace;">a2enmod ssl</pre></div></div>

<p><strong>Generate self-signed ssl certificate</strong><br />
Solution: http://www.akadia.com/services/ssh_test_certificate.html</p>
<p>Just follow instruction carefully. Make sure that i step 2 you need to enter a correct &#8220;Common Name&#8221;, ie your domain. Step 5 and 6 also different for different distributions and installation &#8230;</p>
<p>Summary in case link above is not available anymore:<br />
Step 1: Generate a Private Key</p>

<div class="wp_syntax"><div class="code"><pre class="ini" style="font-family:monospace;">openssl genrsa -des3 -out server.key <span style="">1024</span></pre></div></div>

<p>Step 2: Generate a CSR (Certificate Signing Request)</p>

<div class="wp_syntax"><div class="code"><pre class="ini" style="font-family:monospace;">openssl req -new -key server.key -out server.csr</pre></div></div>

<p>Step 3: Remove Passphrase from Key</p>

<div class="wp_syntax"><div class="code"><pre class="ini" style="font-family:monospace;">cp server.key server.key.org
openssl rsa -in server.key.org -out server.key</pre></div></div>

<p>Step 4: Generating a Self-Signed Certificate</p>

<div class="wp_syntax"><div class="code"><pre class="ini" style="font-family:monospace;">openssl x509 -req -days <span style="">365</span> -in server.csr -signkey server.key -out server.crt</pre></div></div>

<p>Step 5: Installing the Private Key and Certificate<br />
  (or the location you want to store)</p>

<div class="wp_syntax"><div class="code"><pre class="ini" style="font-family:monospace;">cp server.crt /usr/local/apache/conf/ssl.crt
cp server.key /usr/local/apache/conf/ssl.key</pre></div></div>

<p>Step 6: Configuring SSL Enabled Virtual Hosts</p>

<div class="wp_syntax"><div class="code"><pre class="ini" style="font-family:monospace;">SSLEngine on
SSLCertificateFile /usr/local/apache/conf/ssl.crt
SSLCertificateKeyFile /usr/local/apache/conf/ssl.key
SetEnvIf User-Agent <span style="color: #933;">&quot;.*MSIE.*&quot;</span> nokeepalive ssl-unclean-shutdown</pre></div></div>

<p>Step 7: Restart Apache and Test</p>
<p><strong>New problem:</strong><br />
ssl_error_ssl2_disabled<br />
Solution in ssl.conf:<br />
# enable only secure protocols: SSLv3 and TLSv1, but not SSLv2<br />
## disabled this one<br />
#SSLProtocol all -SSLv2<br />
## use this instead<br />
SSLProtocol all</p>
<p>See also <a href="http://httpd.apache.org/docs/2.0/ssl/ssl_howto.html" target="_blank">http://httpd.apache.org/docs/2.0/ssl/ssl_howto.html</a></p>
<p><strong>New problem:</strong><br />
sec_error_untrusted_issuer due to self-signed SSL Certificate<br />
But it is no problem for me since this is for my own usage and test&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://howto.isgoodness.com/2009/11/howto-enable-ssl-and-create-self-signed-ssl-certificate/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

