LDAP Authentication in Linux
hausmasta writes "HowtoForge has published a walkthrough to show you how to store your users in LDAP and authenticate some of the services against it. It will not show how to install particular packages, as it is distribution/system dependent, instead it will focus on pure configuration of all components needed to have LDAP authentication/storage of users. The howto assumes that you are migrating from a regular passwd/shadow authentication, but it is also suitable for people who do it from scratch."
fuuuuuck all you hoes
Should have stuck with the standard "nothing but socks and shoes" answer...
Besides geek points, why would one want to do this? There is an old saying....If it ain't broke, don't fix it.
B.
This is a sig. This is only a sig. Had this been an actual sig you would have been informed where to tune for more sigs.
A "power" user. *sigh*
Deleted
My neighbour is a Mac owner and heavily into RoR, is teh gay contagious?
Someone needs to clean up the typos there, they detract from 'the message'.
Mielipiteet omiani - Opinions personal, facts suspect.
Seems like a good place to ask. In a recent job I asked why we stick to login/password? Why not have just passwords? Yes you'll have to reject taken passwords, but that's good policy anyway.
Really, you need to add kerberos to the mix, especially the heimdall kerberos implementation is attractive, since it allows you to store its settings inside the ldap tree, providing a true centralised secure single signon enviroment.
Using ldap itself is really not much better than using NIS, aside from the fact that it can contain much more than just the user database.
Ever since I rolled out an LDAPed Samba domain for a customer I was wondering why this is not beeing used for more stuff?
:) Been there...
Its relatively eay to setup and quite stable. This in combination with PAM should be the once and for all way of authentication.
If you have a directory like this you can add virtually everything to it, be it intranet pages, mailserver authentication, hell even an inhouse Jabber client for employees. This should be unified and used much more often.
The management is a blast with the ability to choose whatever LDAP-Frontend you might wanna use and worstcase you can go back to browserbased or console. Its really flexible, elegant and in a Unix style a tool for the job.
Who can enlighten me why this is still rather a niche? are Unixadmins simply too used to the passwd/shadow style auth?
Oh yeah: In case you are going to set it up stay the hell away from BerkeleyDB 4.3.
It can have some nasty surprises.
OpenLDAP is great and does a good job. You may also want to look at Fedora Directory Server, which is based on a previously commercial product. Both are ridiculously easy to configure for basic authentication. Another option for OpenLDAP is to grab the VMWare OpenLDAP appliance. It's an easy way to get LDAP working.
For administration, check out JXplorer. It makes it easy to add/delete/modify users.
I use LDAP at work for everything and life is so much better now.
/home/username. Public drives are mapped as well.
Windows Desktops (Samba PDC and BDC -> LDAP)
Linux pam_ldap + nss -> LDAP and NFS shares
You can log into either a windows desktop or linux box and have the same file shares open. Windows has H: and Linux is
Then for email, postfix + dovecot -> ldap. You can store not only use the same username password as for linux, but you can add unlimited number of real-time mail aliases to each user. Also supports virtual domains.
Directory services for phone numbers, room locations, etc. in ldap. Mapped to email clients search/contact lists.
squid + ldap and apache + ldap, secure login to website.
Squirrelmail/horde both use ldap as well. Auth is done via imap, but horde can do much more with ldap. Both can use it for directory services.
Admin can be done either via CLI smbldap-tools, php ldap admin, gq (ldap tree browser), or ldapmodify if you're hard core. Plus with sync'ing data to other sites they have a copy of the data for their BDC/etc. If I need to add/modify a user there is only one place that needs to be modified. And I can do it from home. =)
I figured this was as good time as any to point out our relatively complete Linux LDAP HOWTO, which covers quite a few LDAP servers (MS AD, Novell eDir, OpenLDAP) and the security implications of different setups (eg. using PAM_LDAP vs just using NSS_LDAP). The article lives in a wiki so any improvements are welcome. :-)
I hope you find it useful.
Well, you all make good points. But still, for a just-for-fun bulletin board, it may be OK. Hashing is not a problem with few users and a fast system.
LDAP authentication is cool, but LDAP is just an interface. Unfortunately, it usually comes bundled monolithically with a dedicated datastore, the BerkeleyDB. Which is neat and fast, working well for "standalone LDAP". But it ghettoizes ID info away from other apps which don't already have an LDAP interface. Some of which need relational access for their app logic, or just higher performance than massive volumes of LDAP queries will permit. The OpenLDAP server is stuck this way. Its basic features are really good, but that's as far as it goes.
So where's the HOWTO for porting OpenLDAP to Postgres for its datastore? There's some HOWTOs for porting it to MySQL, but MySQL doesn't scale as well as Postgres, and existing Postgres installs are out of luck. The few existing LDAP/Postgres HOWTOs seem inconclusive, untested. And some of the commercial products that advertise the feature don't even respond to emails to sales departments asking about the cutover.
As long as Slashdot is staring down "LDAP Auth in Linux", how about taking it to (and over) the Postgres wall?
--
make install -not war
Where is easy to follow details to get your mobile clients working with disconnected logins ?
To have nice Windows replacements, log on when connected to the network, and then go away on the road, and log-on with that cached user-name and password...
Pam-ccreds apparently does it, but no-where that I can find either a nice how-to, or something where I don't have to manually configure the files EVERY bloody laptop install.
Easy, out-of-the box Disconected logins is a killer "MUST" for Linux/BSD to overcome relience on Windows laptops.
AM
https://dpw.threerings.net/projects/splat/ (written by the wonderful people I work with and BSD-licensed) hooks into LDAP, allowing for the storage of public keys for SSH access and other niftiness. We use it for managing passwordless SSH-key based access to the two dozen or so servers here with great success.
The article uses OpenLDAP as the LDAP server. Has anyone got this to work using the Apache Directory Server?
Based on upvotes, Ageism is the only "-ism" Slashdotters care about and think isn't SJW
The author failed to point out one of (IMHO) the neatest parts of doing PAM/NSS/LDAP authentication against your server: controlling by host. The LDAP authentication set includes the ability to dictate (using the "host" attribute) which users are allowed on which servers. From an enterprise POV, that helps limit the systems users have access to (controlling which servers your UNIX gurus have access to). You can also tie LDAP into Samba, and using some scripts emulate an active directory. We've been playing with this whole idea for awhile now where I work, to essentially create a mixed environment where Linux/UNIX and Windows can play (somewhat) nicely together. Hopefully this article will bring some more people on board with LDAP authentication for servers....
I tried to migrate an existing file and NIS based system to LDAP - I had no problem with setting up PAM and openldap, however I did not find a replacement for the Debian adduser program, so I would have to hack my own user management tools. Does anyone know an alternative to this?
Life is just nature's way of keeping meat fresh.
The big problem with ldap is that most of autentication plugins (apache, pam and the others) matches only first level group members, not nested groups, normally used, expecially, in big micro$oft directories. This creates a lot of "difficul to mantain" groups containing very big lists of accounts. I know that filters or organizational units can be used to group them, but most of the times this is not enaugh. For this reason i usually prefer radius which integrates well *nix and m$ worlds (even if i still use ldap for apache cause radius mod for apache is not so customizable).
This tutorial should have some major security warnings plastered all over and I see nothing to that effect so here's a suppliment.
First, LDAP is NOT an authentication service. I cringe a little whenever someone mentions using "LDAP authentication" for anything other than LDAP clients. Some of these tools use LDAP as a make-shift "pass-through" style authentication service. This is like passing credentials to an SSH server to authenticate web clients (only SSH would be more secure since it enforces confidentiality and integrity).
Second, if you are going to use LDAP like this, make sure the bind is being conducted over SSL. Using SASL would be even better but that's a little harder for a long lived service account and somewhat pointless if you already have Kerberos setup. With a plain bind you're sending passwords in clear text. Do not ever do that or someone will eventually come to your cube asking funny questions.
Finally, using LDAP as an authentication service does not provide Single Sign-On (SSO). You basically have to store some kind of token in the user's HTTP session which means someone could get your session ID and impersonate you (e.g. inadvertantly send a link with a session ID in it).
In general I don't recommend using LDAP as a make-shift authentication service as it is very easy for it to be insecure. Use Kerberos through and through people. It's the correct way to do things, it scales well and it's portable across both UNIX and Microsoft.
I believe I have one of the most advanced LDAP/Kerberos/Samba/Bind "Open Directory" setups. I have two Samba 3 Domain Controllers, both Kerberos and Bind Enabled. with OpenLDAP and MIT Kerberos. I have no need for NFS.
My OpenLDAP stores:
POSIX User Attributes
Samba User Attributes
Radius User Attributes
eGroupware User Attributes (Egroupware accounts.)
DNS Information for our internal DNS Server
DHCP Lease information.
I use Kerberos with ssh-agent to distribute software RPMS for Mandriva Linux to mass distibute RPMs with a single command.
I have Samba Kerberos enabled so that Samba will not repeatedly ask for usernames and passwords, and requires zero configuration.
I have had the code to Egroupware modified so that eGroupware, and Nagios can use Apache's mod_auth_kerb addon to authenticate eGroupware users with a single click instead of a whole second login process.
I'm currently workong on creating a Samba Authenticated gateway with NTLM-SPNEGO support so that kerberos will handle Squid too.
All I need now is for someone to make the modifications nesessary to eGroupware's XMLRPC so that Kontact could use Kerberos and I would have the "Exchange Killer" I always wanted.
All of my users use Samba for network browsing under KDE's Konqueror, with Kerberos and LDAP, it just works.
I consider this my shining accomplishment.
I like to have myself believe that I accomplished "Active Direrctory" under Linux now. I don't use Windows at all in this network, so keep that in mind. The eGroupware people can attest to what a past I am. bugging them to include Kerberos detection in session management. But it all works.
wa"lk up to a play Usenet posts. aNd abroad for
In all but the largest unix/linux installations, managing the users in LDAP is an exercise in futility. When you're all done you have something that's still more difficult to manage than adduser/deluser on the individual machines. Worse, its now brittle: the LDAP server breaks and now every unix box in the system fails at every task that requires a UID to user mapping.
Far more useful is managing the users locally but authenticating them (i.e. checking their password) via LDAP. For example, in an enterprise you might want to piggyback the Windows Active Directory passwords or the IBM/Lotus Domino passwords. This turns out to be trivial to do via a PAM module but the LDAP connectors don't seem to exist. They all want to pull the crypt or MD5 password from LDAP and then compute it instead of binding against LDAP with the given credentials. Every time I want to do this I find myself having to write another PAM module like http://bill.herrin.us/freebies/notesldap.tar.gz
Moderating "-1, Disagree" is simple censorship. Have the guts to post your opinion.
Yep centralised user management, great, no doubt.
But, what happens when the LDAP service isn't available?
I say service to not distinguish between a physical server, a cluster of servers, a crashed openLDAP process, broken network link, yadda, yadda, yadda.
With AD if a PDC isn't there, you can still login if you've logged on before.
The article really should have mentioned nss_updatedb and pam_ccreds from PADL (I don't know if there are any other alternatives, nor do I know if that actually work, sounds like they do though).
Few years ago, this was a common setup I would put in place. When I had a number of users accessing all different types of devices or services, I would setup an LDAP server and have everything auth against it. It worked well, but has 2 major flaws.
Total pain in the ass to setup
Total pain in the ass to maintain
Now, I am using radius for the same thing. It works a lot better, because lets face it. PostgreSQL or MySQL is a hell of a lot easier to work with then LDAP.
LDAP does have its place. If you are looking to tie more then just auth into a profile, then LDAP is the choice. If you just want auth, use something Radius.
Of course, if you are a total LDAP guru, you are gonna recommend LDAP. But for average admins, or quick setups. LDAP isn't the way to go.
until (succeed) try { again(); }
We switched to ldap authentication on our UNIX systems about a year ago, and basically it rocks. Providing single-sign-on between all of your device of varying operating systems and utility (i.e. servers, routers, switches, terminal/console servers, a lot of applications, and even kvm's) is great when you have a multi-teared support organization, and even if you don't you can still save yourself a lot of useradd / usermod /userdel commands if you centralize.
Why does it rock so much? LDAP seems unique that, unlike almost every other authentication method under the sun (NIS, NIS+ radius) it can be used on a number of devices. Additionally LDAP tends to be a great back-end for other authentication protocols (i.e. radius) can use an LDAP backend.
Practically speaking, often times all someone needs to do is have read access to a device to find out if an interface is up but many system admins give up if they don't have the ability to centralize and allow the company to become altogether too dependent on them. LDAP basically gets rid of this hassle and the administration is minimal. This means that the system admin gets paged less and more people can get work done with better efficiency.
Samba 4. When it lands you will be able to upgrade without problem and have all the support of LDAP and Equal to 2003 domain controllers everywhere. Samba 4 is even working on Vista domain controls.
Basicly linux is catching up fast.
Bind and dhcpd come with their own schemas in OprnLDAP. The Bind-sdb Schema is known as dnszone.schema, and dhcp.schema Then all you do is change the "file" commands in named.conf to say "database" and give them a DN Suffix. ldap-server "localhost"; ldap-port 389; ldap-username "cn=DHCP User, dc=ntelos, dc=net"; ldap-password "blah"; ldap-base-dn "dc=ntelos, dc=net"; ldap-method dynamic; ldap-debug-file "/var/log/dhcp-ldap-startup.log"; This goes in dhcpd.conf, it connects DHCP to LDAP. (Except put your correct DN information in here. Samba with Kerberos is rather simple. Add cifs/ entries for all of your servers attached in the KDC, distribute copies of the new keytab. Then, add 'use kerberos keytab = Yes' to Samba, and realm = MYREALM to smb.conf Assuming everything is peachy, you should be able to test the bind with smbclient -kd 3 //Server/share, and watch the Kerberos SPNEGO take place,.
Just use Novell Directory Services, or EDirectory as it is now named.
Nope it aint free, nope it aint open source. But it DOES rock the house!
Scales to over a billion objects. Easy administration and setup.
Runs on practicaly everything Form Linux, Unix, Solaris, Windows, Copiers, Printers to Toasters and Web Servers.
Why yes I am a Novell Fan Boy. Whats your fucking point!
Hey KID! Yeah you, get the fuck off my lawn!
For small/medium sized shops, are there any benefits of using LDAP over MySQL for authentication tasks?
I'm curious because we're already running mysqld for web apps and postfix maps. Is it worth running another service and all of the administrative overhead? Obviously the answer may be "it depends." What should I consider in making the decision?
See the subject.
it was like a whole 5 lines of code
Funnily enough I was having a similar conversation with someone at work last week. It seems that our Intranet authenticates via an LDAP bind, and when I found this out I thought "huh?!" and went to talk to the guy responsible. Of course, I didn't really have any better answer for him because although it's very easy to say "Just use Kerberos!", I only really know the basic principles of it and not really the practice.
So, my question to you is... do you have any good pointers to a nice, simple "getting started" HOWTO for doing Kerberos auth both through PAM and from my own software? Also, I was under the impression that under Kerberos you're not supposed to share your password around, but instead present tickets; how does that work in an app that just accepts a username and password? (Like, say, a Jabber server, or login at the Linux console, or when doing HTTP auth.)
The enabling software pam_ldap and nss_ldap have been around for years. I worked on a project in Novell implementing similar functionality using NDS six years back.
Does anyone here have any experience with NIS gateways to LDAP servers, so existing infrastructure can continue to work?
I have a love/hate relationship with Berkeley DB. This comment applies to OpenLDAP.
...), and if it gets corrupted, you'd better have a backup.
It's moody (DB_CONFIG anyone?), it's fast, gets reliable somewhere after many minor releases (started to trust 4.2.52, 4.3.25,
I agree with your point, in theory - RDBMS datastores could offer a lot of flexibility, and eliminate many data redundancy complications. In small-ish implementations, you may be fine.
The implementations I've seen are a different animal.
1. Berkeley DB is fast. When you're issuing a lot of reads(3000+/sec/replica), across what is already a large farm (20+) of replicas, BDB means less hardware, hence far less cost than any RDBMS datastore.
2. RDBMS backends for OpenLDAP aren't as well tested. This matters when your database drives your email, authentication, authorization, and address books.
But I agree that the RDBMS should be the _authoritative_ data store. It should populate your LDAP directory. Yes, that's easier said than done. The benefits of this are great though - flexible lower throughput data for the applications that can use it, low data redundancy ( if you've designed both your RDBMS and LDAP schemas properly), blazing read speeds, and excellent service availability.
Caching is a convenience to increase speed and diminish load in the servers.
Caching is not intended as a backup mechanism.
YOur root passwrod should *always* be in the local machine.
Also if you fail to secure access to your name service servers, and then proceed to put your root passwords in the name service, you could as well hand over the root password to a hacker...
IANAL but write like a drunk one.
.... al data is transfered in clear text.
I believe LDAP+ Kerberos that is not the case, but I am not familiar with it so I can't comment.
IANAL but write like a drunk one.
I agree. LDAP is a protocol, and interface between ID data and applications. BDB is high performance, optimized for the hierarchical data model of LDAP data. A local hierarchical cache in BDB is the right way to support the high transaction volume in LDAP transactions. So a BDB datamart against an RDBMS datastore is the best compromise for required performance, flexibility, manageability and access to applications outside the LDAP interface.
That means extra HW and complexity. The extra HW cost is worth it if the requirements can't be met by the BDB, as in joins to existing relational data, because it's still the cheapest alternative. The extra complexity of maintaining parallel BDB and RDBMS datasets with bidirectional consistency is a bigger question. I think this architecture won't really be fully worked out until people with expertise in write-thru caches apply their techniques to this device for both performance and integrity, without sacrificing the rest of the features.
--
make install -not war
OpenLDAP (or Fedora Directory Server, if you will), is an excellent choice for things like back-ending OpenVPN installations. OpenVPN + customized OpenVPN-Win32-GUI + Fedora DS = no more commercial client VPN.
Questions for the slashdot crowd..
- How do you make multi-master replication useful for clients that only query one server? Like if you choose to use LDAP for linux authentication ("authconfig") how do you deal with having your primary server fail? I know the usual stuff like having a virtual IP, etc, but was wondering if someone had come up with any hacks to have the clients know to try a different LDAP repository.
- How do you approach UID conformity across a spread of organically grown servers? Take your typical startup, for instance, where people having been indiscriminately creating local users via "useradd" with little regard for varying UIDs. Are there any best practices for convergence when moving to LDAP outside of manually logging into a system, booting the user offline, changing the UID, then "find / " throughout the filesystem to chown the files?
CommentBot 0.7a running with args "-module irritate,disagree -target random"
LDAP authentication in Linux is pretty mature now, and there are many alternatives you can choose according to your needs. They've already been discusses above, I'll try to summarize.
If you just want an quick and easy solution with good compatibility, Active Directory is your friend. It stores all the user, machine and configuration information in LDAP, supports authentication via Kerberos and discovery by using DNS. And Windows Server 2003 R2 brought an NIS server, which you can use if you have some old (probably Sun) boxes lying around.
If you do not like Microsoft, you can choose Novell's NDS. They have a very good history in directory space. However NDS does not run (or I could not easily get it to) on "unspported" new Linux releases (like CentOS/RedHat 4.3).
If you want to go open source you may prefer Fedora Directory Server. It's solid, it has many features (4 way multi master replication, GUI administration, live backups, etc), and you can easily migrate your old passwords to it. However if combining with Kerberos, you'll need to sacrifise those passwords (and a lot of time reading kerberos documentation).
You can also choose Sun's directory server (which shares roots with FDS), or Apache DS (which has the most functionality, yet not stable enough).
I'd recommend against OpenLDAP, unless for maintaining legacy systems. Access Control information is store in configuration files as regular expressions. It's both less secure (you may easily make mistakes), and you need to restart the server when changing ACLs. It also has less features than any other alternative. (They had helped the community for a long time, but I guess they've served their purpose).
Any correction is welcome, so I can fix our current system (FDS).