<?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>Michael Conigliaro &#187; Apache</title>
	<atom:link href="http://conigliaro.org/category/apache/feed/" rel="self" type="application/rss+xml" />
	<link>http://conigliaro.org</link>
	<description>cat /dev/brain &#124; grep technology &#62;&#62; blog</description>
	<lastBuildDate>Wed, 06 Jan 2010 02:37:22 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Active Directory Authentication on Apache with mod_authnz_ldap</title>
		<link>http://conigliaro.org/2008/12/31/active-directory-authentication-on-apache-with-mod_authnz_ldap/</link>
		<comments>http://conigliaro.org/2008/12/31/active-directory-authentication-on-apache-with-mod_authnz_ldap/#comments</comments>
		<pubDate>Wed, 31 Dec 2008 21:19:31 +0000</pubDate>
		<dc:creator>Mike</dc:creator>
				<category><![CDATA[Apache]]></category>

		<guid isPermaLink="false">http://conigliaro.org/?p=549</guid>
		<description><![CDATA[
&#60;directory /path/to/top/secret/area&#62;
    AuthName &#34;Top Secret Area&#34;
    AuthType Basic
    AuthBasicProvider ldap
    AuthzLDAPAuthoritative Off
    AuthLDAPURL &#34;ldap://example.com:389/DC=example,DC=com?sAMAccountName?sub?(objectClass=*)&#34; NONE
    AuthLDAPBindDN apacheldapauth@example.com
    AuthLDAPBindPassword mypassword
    Require valid-group cn=Admins,ou=Groups,DC=example.com,DC=com
&#60;/directory&#62;

In this example, I am password-protecting /path/to/top/secret/area. The AuthLDAPURL directive [...]]]></description>
			<content:encoded><![CDATA[
<div class="wp_syntax"><div class="code"><pre class="apache" style="font-family:monospace;">&lt;<span style="color: #000000; font-weight:bold;">directory</span> /path/to/top/secret/area&gt;
    <span style="color: #00007f;">AuthName</span> <span style="color: #7f007f;">&quot;Top Secret Area&quot;</span>
    <span style="color: #00007f;">AuthType</span> Basic
    AuthBasicProvider ldap
    AuthzLDAPAuthoritative <span style="color: #0000ff;">Off</span>
    AuthLDAPURL <span style="color: #7f007f;">&quot;ldap://example.com:389/DC=example,DC=com?sAMAccountName?sub?(objectClass=*)&quot;</span> <span style="color: #0000ff;">NONE</span>
    AuthLDAPBindDN apacheldapauth@<span style="color: #00007f;">example</span>.com
    AuthLDAPBindPassword mypassword
    <span style="color: #00007f;">Require</span> valid-<span style="color: #00007f;">group</span> cn=Admins,ou=Groups,DC=<span style="color: #00007f;">example</span>.com,DC=com
&lt;/<span style="color: #000000; font-weight:bold;">directory</span>&gt;</pre></div></div>

<p>In this example, I am password-protecting <strong>/path/to/top/secret/area</strong>. The <strong>AuthLDAPURL</strong> directive contains the address of your active directory server (ldap://example.com:389), the base DN to search (DC=example,DC=com), and the LDAP attribute that contains the user&#8217;s username (sAMAccountName). In order to perform the search, Apache will bind to the Active Directory server using the credentials defined in <strong>AuthLDAPBindDN</strong> and <strong>AuthLDAPBindPassword</strong>. If a user is found and the password matches, one last search is done to make sure they belong to the appropriate group (cn=Admins,ou=Groups,DC=example.com,DC=com).</p>
<p>There&#8217;s nothing special about this example so far as it relates to Active Directory. The same config should work on any LDAP server. However, the real key to making this work with Active Directory is by adding the following to <strong>/etc/openldap/ldap.conf</strong>:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">REFERRALS off</pre></div></div>

<p>Note that since the bind password is stored in plain text, make sure your Apache config file file can only be read by authorized users.</p>
]]></content:encoded>
			<wfw:commentRss>http://conigliaro.org/2008/12/31/active-directory-authentication-on-apache-with-mod_authnz_ldap/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Redirect to the SSL Version of a Page with mod_rewrite on Apache</title>
		<link>http://conigliaro.org/2008/12/23/redirect-to-the-ssl-version-of-a-page-with-mod_rewrite-on-apache/</link>
		<comments>http://conigliaro.org/2008/12/23/redirect-to-the-ssl-version-of-a-page-with-mod_rewrite-on-apache/#comments</comments>
		<pubDate>Tue, 23 Dec 2008 15:27:57 +0000</pubDate>
		<dc:creator>Mike</dc:creator>
				<category><![CDATA[Apache]]></category>

		<guid isPermaLink="false">http://conigliaro.org/?p=542</guid>
		<description><![CDATA[User: The web interface doesn&#8217;t work.
Mike: Type &#8220;https&#8221; instead of &#8220;http.&#8221;
User: Oh yeah, now it works.
A quick exchange like this is not a big deal on its own, but as every sysadmin knows, little things like this can add up and become annoying very quickly (for all parties involved). I find that if I can [...]]]></description>
			<content:encoded><![CDATA[<p><strong>User:</strong> The web interface doesn&#8217;t work.<br />
<strong>Mike:</strong> Type &#8220;https&#8221; instead of &#8220;http.&#8221;<br />
<strong>User:</strong> Oh yeah, now it works.</p>
<p>A quick exchange like this is not a big deal on its own, but as every sysadmin knows, little things like this can add up and become annoying very quickly (for all parties involved). I find that if I can prevent these little distractions from happening in the first place, everyone is a little happier and more productive.</p>
<p>One way I accomplish this is by <strong>not</strong> expecting users to remember which sites need to be accessed via SSL and which do not. I just allow them to connect to everything on port 80, then I let mod_rewrite redirect them to the SSL version as needed:</p>

<div class="wp_syntax"><div class="code"><pre class="apache" style="font-family:monospace;">&lt;<span style="color: #000000; font-weight:bold;">location</span> <span style="color: #7f007f;">&quot;/&quot;</span>&gt;    
    <span style="color: #00007f;">RewriteEngine</span> <span style="color: #0000ff;">On</span>
    <span style="color: #00007f;">RewriteCond</span> %{HTTPS} <span style="color: #0000ff;">off</span>
    <span style="color: #00007f;">RewriteRule</span> (.*) https://%{HTTP_HOST}%{REQUEST_URI}
&lt;/<span style="color: #000000; font-weight:bold;">location</span>&gt;</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://conigliaro.org/2008/12/23/redirect-to-the-ssl-version-of-a-page-with-mod_rewrite-on-apache/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Apache HostnameLookups implicitly enabled?</title>
		<link>http://conigliaro.org/2006/05/21/apache-hostnamelookups-implicitly-enabled/</link>
		<comments>http://conigliaro.org/2006/05/21/apache-hostnamelookups-implicitly-enabled/#comments</comments>
		<pubDate>Sun, 21 May 2006 17:50:09 +0000</pubDate>
		<dc:creator>Mike</dc:creator>
				<category><![CDATA[Apache]]></category>

		<guid isPermaLink="false">http://www.gyrate.org/archives/35</guid>
		<description><![CDATA[I finally figured out why my site has been so slow for some people.  After multiple sessions of staring at tcpdump output and grep-ing through error logs, I finally noticed that Apache&#8217;s access_log was full of hostnames&#8230;  Duh!  This meant that Apache was doing a reverse lookup on every address that accessed [...]]]></description>
			<content:encoded><![CDATA[<p>I finally figured out why my site has been so slow for some people.  After multiple sessions of staring at tcpdump output and grep-ing through error logs, I finally noticed that Apache&#8217;s access_log was full of hostnames&#8230;  Duh!  This meant that Apache was doing a reverse lookup on every address that accessed my site.</p>
<p>(For those who don&#8217;t undrstand why this is such a serious performance bottleneck, Apache won&#8217;t display the page until the hostname is resolved.  This will take a couple seconds in a lot of cases, and in the worst case (if there&#8217;s no PTR record associated with the client&#8217;s IP address), Apache will wait up to 30 seconds before giving up and displaying the page anyway.)</p>
<p>&#8220;Ah ha,&#8221; I exclaimed, as I fired up vi and scrolled down to HostnameLookups in my httpd.conf, but I became even more confused when I discovered that HostnameLookups was already disabled.  Just to be sure, I grep-ed my entire /etc partition for HostnameLookups, but it was definately turned off.  So why was Apache continuing to do reverse lookups even though I told it not to?  The answer was a faulty &#8220;deny&#8221; statement in one of my access lists.  I was originally commenting my deny statements like this:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">Deny from 10.20.30 #some jerk</pre></div></div>

<p>But apparently, the entire line (including the comment) was being misinterpreted as a hostname, which implicitely enabled HostnameLookups.  The solution was to move the comments to their own lines like this:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">#some jerk
Deny from 10.20.30</pre></div></div>

<p>I hope this saves someone out there a lot of time and confusion.</p>
]]></content:encoded>
			<wfw:commentRss>http://conigliaro.org/2006/05/21/apache-hostnamelookups-implicitly-enabled/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>
