<?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>Ben Ruset &#187; Windows</title>
	<atom:link href="http://blog.benruset.com/category/windows/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.benruset.com</link>
	<description>Sysadmin, etc.</description>
	<lastBuildDate>Wed, 30 Jun 2010 23:28:18 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Win2k3 Server Migration</title>
		<link>http://blog.benruset.com/2009/04/08/win2k3-server-migration/</link>
		<comments>http://blog.benruset.com/2009/04/08/win2k3-server-migration/#comments</comments>
		<pubDate>Wed, 08 Apr 2009 14:23:43 +0000</pubDate>
		<dc:creator>Ben Ruset</dc:creator>
				<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://blog.benruset.com/?p=168</guid>
		<description><![CDATA[At work I have a Windows 2003 server running on a Dell Poweredge 2650 that's just fallen out of warranty. I have a brand new Dell Poweredge 2950 that I want to bring up as a replacement. The thing is, I don't want to have to manually create the 200+ file shares, 400+/- local groups, [...]]]></description>
			<content:encoded><![CDATA[<p>At work I have a Windows 2003 server running on a Dell Poweredge 2650 that's just fallen out of warranty. I have a brand new Dell Poweredge 2950 that I want to bring up as a replacement. The thing is, I don't want to have to manually create the 200+ file shares, 400+/- local groups, and permissions on the new box. It'd be so easy to P2V the old server and turn it into a VM, but that's not an option here. So, I figured out a pretty halfway decent way to image the server over using free tools.</p>
<p>The long and short of it is that, on the old server, you need to load the drivers for the new RAID controller. You'll have to do it manually. (Add new hardware, have disk, etc.) Then I took a CentOS 4.7 rescue disk, booted it, and DD'd the disk over to an image file on an NFS share (my iMac). Then on the new server, boot the CentOS rescue disk, dd the image from NFS to the local disk, and reboot.</p>
<p>Windows comes up, and will complain about needing to find new drivers for everything. But the server is now running on new hardware. Sweet. Linux to the rescue in a Windows shop!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.benruset.com/2009/04/08/win2k3-server-migration/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Linux to Active Directory Authentication (Part 1)</title>
		<link>http://blog.benruset.com/2008/10/29/linux-to-active-directory-authentication-part-1/</link>
		<comments>http://blog.benruset.com/2008/10/29/linux-to-active-directory-authentication-part-1/#comments</comments>
		<pubDate>Thu, 30 Oct 2008 04:12:01 +0000</pubDate>
		<dc:creator>Ben Ruset</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[LDAP]]></category>

		<guid isPermaLink="false">http://blog.benruset.com/?p=141</guid>
		<description><![CDATA[For a while now I've been meaning to write an article on how to easily set up your Linux boxes to authenticate against an Active Directory setup. I've had this working in production environments for a while now, having cobbled together bits and pieces from various websites, blogs, and trial and error experimentation. First of [...]]]></description>
			<content:encoded><![CDATA[<p>For a while now I've been meaning to write an article on how to easily set up your Linux boxes to authenticate against an Active Directory setup. I've had this working in production environments for a while now, having cobbled together bits and pieces from various websites, blogs, and trial and error experimentation. </p>
<p>First of all, you're going to need a Windows 2000 Server or Windows Server 2003 system with Active Directory and <a href="http://technet.microsoft.com/en-us/interopmigration/bb380242.aspx">Microsoft Services for UNIX</a> installed. SFU provides things like extensions to LDAP to make this work, an NFS server, and bits and pieces of other stuff that you probably wouldn't ever care about. If you're using Windows Server 2003 R2 or Windows 2008 then you don't need to worry about SFU comes as part of the base operating system.</p>
<p>Second of all, you're going to need a Linux system. I have done all of my testing with CentOS 4 and 5, which means that it will work for real Red Hat Enterprise Linux servers as well as Oracle Enterprise Linux, if you're one of the five people out there running it. The configuration files below will work fine for either version, so you won't have any problems there.</p>
<p>I'm going to give you a very, very basic config to look at which, later in the article, I will explain why you won't want to use in production. In a (very) soon to be written follow-up article I'll give you some more information on how to make it production ready.</p>
<p>For your Linux machines, you're going to want to make sure that you have the ncsd and nss_ldap packages installed. OpenLDAP should get installed in a default installation, but if you're using a custom kickstart that does not include it, you'll want to install it. On CentOS systems it's as easy as yum'ming it in. On RedHat systems you'll either need to use up2date (if you have a RHN subscription) or manually install it from your media.</p>
<p>The way that LDAP works is when you log in with a user on your Linux box, it will query your LDAP server (in this case your Domain Controllers) to see if you are a valid user, and if you're providing a valid password. On Linux (OpenLDAP) and Windows 2000 servers, this query can be run anonymously - without having to supply some form of credentials to the server to specify that you have rights to do the lookup. Microsoft (rightly) changed the default behavior in Windows 2003 to require a user to bind to Active Directory to do the lookup. So the first order of business is to create a domain user that can be used to query your Active Directory. This user just needs rights in the Domain Users security group. They should not get Administrator access. In my examples this user is called "binduser" and has a password of "password". You should be able to lock this user down so they can not actually log in from any station. (I'll need to test that.)</p>
<p>On your Linux machine, edit the file /etc/ldap.conf, and replace the contents with this. Note the comments in-line:</p>
<p><code><br />
host your.domain.controller # If you have multiple LDAP servers, separate them with a space. </p>
<p>base cn=Users,dc=domain,dc=com<br />
# If your AD domain is called "foo.com" then the LDAP base is cn=Users,dc=foo,dc=com<br />
# If you're like me, you store users in various OU's, so you could have your base be something further up or down<br />
# the tree, such as:<br />
# base dc=domain,dc=com (to include everything)<br />
# base cn=Sales,dc=domain,dc=com<br />
# base cn=Development,dc=domain,dc=com<br />
# etc.<br />
binddn cn=binduser,cn=Users,dc=domain,dc=com<br />
# This is the important bit. This is where it's going to look to find that user that it will use to look at your AD.<br />
# I store mine in the default "Users" OU, if you put yours elsewhere, you'll need to adjust that as needed<br />
bindpw password<br />
# Since the password is stored in plaintext on your servers you're going to want to use some throwaway<br />
# password for this user.<br />
scope sub</p>
<p>#<br />
# Active Directory Mappings<br />
#<br />
# Since Microsoft doesn't use the same sort of naming scheme for account names, passwords, or other LDAP<br />
# attributes as OpenLDAP we need to provide some sort of translation. Here's where we tell Linux to look for<br />
# various things in AD. Most importantly the username for the user is found at the attribute sAMAccountName<br />
pam_login_attribute     sAMAccountName<br />
pam_filter              objectclass=User<br />
pam_password            ad<br />
pam_member_attribute    msSFU30PosixMember<br />
nss_base_passwd         dc=domain,dc=com<br />
nss_base_shadow         dc=domain,dc=com<br />
nss_base_group          dc=domain,dc=com<br />
nss_map_objectclass     posixAccount    User<br />
nss_map_objectclass     shadowAccount   User<br />
nss_map_attribute       uid             sAMAccountName<br />
nss_map_attribute       uidNumber       msSFU30UidNumber<br />
nss_map_attribute       gidNumber       msSFU30GidNumber<br />
nss_map_attribute       cn              sAMAccountName<br />
nss_map_attribute       uniqueMember    member<br />
nss_map_attribute       userPassword    msSFU30Password<br />
nss_map_attribute       homeDirectory   msSFU30HomeDirectory<br />
nss_map_attribute       loginShell      msSFU30LoginShell<br />
nss_map_attribute       gecos           name<br />
nss_map_objectclass     posixGroup      Group<br />
nss_map_attribute       uniqueMember    msSFU30PosixMember<br />
nss_map_attribute       cn              cn<br />
</code></p>
<p>Now, open up the file /etc/openldap/ldap.conf and edit it thusly:</p>
<p><code><br />
HOST your.domain.controller # If you have multiple LDAP servers, separate them with a space.<br />
BASE dc=domain,dc=com<br />
</code></p>
<p>Now, edit the file /etc/nss/nsswitch.conf. This is going to tell Linux where to look for user authentication. Make sure the passwd, shadow, and group lines look like this. It will check for local users first, and then go to LDAP if there is no local user.</p>
<p><code><br />
passwd:      files ldap compat<br />
shadow:      files ldap compat<br />
group:       files ldap compat<br />
</code></p>
<p>One handy thing would be to have Linux auto-create a home directory from the /etc/skel templates for a user that logs in via LDAP for the first time. You can edit the /etc/pam.d/system-auth file and edit it so it looks like this:</p>
<p><code><br />
auth        required      /lib/security/$ISA/pam_env.so<br />
auth        sufficient    /lib/security/$ISA/pam_unix.so likeauth nullok<br />
auth        sufficient    /lib/security/$ISA/pam_ldap.so use_first_pass<br />
auth        required      /lib/security/$ISA/pam_deny.so</p>
<p>account     required      /lib/security/$ISA/pam_unix.so broken_shadow<br />
account     sufficient    /lib/security/$ISA/pam_succeed_if.so uid < 100 quiet<br />
account     [default=bad success=ok user_unknown=ignore] /lib/security/$ISA/pam_ldap.so<br />
account     required      /lib/security/$ISA/pam_permit.so</p>
<p>password    requisite     /lib/security/$ISA/pam_cracklib.so retry=3<br />
password    sufficient    /lib/security/$ISA/pam_unix.so nullok use_authtok md5 shadow<br />
password    sufficient    /lib/security/$ISA/pam_ldap.so use_authtok<br />
password    required      /lib/security/$ISA/pam_deny.so</p>
<p>session     required      /lib/security/$ISA/pam_limits.so<br />
session     required      /lib/security/$ISA/pam_unix.so<br />
session     required      /lib/security/$ISA/pam_mkhomedir.so skel=/etc/skel/ umask=0077 # sets home dir perms to 700<br />
session     optional      /lib/security/$ISA/pam_ldap.so<br />
</code></p>
<p>Now, don't rush to log in as a Windows user yet. You'll need to give them access via Services for UNIX. On the domain controller that you have SFU installed on, go to Active Directory Users and Computers and edit the properties for the user. There should be a tab that says "UNIX Attributes." Select that, and then put them in the NIS domain of your organization, assign them a UID, a default shell, and you should be set.</p>
<p>Try logging in as the user. It may be a bit slow depending on your network and the speed of your machines, but if all goes right the user will authenticate and get a home directory made for them (with the proper umask!)</p>
<p>So, remember before when I said that you don't want to use this in production? Well, think of what happens when you log in. The system presents you with a prompt for your username. Fine, you enter that in. Then it asks you for your password. It then takes both of them and goes up to your domain controller and says "Here's user X does he exist? Fine. Here's his password" sent in cleartext over the wire. Fortunately, you can use SSL to encrypt that exchange so your password does not get sent around to the nearest sniffer. I'll be covering that in a (soon to be written) future article as it's a bit tricky to get set up right.</p>
<p>I'd love to hear from other people doing this in their environments. Feel free to send me a comment and let me know if I am missing any information or if there's anything not very clear.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.benruset.com/2008/10/29/linux-to-active-directory-authentication-part-1/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
