3 # central usermanagement
5 ...using ldap and kerberos
14 * komfort (single sign on)
17 * fehlerquelle komplexitaet
18 * gefahr single point of failure / break in
26 * [[http://www.openinput.com/auth-howto/index.html|http://www.openinput.com/auth-howto/index.html]]
27 * [[http://www.pdc.kth.se/heimdal/|http://www.pdc.kth.se/heimdal/]]
28 * [[http://www.openldap.org/doc/admin23/|http://www.openldap.org/doc/admin23/]]
31 * trusted third party, der KDC. hat gemeinsames secret mit allen hosts/services/usern. "principals". generiert auf anfrage ticket mit zeit, ip, und welcher user zu welchem service.
34 * keine passwoerter im ldap, alles via kerberos, rueckwaertskompatibilitaet via pam_krb, nicht sasl oder pam_ldap.
35 * kerberos datenbank im ldap, keine seperate replikation noetig (nur mit heimdal).
36 * eigene ldap range fuer uid/groupid, root und systemuser bleiben lokal falls das netzwerk spinnt.
42 * heimdal kerberos (ldap), alternativen: mit, shishi
43 * openldap, alternativ: mysql, postgresql
44 * wohlgepflegtes dns und reverse-dns
45 * schwer empfohlen: replikation und redundanz
48 sudo aptitude install slapd heimdal-kdc
54 * sasl mit gssapi provider
55 * richtige zeit, zb. openntpd (kann aber nicht stratum faken fuer windows)
56 * kerberized client/serversoftware (zb. openssh, apache2)
59 sudo aptitude install libnss-ldap libpam-krb5 libsasl2-gssapi-mit heimdal-clients
62 # vorbereitung: domain name service
64 config im dns (da gibts uebrigens auch welche mit ldap/sql backend ;):
66 aka "srv records rock! - for kerberos but not for ldap :("
68 config file /etc/krb5.conf auf allen hosts ident!
70 was ist ein "canonical hostname"?
72 zonefile mm-karton.com (snippet):
74 $ORIGIN mm-karton.com.
75 kerberos A 10.128.0.24
76 kerberos-1 A 10.128.0.25
77 ldap CNAME srv-vie-26.vie.mm-karton.com.
78 ldap-1 CNAME srv-vie-27.vie.mm-karton.com.
80 _kerberos TXT "MM-KARTON.COM"
81 _kerberos-master._tcp SRV 10 1 88 kerberos
82 _kerberos-master._udp SRV 10 1 88 kerberos
83 _kpasswd._udp SRV 10 1 464 kerberos
84 _kerberos-adm._tcp SRV 10 1 749 kerberos
85 _kerberos._tcp SRV 10 1 88 kerberos
86 _kerberos._udp SRV 10 1 88 kerberos
87 _kerberos._tcp SRV 20 1 88 kerberos-1
88 _kerberos._udp SRV 20 1 88 kerberos-1
90 _ldap._tcp SRV 10 1 88 ldap
91 _ldap._tcp SRV 20 1 88 ldap-1
93 zonefile mm-karton.net (snippet), afaik heimdal specific:
95 _kerberos TXT "MM-KARTON.COM"
104 # This is the main slapd configuration file. See slapd.conf(5) for more
105 # info on the configuration options.
107 #######################################################################
110 include /etc/ldap/schema/core.schema
111 include /etc/ldap/schema/cosine.schema
112 include /etc/ldap/schema/nis.schema
113 include /etc/ldap/schema/inetorgperson.schema
115 include /etc/ldap/schema/hdb.schema
118 TLSCACertificateFile /etc/ldap/ca_crt.pem
119 TLSCertificateFile /etc/ldap/ldap.mm-karton.com_crt.pem
120 TLSCertificateKeyFile /etc/ldap/ldap.mm-karton.com_key.pem
121 TLSCipherSuite HIGH:MEDIUM:+SSLv2
124 pidfile /var/run/slapd/slapd.pid
125 argsfile /var/run/slapd/slapd.args
129 modulepath /usr/lib/ldap
133 # The maximum number of entries that is returned for a search operation
139 #######################################################################
140 # Specific Backend Directives for bdb:
147 #######################################################################
150 suffix "dc=mm-karton,dc=com"
151 rootdn "cn=ldapmaster@mm-karton.com,dc=mm-karton,dc=com"
153 directory "/var/lib/ldap"
154 dbconfig set_cachesize 0 33554432 0
159 index cn,uid,displayName eq,sub,pres
160 index krb5PrincipalName eq
161 index associatedDomain pres,eq,sub
162 index entryUUID,default,entryCSN eq
165 # needed for syncrepl
167 syncprov-checkpoint 100 10
168 syncprov-sessionlog 100
170 limits dn.exact="cn=ldap/srv-vie-27.vie.mm-karton.com@mm-karton.com,ou=kdc,dc=mm-karton,dc=com" time.soft=unlimited time.hard=unlimited size.soft=unlimited size.hard=unlimited
177 #######################################################################
180 sasl-secprops minssf=0
181 security simple_bind=64
184 uid=(.+),cn=.+,cn=auth
185 ldap:///dc=mm-karton,dc=com??sub?(|(uid=$1)(krb5PrincipalName=$1@MM-KARTON.COM))
186 sasl-regexp "=0" "cn=ldapmaster@mm-karton.com,dc=mm-karton,dc=com"
191 #######################################################################
194 # needed for certain auth stuff
195 access to dn.base="" by * read
196 access to dn.base="cn=Subschema" by * read
198 access to attrs=krb5PrincipalName
199 by dn="cn=unki@mm-karton.com,dc=mm-karton,dc=com" write
200 by dn="cn=lefant@mm-karton.com,dc=mm-karton,dc=com" write
201 by dn="cn=ldap/srv-vie-27.vie.mm-karton.com@mm-karton.com,ou=kdc,dc=mm-karton,dc=com" read
204 access to attrs=userPassword
205 by dn="cn=unki@mm-karton.com,dc=mm-karton,dc=com" write
206 by dn="cn=lefant@mm-karton.com,dc=mm-karton,dc=com" write
207 by dn="cn=ldap/srv-vie-27.vie.mm-karton.com@mm-karton.com,ou=kdc,dc=mm-karton,dc=com" read
212 # Kerberos attributes only accessible to root/ldapmaster and the superadmins
213 access to attrs=krb5KeyVersionNumber,krb5PrincipalRealm,krb5EncryptionType,krb5KDCFlags,krb5Key,krb5MaxLife,krb5MaxRenew,krb5PasswordEnd,krb5ValidEnd,krb5ValidStart,krb5RealmName
214 by dn="cn=unki@mm-karton.com,dc=mm-karton,dc=com" write
215 by dn="cn=lefant@mm-karton.com,dc=mm-karton,dc=com" write
216 by dn="cn=ldap/srv-vie-27.vie.mm-karton.com@mm-karton.com,ou=kdc,dc=mm-karton,dc=com" read
221 # user info readable for nssproxy user
222 access to dn.subtree="ou=users,dc=mm-karton,dc=com"
223 by dn="cn=unki@mm-karton.com,dc=mm-karton,dc=com" write
224 by dn="cn=lefant@mm-karton.com,dc=mm-karton,dc=com" write
225 by dn="cn=ldap/srv-vie-27.vie.mm-karton.com@mm-karton.com,ou=kdc,dc=mm-karton,dc=com" read
226 by dn="uid=nssproxy,dc=mm-karton,dc=com" read
227 access to dn.subtree="ou=groups,dc=mm-karton,dc=com"
228 by dn="cn=unki@mm-karton.com,dc=mm-karton,dc=com" write
229 by dn="cn=lefant@mm-karton.com,dc=mm-karton,dc=com" write
230 by dn="cn=ldap/srv-vie-27.vie.mm-karton.com@mm-karton.com,ou=kdc,dc=mm-karton,dc=com" read
231 by dn="uid=nssproxy,dc=mm-karton,dc=com" read
232 access to attrs=uid,uidNumber,gidNumber,gecos,homeDirectory,loginShell,memberUid
233 by dn="cn=unki@mm-karton.com,dc=mm-karton,dc=com" write
234 by dn="cn=lefant@mm-karton.com,dc=mm-karton,dc=com" write
235 by dn="cn=ldap/srv-vie-27.vie.mm-karton.com@mm-karton.com,ou=kdc,dc=mm-karton,dc=com" read
236 by dn="uid=nssproxy,dc=mm-karton,dc=com" read
241 access to dn.subtree="dc=mm-karton,dc=com"
242 by dn="cn=unki@mm-karton.com,dc=mm-karton,dc=com" write
243 by dn="cn=lefant@mm-karton.com,dc=mm-karton,dc=com" write
244 by dn="cn=ldap/srv-vie-27.vie.mm-karton.com@mm-karton.com,ou=kdc,dc=mm-karton,dc=com" read
248 # Default location of the slapd.conf file
251 # System account to run the slapd server under. If empty the server
253 SLAPD_USER="openldap"
255 # System group to run the slapd server under. If empty the server will
256 # run in the primary group of its user.
257 SLAPD_GROUP="openldap"
259 # Path to the pid file of the slapd server. If not set the init.d script
260 # will try to figure it out from $SLAPD_CONF (/etc/ldap/slapd.conf)
263 # Configure if the slurpd daemon should be started. Possible values:
264 # - yes: Always start slurpd
265 # - no: Never start slurpd
266 # - auto: Start slurpd if a replica option is found in slapd.conf (default)
269 # slapd normally serves ldap only on all TCP-ports 389. slapd can also
270 # service requests on TCP-port 636 (ldaps) and requests via unix
273 SLAPD_SERVICES="ldap://10.128.4.36/ ldapi:///"
275 # Additional options to pass to slapd and slurpd
279 export KRB5_KTNAME="FILE:/etc/ldap/ldap.keytab"
281 [ -L /var/run/ldapi ] || ln -s /var/run/slapd/ldapi /var/run/ldapi
283 /etc/heimdal-kdc/kadmin.acl
285 lefant/admin@MM-KARTON.COM all
287 /etc/heimdal-kdc/kdc.conf
291 realm = MM-KARTON.COM
292 dbname = ldap:dc=mm-karton,dc=com
293 mkey_file = /var/lib/heimdal-kdc/m-key
294 acl_file = /etc/heimdal-kdc/kadmind.acl
296 addresses = 10.128.0.24
307 /etc/libnss-ldap.conf
309 BASE dc=mm-karton, dc=com
310 URI ldap://ldap.mm-karton.com/,ldap://ldap-1.mm-karton.com/
314 tls_cacertfile /etc/ssl/certs/mmagca_crt.pem
316 binddn uid=nssproxy,dc=mm-karton,dc=com
320 pam_filter objectClass=posixAccount
321 nss_base_passwd ou=users,dc=mm-karton,dc=com
322 nss_base_group ou=groups,dc=mm-karton,dc=com
327 # Bind/connect timelimit
333 nss_reconnect_tries 1
334 nss_reconnect_sleeptime 1
335 nss_reconnect_maxsleeptime 2
336 nss_reconnect_maxconntries 3
337 nss_initgroups_ignoreusers arpwatch,asterisk,backup,bin,bind,clamav,cricket,daemon,Debian-exim,debianmirror,dovecot,fetchmail,ftp,games,gnats,identd,irc,list,lp,mail,man,messagebus,mysql,nagios,news,nobody,ntp,ntpd,nut,openvpn,pdns,proftpd,proxy,puppet,root,smmsp,smmta,smsd,snmp,snort,sshd,statd,sync,sys,uucp,www-data,zope
358 default_realm = MM-KARTON.COM
359 dns_lookup_realm = yes
362 default = SYSLOG:NOTICE:DAEMON
363 kdc = FILE:/var/log/kdc.log
364 kadmind = FILE:/var/log/kadmind.log
368 ticket_lifetime = 10h
372 retain_after_close = false
378 srv-pof-30.pof.mmk.mmdom.net = MM-KARTON.COM
383 kpasswd_server = DC-VIE-50
384 auth_to_local_names = {
390 admin_server = kerberos.mm-karton.com
391 auth_to_local = RULE:[1:$1@$0](^.*@MMK.MMDOM.NET$)s/@MMK.MMDOM.NET//
392 auth_to_local = DEFAULT
395 /etc/pam.d/common-account
397 account required pam_access.so
398 account sufficient pam_krb5.so forwardable realm=MMK.MMDOM.NET minimum_uid=20000
399 account sufficient pam_krb5.so forwardable realm=MM-KARTON.COM minimum_uid=20000
400 account required pam_unix.so
402 /etc/pam.d/common-auth
404 auth optional pam_group.so
405 auth sufficient pam_krb5.so forwardable realm=MMK.MMDOM.NET minimum_uid=20000 try_first_pass
406 auth sufficient pam_krb5.so forwardable realm=MM-KARTON.COM minimum_uid=20000 try_first_pass
407 auth required pam_unix.so try_first_pass
409 /etc/pam.d/common-session
411 session required pam_mkhomedir.so umask=0022 skel=/etc/mmskel
412 session sufficient pam_krb5.so forwardable realm=MMK.MMDOM.NET minimum_uid=20000
413 session sufficient pam_krb5.so forwardable realm=MM-KARTON.COM minimum_uid=20000
414 session required pam_unix.so
416 restrict logins to certain users:
418 /etc/security/access.conf
420 # first, to avoid delays when network is still unavailable
424 # remote users and groups
427 # deny everything else
430 /etc/adduser.conf (snippet)
432 # FIRST_[GU]ID to LAST_[GU]ID inclusive is the range of UIDs of dynamically
433 # allocated user accounts/groups.
437 ldap client config (administration):
441 BASE dc=mm-karton, dc=com
442 URI ldap://ldap.mm-karton.com/
444 tls_cacert /etc/ssl/certs/ca_crt.pem
446 ldapwhoami, ldapsearch
448 sudo, nopasswd, weil solches haben wir ja nicht...
452 lefant ALL=(ALL) NOPASSWD:ALL
455 # single sign on fuer applikationen (gssapi support, das grosse fragezeichen)
457 /etc/ssh/sshd_config (snippet)
459 GSSAPIAuthentication yes
460 GSSAPIKeyExchange yes
462 /etc/ssh/ssh_config (snippet)
465 GSSAPIAuthentication yes
466 GSSAPIDelegateCredentials yes
469 firefox: out-of-the-box!
471 apache: (apt-get install libapache2-mod-auth-kerb) config snippet
475 AuthName "MM Login (use windows login *without* mm\ prefix)"
477 Krb5Keytab /etc/apache2/keytab
478 KrbAuthRealms MMK.MMDOM.NET MM-KARTON.COM
479 AuthGroupFile /etc/wwwusers
480 Require group NocUsers
483 Allow from noc.mm-karton.com