<?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>bits &#124; andy smith&#039;s blog &#187; Linux</title>
	<atom:link href="http://andys.org.uk/bits/category/linux/feed/" rel="self" type="application/rss+xml" />
	<link>http://andys.org.uk/bits</link>
	<description>random stuff from the mind of a twenty-something professional geek</description>
	<lastBuildDate>Mon, 16 Apr 2012 00:39:54 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>A Prelude to better things &#8211; Open Source and IDS</title>
		<link>http://andys.org.uk/bits/2012/01/21/a-prelude-to-better-things-open-source-and-ids/</link>
		<comments>http://andys.org.uk/bits/2012/01/21/a-prelude-to-better-things-open-source-and-ids/#comments</comments>
		<pubDate>Sat, 21 Jan 2012 03:35:45 +0000</pubDate>
		<dc:creator>Andy Smith</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[ids]]></category>
		<category><![CDATA[ips]]></category>
		<category><![CDATA[prelude]]></category>
		<category><![CDATA[snort]]></category>

		<guid isPermaLink="false">http://andys.org.uk/bits/?p=139</guid>
		<description><![CDATA[A recent number of attempted break-ins to a few machines I manage has had me thinking again about the overall security of the machines, and how to get a better handle on what&#8217;s going on. This isn&#8217;t something new &#8211; anyone managing internet-facing systems ought to be aware of the dangers, and how to mitigate [...]]]></description>
			<content:encoded><![CDATA[<p>A recent number of attempted break-ins to a few machines I manage has had me thinking again about the overall security of the machines, and how to get a better handle on what&#8217;s going on. This isn&#8217;t something new &#8211; anyone managing internet-facing systems ought to be aware of the dangers, and how to mitigate them. As with many things related to open source, there are a plethora of tools out there aimed at providing alerting based on network activity.</p>
<p>I&#8217;d wager that many people have heard of <a href="http://www.snort.org/">Snort</a>, and what it does. For those who aren&#8217;t familiar with it, it&#8217;s an open source intrusion detection system (IDS)/intrusion prevention system (IPS). In a normal configuration, Snort monitors traffic and alerts based on predefined rules for such things as port scans and maliciously-crafted HTTP requests. It&#8217;s an extremely powerful tool that is also highly configurable, and with an excellent community that provide custom rules for a wide variety of situations. But alerting is one thing &#8211; being able to make sense of those alerts is something else.</p>
<h2><span id="more-139"></span>Prelude</h2>
<p><a href="http://www.prelude-technologies.com/en/solutions/universal-siem/index.html">Prelude</a> is a <a href="http://en.wikipedia.org/wiki/Security_information_management">security information management</a> (or SIM) system &#8211; that is, it&#8217;s designed to aggregate and correlate events from tools like Snort and provide a centralised place to manage those events. On its own, this is useful, but coupled with a few additional tools it really becomes something else.</p>
<p>The main prerequisite for our setup is to MySQL, so if you don&#8217;t already have it installed, go ahead and do so. Most Linux distributions include Prelude in their repositories, so installing it should be pretty straightforward. I use Debian, so once MySQL is installed and working, installing the <strong>manager</strong> is a case of running the following:-</p>
<pre>root@dev-vm-lnxd-01:~# <strong>apt-get install prelude-manager</strong></pre>
<p>Follow the on-screen debconf prompts regarding the database &#8211; one thing to note that I discovered on squeeze is that if I let debconf generate a password for the prelude database user, that password wasn&#8217;t written to the prelude configuration. Since debconf doesn&#8217;t output the password it&#8217;s generated, this means you&#8217;ll have no idea of the password. Therefore, I recommend picking a password yourself.</p>
<p>Next, it will generate a 2048-bit RSA key for the manager. This can take a while, and on a quiet server will take a few minutes at least. Generating disk I/O is how I usually increase the amount of entropy for the key generation &#8211; running <strong>find / &gt;/dev/null</strong> works well in this situation I&#8217;ve found.</p>
<p>By default, prelude-manager will refuse to start, because it&#8217;s disabled in <strong>/etc/default/prelude-manager</strong>. Edit it, and change <strong>RUN=no</strong> to <strong>RUN=yes</strong>. Next make sure that the database configuration in <strong>/etc/prelude-manager/prelude-manager.conf</strong> is correct &#8211; especially regarding my note earlier about auto-generated passwords.</p>
<p>When you&#8217;re happy the configuration is correct, start prelude-manager:-</p>
<pre>root@dev-vm-lnxd-01:~# <strong>/etc/init.d/prelude-manager start</strong></pre>
<p>If everything is okay, prelude-manager will start.</p>
<h2>Putting it to work</h2>
<p>We now have a running prelude-manager instance. But on its own, this is pretty useless &#8211; no events are being sent to it, so there&#8217;s nothing for it to do. Let&#8217;s fix that by installing a sensor &#8211; Snort.</p>
<p>Again, installing Snort should be straightforward:-</p>
<pre>root@dev-vm-lnxd-01:~# <strong>apt-get install snort</strong></pre>
<p>As before, follow the debconf prompts. Unlike <strong>prelude-manager</strong>, snort will be started automatically after install. A quick glance at /var/log/snort will reveal a file named alert and possibly a number of tcpdump.log files. This is how Snort by default saves alerts, with the tcpdump.log files being captures associated with those alerts. But since we&#8217;re talking about Prelude, let&#8217;s get the alerts sent there.</p>
<p>The first step is to register Snort with prelude-manager, so that prelude-manager knows about it. We can do this with the prelude-admin command:-</p>
<pre>root@dev-vm-lnxd-01:~# <strong>prelude-admin register "snort" "idmef:w" 127.0.0.1 --uid 106 --gid 106</strong></pre>
<p>You&#8217;ll notice that I passed the UID and GID of the snort to prelude-admin. By default, the snort has both a UID and GID of 106, but do check this before running it. The other options are the name of the agent (<strong>&#8220;snort&#8221;</strong>), the permissions (<strong>&#8220;idmef:w&#8221;</strong>) and the IP address of the server running <strong>prelude-manager</strong>. The name can be anything, as long as this matches the name used in the Snort configuration, and the &#8216;idmef:w&#8217; refers to the <a href="http://en.wikipedia.org/wiki/IDMEF">Intrusion Detection Message Exchange Format</a>, and that we want to give Snort write permissions. Finally, because we&#8217;re running Snort on the same server as the one running prelude-manager, we use 127.0.0.1 as the host.</p>
<pre>root@dev-vm-lnxd-01:~# <strong>prelude-admin register "snort" "idmef:w" 127.0.0.1 --uid 106 --gid 106</strong>
Generating 2048 bits RSA private key... This might take a very long time.
[Increasing system activity will speed-up the process].
Generation in progress... X..+++++O.+++++O</pre>
<pre>You now need to start "prelude-admin" registration-server on 127.0.0.1:
example: "prelude-admin registration-server prelude-manager"</pre>
<pre>Enter the one-shot password provided on 127.0.0.1:</pre>
<p>Once again, an RSA key is generated, but this time for the sensor, so now might be a good time to go and make a cuppa. Once the key has been generated, you&#8217;ll be prompted (as above) for a &#8216;one-shot password&#8217; to authenticate it to <strong>prelude-manager</strong>. At this point, open a new session to the server running prelude-manager and run prelude-manager as directed by the above:-</p>
<pre>root@dev-vm-lnxd-01:~# <strong>prelude-admin registration-server prelude-manager</strong>
The "<span style="color: #ff0000;">8qovmgff</span>" password will be requested by "prelude-admin register"
in order to connect. Please remove the quotes before using it.</pre>
<pre>Generating 1024 bits Diffie-Hellman key for anonymous authentication...
Waiting for peers install request on 0.0.0.0:5553...
Waiting for peers install request on :::5553...</pre>
<p>Make a note of the password (in our example, <strong><span style="color: #ff0000;">8qovmgff</span></strong>), switch back to our first session, and provide it at the prompt:-</p>
<pre>Enter the one-shot password provided on 127.0.0.1: <strong><em><span style="color: #ff0000;">8qovmgff</span></em></strong>
Confirm the one-shot password provided on 127.0.0.1: <strong><em><span style="color: #ff0000;">8qovmgff</span></em></strong></pre>
<pre>Connecting to registration server (127.0.0.1:5553)... Authentication succeeded.</pre>
<p>Switch again to the second session, and accept the registration:-</p>
<pre>Connection from 127.0.0.1:40123...
Registration request for analyzerID="2783582516549275" permission="idmef:w".
Approve registration? [y/n]: <strong>y</strong>
127.0.0.1:40123 successfully registered.</pre>
<p>Snort is now registered as an sensor with prelude-manager.</p>
<p>The next step is to tell Snort to send its output to Prelude. Edit <strong>/etc/snort/snort.conf</strong>, and look for the following line:-</p>
<pre># output alert_prelude: profile=snort-profile-name</pre>
<p>Uncomment it, and change the profile name to snort:-</p>
<pre>output alert_prelude: profile=<strong>snort</strong></pre>
<p>Save the config, and restart snort:-</p>
<pre>root@dev-vm-lnxd-01:~# <strong>/etc/init.d/snort restart</strong>
Stopping Network Intrusion Detection System : snort (eth0 ...done).
Starting Network Intrusion Detection System : snort (eth0 using /etc/snort/snort.conf ...done).</pre>
<h2>Making sense of it all</h2>
<p>All being well, Snort should now be sending events to Prelude. But we still don&#8217;t have any visibility of these alerts&#8230; which is where <a href="http://freecode.com/projects/prewikka">Prewikka</a> comes in.</p>
<p>Prewikka is a graphical front-end to Prelude &#8211; more specifically, to the database that <strong>prelude-manager</strong> uses. Again, there&#8217;s a package in Debian for this, so go ahead and install it:-</p>
<pre>root@dev-vm-lnxd-01:~# <strong>apt-get install prewikka</strong></pre>
<p>As with prelude-manager, follow the debconf prompts regarding database setup. Once completed, Prewikka will have its own database, but you&#8217;ll also need to give it the details for prelude-manager&#8217;s database. Edit <strong>/etc/prewikka/prewikka.conf</strong>, and edit the settings under the <strong>[idmef_database]</strong> section. Save and exit the config, and start Prewikka:-</p>
<pre>root@dev-vm-lnxd-01:~# <strong>prewikka-httpd &amp;</strong></pre>
<p><img class="alignright size-medium wp-image-140" style="margin-left: 10px; margin-right: 10px;" title="Prewikka - Main screen" src="http://andys.org.uk/bits/wp-content/uploads/2012/01/prewikka1-300x170.png" alt="" width="300" height="170" /></p>
<p>By default, Prewikka listens on port 8000, so point your browser at <strong>http://<em>&lt;server&gt;</em>:8000/</strong>. The default username and password is <strong>admin</strong> and <strong>admin</strong>, so go ahead and log in. You&#8217;ll then be presented with the main event viewer, which should be similar to the screenshot to the right.</p>
<p>Running Prewikka in this way uses its own built-in webserver, but within the package a <strong>prewikka.cgi</strong> file is provided, which can be served by your favourite webserver of choice as a traditional CGI executable.</p>
<p>Now, before taking the screenshot to the right I cheated a little. I ran a quick nmap against the server to generate some events as an example, but in the absence of any events you can still check that snort is communicating with <strong>prelude-manager</strong>. Click on the <strong>Agents</strong> link in the menu, and there should be an entry for the server. Click on it once to expand it, and then on the Total box to expand the sensors. If everything is configured correctly, Snort should appear in the listing:-</p>
<p><a href="http://andys.org.uk/bits/wp-content/uploads/2012/01/prewikka-agents.png"><img class="aligncenter size-full wp-image-141" title="Prewikka Sensors" src="http://andys.org.uk/bits/wp-content/uploads/2012/01/prewikka-agents.png" alt="" width="703" height="159" /></a></p>
<p style="text-align: left;">Prewikka allows you to filter and sort the events displayed, so now would be a good time to have a play about with it. Clicking on an alert will let you view the details of that alert, and because the events at the moment are from Snort, all the relevant alert information that Snort would have logged to <strong>/var/log/snort/alert</strong> should be available.</p>
<h2 style="text-align: left;">Add logs, and sprinkle in a bit of correlation</h2>
<p>So now we have working Prelude and Snort installs, with the two working together and a nice front-end to view them through. While nice to look at, we&#8217;re missing one of the things that all good IDS tools have, which is correlation.</p>
<p>Before going any further, let&#8217;s install two more Prelude packages &#8211; <strong>prelude-lml</strong> (Prelude Log Agent) and <strong>prelude-correlator</strong>:-</p>
<pre>root@dev-vm-lnxd-01:~# <strong>apt-get install prelude-lml prelude-correlator</strong></pre>
<p>On my squeeze install, the post-install script for prelude-lml exits with an error because the service is initially disabled. This is fixed in a later version, but it&#8217;s something to look out for. For now, ignore the error &#8211; after we&#8217;ve configured it we can pacify dpkg&#8230;</p>
<p>Because <strong>prelude-lml</strong> and <strong>prelude-correlator</strong> are sensors themselves, we&#8217;ll need to register them with <strong>prelude-manager</strong> in the same way that we did for Snort with the <strong>prelude-admin</strong> command:-</p>
<pre>root@dev-vm-lnxd-01:~# <strong>prelude-admin register "prelude-lml" "idmef:w" 127.0.0.1 --uid 0 --gid 0</strong>
<em>...output from prelude-admin...</em>
root@dev-vm-lnxd-01:~# <strong>prelude-admin register "prelude-correlator" "idmef:rw" 127.0.0.1 --uid 0 --gid 0</strong>
<em>...output from prelude-admin...</em></pre>
<p>As before, you&#8217;ll need to run <strong>prelude-admin registration-server prelude-manager</strong> in a second session for both sensors. Also, make sure that you correctly give <strong>prelude-correlator</strong> the &#8216;idmef:rw&#8217; permissions &#8211; this is because it needs to both read <strong>and</strong> write events. Then, enable <strong>prelude-correlator</strong> in the same way as prelude-manager by changing <strong>RUN=no</strong> to <strong>RUN=yes</strong> in <strong>/etc/default/prelude-correlator</strong>. Finally, start <strong>prelude-correlator</strong>:-</p>
<pre>root@dev-vm-lnxd-01:/etc/prelude/profile# <strong>/etc/init.d/prelude-correlator start</strong>
Starting prelude-correlator : prelude-correlator21 Jan 03:06:57 prelude-correlator (process:22339) INFO: [FirewallPlugin]: disabled on user request
21 Jan 03:06:57 prelude-correlator (process:22339) WARNING: SpamhausDropPlugin = PreludeCorrelator.plugins.spamhausdrop:SpamhausDropPlugin: No module named netaddr
21 Jan 03:06:57 prelude-correlator (process:22339) INFO: [BusinessHourPlugin]: disabled on user request
21 Jan 03:06:57 prelude-correlator (process:22339) INFO: 7 plugin have been loaded.
.</pre>
<p>A word of warning at this point &#8211; initially, prelude-correlator failed to start for me. If this happens, make sure that <strong>/etc/prelude/prelude-correlator</strong>, <strong>/var/spool/prelude/prelude-correlator</strong> and <strong>/var/lib/prelude-correlator</strong> (plus any subdirectories) are owned by the <strong>prelude-correlator</strong> user, and then again try to start prelude-correlator.</p>
<p>If you had problems earlier with the dpkg post-install script for prelude-lml, running <strong>apt-get -f install</strong> here will tidy that up and start prelude-lml. If you didn&#8217;t, then start prelude-lml manually:-</p>
<pre>root@dev-vm-lnxd-01:/etc/prelude/profile# <strong>/etc/init.d/prelude-lml start</strong>
Starting Prelude LML: prelude-lml.</pre>
<p>Going back to our Prewikka browser window, if we click again on <strong>Agents</strong> and expand the nodes and sensors, we should see entries for <strong>prelude-lml</strong> and <strong>prelude-correlator</strong>.</p>
<p>To demonstrate what prelude-lml and prelude-correlator can do, let&#8217;s first add an iptables entry to log all TCP connection attempts on port 22:-</p>
<pre>root@dev-vm-lnxd-01:~# <strong>iptables -I INPUT -p tcp --dport 22 -m state --state NEW -j LOG</strong></pre>
<p>Opening another SSH connection to the server should result in a log message in <strong>/var/log/messages</strong> similar to the following:-</p>
<pre>Jan 21 03:17:08 dev-vm-lnxd-01 kernel: [ 7981.313741] IN=eth0 OUT= MAC=xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx SRC=192.168.xxx.aaa DST=192.168.xxx.yyy LEN=60 TOS=0x10 PREC=0x00 TTL=64 ID=1313 DF PROTO=TCP SPT=56168 DPT=22 WINDOW=14600 RES=0x00 SYN URGP=0</pre>
<p>Next, purposefully fail an attempt to log into the server &#8211; for example, with an incorrect password. Then, check the events again:-</p>
<p style="text-align: center;"><a href="http://andys.org.uk/bits/wp-content/uploads/2012/01/prewikka-correlator-lml.png"><img class="aligncenter  wp-image-142" title="Prewikka (Correlator and LML)" src="http://andys.org.uk/bits/wp-content/uploads/2012/01/prewikka-correlator-lml-1024x129.png" alt="" width="819" height="103" /></a></p>
<p style="text-align: left;">There&#8217;s a few things here, but the main thing to notice is that there are a number of new sensors listed in the <strong>Analyzer</strong> column. <strong>PAM</strong>, <strong>sshd</strong>, and <strong>netfilter</strong> have all been picked up by <strong>prelude-lml</strong> from the logfiles it monitors, and in the case of the first event, <strong>prelude-correlator</strong> has correctly identified &#8211; from the prelude-lml events &#8211; that a brute-force attack has occurred. In my example above, it&#8217;s also picked up that there was a successful login &#8211; this was me logging in with the correct password, but if this was a production system this may well be indicative of a brute-force attack resulting in a correctly-guessed password!</p>
<h2 style="text-align: left;">Where now?</h2>
<p>This is just a quick overview of what&#8217;s possible with open-source IDS software. All the tools I&#8217;ve written about in this post are extremely configurable &#8211; <strong>prelude-lml</strong> for example can monitor many different types of logfile and can be configured with custom regular expressions to look for specific things. Many similar tools can be configured to send events to Prelude, which <strong>prelude-correlator</strong> can correlate as above. One thing I&#8217;ve not covered here is <strong>auditd</strong>, which has (via the audispd multiplexor) the ability to send to Prelude &#8211; something which I&#8217;ll cover in a future post.</p>
<p>&nbsp;</p>
<p style="text-align: center;">
]]></content:encoded>
			<wfw:commentRss>http://andys.org.uk/bits/2012/01/21/a-prelude-to-better-things-open-source-and-ids/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>RedHat, NFS and static ports</title>
		<link>http://andys.org.uk/bits/2010/12/17/redhat-nfs-and-static-ports/</link>
		<comments>http://andys.org.uk/bits/2010/12/17/redhat-nfs-and-static-ports/#comments</comments>
		<pubDate>Fri, 17 Dec 2010 20:05:19 +0000</pubDate>
		<dc:creator>Andy Smith</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Networking]]></category>
		<category><![CDATA[nfs]]></category>
		<category><![CDATA[ports]]></category>
		<category><![CDATA[redhat]]></category>

		<guid isPermaLink="false">http://andys.org.uk/bits/?p=121</guid>
		<description><![CDATA[Using NFS between two machines on the same network is usually free of hassle, so the default behaviour &#8211; on Linux, at least &#8211; is fine and can be left as it is. However, in a commercial setting (such as the ones I manage in my day job) it&#8217;s often the case that the machines [...]]]></description>
			<content:encoded><![CDATA[<p>Using NFS between two machines on the same network is usually free of hassle, so the default behaviour &#8211; on Linux, at least &#8211; is fine and can be left as it is. However, in a commercial setting (such as the ones I manage in my day job) it&#8217;s often the case that the machines might not be on the same network &#8211; or even in the same location, for that matter. It&#8217;s likely that there&#8217;s a number of network devices in between the machines, and the way NFS uses <a href="http://en.wikipedia.org/wiki/Portmap">portmap</a> can sometimes make things frustrating.</p>
<p>Luckily, it&#8217;s really easy to fix.</p>
<p><span id="more-121"></span></p>
<p>On <strong>RedHat</strong>-based systems, it&#8217;s a case of editing /etc/sysconfig/nfs. In there, by default you&#8217;ll find quite a few <code>&lt;service&gt;_PORT=&lt;port&gt;</code> entries, but they&#8217;re hashed out. For example:-</p>
<blockquote>
<pre># Port rpc.statd should listen on.
#STATD_PORT=662</pre>
</blockquote>
<p>You can go ahead and uncomment the line, or if you wish you can change the port. Repeat this for the other <code>&lt;service&gt;_PORT</code> entries as required &#8211; you&#8217;ll want to do <code>LOCKD_TCPPORT</code> (if you&#8217;re using TCP), <code>LOCKD_UDPPORT</code> (if you&#8217;re using UDP), <code>MOUNTD_PORT</code> and <code>STATD_PORT</code>.</p>
<p>Once you&#8217;re happy, restart the services:-</p>
<blockquote>
<pre>/sbin/service portmap restart
/sbin/service nfs restart</pre>
</blockquote>
<p>Running <code>rpcinfo -p</code> should show the various NFS services now running on the ports specified in <code>/etc/sysconfig/nfs</code>:-</p>
<blockquote>
<pre>[root@nfs-server ~]# <strong>rpcinfo -p</strong>
program vers proto   port
100000    2   tcp    111  portmapper
100000    2   udp    111  portmapper
100011    1   udp    875  rquotad
100011    2   udp    875  rquotad
100011    1   tcp    875  rquotad
100011    2   tcp    875  rquotad
100003    2   udp   2049  nfs
100003    3   udp   2049  nfs
100003    4   udp   2049  nfs
100021    1   udp  32769  nlockmgr
100021    3   udp  32769  nlockmgr
100021    4   udp  32769  nlockmgr
100021    1   tcp  32803  nlockmgr
100021    3   tcp  32803  nlockmgr
100021    4   tcp  32803  nlockmgr
100003    2   tcp   2049  nfs
100003    3   tcp   2049  nfs
100003    4   tcp   2049  nfs
100005    1   udp    892  mountd
100005    1   tcp    892  mountd
100005    2   udp    892  mountd
100005    2   tcp    892  mountd
100005    3   udp    892  mountd
100005    3   tcp    892  mountd</pre>
</blockquote>
<p>Firewall rules should be somewhat easier to manage now.</p>
<p>For Debian and Ubuntu systems, you might find <a href="http://ubuntuforums.org/showthread.php?t=352486">this link</a> useful.</p>
]]></content:encoded>
			<wfw:commentRss>http://andys.org.uk/bits/2010/12/17/redhat-nfs-and-static-ports/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PXE booting a Debian Squeeze install</title>
		<link>http://andys.org.uk/bits/2010/03/22/pxe-booting-a-debian-squeeze-install/</link>
		<comments>http://andys.org.uk/bits/2010/03/22/pxe-booting-a-debian-squeeze-install/#comments</comments>
		<pubDate>Mon, 22 Mar 2010 12:42:49 +0000</pubDate>
		<dc:creator>Andy Smith</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Networking]]></category>
		<category><![CDATA[debian]]></category>
		<category><![CDATA[pxe]]></category>
		<category><![CDATA[pxeboot]]></category>
		<category><![CDATA[pxelinux]]></category>
		<category><![CDATA[squeeze]]></category>

		<guid isPermaLink="false">http://andys.org.uk/bits/?p=78</guid>
		<description><![CDATA[Update: I&#8217;ve not tested myself, but the comment from Sombunall below points out that package names for the TFTP server and the DHCP server have changed since I wrote this post! It&#8217;s often the case that there&#8217;s no easy way of installing a machine that doesn&#8217;t have any removable media. For instance, I have an [...]]]></description>
			<content:encoded><![CDATA[<p><em><strong>Update</strong>: I&#8217;ve not tested myself, but the <a href="http://andys.org.uk/bits/2010/03/22/pxe-booting-a-debian-squeeze-install/comment-page-1/#comment-7994">comment from Sombunall below</a> points out that package names for the TFTP server and the DHCP server have changed since I wrote this post!</em></p>
<p>It&#8217;s often the case that there&#8217;s no easy way of installing a machine that doesn&#8217;t have any removable media. For instance, I have an old <a href="http://h18000.www1.hp.com/products/quickspecs/10021_div/10021_div.HTML">Compaq Deskpro EN</a> that&#8217;s too old to support booting from USB, so using something like <a href="http://http://unetbootin.sourceforge.net/">UNetbootin</a> is out of the question. Luckily, there&#8217;s an an alternative, which is to <a href="http://en.wikipedia.org/wiki/Preboot_Execution_Environment">PXE</a> boot an installer over the network.</p>
<p><span id="more-78"></span><br />
PXE (or <em>Preboot eXecution Environment</em>) is a means of booting a machine over a network,which conveniently removes any requirement for anything special on the machine that&#8217;s to be installed other than an network card. PXE boot (or <em>network boot</em>) support tends to be available in older machines that don&#8217;t support booting from USB, so it&#8217;s a very useful feature to be able to use.</p>
<p>There&#8217;s a very useful article on <a href="http://www.debian-administration.org/articles/478">Debian Administration</a> that covers configuring a Debian machine to act as a PXE boot server to serve out an <a href="http://wiki.debian.org/DebianEtch">etch</a> installer. I personally run <a href="http://www.debian.org/releases/testing/">squeeze</a>, so I&#8217;ve used the article as a basis for setting up a Debian squeeze machine to serve out a squeeze installer.</p>
<h3>Installing the prerequisites</h3>
<p>To start with, we need a TFTP server and a DHCP server. You might already have one (or both) of these installed already, but for the purposes of this we&#8217;ll assume that you haven&#8217;t. So, to get started, install the tftpd-hpa and dhcp3-server packages:-</p>
<blockquote><p><code>apt-get install tftpd-hpa dhcp3-server</code></p></blockquote>
<h3>Configuring DHCPd</h3>
<p>First, make sure that the tftpboot directory exists. This used to be <code>/var/lib/tftpboot</code>, but Debian now uses <code>/srv/tftpboot</code>. The installer should have created it, but just in case, check it exists and if create it if not.</p>
<p>The next step is to add a subnet declaration to <code>/etc/dhcp3/dhcpd.conf</code> for your network. A simple one will be something like this:-</p>
<blockquote>
<pre>subnet 192.168.51.0 netmask 255.255.255.0 {
       range 192.168.51.64 192.168.51.80;
       <span style="color: #008000;">filename "pxelinux.0";
       next-server 192.168.51.1;</span>
       option routers 192.168.51.1;
}</pre>
</blockquote>
<p>If you&#8217;ve already got DHCPd installed and configured, the two lines highlighted in green are the ones you need to add to your existing subnet declaration. The <code>filename</code> option tells PXE clients which file they need to request via TFTP, and the <code>next-server</code> option tells the clients the TFTP server they should use to get it.</p>
<h3>Creating the PXE boot environment</h3>
<p>Before we pull down any of the installer files, we need to create somewhere for those files to go, along with the PXE boot configuration. So, create the <code>pxelinux.cfg</code> and <code>debian/squeeze/i386</code> directories:-</p>
<blockquote>
<pre>mkdir -pv /srv/tftpboot/pxelinux.cfg
mkdir -pv /srv/tftpboot/debian/squeeze/i386</pre>
</blockquote>
<p>Next, create the config for pxelinux in <code>pxelinux.cfg/default</code>:-</p>
<blockquote>
<pre>DISPLAY boot.txt

DEFAULT squeeze_i386_install

LABEL squeeze_i386_install
     kernel debian/squeeze/i386/linux
     append vga=normal initrd=debian/squeeze/i386/initrd.gz  --
LABEL squeeze_i386_linux
     kernel debian/squeeze/i386/linux
     append vga=normal initrd=debian/squeeze/i386/initrd.gz  --
LABEL squeeze_i386_expert
     kernel debian/squeeze/i386/linux
     append priority=low vga=normal initrd=debian/squeeze/i386/initrd.gz  --
LABEL squeeze_i386_rescue
     kernel debian/squeeze/i386/linux
     append vga=normal initrd=debian/squeeze/i386/initrd.gz  rescue/enable=true --
PROMPT 1
TIMEOUT 0</pre>
</blockquote>
<p>Then, create <code>boot.txt</code> in <code>pxelinux.cfg</code>, which is our boot menu:-</p>
<blockquote>
<pre>- Boot Menu -
=============

squeeze_i386_install
squeeze_i386_linux
squeeze_i386_expert
squeeze_i386_rescue</pre>
</blockquote>
<p>Finally, download the installer parts from the Debian FTP mirror:-</p>
<blockquote>
<pre>cd /srv/tftpboot/
wget <a title="http://ftp.uk.debian.org/debian/dists/squeeze/main/installer-i386/current/images/netboot/debian-installer/i386/pxelinux.0" rel="nofollow" href="http://ftp.uk.debian.org/debian/dists/squeeze/main/installer-i386/current/images/netboot/debian-installer/i386/pxelinux.0">http://ftp.uk.debian.org/debian/dists/squeeze/main/installer-i386/current/images/netboot/debian-installer/i386/pxelinux.0</a>
cd /srv/tftpboot/debian/squeeze/i386
wget <a title="http://ftp.uk.debian.org/debian/dists/squeeze/main/installer-i386/current/images/netboot/debian-installer/i386/linux" rel="nofollow" href="http://ftp.uk.debian.org/debian/dists/squeeze/main/installer-i386/current/images/netboot/debian-installer/i386/linux">http://ftp.uk.debian.org/debian/dists/squeeze/main/installer-i386/current/images/netboot/debian-installer/i386/linux</a>
wget <a title="http://ftp.uk.debian.org/debian/dists/squeeze/main/installer-i386/current/images/netboot/debian-installer/i386/initrd.gz" rel="nofollow" href="http://ftp.uk.debian.org/debian/dists/squeeze/main/installer-i386/current/images/netboot/debian-installer/i386/initrd.gz">http://ftp.uk.debian.org/debian/dists/squeeze/main/installer-i386/current/images/netboot/debian-installer/i386/initrd.gz</a></pre>
</blockquote>
<h3>Final steps</h3>
<p>Make sure that tftpd-hpa and dhcp3-server are running:-</p>
<blockquote><p><code>service tftpd-hpa restart<br />
service dhcp3-server restart</code></p></blockquote>
<p>You should now be able to network boot machines into the Debian squeeze installer.</p>
<p>I&#8217;ve also put this on the <a href="http://andys.org.uk/wiki">Bits Wiki</a> as a <a href="http://andys.org.uk/wiki/Guide:PXE_network_booting_Debian_install">guide</a> &#8211; feel free to have a look and add any notes you feel may be useful!</p>
]]></content:encoded>
			<wfw:commentRss>http://andys.org.uk/bits/2010/03/22/pxe-booting-a-debian-squeeze-install/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>iproute2: Life after ifconfig</title>
		<link>http://andys.org.uk/bits/2010/02/24/iproute2-life-after-ifconfig/</link>
		<comments>http://andys.org.uk/bits/2010/02/24/iproute2-life-after-ifconfig/#comments</comments>
		<pubDate>Wed, 24 Feb 2010 23:57:17 +0000</pubDate>
		<dc:creator>Andy Smith</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Networking]]></category>
		<category><![CDATA[ifconfig]]></category>
		<category><![CDATA[iproute2]]></category>

		<guid isPermaLink="false">http://andys.org.uk/bits/?p=56</guid>
		<description><![CDATA[The standard network tools ifconfig, netstat and route will be familiar to anyone with more than a passing interest in UNIX or any of its derivations. Linux is no exception, and if you hop on to your nearest Linux machine, you&#8217;ll find these installed. However, for the past few years ifconfig and its ilk (often [...]]]></description>
			<content:encoded><![CDATA[<p>The standard network tools <em>ifconfig</em>, <em>netstat </em>and <em>route </em>will be familiar to anyone with more than a passing interest in UNIX or any of its derivations. Linux is no exception, and if you hop on to your nearest Linux machine, you&#8217;ll find these installed. However, for the past few years ifconfig and its ilk (often collectively referred to as <em>net-tools</em>) <a href="http://en.wikipedia.org/wiki/Ifconfig#Current_status">have been deprecated</a> in favour of the <strong>iproute2</strong> suite.</p>
<p><span id="more-56"></span>iproute2 is a suite of tools developed to unify the functions provided by the traditional tools in one place under the <code><strong>ip</strong></code> command. Interface configuration, routing and tunnelling can now all be configured and managed using the ip command.</p>
<h3>Interface configuration</h3>
<p>Historically, interfaces are managed using the <a href="http://en.wikipedia.org/wiki/Ifconfig">ifconfig</a> command, and to get an overview of the interfaces you&#8217;d type <code>ifconfig -a</code>. With iproute2, interfaces addressing is managed through the address subcommand &#8211; which, like the rest of the subcommands for iproute2 can be shortened Cisco IOS-style, as long as it&#8217;s unique. In theory this means you can use <code>ip a</code>, but the manual page refers to it as <code>ip addr</code>, which I&#8217;ll use here for clarity. So, the equivalent of <code>ifconfig -a</code> is the self-explanatory <code>ip addr show</code>, which if we&#8217;re not specifying a specific interface can be shortened to simply <code>ip addr</code>:-</p>
<blockquote>
<pre>[root@example ~]# <strong>ip addr</strong>
1: lo: &lt;LOOPBACK,UP,LOWER_UP&gt; mtu 16436 qdisc noqueue state UNKNOWN
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: eth0: &lt;NO-CARRIER,BROADCAST,MULTICAST,UP&gt; mtu 1500 qdisc
      pfifo_fast state DOWN qlen 1000
    link/ether 00:d0:b7:2d:ce:cf brd ff:ff:ff:ff:ff:ff
    inet 192.0.2.1/24 brd 192.0.2.255 scope global eth0</pre>
</blockquote>
<p>Most of this should be self-explanatory, and everything you would see with <code>ifconfig -a</code> you&#8217;ll see with <code>ip addr</code>.</p>
<p>Bringing up <strong>eth0</strong> on a Linux box would usually consist of doing the following:-</p>
<blockquote>
<pre>[root@example ~]# <strong>ifconfig eth0 up</strong>
[root@example ~]# <strong>ifconfig eth0 192.0.2.1 netmask 255.255.255.0</strong></pre>
</blockquote>
<p>With iproute2, control of interfaces themselves &#8211; both physical and logical &#8211; is through the <strong>link</strong> subcommand. Bringing up eth0 can be done with:-</p>
<pre>
<blockquote>
<pre>[root@example ~]# <strong>ip link set eth0 up</strong></pre>
</blockquote>
</pre>
<p>Managing the addresses on an interface is through the aforementioned addr subcommand, so using our example again, we&#8217;d do something like this to add an IP to eth0:-</p>
<pre>
<blockquote>
<pre>[root@example ~]# <strong>ip addr add 192.0.2.1/24 dev eth0</strong></pre>
</blockquote>
</pre>
<p>I&#8217;ve used CIDR notation in this example, but you can use the normal dotted quad format for the netmask if you wish.</p>
<p>This also makes adding multiple IP addresses to interfaces really easy. To add <strong>192.0.2.2</strong> to our example eth0 interface, you&#8217;d just do:-</p>
<pre>
<pre>
<blockquote>
<pre>[root@example ~]# <strong>ip addr add 192.0.2.2/24 dev eth0</strong></pre>
</blockquote>
</pre>
</pre>
<p>Showing the addresses on our eth0 interface only will show that both the addresses are now there:-</p>
<blockquote>
<pre>[root@example ~]# <strong>ip addr show dev eth0</strong>
2: eth0: &lt;NO-CARRIER,BROADCAST,MULTICAST,UP&gt; mtu 1500 qdisc
      pfifo_fast state DOWN qlen 1000
    link/ether 00:d0:b7:2d:ce:cf brd ff:ff:ff:ff:ff:ff
    inet 192.0.2.1/24 brd 192.0.2.255 scope global eth1
    inet 192.0.2.2/24 scope global secondary eth1</pre>
</blockquote>
<p>Removing an IP from an interface is also straightforward:-</p>
<blockquote>
<pre>[root@example ~#] <strong>ip addr del 192.0.2.2/24 dev eth0</strong></pre>
</blockquote>
<p>Querying the interface again shows that 192.0.2.2 is no longer assigned to eth0:-</p>
<blockquote>
<pre>[root@example ~]# <strong>ip addr show dev eth0</strong>
2: eth0: &lt;NO-CARRIER,BROADCAST,MULTICAST,UP&gt; mtu 1500 qdisc
      pfifo_fast state DOWN qlen 1000
    link/ether 00:d0:b7:2d:ce:cf brd ff:ff:ff:ff:ff:ff
    inet 192.0.2.1/24 brd 192.0.2.255 scope global eth1</pre>
</blockquote>
<h3>Routing</h3>
<p>Using <code>netstat -rn</code> is pretty much burned into the brains of most UNIX engineers, but luckily the iproute2 method is just as snappy. Routing management is handled with the <strong>route</strong> subcommand, and in line with <strong>addr</strong> and <strong>link</strong>, it can be shortened &#8211; <code>ip r</code> will work, but I usually settle for <code>ip ro</code>. The full command for showing the routing table is <code>ip route show</code>, but as with <code>ip addr</code> you can drop the <strong>show</strong> if you want to show the entire routing table:-</p>
<blockquote>
<pre>[root@example ~]# <strong>ip ro</strong>
192.0.2.0/24 dev eth0  proto kernel  scope link  src 192.0.2.1
default via 192.0.2.254 dev eth0</pre>
</blockquote>
<p>Adding and removing routes is accomplished with <code>ip ro add</code> and <code>ip ro del</code> respectively:-</p>
<blockquote>
<pre>[root@example ~]# <strong>ip ro add 10.0.0.0/16 via 192.0.2.253</strong>
[root@example ~]# <strong>ip ro del 10.0.0.0/16 via 192.0.2.253</strong></pre>
</blockquote>
<p>One useful feature of <code>ip route</code> is the <strong>get</strong> function, which we can use to query the routing table for a particular network or address. In our example, querying for an address not on our local network shows that the route to it goes via our default gateway:-</p>
<blockquote>
<pre>[root@example ~]# <strong>ip ro get 1.2.3.4</strong>
1.2.3.4 via 192.0.2.254 dev eth0  src 192.0.2.1
    cache  mtu 1500 advmss 1460 hoplimit 64</pre>
</blockquote>
<h3>Neighbours</h3>
<p><code>arp -na</code> is the traditional way you&#8217;d query the ARP table on a UNIX machine. You can accomplish this with iproute2 using <code>ip neighbor</code> (or <code>ip neighbour</code> for us not from the US), with <code>ip n</code> being the shortened extreme:-</p>
<blockquote>
<pre>[root@example ~]# <strong>ip neigh</strong>
192.0.2.3 dev eth0 lladdr 00:02:a5:1f:cb:2d REACHABLE
192.0.2.254 dev eth0 lladdr 00:09:43:bc:aa:80 REACHABLE</pre>
</blockquote>
<p>I&#8217;ll skip the example for this, but needless to say you can add and remove entries with <code>ip neigh add</code> and <code>ip neigh del</code> respectively.</p>
<h3>A little helping hand</h3>
<p>If you&#8217;re stuck, then the help argument can come in handy. If you specify help as an argument to ip itself, or to one of the subcommands, it&#8217;ll give you a quick overview of the options available. For example, for <strong>ip neighbor</strong>:-</p>
<blockquote>
<pre>[root@example ~]# <strong>ip neigh help</strong>
Usage: ip neigh { add | del | change | replace } { ADDR [ lladdr
          LLADDR ] [ nud { permanent | noarp | stale |
          reachable } ] | proxy ADDR } [ dev DEV ]
       ip neigh {show|flush} [ to PREFIX ] [ dev DEV ] [ nud STATE ]</pre>
</blockquote>
<h3>Not forgetting IPv6&#8230;</h3>
<p>I&#8217;ve purposely neglected to show any configuration of IPv6 addresses in this post, not because iproute2 can&#8217;t handle it, but for the exact opposite reason &#8211; the iproute2 suite will handle IPv6 addresses in exactly the same way as IPv4 addresses. All the commands used above can be used for both IPv4 and IPv6 configuration without any issues.</p>
<p>If there&#8217;s a reason you want to force the behaviour one way or the other, you can use the <code>-4</code> and <code>-6</code> switches. This isn&#8217;t needed normally, because when adding or removing an address, for example, iproute2 will happily recognise an IPv6 address instead of an IPv4 one. Where it does come in useful is if you want to limit the data returned in a query to just IPv6, or just IPv4. A real-world example of this is on one of my Linux machines, where ip -6 ro shows:-</p>
<blockquote>
<pre>[root@daedalus ~]# <strong>ip -6 ro</strong>
2001:470:XXXX:1::/64 dev eth0  proto kernel  metric 256  mtu 1500
  advmss 1440 hoplimit 0
fe80::/64 dev eth0  proto kernel  metric 256  mtu 1500 advmss 1440
  hoplimit 0
default via 2001:470:XXXX:1::1 dev eth0  metric 1  mtu 1500 advmss
  1440 hoplimit 0</pre>
</blockquote>
<p>&#8230;which comes in handy if you&#8217;re only interested in the IPv6 routing table.</p>
<h3>What next?</h3>
<p>This post only really scratches the surface of iproute2 &#8211; I&#8217;ve just covered the iproute2 equivalents of the most-used commands. It&#8217;s capable of much, much more, such as <a href="http://www.deepspace6.net/docs/iproute2tunnel-en.html">setting up tunnels</a>, managing <a href="http://linux-ip.net/html/routing-tables.html">multiple routing tables</a> and configuring interfaces for multicast to name a few. I&#8217;ll be covering some of these in more depth in future posts.</p>
<h3>Further reading</h3>
<ul>
<li>The <a href="http://lartc.org/howto/">Linux Advanced Routing &amp; Traffic Control HOWTO</a>, which is probably <em>the</em> definitive guide when it comes to iproute2</li>
<li><a href="http://en.wikipedia.org/wiki/Iproute2">iproute2 on Wikipedia</a></li>
<li>The Linux Foundation&#8217;s <a href="http://www.linuxfoundation.org/collaborate/workgroups/networking/iproute2">iproute2 page</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://andys.org.uk/bits/2010/02/24/iproute2-life-after-ifconfig/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Fixing Likewise startup scripts on Debian Squeeze</title>
		<link>http://andys.org.uk/bits/2010/02/11/fixing-likewise-startup-scripts-on-debian-squeeze/</link>
		<comments>http://andys.org.uk/bits/2010/02/11/fixing-likewise-startup-scripts-on-debian-squeeze/#comments</comments>
		<pubDate>Thu, 11 Feb 2010 00:13:35 +0000</pubDate>
		<dc:creator>Andy Smith</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[chkconfig]]></category>
		<category><![CDATA[debian]]></category>
		<category><![CDATA[fix]]></category>
		<category><![CDATA[likewise]]></category>
		<category><![CDATA[squeeze]]></category>
		<category><![CDATA[startup]]></category>

		<guid isPermaLink="false">http://andys.org.uk/bits/?p=47</guid>
		<description><![CDATA[Just a quick one, this&#8230; If you install Likewise Open on Debian Squeeze, you may notice that it doesn&#8217;t start on boot-up. The reason is because the new dependency-based boot sequence doesn&#8217;t like the init scripts Likewise provides. Luckily, it&#8217;s pretty easy to fix. First, make sure you have chkconfig installed (apt-get install chkconfig if [...]]]></description>
			<content:encoded><![CDATA[<p>Just a quick one, this&#8230;</p>
<p>If you install <a href="http://www.likewise.com/">Likewise Open</a> on <a href="http://www.debian.org/releases/squeeze/">Debian Squeeze</a>, you may notice that it doesn&#8217;t start on boot-up. The reason is because the new dependency-based boot sequence doesn&#8217;t like the init scripts Likewise provides.</p>
<p>Luckily, it&#8217;s pretty easy to fix. First, make sure you have <a href="http://articles.techrepublic.com.com/5100-10878_11-5033660.html">chkconfig</a> installed (<code>apt-get install chkconfig</code> if not), change into your <code>/etc/init.d</code> directory and do this:-</p>
<blockquote>
<pre>for INIT in lsassd lwiod eventlogd dcerpcd netlogond lwregd srvsvcd; do \
   echo "Fixing '${INIT}'..."; \
   sed -i -e 's/^#LWI_STARTUP_TYPE_SUSE#/#/g' \
      -e 's/Default-Start: 3 5/Default-Start: 2 3 4 5/g' \
      -e 's/Default-Stop: 0 1 2 6/Default-Stop: 0 1 6/g' ${INIT}; \
done</pre>
<pre>for INIT in lsassd lwiod netlogond eventlogd dcerpcd; do \
   echo "Disabling ${INIT}..."; \
   chkconfig -d ${INIT}; \
done</pre>
<pre>for INIT in dcerpcd eventlogd netlogond lwiod lsassd; do \
   echo "Re-enabling ${INIT}..."; \
   chkconfig -a ${INIT}; \
done</pre>
</blockquote>
<p>This uncomments the SUSE parts of the init scripts, which chkconfig wants. It then calls chkconfig to first delete each entry, and then re-add it to make sure everything&#8217;s okay. Reboot, and you should have working domain authentication without having to manually start it up.</p>
]]></content:encoded>
			<wfw:commentRss>http://andys.org.uk/bits/2010/02/11/fixing-likewise-startup-scripts-on-debian-squeeze/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>IPv6 for a Linux generation</title>
		<link>http://andys.org.uk/bits/2010/02/07/ipv6-for-an-linux-generation/</link>
		<comments>http://andys.org.uk/bits/2010/02/07/ipv6-for-an-linux-generation/#comments</comments>
		<pubDate>Sun, 07 Feb 2010 23:35:04 +0000</pubDate>
		<dc:creator>Andy Smith</dc:creator>
				<category><![CDATA[IPTables/Netfilter]]></category>
		<category><![CDATA[IPv6]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Security]]></category>

		<guid isPermaLink="false">http://andys.org.uk/bits/?p=33</guid>
		<description><![CDATA[IPv6 is nothing new &#8211; it was finally standardised back in 1998 in RFC 2460, and virtually all operating systems have supported it now for at least 5 years, so most people are in a position to give it a try. If you&#8217;re one of the lucky ones, your ISP might provide native IPv6 connectivity [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://en.wikipedia.org/wiki/IPv6">IPv6</a> is nothing new &#8211; it was finally standardised back in 1998 in <a href="http://tools.ietf.org/html/rfc2460">RFC 2460</a>, and virtually all operating systems have supported it now for at least 5 years, so most people are in a position to give it a try.</p>
<p>If you&#8217;re one of the lucky ones, your ISP might provide native IPv6 connectivity (like <a href="http://www.aaisp.net.uk/kb-broadband-ipv6.html">AAISP</a>), but for most of us, the main way to get connected to the rest of the IPv6 Internet is to use something we&#8217;ve already got &#8211; IPv4. And we&#8217;re going to tunnel over it.</p>
<p><span id="more-33"></span>The first thing we need to do is choose a tunnel broker, which is a fancy name for someone who&#8217;ll provide us with an IPv4 endpoint we can tunnel IPv6 over. Wikipedia <a href="http://en.wikipedia.org/wiki/List_of_IPv6_tunnel_brokers">has a list</a>, but the main, globally available ones are <a href="http://tunnelbroker.net/">Hurricane Electric</a> and <a href="http://www.sixxs.net/">SixXS</a>. Either of these will do, and some people prefer HE over SixXS, but that&#8217;s a purely personal choice &#8211; in my experience, both work equally as well. For this example, though, we&#8217;ll go with HE &#8211; so head on over to <a href="http://tunnelbroker.net/">http://tunnelbroker.net/</a> and create an account.</p>
<h2>My first tunnel</h2>
<p>Once you&#8217;ve created your account, log in and create a tunnel. For some reason, it always seems to pick their New York POP, so you might want to manually choose one geographically closer (in my case &#8211; and for our example &#8211; London, UK)</p>
<div id="attachment_34" class="wp-caption aligncenter" style="width: 439px"><a href="http://andys.org.uk/bits/wp-content/uploads/2010/02/tunnel1.png"><img class="size-full wp-image-34" title="Creating a tunnel" src="http://andys.org.uk/bits/wp-content/uploads/2010/02/tunnel1.png" alt="" width="429" height="502" /></a><p class="wp-caption-text">Creating a tunnel</p></div>
<p>The IP address you use as your local end of the tunnel will need to be a public IP address. It&#8217;s possible to use a machine behind a NAT device if it&#8217;s in a DMZ-style setup where all the traffic destined for the public IP address gets forwarded by the NAT device to the machine behind it, but your mileage may vary.</p>
<p>Once created, view the tunnel details, which should look something like this:-</p>
<div id="attachment_35" class="wp-caption aligncenter" style="width: 460px"><a href="http://andys.org.uk/bits/wp-content/uploads/2010/02/tunnel2.png"><img class="size-full wp-image-35" title="Editing the tunnel details" src="http://andys.org.uk/bits/wp-content/uploads/2010/02/tunnel2.png" alt="Editing the tunnel details" width="450" height="324" /></a><p class="wp-caption-text">Editing the tunnel details</p></div>
<p style="text-align: left;">Our tunnel has been created! At the bottom of the page, you&#8217;ll notice a little drop-down that generates the commands needed to bring up the tunnel. For this example, we&#8217;re using <a href="http://en.wikipedia.org/wiki/Iproute2">iproute2</a>, so the commands go something like this:-</p>
<p>&nbsp;</p>
<blockquote>
<pre>ip tunnel add he-ipv6 mode sit remote 216.66.80.26 local 192.0.2.1 ttl 255
ip link set he-ipv6 up
ip addr add 2001:470:1f08:810::2/64 dev he-ipv6
ip route add ::/0 dev he-ipv6</pre>
</blockquote>
<p>The first command creates an IPv6-in-IPv4 tunnel between us and HE, and the second command brings up that tunnel. The third command adds our IPv6 address to our end of the tunnel, and finally the fourth command sets the IPv6 default route to be down our newly-created tunnel.</p>
<p>And that&#8217;s it &#8211; we&#8217;re now connected to the global IPv6 internet. To test it, let&#8217;s try pinging something:-</p>
<blockquote>
<pre>mordor:~# <strong>ping6 -c 3 www.he.net</strong>
PING www.he.net(he.net) 56 data bytes
64 bytes from he.net: icmp_seq=1 ttl=58 time=375 ms
64 bytes from he.net: icmp_seq=2 ttl=58 time=257 ms
64 bytes from he.net: icmp_seq=3 ttl=58 time=255 ms</pre>
<pre>--- www.he.net ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2002ms
rtt min/avg/max/mdev = 255.562/296.218/375.628/56.158 ms</pre>
</blockquote>
<p>If you see something like the above, then give yourself a pat on the back, because it&#8217;s working!</p>
<h2>Next steps</h2>
<p>HE by default assigns you a <strong>/64</strong> network, which is <a href="http://www.ripe.net/docs/ipv6policy.html#assignment_size">the smallest size intended to be allocated</a>. This gives you <strong>18,446,744,073,709,551,616</strong> IPs, and whichever way you look at it that&#8217;s a lot of addresses. With this in mind, you might be wondering why HE will give you a <strong>/48</strong> (that&#8217;s <em><strong>1,208,925,819,614,629,174,706,176</strong></em> IPs!). The reason is that each network is intended to have a /64, and a /48 allows you to carve up that space into a total of <strong>65,536</strong> separate /64 networks. Now this obviously sounds like overkill to the average user, but autoconfiguration tools such as <a href="http://en.wikipedia.org/wiki/Radvd">radvd</a> won&#8217;t work with networks smaller than /64, again because of the intentions mentioned previously. This means that if you have more than one network at home (say, a wired network and a wireless network, currently with separate IPv4 networks for each), you can assign a /64 to each one.</p>
<p>With this is mind, let&#8217;s ask HE for a /48 by clicking on <strong>Allocate</strong> in the &#8216;Routed /48&#8242; section. After a few seconds, you&#8217;ll see something like this:-</p>
<div id="attachment_37" class="wp-caption aligncenter" style="width: 456px"><a href="http://andys.org.uk/bits/wp-content/uploads/2010/02/tunnel4.png"><img class="size-full wp-image-37" title="Allocating our /48" src="http://andys.org.uk/bits/wp-content/uploads/2010/02/tunnel4.png" alt="" width="446" height="51" /></a><p class="wp-caption-text">Allocating our /48</p></div>
<p>In our example, we&#8217;ve been allocated <code>2001:470:90d3::/48</code>, and now it&#8217;s time to plan our IP schema.</p>
<h2>Laying it out</h2>
<p>Taking my own home network as an example, I have three networks &#8211; one for general use (the &#8216;<em>LAN</em>&#8216;), one for guest use over wireless (the &#8216;<em>WLAN</em>&#8216;), and finally a DMZ (the&#8230; er, &#8216;<em>DMZ</em>&#8216;). We could lay these out like this:-</p>
<ul>
<li>LAN &#8211; <code>2001:470:90d3:<strong><span style="color: #008000;">1</span></strong>::/64</code></li>
<li>DMZ &#8211; <code>2001:470:90d3:<span style="color: #008000;"><strong>2</strong></span>::/64</code></li>
<li>WLAN &#8211; <code>2001:470:90d3:<strong><span style="color: #008000;">3</span></strong>::/64</code></li>
</ul>
<p>Nice and simple, and easy to remember. Assuming all three networks are connected to the same gateway machine, we can give the gateway the first IP in the range &#8211; <code>2001:470:90d3:<strong><span style="color: #008000;">1::1</span></strong></code>, <code>2001:470:90d3:<strong><span style="color: #008000;">2::1</span></strong></code> and <code>2001:470:90d3:<strong><span style="color: #008000;">3::1</span></strong></code>.</p>
<h2>Routing things further</h2>
<p>Before we start, we need to enable IP forwarding for IPv6:-</p>
<blockquote>
<pre>sysctl -w net.ipv6.conf.all.forwarding=1</pre>
</blockquote>
<p>You&#8217;ll probably want to add this somewhere so it gets activated on bootup &#8211; under Debian this would be in <code>/etc/sysctl.conf</code> (which already has the entry, albeit commented out).</p>
<p>One way to provide connectivity to machines on the individual networks is to manually give each machine an IPv6 address, and to route it through our gateway:-</p>
<blockquote>
<pre>ip addr add 2001:470:90d3:1::2/64 dev eth0
ip route add ::/0 via 2001:470:90d3:1::1 dev eth0</pre>
</blockquote>
<p>Again, all being well, you should now be able to route to the wider IPv6 Internet from our newly-configured IPv6 node. More importantly, this also means that the wider IPv6 Internet can route back to you &#8211; which brings us to&#8230;</p>
<h2>Security, not obscurity</h2>
<p>Don&#8217;t be fooled into thinking that because of the immense range of possible IPv6 addresses that securing your new IPv6 setup isn&#8217;t required &#8211; IPv6 is no exception when it comes to the Internet Bad Guys, so implementing firewall rules is of the utmost importance.</p>
<p>The problem with IPv4 and NAT is that it&#8217;s allowed people to become somewhat complacent about security, because machines behind a NAT device are naturally unreachable from the global Internet. IPv6 does not have NAT, which means you don&#8217;t have this (rather lazy) safety net, so we have to do it properly.</p>
<p>Luckily, if you&#8217;re familiar with <a href="http://www.netfilter.org/projects/iptables/index.html">iptables</a>, you&#8217;ll be glad to know that there&#8217;s an IPv6 equivalent &#8211; and it&#8217;s called (predicatably) <a href="http://www.centos.org/docs/4/html/rhel-rg-en-4/s1-ip6tables.html">ip6tables</a>. The syntax is identical, and in fact the only noticeable difference is that you&#8217;re using IPv6 addresses and networks instead of IPv4 ones.</p>
<p>A quick example would go something like this:-</p>
<blockquote>
<pre><em># Clear our INPUT, OUTPUT and FORWARD chains</em>
ip6tables -F INPUT
ip6tables -F OUTPUT
ip6tables -F FORWARD

<em># Allow packets related to existing connections</em>
ip6tables -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
ip6tables -A FORWARD -m state --state RELATED,ESTABLISHED -j ACCEPT

<em># Allow link-local (for neighbour discovery)</em>
ip6tables -A INPUT -s fe80::/10 -j ACCEPT

<em># Allow SSH inbound to our gateway from our LAN</em>
ip6tables -A INPUT -i lan -s 2001:470:90d3:1::/64 -p tcp
   -m tcp --dport 22 -j ACCEPT

<em># Allow all outbound from our networks</em>
ip6tables -A FORWARD -i lan -s 2001:470:90d3:1::/64 -j ACCEPT
ip6tables -A FORWARD -i dmz -s 2001:470:90d3:2::/64 -j ACCEPT
ip6tables -A FORWARD -i wlan -s 2001:470:90d3:3::/64 -j ACCEPT

<em># Allow all outbound from our gateway</em>
ip6tables -A OUTPUT -j ACCEPT

<em># Allow SSH and HTTPS inbound to our DMZ</em>
ip6tables -A FORWARD -i he-ipv6 -d 2001:470:90d3:1::/64 -p tcp
   -m multiport --dports 22,443 -j ACCEPT

<em># Set the default policy to drop</em>
ip6tables -P INPUT DROP
ip6tables -P FORWARD DROP
ip6tables -P OUTPUT DROP</pre>
</blockquote>
<p>So there you have it &#8211; IPv6 firewalling needn&#8217;t be difficult. If you want to make something more complex, you might want to take a look at my previous post about <a href="http://andys.org.uk/bits/2010/01/27/iptables-fun-with-mark/">iptables and the &#8216;mark&#8217; target</a>, which also applies to ip6tables.</p>
<h2>IPv6 &#8211; automatically</h2>
<p>Just like DHCP for IPv4, there are autoconfiguration mechanisms for IPv6 &#8211; radvd and DHCPv6. Radvd is the older of the two, but both can be used for the same purpose. Configuration of radvd is relatively straightforward, and if we wanted to provide autoconfiguration on our example LAN, we can do something like this:-</p>
<blockquote>
<pre>interface lan
{
      AdvSendAdvert on;
      MinRtrAdvInterval 3;
      MaxRtrAdvInterval 10;
      AdvDefaultPreference low;
      AdvHomeAgentFlag off;

      prefix 2001:470:90d3:2::/64
      {
            AdvOnLink on;
            AdvAutonomous on;
            AdvRouterAddr off;
      };
};</pre>
</blockquote>
<h2>Where next?</h2>
<p>This only covers the start &#8211; there&#8217;s more involved in bringing an IPv6 network up to scratch, like setting up forward and reverse <a href="http://www.linuxjournal.com/article/6541">DNS</a>, and <a href="http://tldp.org/HOWTO/Linux+IPv6-HOWTO/chapter-hints-daemons.html">configuring</a> <a href="http://www.linuxjournal.com/article/5451">various</a> <a href="http://www.bieringer.de/linux/IPv6/IPv6-HOWTO/IPv6-HOWTO-7.html">daemons</a> to talk over IPv6 as well as IPv4. If you&#8217;re interested, you might find some of the following links useful reading:-</p>
<ul>
<li><a href="http://tldp.org/HOWTO/Linux+IPv6-HOWTO/index.html">Peter Bieringer&#8217;s Linux IPv6 Howto</a></li>
<li><a href="http://www.ipv6.org.uk/">IPv6 in the UK</a></li>
<li><a href="http://tools.ietf.org/html/rfc2460">RFC 2460 &#8211; IPv6 Specification</a></li>
<li><a href="http://www.deepspace6.net/">Deep Space 6</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://andys.org.uk/bits/2010/02/07/ipv6-for-an-linux-generation/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Authenticating Active Directory users on Linux with Likewise Open</title>
		<link>http://andys.org.uk/bits/2010/01/28/likewise-open-and-linux/</link>
		<comments>http://andys.org.uk/bits/2010/01/28/likewise-open-and-linux/#comments</comments>
		<pubDate>Thu, 28 Jan 2010 01:09:35 +0000</pubDate>
		<dc:creator>Andy Smith</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[UNIX]]></category>
		<category><![CDATA[active directory]]></category>
		<category><![CDATA[ad]]></category>
		<category><![CDATA[authentication]]></category>
		<category><![CDATA[likewise]]></category>
		<category><![CDATA[likewise open]]></category>

		<guid isPermaLink="false">http://andys.org.uk/bits/?p=20</guid>
		<description><![CDATA[Historically, if you wanted to use Active Directory to authenticate users on a UNIX box, you were pretty much limited to using LDAP. This works fine for some people, but it&#8217;s not particularly elegant &#8211; especially if you&#8217;re having to create users home directories all the time, which negates some of the point of centralising [...]]]></description>
			<content:encoded><![CDATA[<p>Historically, if you wanted to use Active Directory to authenticate users on a UNIX box, you were pretty much limited to using <a href="http://www.openldap.org/lists/openldap-software/200010/msg00097.html">LDAP</a>. This works fine for some people, but it&#8217;s not particularly elegant &#8211; especially if you&#8217;re having to create users home directories all the time, which negates some of the point of centralising authentication to begin with.</p>
<p>I&#8217;m from a UNIX (mostly Linux) background, so I&#8217;m more at home using UNIX-alike platforms. That said, there&#8217;s a few things that Microsoft do that are particularly useful, and in my opinion AD is one of them (quiet at the back, there). Handily, there&#8217;s a project that can marry the two, and it goes by the name of <a href="http://www.likewise.com/">Likewise</a>.</p>
<p><span id="more-20"></span><a href="http://www.likewise.com/products/likewise_enterprise/index.php">Likewise Enterprise</a> is Likewise Software&#8217;s commercial offering, but they also provide an open-source edition in the form of <a href="http://www.likewise.com/products/likewise_open/index.php">Likewise Open</a>, which is what I&#8217;m going to focus on here. Conceptually, using Likewise is equivalent to binding a Windows machine to a domain, and the method of doing it is similar. The code is somewhat related to <a href="http://www.samba.org">Samba</a>, so some parts of it may be familiar to anyone who&#8217;s meddled around with Samba in any depth.</p>
<h3>Starting out</h3>
<p>First off, you&#8217;ll need the Likewise Open installer, which you can get from here (<a href="http://www.likewise.com/download/index.php">signup required</a>). Grab the installer for your particular distro or operating system &#8211; for this example I&#8217;m using a fresh Debian (lenny) GNU/Linux install, but the process is essentially the same for others, such as Solaris. One you&#8217;ve got it, installing it is just a matter of running it:-</p>
<blockquote>
<pre>adtest:~# <span style="color: #008000;"><strong>chmod +x ./LikewiseIdentityServiceOpen-...-linux-i386-deb-installer</strong></span>
adtest:~# <span style="color: #008000;"><strong>./LikewiseIdentityServiceOpen-...-linux-i386-deb-installer</strong></span></pre>
</blockquote>
<p>Follow the prompts, and after a few seconds you&#8217;ll be returned to a prompt. Assuming the install completed successfully, in the case of Debian (or Ubuntu), running &#8216;<em>dpkg -l | grep likewise</em>&#8216; will show a few new packages have been installed (for RedHat/CentOS, replace &#8216;<em>dpkg -l</em>&#8216; with &#8216;<em>rpm -qa</em>&#8216;).</p>
<p>Before going any further, make sure your resolvers are set up correctly, and that the local machine&#8217;s time is synchronised &#8211; either against an external NTP source, or one of the domain controllers. You can check that DNS resolution is working correctly by running:-</p>
<blockquote>
<pre>adtest:~# <span style="color: #008000;"><strong>host test.example.com</strong></span></pre>
</blockquote>
<p>&#8230;and all being well, you&#8217;ll see something like this:-</p>
<blockquote>
<pre>test.example.com          A     10.1.1.1
test.example.com          A     10.1.2.1</pre>
</blockquote>
<p>If you&#8217;re okay so far, configuring the machine to use AD requires one command:-</p>
<blockquote>
<pre>adtest:~# <span style="color: #008000;"><strong>/opt/likewise/bin/domainjoin-cli join test.example.com andys</strong></span></pre>
</blockquote>
<p>After a few seconds, providing the local machine can see the domain controllers, you should be prompted for your domain password. As when binding a Windows machine to a domain, the account you use must have the right privileges, which usually means that it&#8217;s in the Domain Admins group or similar. So:-</p>
<blockquote>
<pre>Joining to AD Domain:   test.example.com
With Computer DNS Name: adtest.test.example.com

andys@TEST.EXAMPLE.COM's password: <span style="color: #008000;"><strong><em>&lt;domain password&gt;</em></strong></span></pre>
</blockquote>
<p>&#8230;wait a few seconds&#8230;</p>
<blockquote>
<pre>Warning: System restart required
Your system has been configured to authenticate to Active Directory
for the first time. It is recommended that you restart your system
to ensure that all applications recognize the new settings.

SUCCESS</pre>
</blockquote>
<p>Now, in my experience you don&#8217;t strictly need to reboot, however it&#8217;s a good idea to, so go ahead and reboot the machine.</p>
<h3>The basics</h3>
<p>Assuming the box rebooted, we can now test that AD integration is working. Log in, and at a prompt type:-</p>
<blockquote>
<pre>adtest:~# <span style="color: #008000;"><strong>id TEST\\andys</strong></span></pre>
</blockquote>
<p>&#8230;replacing &#8216;<em>TEST\\andys</em>&#8216; with your domain and username. The double backslash is important, because most UNIX shells use &#8216;\&#8217; for escaping characters. If you want, you can also use the &#8216;<em>user@domain</em>&#8216; syntax. If all is well, you&#8217;ll see something like this:-</p>
<blockquote>
<pre>uid=2096628820(TEST\andys) gid=2096628225(TEST\domain^users)
groups=2096628225(TEST\domain^users),2096628224(TEST\domain^admins)</pre>
</blockquote>
<p>At this point I should offer a word of caution: Because the machine is now bound to the domain, it means users on the domain can log into it. Obviously this is the whole point, but it&#8217;s something to be mindful of, especially if the domain is used by many people.</p>
<p>The UIDs and GIDs may look ridiculously large, but don&#8217;t worry &#8211; UIDs under most UNIXen are 32-bit, so this will be fine. There&#8217;s also a good reason for it &#8211; Likewise guarantees that the IDs will be unique and consistent across all machines bound to the same domain. You&#8217;ll also notice that the user&#8217;s primary group is set to the primary group from AD, which is usually &#8216;<em>Domain Users</em>&#8216;.</p>
<p>The <em>domainjoin-cli</em> command also makes some changes to <strong>/etc/nsswitch.conf</strong> and the PAM configuration. On my example Debian box, having a peek at <strong>/etc/pam.d/common-auth</strong> reveals:-</p>
<blockquote>
<pre>auth    sufficient    /lib/security/pam_lsass.so
auth    required    pam_unix.so nullok_secure try_first_pass</pre>
</blockquote>
<p><strong>pam_lsass.so</strong> is the PAM shared library for the lsass &#8211; or <a href="http://en.wikipedia.org/wiki/Local_Security_Authority_Subsystem_Service">Local Security Authority Subsystem Service</a> &#8211; part of Likewise. The example above is simple enough, and accepts domain users, falling back to standard UNIX users if the given username isn&#8217;t a domain user.</p>
<h3>Making changes</h3>
<p>Likewise installs its configuration files in <strong>/etc/likewise</strong>. The one that&#8217;s probably of most interest is <strong>lsassd.conf</strong>, which controls how the lsass daemon <strong>lsassd</strong> handles users. Before going into any detail, you&#8217;ll notice that lsassd.conf is split into two sections &#8211; the first being for domain users (the <span style="color: #000080;">[auth provider:lsa-activedirectory-provider]</span> section), and the second being for &#8216;local&#8217; users (under <span style="color: #000080;">[auth provider:lsa-local-provider]</span>). The local users are usually just &#8216;<em>COMPUTER\Administrator</em>&#8216; and &#8216;<em>COMPUTER\Guest</em>&#8216; (where <em>COMPUTER</em> is the name of the local machine), and are synonymous to the <em>Administrator</em> and <em>Guest</em> accounts on Windows machines. Chances are you won&#8217;t need to touch the local users section, so we can safely ignore it.</p>
<p>There&#8217;s quite a few options to play with in lssasd.conf, but the main ones we&#8217;re interested in are:-</p>
<ul>
<li><strong>login-shell-template</strong>, which allows us to set the default shell for domain users. This is (by default) set to <strong>/bin/sh</strong>, so in many cases you might want to change it to <strong>/bin/bash</strong>.</li>
<li><strong>homedir-template</strong>, which specifies where domain users&#8217; home directories will be created. The default for this is <strong>%H/local/%D/%U</strong>, which in our example would expand to <strong>/home/local/TEST/andys</strong> for my account. Personally, I prefer to drop the &#8216;local&#8217; bit and use <strong>%H/%D/%U</strong>, which would change my home directory to <strong>/home/TEST/andys</strong>.</li>
<li><strong>require-membership-of</strong>, which lets us specify which groups are allowed to authenticate against this machine in a comma-separated list.</li>
</ul>
<p>It&#8217;s important to note that if you use the last option, <span style="color: #ff0000;"><span style="text-decoration: underline;">any domain user which isn&#8217;t a member of one of the specified groups will fail any PAM configuration that calls pam_lsass.so</span></span>.  This means that if you wanted to allow certains groups SSH access, whilst allowing a larger set of groups access to FTP, you don&#8217;t want to omit the FTP user groups from here. If you&#8217;re building this kind of setup, you&#8217;ll want to allow all the groups in lsassd.conf, and then build your PAM configuration to conditionally allow access based on group membership using <a href="http://www.kernel.org/pub/linux/libs/pam/Linux-PAM-html/sag-pam_group.html">pam_group</a>.</p>
<p>Once you&#8217;ve finished making your configuration changes, you&#8217;ll need to tell Likewise to reload the configuration:-</p>
<blockquote>
<pre>adtest:~# <span style="color: #008000;"><strong>/opt/likewise/bin/lw-refresh-configuration</strong></span>
Configuration successfully loaded from disk.</pre>
</blockquote>
<p>It also doesn&#8217;t hurt (and I&#8217;ve sometimes found it neccessary) to clear the local AD cache:-</p>
<blockquote>
<pre>adtest:~# <span style="color: #008000;"><strong>/opt/likewise/bin/lw-ad-cache --delete-all</strong></span>
The cache has been emptied successfully.</pre>
</blockquote>
<p>&#8230;and that&#8217;s it! You should now have AD authentication working through PAM.</p>
<h3>Useful commands</h3>
<p>Likewise installs quite a few tools in <strong>/opt/likewise/bin</strong> (many of which are symlinks to <strong>lw-lsa</strong>), some of which come in handy for testing:-</p>
<ul>
<li><strong>lw-refresh-configuration</strong>, which as mentioned above reloads the <strong>lsassd</strong> configuration from <strong>lsassd.conf</strong>.</li>
<li><strong>lw-ad-cache</strong> (also partly mentioned above), which lets us manipulate the local AD cache. For example, <strong>lw-ad-cache &#8211;enum-users</strong> will list the users&#8217; details currently stored in the cache.</li>
<li><strong>lw-enum-users</strong>/<strong>lw-enum-groups</strong>, which predictably list all the users and groups in the domain.</li>
<li><strong>lw-get-status</strong>, which shows quite a bit of information about the domain itself.</li>
</ul>
<p>These are just a few, so it&#8217;s useful to have a poke about in <strong>/opt/likewise/bin</strong> and see what there is.</p>
<h3>Hints</h3>
<p>Because Likewise integrates itself via PAM, pretty much everything which can work with normal UNIX users can cope fine with domain users. For instance:-</p>
<ul>
<li>You can use the tilde (~) shortcut to go to a domain user&#8217;s home directory, for example <strong>cd ~andys@TEST</strong>. For some reason, the backslash notation doesn&#8217;t work here, and you may also notice that tab completion doesn&#8217;t work either.</li>
<li>With most things, you can refer to domain users as either <em>TEST\\andys</em>, <em>TEST.EXAMPLE.COM\\andys</em>, <em>andys@TEST</em> or <em>andys@TEST.EXAMPLE.COM</em>, including when logging in on the console or via SSH. There are exceptions (such as the previous point), but they&#8217;re few and far between.</li>
<li>Sudo happily works with domain groups &#8211; just remember to double-backslash.</li>
<li>You can use <strong>chown</strong> and <strong>chgrp</strong> in the ways you&#8217;d normally expect, using either the domain group names, or their GIDs.</li>
<li><strong><a href="http://www.suse.de/~agruen/acl/linux-acls/online/">ACLs</a></strong> (under Linux) also work, so if you&#8217;ve mounted a partition with the &#8216;<strong>acl</strong>&#8216; option, you can use <strong>setfacl</strong> as normal.</li>
</ul>
<h3>If it all goes wrong&#8230;</h3>
<p>Sometimes things go wrong. With Likewise, it&#8217;s usually straightforward. If you&#8217;re getting errors when binding to the domain with <strong>domainjoin-cli</strong>, it&#8217;s usually because it&#8217;s having problems connecting to the domain controller. If your domain controllers are on a different network, check that any firewalls inbetween aren&#8217;t dropping SMB traffic. The <strong>domainjoin-cli</strong> command should give you a definitive list of ports it needs open to communicate with the domain controller.</p>
<p>Once up and running, I&#8217;ve found Likewise Open to be very stable, but on the odd occasion that something has gone awry, it&#8217;s often enough to just restart the <strong>lsassd</strong> daemon. Failing that, try emptying the cache (with <strong>lw-ad-cache &#8211;delete-all</strong>). If you&#8217;re still getting odd errors, it might be worth checking out the <a href="http://www.likewise.com/resources/documentation_library/">documentation</a> or the <a href="http://www.likewise.com/community/index.php/forums/">forums</a>.</p>
<h3>Where to from here?</h3>
<p>Because the PAM magic happens with pam_lsass, in theory anything which uses PAM can be made AD-aware. I&#8217;ve personally used it with <a href="http://www.pureftpd.org">Pure-FTPd</a> to provide company-wide access to an fileserver, and it works flawlessly with <strong>gdm</strong>, so you can use it on your desktop. Again, because it&#8217;s PAM-based, it can be stacked with other modules such as <strong>pam_securid</strong> (for RSA&#8217;s SecurID tokens) or <a href="http://www.gsp.com/cgi-bin/man.cgi?section=8&amp;topic=pam_opie">pam_opie</a> (for one-time password sets).</p>
<p>Ironically, one thing that does require a little bit more configuration is Samba &#8211; something I&#8217;ll cover in a future post.</p>
<p><strong>Update</strong>: Yvo van Doorn <a href="http://andys.org.uk/bits/2010/01/28/likewise-open-and-linux/comment-page-1/#comment-30">comments below</a> with a handy hint if you only need access to one domain, which should save on keyboard wear for some users <img src='http://andys.org.uk/bits/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://andys.org.uk/bits/2010/01/28/likewise-open-and-linux/feed/</wfw:commentRss>
		<slash:comments>17</slash:comments>
		</item>
	</channel>
</rss>

