Gentoo Logo
Gentoo Spaceship




Note: Due to technical difficulties, the Archives are currently not up to date. GMANE provides an alternative service for most mailing lists.
c.f. bug 424647
List Archive: gentoo-server
Navigation:
Lists: gentoo-server: < Prev By Thread Next > < Prev By Date Next >
Headers:
To: Brian Kroth <bpkroth@...>
From: Vinícius Ferrão <viniciusferrao@...>
Subject: Re: Complete migration from Scientific Linux with new features (Samba+AD/Winbind)
Date: Wed, 2 Nov 2011 23:00:21 -0200
<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Really thanks Brian. Things appears to be working now... but I've some issues, can you help-me solving this?<br><br>First of all, I cannot really understand what is going on. Kerberos is still needed, as I can see.<br><br>I've emerged: sys-auth/nss-ldapd and sys-auth/pam_krb5; why nss-ldapd and not nss_ldap? Because I can't get it working. Through your links I've found this:&nbsp;<a href="https://help.ubuntu.com/community/ADWin2k8KerberosLDAP?highlight=((ActiveDirectoryHowto))">https://help.ubuntu.com/community/ADWin2k8KerberosLDAP?highlight=%28%28ActiveDirectoryHowto%29%29</a><br><br>I followed the instructions but skipped the key tab generation in Windows CLI. But configured the /etc/krb5.conf like this:<br><br><div>auth ~ # cat /etc/krb5.conf</div><div>[libdefaults]</div><div><span class="Apple-tab-span" style="white-space:pre">	</span>default_realm = IF.UFRJ.BR</div><div><span class="Apple-tab-span" style="white-space:pre">	</span>dns_lookup_realm = true</div><div><span class="Apple-tab-span" style="white-space:pre">	</span>dns_lookup_kdc = true</div><div><span class="Apple-tab-span" style="white-space:pre">	</span>ticket_lifetime = 24h</div><div><span class="Apple-tab-span" style="white-space:pre">	</span>renew_lifetime = 7d</div><div><span class="Apple-tab-span" style="white-space:pre">	</span>forwardable = true</div><div><span class="Apple-tab-span" style="white-space:pre">	</span>verify_ap_req_nofail = false</div><div><br></div><div>[appdefaults]</div><div><span class="Apple-tab-span" style="white-space:pre">	</span>kinit = {</div><div><span class="Apple-tab-span" style="white-space:pre">		</span>renewable = true</div><div><span class="Apple-tab-span" style="white-space:pre">		</span>forwardable = true</div><div><span class="Apple-tab-span" style="white-space:pre">	</span>}</div><div><br></div><div>[realms]</div><div># use "kdc = ..." if realm admins haven't put SRV records into DNS</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">	</span>IF.UFRJ.BR = {</div><div><span class="Apple-tab-span" style="white-space:pre">		</span>kdc = <a href="http://ad.if.ufrj.br">ad.if.ufrj.br</a></div><div><span class="Apple-tab-span" style="white-space:pre">		</span>default_domain = <a href="http://if.ufrj.br">if.ufrj.br</a></div><div><span class="Apple-tab-span" style="white-space:pre">	</span>}</div><div><span class="Apple-tab-span" style="white-space:pre">	</span></div><div>[domain_realm]</div><div><span class="Apple-tab-span" style="white-space:pre">	</span>.if.ufrj.br = IF.UFRJ.BR</div><div><span class="Apple-tab-span" style="white-space:pre">	</span><a href="http://if.ufrj.br">if.ufrj.br</a> = IF.UFRJ.BR</div><div><br></div><div>[logging]</div><div><span class="Apple-tab-span" style="white-space:pre">	</span>default = FILE:/var/log/krb5libs.log</div><div><span class="Apple-tab-span" style="white-space:pre">	</span>kdc = FILE:/var/log/krb5kdc.log</div><div><span class="Apple-tab-span" style="white-space:pre">	</span>admin_server = FILE:/var/log/kadmind.log</div><div><span class="Apple-tab-span" style="white-space:pre">	</span>kdc_rotate = {</div><div><span class="Apple-tab-span" style="white-space:pre">		</span>period = 1d</div><div><span class="Apple-tab-span" style="white-space:pre">		</span>version = 10</div><div><span class="Apple-tab-span" style="white-space:pre">	</span>}</div><div><br>Other files that may interest:<br><br>/etc/nss-ldapd.conf</div><div><div>uri <a href="ldap://ad.if.ufrj.br">ldap://ad.if.ufrj.br</a></div><div><br></div><div>base dc=if,dc=ufrj,dc=br</div><div>scope sub</div><div><br></div><div>binddn cn=ldapquery,cn=Users,dc=if,dc=ufrj,dc=br</div><div>bindpw procur4NOel3d4p3&nbsp;</div><div><br></div><div>filter passwd (&amp;(objectClass=user)(!(objectClass=computer))(uidNumber=*)(unixHomeDirectory=*))</div><div>map passwd uid sAMAccountName</div><div>map passwd uidnumber uidNumber</div><div>map passwd homedirectory unixHomeDirectory</div><div>map passwd loginshell loginShell</div><div>map passwd gecos displayName</div><div>filter shadow (&amp;(objectClass=user)(!(objectClass=computer))(uidNumber=*)(unixHomeDirectory=*))</div><div>map shadow uid sAMAccountName</div><div>filter group (objectClass=group)</div><div>map group uniqueMember member</div></div><div><br>/etc/nsswitch.conf<br><div># $Header: /var/cvsroot/gentoo/src/patchsets/glibc/extra/etc/nsswitch.conf,v 1.1 2006/09/29 23:52:23 vapier Exp $</div><div><br></div><div># ldap added for AD Integration</div><div>passwd: &nbsp; &nbsp; &nbsp;compat ldap&nbsp;</div><div>shadow: &nbsp; &nbsp; &nbsp;compat&nbsp;</div><div>group: &nbsp; &nbsp; &nbsp; compat ldap</div><div><br></div><div># passwd: &nbsp; &nbsp;db files nis</div><div># shadow: &nbsp; &nbsp;db files nis</div><div># group: &nbsp; &nbsp; db files nis</div><div><br></div><div>hosts: &nbsp; &nbsp; &nbsp; files dns</div><div>networks: &nbsp; &nbsp;files dns</div><div><br></div><div>services: &nbsp; &nbsp;db files</div><div>protocols: &nbsp; db files</div><div>rpc: &nbsp; &nbsp; &nbsp; &nbsp; db files</div><div>ethers: &nbsp; &nbsp; &nbsp;db files</div><div>netmasks: &nbsp; &nbsp;files</div><div>netgroup: &nbsp; &nbsp;files</div><div>bootparams: &nbsp;files</div><div><br></div><div>automount: &nbsp; files</div><div>aliases: &nbsp; &nbsp; files</div><div><br></div>And finally the most messed one: /etc/pam.d/system-auth<br><div>auth ~ # cat /etc/pam.d/system-auth</div><div>auth<span class="Apple-tab-span" style="white-space:pre">		</span>required<span class="Apple-tab-span" style="white-space:pre">	</span>pam_env.so&nbsp;</div><div>auth<span class="Apple-tab-span" style="white-space:pre">		</span>sufficient<span class="Apple-tab-span" style="white-space:pre">	</span>pam_krb5.so try_first_pass</div><div>auth<span class="Apple-tab-span" style="white-space:pre">		</span>required<span class="Apple-tab-span" style="white-space:pre">	</span>pam_unix.so likeauth nullok&nbsp;</div><div>auth<span class="Apple-tab-span" style="white-space:pre">		</span>optional<span class="Apple-tab-span" style="white-space:pre">	</span>pam_permit.so</div><div>&nbsp;</div><div>account<span class="Apple-tab-span" style="white-space:pre">		</span>required<span class="Apple-tab-span" style="white-space:pre">	</span>pam_unix.so&nbsp;</div><div>account<span class="Apple-tab-span" style="white-space:pre">		</span>optional<span class="Apple-tab-span" style="white-space:pre">	</span>pam_permit.so</div><div>&nbsp;</div><div>password<span class="Apple-tab-span" style="white-space:pre">	</span>required<span class="Apple-tab-span" style="white-space:pre">	</span>pam_cracklib.so difok=2 minlen=8 dcredit=2 ocredit=2 retry=3&nbsp;</div><div>password<span class="Apple-tab-span" style="white-space:pre">	</span>required<span class="Apple-tab-span" style="white-space:pre">	</span>pam_unix.so use_authtok nullok sha512 shadow&nbsp;</div><div>password<span class="Apple-tab-span" style="white-space:pre">	</span>sufficient<span class="Apple-tab-span" style="white-space:pre">	</span>pam_krb5.so use_authtok</div><div>password<span class="Apple-tab-span" style="white-space:pre">	</span>optional<span class="Apple-tab-span" style="white-space:pre">	</span>pam_permit.so</div><div>&nbsp;</div><div>session<span class="Apple-tab-span" style="white-space:pre">		</span>required<span class="Apple-tab-span" style="white-space:pre">	</span>pam_limits.so&nbsp;</div><div>session<span class="Apple-tab-span" style="white-space:pre">		</span>required<span class="Apple-tab-span" style="white-space:pre">	</span>pam_env.so&nbsp;</div><div>session<span class="Apple-tab-span" style="white-space:pre">		</span>required<span class="Apple-tab-span" style="white-space:pre">	</span>pam_unix.so&nbsp;</div><div>session<span class="Apple-tab-span" style="white-space:pre">		</span>optional<span class="Apple-tab-span" style="white-space:pre">	</span>pam_permit.so</div><div><br></div><div>I really need help in pam.d; don't know what I'm doing. But I'll continue mixing this.</div><div><br></div><div>PS: The only disadvantage is the difficult to set it up working.</div><br>On Nov 1, 2011, at 10:58 PM, Brian Kroth wrote:<br><br><blockquote type="cite">Actually, you don't even need kerberos for the authentication portion of it. &nbsp;You can have pam test the user's provided password by binding against ldap directly to do that step. &nbsp;I find this easier because it avoids all the complexities of maintaining kerberos service tickets on linux hosts entirely. &nbsp;You may still wish to do that for some services (eg: for single sign on for apache websites from windows ad clients, but they probably still need to support passwords from non-domain clients, so it's never seemed like a big win to me). &nbsp;Doing that then requires that your linux clients have tickets to make use of them, which is another hassle. &nbsp;It works in Windows clients a little bit more naturally.<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">Anyways, on how to do it ...<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">there used to be some nice gentoo wiki articles on it. &nbsp;They're giving me 500 errors at the moment, so ... <br></blockquote><blockquote type="cite">The ubuntu page here [1] gives a reasonably good explanation of it except that it also includes kerberos integration. &nbsp;Basically to avoid that, skip those sections, and rather than specifying pam_krb5.so in those files, specify pam_ldap.so [2].<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">The handful of gotchas as I recall them:<br></blockquote><blockquote type="cite">- you have to setup a proxy user in order to do the base queries for &nbsp;&nbsp;libnss-ldap [3] to find your account's dn so that pam_ldap can attempt &nbsp;&nbsp;to bind as it.<br></blockquote><blockquote type="cite">- ad wants all of its connections to be ssl. &nbsp;That might also mean that &nbsp;&nbsp;you have to setup the cert for it (usually obtainable from your ad's &nbsp;&nbsp;ca) as "trusted" in the system wide ldap confs &nbsp;&nbsp;(/etc/openldap/ldap.conf or /etc/ldap/ldap.conf).<br></blockquote><blockquote type="cite">- depending upon your ad schema you might need to remap some attributes &nbsp;&nbsp;to what the libnss-ldap libraries want them to be. &nbsp;The ubuntu page &nbsp;&nbsp;has some details on that (nss_map_attribute). &nbsp;In more flexible &nbsp;&nbsp;environments you can actually use these to do some fancy service &nbsp;&nbsp;tricks (eg: different shell/homedir for sftp only hosts).<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">Some other tips:<br></blockquote><blockquote type="cite">- make sure you can do all these steps with the command line ldapsearch &nbsp;&nbsp;utility first<br></blockquote><blockquote type="cite">- adsi edit (or some such - should be available in mmc) is the windows &nbsp;&nbsp;utility to browse it's ldap store<br></blockquote><blockquote type="cite">- use nscd or one of the other tools I mention below to cache ldap data<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">So, following all those goodies, you should hopefully be able to get ldap only id mapping and authentication going.<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">You can also tell samba (or apache, freeradius, etc.) to use those details for id mapping and authentication, again avoiding the need for kerberos entirely. &nbsp;Have a look at the ldap settings within smb.conf for details. &nbsp;In all cases, tls/ssl is your friend.<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">Hope that helps,<br></blockquote><blockquote type="cite">Brian<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">[1] <a href="https://help.ubuntu.com/community/ActiveDirectoryHowto">https://help.ubuntu.com/community/ActiveDirectoryHowto</a><br></blockquote><blockquote type="cite">[2] <a href="http://linux.die.net/man/5/pam_ldap">http://linux.die.net/man/5/pam_ldap</a><br></blockquote><blockquote type="cite">AD may very well be doing a kerberos auth behind the scenes when you bind to its ldap, but that doesn't really matter. &nbsp;That's a common way for people to configure openldap as well - use kerberos as the password hash store, but then you need a service ticket for openldap ...<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">[3] As an aside, there are also alternatives to libnss-ldap now including: nslcd, sssd. &nbsp;I think sssd is the more preferred one nowadays. &nbsp;Basically, they make a user program responsible for doing all ldap lookups so that you can save some shared memory and protect the proxy user's credentials. &nbsp;Really though, the sort of stuff you'll be querying in ldap is more or less "public" data as far as the rest of the system is concerned anyways, so I wouldn't be too concerned with that unless you've given the proxy user some ridiculous rights. &nbsp;That goes for openldap, opendirectory, whatever as well.<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">Vinícius Ferrão &lt;<a href="mailto:viniciusferrao@...">viniciusferrao@...</a>&gt; 2011-11-01 17:24:<br></blockquote><blockquote type="cite"><blockquote type="cite"> As I can understand we need Kerberos 5 for authentication and LDAP acting<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> only as a directory service with UID, GID, home dir and etc.<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> []'s<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> On Nov 1, 2011, at 5:11 PM, gregorcy wrote:<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> &nbsp;&nbsp;On Sun, Oct 30, 2011 at 1:55 PM, Brian Kroth &lt;[1]<a href="mailto:bpkroth@...">bpkroth@...</a>&gt;<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> &nbsp;&nbsp;wrote:<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> &nbsp;&nbsp;&nbsp;&nbsp;gregorcy &lt;[2]<a href="mailto:gregorcy@...">gregorcy@...</a>&gt; 2011-10-29 10:52:<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;What's missing: OpenLDAP replication from AD? Is this possible?<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Is this<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;needed? Since I want another machines (running Linux) to<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;authenticate it<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;will be a good idea only ONE machine get information from AD and<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;everyone else authenticate natively on this Gentoo Machine.<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;No this is not needed. &nbsp;If you are in a mixed environment (I think)<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;it<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;is much easier to just use AD as the one directory service and join<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;all<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;your linux boxes to it. &nbsp;As long as your idmap ranges match your<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;users<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;will have the same uid on all boxes.<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> &nbsp;&nbsp;&nbsp;&nbsp;I agree with this except for the need to "join all your linux boxes".<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;AD is really just ldap+kerberos. &nbsp;Most of the time you don't need the<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> &nbsp;&nbsp;&nbsp;&nbsp;headache of kerberos and can just use the ldap component. &nbsp;Modern AD<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> &nbsp;&nbsp;&nbsp;&nbsp;schemas include all the of necessary attributes support for having<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> &nbsp;&nbsp;&nbsp;&nbsp;Linux clients talk to it directly for uid/gid mapping, which is much<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> &nbsp;&nbsp;&nbsp;&nbsp;nicer since it avoids the complexity of any samba requirements when<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> &nbsp;&nbsp;&nbsp;&nbsp;you don't need them (eg: mail, web, etc.).<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> &nbsp;&nbsp;So if he is using samba + winbind I don't see how you can not join all<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> &nbsp;&nbsp;your machines to the AD. &nbsp;Actually I would be really interested in how<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> &nbsp;&nbsp;you configure your machines just using the ldap component. &nbsp;I have been<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> &nbsp;&nbsp;using winbind for the last couple of years but if there is a better way<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> &nbsp;&nbsp;I would be interested in learning how it works.<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">References<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> Visible links<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> 1. <a href="mailto:bpkroth@...">mailto:bpkroth@...</a><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> 2. <a href="mailto:gregorcy@...">mailto:gregorcy@...</a><br></blockquote></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><br></blockquote><br></div></body></html>
Attachment:
smime.p7s (S/MIME cryptographic signature)
Replies:
Re: Complete migration from Scientific Linux with new features (Samba+AD/Winbind)
-- Brian Kroth
Re: Complete migration from Scientific Linux with new features (Samba+AD/Winbind)
-- Arturo 'Buanzo' Busleiman
References:
Complete migration from Scientific Linux with new features (Samba+AD/Winbind)
-- Vinícius Ferrão
Re: Complete migration from Scientific Linux with new features (Samba+AD/Winbind)
-- gregorcy
Re: Complete migration from Scientific Linux with new features (Samba+AD/Winbind)
-- Brian Kroth
Re: Complete migration from Scientific Linux with new features (Samba+AD/Winbind)
-- gregorcy
Re: Complete migration from Scientific Linux with new features (Samba+AD/Winbind)
-- Vinícius Ferrão
Re: Complete migration from Scientific Linux with new features (Samba+AD/Winbind)
-- Brian Kroth
Navigation:
Lists: gentoo-server: < Prev By Thread Next > < Prev By Date Next >
Previous by thread:
Re: Complete migration from Scientific Linux with new features (Samba+AD/Winbind)
Next by thread:
Re: Complete migration from Scientific Linux with new features (Samba+AD/Winbind)
Previous by date:
Re: Git as backup tool
Next by date:
Re: Complete migration from Scientific Linux with new features (Samba+AD/Winbind)


Updated Jun 22, 2012

Summary: Archive of the gentoo-server mailing list.

Donate to support our development efforts.

Copyright 2001-2013 Gentoo Foundation, Inc. Questions, Comments? Contact us.