<?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>inutility.net</title>
	<atom:link href="http://inutility.net/feed" rel="self" type="application/rss+xml" />
	<link>http://inutility.net</link>
	<description>for all things useless</description>
	<lastBuildDate>Fri, 25 Jan 2013 10:22:08 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<item>
		<title>Exim &amp; Dovecot mailserver with Active Directory</title>
		<link>http://inutility.net/linux/exim-dovecot-mailserver-with-active-directory</link>
		<comments>http://inutility.net/linux/exim-dovecot-mailserver-with-active-directory#comments</comments>
		<pubDate>Tue, 30 Oct 2012 15:17:27 +0000</pubDate>
		<dc:creator>al</dc:creator>
				<category><![CDATA[Debian]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[active directory]]></category>
		<category><![CDATA[debian]]></category>
		<category><![CDATA[exim]]></category>
		<category><![CDATA[Windows Server 2008]]></category>

		<guid isPermaLink="false">http://inutility.net/?p=111</guid>
		<description><![CDATA[Following on from getting Debian working with Active Directory for account authorisation I had need to set up Exim with Dovecot for a mail server. Obviously I want to use the Active Directory to keep all the accounts as before, &#8230; <a href="http://inutility.net/linux/exim-dovecot-mailserver-with-active-directory">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>Following on from getting <a title="Debian Squeeze, Active Directory &amp; Samba" href="http://inutility.net/work/debian-squeeze-active-directory-samba">Debian working with Active Directory </a>for account authorisation I had need to set up Exim with Dovecot for a mail server. Obviously I want to use the Active Directory to keep all the accounts as before, but I also want it to keep all my email aliases.</p>
<p><span id="more-111"></span></p>
<p>So, if you haven&#8217;t seen how to get <a title="Debian Squeeze, Active Directory &amp; Samba" href="http://inutility.net/work/debian-squeeze-active-directory-samba">Debian working with Active Directory</a> then you might want to read that first.</p>
<p>To make use of LDAP/Active Directory you will need to use the <strong>exim4-daemon-heavy</strong> package, not <strong>exim4-daemon-light</strong> as it has no LDAP support. I also set Exim to use the &#8220;<strong>multiple configuration files</strong>&#8221; option.</p>
<h2>Dovecot</h2>
<p>Dovecot is largely straight forward. Dovecot will use PAM and we have already got this working off the AD servers. We only want the IMAP server, so we installed the <strong>dovecot-imapd</strong> package with apt.</p>
<p>We have the following options specifically set in /etc/dovecot/dovecot.conf</p>
<pre>ssl = required # requires either SSL or STARTTLS to be used. No unencrypted connections

mail_location = maildir:~/Maildir # if you use maildirs this forces their use

passdb pam {
  args = session=yes dovecot #  this makes dovecot create the home directory 
}</pre>
<p>You will need to restart Dovecot to apply these changes.</p>
<h1>Exim</h1>
<h2>Using Dovecot&#8217;s deliver</h2>
<p>Exim can use Dovecot&#8217;s delivery program which will automatically create the indexes that it uses. It is not required, but if you are using mbox (not maildir) there can be a delay as it rebuilds indexes after email delivery. There is less of a benefit when you&#8217;re using Maildir though</p>
<p>Create a file called /etc/exim4/conf.d/transport/30_exim4-config_dovecot_delivery with the contents:</p>
<pre>dovecot_delivery:
  driver = pipe
  command = /usr/lib/dovecot/deliver
  message_prefix =
  message_suffix =
  log_output
  delivery_date_add
  envelope_to_add
  return_path_add
  #group = mail
  #mode = 0660
  temp_errors = 64 : 69 : 70: 71 : 72 : 73 : 74 : 75 : 78</pre>
<p>Then edit /etc/exim4/update-exim4.conf.conf and modify the dc_localdelivery entry:</p>
<pre>dc_localdelivery='dovecot_delivery'</pre>
<p>You will then need to issue the command</p>
<pre>update-exim4.conf</pre>
<p>This will update the configuration and Exim should then use this without a restart.</p>
<h2>Keeping email aliases in AD</h2>
<p>This one took a bit of figuring out and I found only pieces from other people.</p>
<h3>Active Directory setup</h3>
<p>We are using Windows 2008 and this does not require us to add anything to the AD to support this</p>
<p>Using the <em>Active Directory Users and Groups</em> tool if you edit a user&#8217;s information and go to the <em>Attribute Editor</em> tab you can scroll to the <strong>otherMailbox</strong> entry. Editing this allows you to add and remove email addresses to the list. I use full email addresses, but I imagine it may work fine with simple usernames also</p>
<h3>Exim configuration</h3>
<p>A couple of configuration files are needed here. Firstly you need a file with all your LDAP configuration for which I create the file /etc/exim4/conf.d/main/04_exim4-config_ldap which contains:</p>
<p>ldap_default_servers = server1.int.inutility.net:server2.int.inutility.net</p>
<p>Obviously you should use the command &#8220;chmod 640 /etc/exim4/conf.d/main/04_exim4-config_ldap&#8221; so users cannot see the password in this file.</p>
<pre># Configuration for LDAP email aliases
ldap_default_servers = server1.int.inutility.net:server2.int.inutility.net
LDAPUSER = cn=ldapuser,cn=Users,dc=int,dc=inutility,dc=net
LDAPPASS = ARealPassword
LDAPSEARCHBASE = dc=int,dc=inutility,dc=net</pre>
<p>Obviously you need to update your own values. Multiple AD servers can be specified separated by :. You will also need to make an LDAP account with limited privileges to be able to enumerate the aliases. It only needs to have limited access, but I&#8217;m afraid I won&#8217;t be covering the set up of this here.</p>
<p>The second file you need is /etc/exim4/conf.d/router/450_exim4-config_ldap_aliases and should contain:</p>
<pre>ldap_aliases:
        debug_print = "R: ldap_aliases LDAP lookup for $local_part@$domain"
        driver = redirect
        domains = +local_domains
        condition = ${lookup ldap {user=LDAPUSER pass=LDAPPASS ldap:///LDAPSEARCHBASE?mail?sub?(otherMailbox=*${quote_ldap:$local_part@$domain}*)}}
        data = ${lookup ldap {user=LDAPUSER pass=LDAPPASS ldap:///LDAPSEARCHBASE</pre>
<p>Nothing should need to be changed in this file.  You will then need to update your Exim config with the</p>
<pre>update-exim4.conf</pre>
<p>And then exim will use this configuration. You can use the command below to check the routing of email addresses and that the lookup is working correctly:</p>
<pre>exim4 -bt &lt;email address or alias&gt;</pre>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://inutility.net/linux/exim-dovecot-mailserver-with-active-directory/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Acronym overload: Migrating Xen PVM hosts to KVM HVM hosts</title>
		<link>http://inutility.net/linux/acronym-overload-migrating-xen-pvm-hosts-to-kvm-hvm-hosts</link>
		<comments>http://inutility.net/linux/acronym-overload-migrating-xen-pvm-hosts-to-kvm-hvm-hosts#comments</comments>
		<pubDate>Thu, 08 Dec 2011 14:17:34 +0000</pubDate>
		<dc:creator>al</dc:creator>
				<category><![CDATA[Debian]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[Virtualisation]]></category>

		<guid isPermaLink="false">http://inutility.net/?p=86</guid>
		<description><![CDATA[I have a server I&#8217;ve been using which does not have  hardware virtualisaton (HVM). On this I&#8217;ve been using Xen paravirtualisation (PVM). This is all well and good, except the server is approaching six years old and I&#8217;ve a shiney &#8230; <a href="http://inutility.net/linux/acronym-overload-migrating-xen-pvm-hosts-to-kvm-hvm-hosts">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>I have a server I&#8217;ve been using which does not have  hardware virtualisaton (HVM). On this I&#8217;ve been using Xen paravirtualisation (PVM). This is all well and good, except the server is approaching six years old and I&#8217;ve a shiney new server that does support HVM that I&#8217;d like to use.</p>
<p><strong>Warning: Acronym overload ahead&#8230;</strong></p>
<p><span id="more-86"></span>Given that the virtual machines (VM), in Xen parlance these are known as DomU, are not going to change I thought it easier to try and migrate the hosts over one by one.</p>
<p>They are all running Debian, though not all the same version nor the same architecture (i386/amd64). Some are running Lenny rather than Squeeze and I don&#8217;t want to force myself to upgrade just yet.</p>
<p>The plan of action. This is a plan, not exact details. I&#8217;ll probably add them in blow</p>
<ul>
<li>Create a logical volume (LV) on the host with LVM to contain all of the VM disk space.</li>
<li>Create a &#8220;test&#8221; VM. This is required as I&#8217;m going to create an LVM volume group (VG) within the LV I just created, and I seem unable to do this on the host. I could be wrong about that</li>
<li>Add the VM LV as a secondary disk to the &#8220;test&#8221; VM &amp; start the &#8220;test&#8221; VM</li>
<li>On the VM disk create two partitions. One 500Mb (for /boot) and one containing the rest for LVM.</li>
<li>Create LV paritions for / /var /usr &amp; /home as neccessary. Mount in the usual file structure</li>
<li>Stop services on the source machine (except SSH obviously) and rsync files over SSH</li>
<li>Modify files as neccessary (such as /etc/fstab) to accomodate changes</li>
<li>Chroot to the mount point and install LVM2 if not installed.</li>
<li>Shut down &#8220;test&#8221; VM</li>
<li>Create VM for the copied machine and include the KVM host&#8217;s kernel &amp; initrd. This will allow it to boot as Xen PVMs do not have a kernel or Grub</li>
<li>Start the KVM, all should boot okay if you updated. This will fail if LVM2 package is not installed</li>
<li>Install a kernel and Grub. Shut down the VM</li>
<li>Remove the KVM hosts kernel &amp; initrd and start the VM It should boot Grub in the VM and all should be well</li>
</ul>
<p><em>I expect to add a more detailed description on this later.</em></p>
]]></content:encoded>
			<wfw:commentRss>http://inutility.net/linux/acronym-overload-migrating-xen-pvm-hosts-to-kvm-hvm-hosts/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fun with KVM on Squeeze</title>
		<link>http://inutility.net/linux/fun-with-kvm-on-squeeze</link>
		<comments>http://inutility.net/linux/fun-with-kvm-on-squeeze#comments</comments>
		<pubDate>Fri, 16 Sep 2011 22:45:46 +0000</pubDate>
		<dc:creator>al</dc:creator>
				<category><![CDATA[Debian]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[debian]]></category>
		<category><![CDATA[kvm]]></category>
		<category><![CDATA[squeeze]]></category>
		<category><![CDATA[virtualisation]]></category>

		<guid isPermaLink="false">http://inutility.net/?p=73</guid>
		<description><![CDATA[Have recently received a server from a friend which I&#8217;m going to be using to replace my existing one. It&#8217;s currently running a handful of virtual hosts with Xen using paravirtualisation. The new server has hardware virtualisation so I thought &#8230; <a href="http://inutility.net/linux/fun-with-kvm-on-squeeze">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>Have recently received a server from a friend which I&#8217;m going to be using to replace my existing one. It&#8217;s currently running a handful of virtual hosts with Xen using paravirtualisation. The new server has hardware virtualisation so I thought I would try KVM as it seems more in vogue these days. There is a useful <a href="http://www.howtoforge.com/virtualization-with-kvm-on-a-debian-squeeze-server" target="_blank">KVM/Debian Squeeze Howto </a>on HowtoForge.com which gave me a good grounding on most things.</p>
<p>It seems quite good so far, but not without some minor issues.</p>
<h2><span id="more-73"></span>Boot order</h2>
<p>I experienced a problem between the cgroups and libvirt-bin. By default it seems that cgroups (<em>/etc/init.d/cgred</em>) starts before libvirt-bin and this stopped my virtual machines from starting up. It gave the following errors trying to start the &#8220;test1&#8243; virtual machine (VM).</p>
<pre>warning : qemudParsePCIDeviceStrs:1422 : Unexpected exit status '1', qemu probably failed
error : qemuSetupCgroup:3416 : Unable to create cgroup for test1: No such file or directory
error : qemuRemoveCgroup:3501 : internal error Unable to find cgroup for test1#012
warning : qemudShutdownVMDaemon:4067 : Failed to remove cgroup for test1</pre>
<p>Not being too knowledgeable with the new dependency based boot system it took me a while to work out how to get it to change the order but eventually I edited /etc/init.d/libvirt.bin and changed the line</p>
<pre># Required-Start:    $network $remote_fs $syslog</pre>
<p>to</p>
<pre># Required-Start:    $network $remote_fs $syslog cgred</pre>
<p>Then you need to apply this change with the following command:</p>
<pre>insserv libvirt-bin</pre>
<p>This makes the dependency make sure it starts after cgred. Whether this is the &#8220;official&#8221; way I don&#8217;t know, but this now works correctly for me.</p>
<h2>Starting VM at boot</h2>
<p>By default new virtual machines do not start with the computer but this can be enabled:</p>
<pre>virsh autostart &lt;vmname&gt;</pre>
<p>as well as disabled</p>
<pre>virsh autostart &lt;vmname&gt; --disable</pre>
<h2>Shutting down VMs on reboot/shutdown</h2>
<p>As I only have on server I will be wanting to (at least try to) shut down virtual machines when I shutdown or reboot rather than killing them which seems to happen by default. <a href="http://exain.wordpress.com/2009/05/22/auto-shutdown-kvm-virtual-machines-on-system-shutdown/">An entry on Vivek&#8217;s blog </a>has a script which can do this. It has been noted in the comments that this does not get called with the new Debian dependency boot scripts.</p>
<p>I have, for now hacked my libvirt-bin init.d script, amendnig the &#8220;<em>stop</em>&#8221; section to call this script just before the libvirt daemon is shutdown.</p>
<p>Not the most elegant, but works for now. I&#8217;ll have to try and tidy that up.</p>
]]></content:encoded>
			<wfw:commentRss>http://inutility.net/linux/fun-with-kvm-on-squeeze/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Debian Squeeze, Active Directory &amp; Samba</title>
		<link>http://inutility.net/work/debian-squeeze-active-directory-samba</link>
		<comments>http://inutility.net/work/debian-squeeze-active-directory-samba#comments</comments>
		<pubDate>Thu, 04 Aug 2011 11:45:12 +0000</pubDate>
		<dc:creator>al</dc:creator>
				<category><![CDATA[Debian]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[Work]]></category>
		<category><![CDATA[active directory]]></category>
		<category><![CDATA[debian]]></category>
		<category><![CDATA[samba]]></category>
		<category><![CDATA[squeeze]]></category>
		<category><![CDATA[winbind]]></category>
		<category><![CDATA[windows]]></category>
		<category><![CDATA[Windows Server 2008]]></category>

		<guid isPermaLink="false">http://inutility.net/blog/?p=30</guid>
		<description><![CDATA[[Updated 30/10/2012 to include a configuration option to stop timeout errors] This originally started as a note to myself should I ever need to revisit this, but I have expanded it a bit to make it a bit more general &#8230; <a href="http://inutility.net/work/debian-squeeze-active-directory-samba">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p><strong>[Updated 30/10/2012 to include a configuration option to stop timeout errors]</strong></p>
<p>This originally started as a note to myself should I ever need to revisit this, but I have expanded it a bit to make it a bit more general in case others might find it useful.</p>
<p>I use Debian Squeeze on our Linux servers. I have been trying to get them to authenticate off of our Active Directory/Windows Server 2008. Previously we used OpenLDAP and this worked well, but with AD I&#8217;d rather have one authentication system. One password rather than two.</p>
<p>My experience with Winbind has not been favourable. Despite documentation and plenty of blogs with <a title="Debian joining windows domain" href="http://zeldor.biz/2010/12/debian-join-windows-domain/" target="_blank">well written examples</a> of how to do it I could not get it to work for me. Most of what is written is from there.</p>
<p><span id="more-30"></span>In this blog I will use the following settings on my network which I will use in my examples. You will wish to change them to reflect your own settings:</p>
<p>server1.int.inutility.net &#8211; 192.168.188.10 &#8211; Windows Active Directory &amp; WINS server<br />
server2.int.inutility.net -  192.168.188.11 &#8211; Windows Active Directory server<br />
linux.int.inutility.net &#8211; 192.168.188.20 &#8211; Debian Linux box to authenticate against AD<br />
INUTILITY &#8211; Windows Domain<br />
INT.INUTILITY.NET &#8211; Kerberos/AD Realm</p>
<h2>Preparation</h2>
<h3>Active Directory</h3>
<p>You can edit this using the &#8220;Active Directory Users &amp; Computers&#8221; program on your Windows server, finding a user (or group) and going to the &#8220;UNIX Attributes&#8221; tab. If you do not have this tab then you are missing the &#8220;Identify Management for UNIX&#8221; role, and you probably want to investigate that before following this.</p>
<h3>DNS</h3>
<p>If you are just using Windows DNS and Windows DHCP then you are probably already set for this and can probably skip this section.</p>
<p>You need to make sure your domain name is correct.  If you use a mixture of Windows &amp; Linux services (for DHCP &amp; DNS) then you need to make sure your /etc/resolv.conf has the correct &#8220;domain&#8221; setting to match the DNS of your Windows servers. If not it is possible you may experience a problem later. This may be set manually or automatically from your DHCP server</p>
<p>Secondly you need to make sure your Windows DNS servers are configured. My /etc/resolv.conf is</p>
<pre>domain int.inutility.net
search int.inutility.net
nameserver 192.168.188.10
nameserver 192.168.188.11</pre>
<h3>NTP</h3>
<p>It&#8217;s good practice to have time syncronised up. My Windows servers both provide NTP service.</p>
<pre>apt-get install ntp</pre>
<p>Edit the /etc/ntp.conf file, commenting out the existing debian servers and adding in your servers</p>
<p>Line 21</p>
<pre>#server 0.debian.pool.ntp.org iburst
#server 1.debian.pool.ntp.org iburst
#server 2.debian.pool.ntp.org iburst
#server 3.debian.pool.ntp.org iburst

server server1.int.inutility.net iburst
server server2.int.inutility.net iburst</pre>
<p>You will then need to restart the NTP daemon:</p>
<pre>/etc/init.d/ntpd restart</pre>
<p>This may take some time to syncronise your Debian server&#8217;s clock with that of the Windows Servers&#8217;. Check your syslog. <strong>ntpd -q</strong> will report information on your time servers and syncronisation.</p>
<h2>Installation</h2>
<h3>LDAP Authentication</h3>
<p>This allows you to authenticate your users against the Active Directory using LDAP. It allows you to SSH into your server as your AD users and is required to access your server using Samba.</p>
<pre>apt-get install libnss-ldapd libpam-ldapd nslcd unscd</pre>
<p>This is not to be confused to libpam-ldap and libnss-ldap (no d at the end) which are older methods of LDAP authentication that I have not satisfactorily got working with Active Directory.</p>
<p>It will ask you a few questions while the packages install. For LDAP server URI I entered both my AD servers:</p>
<pre>ldap://server1.int.inutility.net/ ldap://server2.int.inutility.net/</pre>
<p>You can leave it at one server, or add as many as you want separated by spaces.</p>
<p>You will be asked for your LDAP server search base. It will guess this based on your DNS domain, but sometimes it gets the ending wrong (espcially with country codes). I entered:</p>
<pre>dc=int,dc=inutility,dc=net</pre>
<p>You will then need to select the Name Services to use with LDAP. Select &#8220;<em>group</em>&#8220;, &#8220;<em>passwd</em>&#8221; and &#8220;<em>shadow</em>&#8220;. It will then finish installation, but there is still a bit to be configured.</p>
<p>It will automatically edit your PAM files (in /etc/pam.d) and your /etc/nsswitch.conf with correct entries so you do not have to unless your set up is a bit unusual. For historical reasons our UIDs start at 500 so I edited the /etc/pam.d/common-* files so the &#8220;<em>minimum_uid</em>&#8221; entry was <strong>500</strong>, not the default <strong>1000</strong>.</p>
<p>I use TLS encryption to my servers, using a certificate we have purchased. It requires intermediate certificates which it terms a bundle. You may not require the &#8220;<em>tls_cacertfile</em>&#8221; entry, but you may require the &#8220;<strong>ca-certificates</strong>&#8221; Debian package installed. The &#8220;bundle&#8221; can be an intermediate chain of Certificate Authorities. Your SSL certificate provider will provide this. Using the &#8220;<strong>tls_reqcert demand</strong>&#8221; entry makes sure that if the certificate is not verified the connection will not proceed. Add the following lines to your /etc/nslcd.conf:</p>
<pre># SSL options
ssl starttls
tls_reqcert demand
tls_cacertfile /etc/ssl/certs/bundle.crt</pre>
<p>You also require some entries in this file so it knows where to pull all the user information from. Again this is in /etc/nslcd.conf</p>
<pre># Mappings for Active Directory
pagesize 1000
referrals off
filter passwd (&amp;(objectClass=user)(!(objectClass=computer))(uidNumber=*)(unixHomeDirectory=*))
map    passwd uid              sAMAccountName
map    passwd homeDirectory    unixHomeDirectory
map    passwd gecos            displayName
filter shadow (&amp;(objectClass=user)(!(objectClass=computer))(uidNumber=*)(unixHomeDirectory=*))
map    shadow uid              sAMAccountName
map    shadow shadowLastChange pwdLastSet
filter group (&amp;(objectClass=group)(gidNumber=*))
map    group  uniqueMember     member</pre>
<p>After restarting nslcd you should then be able to check users &amp; groups are listed using the <strong>getent</strong> tool:</p>
<pre>/etc/init.d/nslcd restart
Restarting LDAP connection daemon: nslcd.
getent passwd al
al:*:1000:100:Al:/home/al:/bin/bash</pre>
<p>You should now be able to SSH into your machine as your Active Directory users, though they may not have home directories (see also the section &#8220;<em>Automatic creation of user&#8217;s home directory</em>&#8221; towards the bottom of the page).</p>
<h3>Kerberos</h3>
<p>Install the Kerberos packages:</p>
<pre>apt-get install krb5-config krb5-user</pre>
<p>Then edit /etc/krb5.conf to include entries for your realm:</p>
<pre>[libdefaults]
 default_realm = INT.INUTILITY.NET</pre>
<p>and</p>
<pre>[realms]
        INT.INUTILITY.NET= {
                kdc = 192.168.188.10:88
                admin_server = 192.168.188.10
                default_domain = int.inutility.net
        }
        ATHENA.MIT.EDU = {</pre>
<p>and</p>
<pre>[domain_realm]
        .int.inutility.net = INT.INUTILITY.NET
        int.inutility.net = INT.INUTILITY.NET
        .mit.edu = ATHENA.MIT.EDU</pre>
<h3>Samba</h3>
<p>Firstly you&#8217;ll need to install the samba packages:</p>
<pre>apt-get install samba samba-common samba-common-bin</pre>
<p>I was asked only for my &#8220;<em>Workgroup/Domain Name</em>&#8221; which I entered in as &#8220;<strong>INUTILITY</strong>&#8221; during installation.</p>
<p>Then you need to make some edits to your /etc/samba/smb.conf.</p>
<p>Add the Kerberos realm:</p>
<pre># Change this to the workgroup/NT-domain name your Samba server will part of
   workgroup = INUTILITY
   realm = INT.INUTILITY.NET</pre>
<p>Add in WINS server:</p>
<pre># WINS Server - Tells the NMBD components of Samba to be a WINS Client
# Note: Samba can be either a WINS Server, or a WINS Client, but NOT both
   wins server = 192.168.188.10</pre>
<p>To use Active Directory security:</p>
<pre># "security = user" is always a good idea. This will require a Unix account
# in this server for every user accessing the server. See
# /usr/share/doc/samba-doc/htmldocs/Samba3-HOWTO/ServerType.html
# in the samba-doc package for details.
   security = ads</pre>
<p>To configure SAMBA not to be the master browser for the domain.</p>
<pre># Domain Master specifies Samba to be the Domain Master Browser. If this
# machine will be configured as a BDC (a secondary logon server), you
# must set this to 'no'; otherwise, the default behavior is recommended.
   domain master = no
   local master = no
   preferred master = no</pre>
<p>Restart the samba services to load these settings.</p>
<pre>/etc/init.d/samba restart</pre>
<h3>Joining the domain</h3>
<p>You can not joing the domain with the following command (or another administrator account can be used)</p>
<pre>net ads join -U Administrator</pre>
<p>This suceeds, but reports:</p>
<pre>kerberos_kinit_password LINUX$@INT.INUTILITY.NET failed: Client not found in Kerberos database</pre>
<p>This is something I&#8217;ve not been able to trace down yet, but everything works as expected. I have been advised that this may in fact be down to our incorrect reverse DNS.</p>
<p>You should now be able to access the machine using <strong>\\LINUX</strong> as per a normal Windows server.</p>
<h2>Other useful things</h2>
<h3>Automatic creation of user&#8217;s home directory</h3>
<p>If you edit /etc/pam.d/common-session you can add an entry to automatically create a user&#8217;s home directory upon login:</p>
<pre>session     required      pam_mkhomedir.so skel=/etc/skel umask=0022 silent</pre>
<p>This saves you having to manually copy the /etc/skel files for any users who have not logged into the system before.</p>
<h3>Leaving the AD Domain</h3>
<p>This can be done using the command below and removes your computer&#8217;s entry from the Active Directory:</p>
<p lang="text">net ads leave -U Administrator</p>
<h1>Update 30/10/2012: LDAP timeouts</h1>
<p>Occasionally we get the following messages in our syslog:</p>
<pre>ldap_search_ext() failed: Can't contact LDAP server
connected to LDAP server ldap://server1.int.inutility.net/</pre>
<p>These seem to be due to the AD server(s) timing out the connection without nslcd noticing this, which while not fatal is annoying and can slow down resolving a username &amp; their groups. AD seems to timeout the connections after 2 minutes.</p>
<p>If you put:</p>
<pre>idle_timelimit 60</pre>
<p>Into your<strong> /etc/nslcd.conf</strong> file this will disconnect after a minute and reconnect as needed which is a much faster process than the connection failure it was doing.</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://inutility.net/work/debian-squeeze-active-directory-samba/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>
