<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>khax.net &#187; sysadmin</title>
	<atom:link href="http://blog.khax.net/tag/sysadmin/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.khax.net</link>
	<description>Adventures in Ubuntu systems administration</description>
	<lastBuildDate>Thu, 08 Jul 2010 02:01:19 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='blog.khax.net' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://0.gravatar.com/blavatar/6ccca40b5ab19d33d91882e4d8f9a9c4?s=96&#038;d=http://s2.wp.com/i/buttonw-com.png</url>
		<title>khax.net &#187; sysadmin</title>
		<link>http://blog.khax.net</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://blog.khax.net/osd.xml" title="khax.net" />
	<atom:link rel='hub' href='http://blog.khax.net/?pushpress=hub'/>
		<item>
		<title>Notes on ubuntu-8.10-serverguide-openldap</title>
		<link>http://blog.khax.net/2009/04/03/notes-on-ubuntu-810-serverguide-openldap/</link>
		<comments>http://blog.khax.net/2009/04/03/notes-on-ubuntu-810-serverguide-openldap/#comments</comments>
		<pubDate>Fri, 03 Apr 2009 04:38:27 +0000</pubDate>
		<dc:creator>agentk</dc:creator>
				<category><![CDATA[Server]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[ldap]]></category>
		<category><![CDATA[openldap]]></category>
		<category><![CDATA[pam]]></category>
		<category><![CDATA[replication]]></category>
		<category><![CDATA[serverguide]]></category>
		<category><![CDATA[ssl]]></category>
		<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[tls]]></category>
		<category><![CDATA[ubuntu-8.10]]></category>

		<guid isPermaLink="false">http://blog.khax.net/?p=123</guid>
		<description><![CDATA[After deciding to learn to setup OpenLDAP yesterday I realised it was more than a days work, and that the documentation that I thought was going to be the most suited for my platform left a lot of holes for the beginner. I also had a firefox window with all the sites I used as [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.khax.net&amp;blog=6484387&amp;post=123&amp;subd=khax&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>After deciding to learn to setup OpenLDAP yesterday I realised it was more than a days work, and that the documentation that I thought was going to be the most suited for my platform left a lot of holes for the beginner. I also had a firefox window with all the sites I used as a reference open in tabs, but then decided to print out some colouring pictures for the kids and one site kept crashing firefox (and ruined my day). So no citing references sorry, most of this information was only grepped from google eventually anyway.</p>
<p>The <a href="https://help.ubuntu.com/8.10/serverguide/C/openldap-server.html" target="_blank">openldap-server guide</a> does try to take you from wo to go fairly well and the following notes are just extra things that would have been handy to know or were needed to continue.<span id="more-123"></span></p>
<h2>Configuration</h2>
<p>The first ldapmodify commands are add extra DbIndex&#8217;s. These are handy to know when you receive errors in syslog such as:</p>
<ul>
<li>
<pre>Apr  3 11:01:18 virt01 slapd[11465]: &lt;= bdb_equality_candidates: (objectClass) not indexed</pre>
</li>
</ul>
<p>You can view the current DbIndex values:</p>
<ul>
<li>
<pre>~$ <strong>ldapsearch -xLLL -b cn=config -D cn=admin,cn=config -W olcDatabase={1}hdb olcDbIndex</strong>
Enter LDAP Password:
<strong>dn: olcDatabase={1}hdb,cn=config
olcDbIndex: objectClass eq
olcDbIndex: cn eq,pres,sub
olcDbIndex: uid eq,pres,sub
olcDbIndex: entryUUID eq
olcDbIndex: memberUid eq
olcDbIndex: uniqueMember eq</strong></pre>
</li>
</ul>
<p>And index&#8217;s can be added using the ldapmodify examples. If you need to delete the entire list and start again these ldapmodify commands will help you:</p>
<ul>
<li>
<pre><strong>dn: olcDatabase={1}hdb,cn=config
delete: olcDbIndex</strong></pre>
</li>
</ul>
<p>The sample of output from my ldap setup above will make an okay base to work with.</p>
<p>I followed the schemas section ok with the exception of a correction of the ldapadd command missing a &#8216;-W&#8217; arg (prompt for password).</p>
<ul>
<li>
<pre class="screen"><span class="command"><strong>ldapadd -x -D cn=admin,cn=config -W -f /tmp/ldif_output/cn\=config/cn\=schema/cn\=\{8\}misc.ldif</strong></span></pre>
</li>
</ul>
<h2>Populating LDAP</h2>
<p>You will now notice with the ldapadd command the reference a second admin principal (cn=admin,dc=example,dc=com). This principal is created with the same password as the first admin (cn=admin,cn=config).</p>
<h2 class="title">LDAP replication</h2>
<p>LDAP replication without TLS was setup within minutes following the guide.</p>
<p>Just be very careful to make sure all modifications are complete and correct before adding the ldif files.</p>
<p>The cn=config replication needs to be applied on both servers, but the dc=example,dc=com replication ldif only needs to be applied on one as once cn=config replication is setup it will replicate the dc=example,dc=com settings to the other server.</p>
<p>The second server also does not need to be setup with all the same changes as the first. Just setup the same domain and password when installing slapd then apply the replication ldif. The additional changes made on ldap01 will be replicated to ldap02 automatically. Once both servers have the ldif applied, then restart slapd on each.</p>
<p>It took a fair while to get replication working again using TLS. Most of my problems were certificate related and couple of missed changes in the TLS replication ldif that would not change back.</p>
<h2>TLS and SSL</h2>
<p>I created my certificates with CA.pl from an existing CA I have setup for other servers. When creating the certificates make sure that the commonName matches the host name of the server as it will be addressed. Ie:</p>
<ul>
<li>Server name: ldap01.example.com</li>
<li>commonName: ldap01.example.com</li>
</ul>
<p>TLS verification will fail if you do a ldap search against ldap://ldap01/ (as opposed to ldap://ldap01.example.com/).</p>
<p>I have not yet tested wildcard certificates either. Also the ca-certificate can be referred to either by file (olcTLSCACertificateFile) or the dir containing the cert (olcTLSCACertificatePath). But only referring to the cert by file name worked in my testing even though I added to cert to Ubuntu&#8217;s ca-certificate management scheme. Ie:</p>
<ul>
<li>
<pre><strong>sudo cp cacert.pem /usr/share/ca-certificates/Example.Com-CA.crt</strong></pre>
</li>
<li>
<pre><strong>echo 'Example.Com-CA.crt' | sudo tee -a /etc/ca-certificates.conf</strong></pre>
</li>
<li>
<pre><strong>sudo update-ca-certificates</strong></pre>
</li>
</ul>
<p>I had to set the SLAPD_SERVICES line to: SLAPD_SERVICES=&#8221;ldap:/// ldaps:/// ldapi:///&#8221; To allow TLS ldap:// connections from other hosts.</p>
<p>The TLS connections are over ldap:// and SSL is over ldaps://. TLS is the newer and preferred standard, but the ldap:// protocol also allows cleartext communication as a fallback.</p>
<p>To test a TLS connection use:</p>
<ul>
<li>
<pre><strong>ldapsearch -xLLL -b cn=config -D cn=admin,cn=config -W -H ldap://ldap01.example.com/ -ZZ</strong></pre>
</li>
</ul>
<ul>
<li><strong>-H ldap://ldap01.example.com/</strong> &#8211; specifies the hostname. Make sure it is the same as commonName in the certificate used.</li>
<li><strong>-ZZ</strong> &#8211; Issues a StartTLS command and requires it succed. Using just <strong>-Z</strong> issues StartTLS but still allows a cleartext connection if the StartTLS directive fails.</li>
</ul>
<p>To debug a connection append <strong>-d5</strong> to the command. It will spew a lot of output, but in there will most likely be the reason for the cause of the error.</p>
<p>The notes at the end of the TLS replication section are also handy for getting a TLS client connection working. I needed the following line in /etc/ldap/ldap.conf on all hosts:</p>
<ul>
<li>
<pre>TLS_CACERT /etc/ssl/certs/Example.Com-CA.crt</pre>
</li>
</ul>
<p>Or if you do not wish to check the validity of certificates then you could use:</p>
<ul>
<li>
<pre>TLS_REQCERT allow</pre>
</li>
</ul>
<h2>TLS Replication</h2>
<p>This should only be attempted once both hosts are confirmed working over TLS. Also make sure you test establishing a TLS connection from one host to the other (ie, running the ldapsearch from ldap01 using <strong>-ZZ -H ldap://ldap02.example.com/</strong>).</p>
<p>After adding the <em>cn=config</em> TLS change to one host (remember it will be replicated to the other host automatically), then restart both slapd backends (sudo /etc/init.d/slapd restart).</p>
<p>If that is working without any errors in syslog then proceed to the <em>dc=example,dc=com</em> tls replication and restart both backends again.</p>
<h2>LDAP Authentication</h2>
<p>My next headache was with the auth-client-config command. The correct command to use is:</p>
<ul>
<li>
<pre><strong>sudo auth-client-config -t nss -p lac_ldap</strong></pre>
</li>
</ul>
<p>Some sites also note another command that is actually unnecessary:</p>
<ul>
<li>
<pre><strong>sudo pam-auth-update ldap</strong></pre>
</li>
</ul>
<p>pam-auth-update allows you to pick which auth methods will be used in your system, but ldap is automatically added when you install libnss-ldap.</p>
<p>Other changes I made to /etc/ldap.conf was uncommenting two lines:</p>
<ul>
<li>
<pre>pam_filter objectclass=account</pre>
</li>
<li>
<pre>ssl start_tls</pre>
</li>
</ul>
<p>This requires a user have the objectclass=account attribute to be able to login. And the second requires a TLS connection to the ldap server.</p>
<p>To use TLS for pam auth you will need to make sure the cert is specified in /etc/ldap/ldap.conf just as on the server. This can be tested by running the same ldapsearch command on the client as on the server.</p>
<p>After managing to get that working on one client the rest were managed easily using puppet.</p>
<h2>User and Group Management</h2>
<p>The command to put the &#8216;secret&#8217; in /etc/ldapscripts/ldapscripts.passwd will not work as expected if you have a dollar symbol in the password. Ie:</p>
<ul>
<li>
<pre><strong>sudo sh -c "echo -n '$ecret' &gt; /etc/ldapscripts/ldapscripts.passwd"</strong></pre>
</li>
</ul>
<p>Will result in an empty passwd file. The correct way to echo the password is to escape the $. Ie: <strong>&#8216;\$ecret&#8217;</strong>. This is not a problem with the server guide, just an oversight that caught me out. It can be seen in the log file as:</p>
<ul>
<li>
<pre>&gt;&gt; 04/01/09 - 17:23 : Command : /usr/sbin/ldapadduser george example
ldap_bind: Server is unwilling to perform (53)
        additional info: unauthenticated bind (DN with no password) disallowed
ldap_bind: Server is unwilling to perform (53)
        additional info: unauthenticated bind (DN with no password) disallowed
Error adding user george to LDAP</pre>
</li>
</ul>
<p>The ldapscripts will also often fail if replication is not working either. Check the output of /var/log/ldapscripts.log.</p>
<ul>
<li>
<pre>&gt;&gt; 04/02/09 - 13:49 : Command : /usr/sbin/ldapadduser george example
Additional information: value does not conform to assertion syntax
ldap_modify: Server is unwilling to perform (53)
        additional info: shadow context; no update referral
Error adding user george to LDAP</pre>
</li>
</ul>
<p>That is the ldapscripts log output I get when replication was not working.</p>
<h2>Finale</h2>
<p>After that was all sorted out I was happy as Larry. Next thing to try is SASL authentication i guess. If anybody wants to point me in the right direction to assist with the Jaunty server guide it would be much appreciated. As well as any more notes and corrections to my post.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/khax.wordpress.com/123/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/khax.wordpress.com/123/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/khax.wordpress.com/123/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/khax.wordpress.com/123/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/khax.wordpress.com/123/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/khax.wordpress.com/123/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/khax.wordpress.com/123/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/khax.wordpress.com/123/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/khax.wordpress.com/123/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/khax.wordpress.com/123/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/khax.wordpress.com/123/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/khax.wordpress.com/123/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/khax.wordpress.com/123/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/khax.wordpress.com/123/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.khax.net&amp;blog=6484387&amp;post=123&amp;subd=khax&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.khax.net/2009/04/03/notes-on-ubuntu-810-serverguide-openldap/feed/</wfw:commentRss>
		<slash:comments>15</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">agentk</media:title>
		</media:content>
	</item>
		<item>
		<title>Making Zabbix progress</title>
		<link>http://blog.khax.net/2009/03/03/making-zabbix-progress/</link>
		<comments>http://blog.khax.net/2009/03/03/making-zabbix-progress/#comments</comments>
		<pubDate>Tue, 03 Mar 2009 11:32:33 +0000</pubDate>
		<dc:creator>agentk</dc:creator>
				<category><![CDATA[Server]]></category>
		<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[zabbix]]></category>

		<guid isPermaLink="false">http://blog.khax.net/?p=114</guid>
		<description><![CDATA[Warning! Bias rant follows. I&#8217;ve been struggling to find a perfect solution for server monitoring for a while now. At the moment it&#8217;s a combination of nagios and cacti plus ipmitool. And recently I have also looked at / tried opennms, zenoss, ganglia, argus and munin. Nagios + cacti has been serving me well, but [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.khax.net&amp;blog=6484387&amp;post=114&amp;subd=khax&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Warning! Bias rant follows.</p>
<p>I&#8217;ve been struggling to find a perfect solution for server monitoring for a while now. At the moment it&#8217;s a combination of nagios and cacti plus ipmitool. And recently I have also looked at / tried opennms, zenoss, ganglia, argus and munin.</p>
<p>Nagios + cacti has been serving me well, but I would be happier to only have to maintain one system and to have some auto discover of both systems and their services would make life much easier. Most of the apps I looked though have failed my expectations by either being hogs (some even java based), complicated mashups, or too simple for my needs (not able to replace both nagios and cacti). And that left me with zabbix. But even zabbix has left me with a bad taste by requiring the zabbix-agent be installed on client machines. Are my requirements really to much to ask? Surely there is enough to be gleamed from snmp, ipmi and nmap to monitor both server and desktops.</p>
<p>So. How does you see the required agent? A negative? I can easily install it on all my linux server with puppet, but what about windows, the desktop machines and routers etc? And I have yet to see anything come close to the asset management I&#8217;d like either.</p>
<p>But on the plus side for zabbix I have found it fairly well thought out, albeit a little confusing at first.</p>
<p>I cant remember the name of that windows thing I tried a little while ago that sent me on this mission to find a decent linux all-in-one system manager, but it was reasonably forgettable because of the auto-discovery problems it kept presenting with the doubling up of systems on each discovery scan, and it&#8217;s inability to be uninstalled.</p>
<p>Anyway I&#8217;ll be off for a week to shift house but I&#8217;ll give zabbix a good go and report back.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/khax.wordpress.com/114/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/khax.wordpress.com/114/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/khax.wordpress.com/114/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/khax.wordpress.com/114/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/khax.wordpress.com/114/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/khax.wordpress.com/114/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/khax.wordpress.com/114/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/khax.wordpress.com/114/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/khax.wordpress.com/114/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/khax.wordpress.com/114/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/khax.wordpress.com/114/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/khax.wordpress.com/114/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/khax.wordpress.com/114/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/khax.wordpress.com/114/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.khax.net&amp;blog=6484387&amp;post=114&amp;subd=khax&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.khax.net/2009/03/03/making-zabbix-progress/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">agentk</media:title>
		</media:content>
	</item>
	</channel>
</rss>