From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1Qt3jP-0006tk-AS for garchives@archives.gentoo.org; Mon, 15 Aug 2011 20:25:55 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 9852F21C109; Mon, 15 Aug 2011 20:25:32 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 479AF21C109 for ; Mon, 15 Aug 2011 20:25:32 +0000 (UTC) Received: from flycatcher.gentoo.org (flycatcher.gentoo.org [81.93.255.6]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 8CBA01B403B for ; Mon, 15 Aug 2011 20:25:31 +0000 (UTC) Received: by flycatcher.gentoo.org (Postfix, from userid 617) id 4FF0B2004C; Mon, 15 Aug 2011 20:25:30 +0000 (UTC) From: "Sven Vermeulen (swift)" To: gentoo-doc-cvs@lists.gentoo.org Subject: [gentoo-doc-cvs] gentoo commit in xml/htdocs/doc/en: ldap-howto.xml X-VCS-Repository: gentoo X-VCS-Files: ldap-howto.xml X-VCS-Directories: xml/htdocs/doc/en X-VCS-Committer: swift X-VCS-Committer-Name: Sven Vermeulen Content-Type: text/plain; charset=utf8 Message-Id: <20110815202530.4FF0B2004C@flycatcher.gentoo.org> Date: Mon, 15 Aug 2011 20:25:30 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-doc-cvs@lists.gentoo.org Reply-to: docs-team@lists.gentoo.org Content-Transfer-Encoding: quoted-printable X-Archives-Salt: X-Archives-Hash: d9ae5921632c43caa09bb09e263a604e swift 11/08/15 20:25:30 Modified: ldap-howto.xml Log: Fix #176075 - Updated OpenLDAP guide Revision Changes Path 1.44 xml/htdocs/doc/en/ldap-howto.xml file : http://sources.gentoo.org/viewvc.cgi/gentoo/xml/htdocs/doc/en/ldap= -howto.xml?rev=3D1.44&view=3Dmarkup plain: http://sources.gentoo.org/viewvc.cgi/gentoo/xml/htdocs/doc/en/ldap= -howto.xml?rev=3D1.44&content-type=3Dtext/plain diff : http://sources.gentoo.org/viewvc.cgi/gentoo/xml/htdocs/doc/en/ldap= -howto.xml?r1=3D1.43&r2=3D1.44 Index: ldap-howto.xml =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /var/cvsroot/gentoo/xml/htdocs/doc/en/ldap-howto.xml,v retrieving revision 1.43 retrieving revision 1.44 diff -u -r1.43 -r1.44 --- ldap-howto.xml 18 Apr 2011 02:01:11 -0000 1.43 +++ ldap-howto.xml 15 Aug 2011 20:25:30 -0000 1.44 @@ -1,15 +1,15 @@ - + =20 - + Gentoo Guide to OpenLDAP Authentication =20 Benjamin Coles - - Sven Vermeulen + + Brandon Hale @@ -33,8 +33,8 @@ =20 -5 -2011-04-17 +6 +2011-08-15 =20 Getting Started with OpenLDAP @@ -166,52 +166,66 @@ =20
 # slappasswd
-New password: my-password
-Re-enter new password: my-password
+New password: my-password
+Re-enter new password: my-password
 {SSHA}EzP6I82DZRnW+ou6lyiXHGxSpSOw2XO4
 
=20

-Now edit the LDAP Server config at /etc/openldap/slapd.conf= : +Now edit the LDAP Server config at /etc/openldap/slapd.conf= . Below +we'll give a sample configuration file to get things started. For a more +detailed analysis of the configuration file, we suggest that you work th= rough +the OpenLDAP Administrator's Guide.

=20
-# Include the needed data schemes below core.schema
-include         /etc/openldap/schema/cosine.schema
-include         /etc/openldap/schema/inetorgperson.schema
-include         /etc/openldap/schema/nis.schema
-
-Uncomment modulepath and hdb module
-# Load dynamic backend modules:
-modulepath    /usr/lib/openldap/openldap
-# moduleload    back_shell.so
-# moduleload    back_relay.so
-# moduleload    back_perl.so
-# moduleload    back_passwd.so
-# moduleload    back_null.so
-# moduleload    back_monitor.so
-# moduleload    back_meta.so
-moduleload    back_hdb.so
-# moduleload    back_dnssrv.so
+include	/etc/openldap/schema/core.schema
+include /etc/openldap/schema/cosine.schema
+include /etc/openldap/schema/inetorgperson.schema
+include /etc/openldap/schema/nis.schema
+include	/etc/openldap/schema/misc.schema
+
+pidfile /var/run/openldap/slapd.pid
+argsfile /var/run/openldap/slapd.args
=20
-# Uncomment sample access restrictions (Note: maintain indentat=
ion!)
+serverID 0 Used in case of replication
+loglevel 0
+
+## Access Controls
 access to dn.base=3D"" by * read
 access to dn.base=3D"cn=3DSubschema" by * read
 access to *
-   by self write
-   by users read
-   by anonymous auth
+  by self write
+  by users read
+  by anonymous read
=20
+## Database definition
+database hdb
+suffix "dc=3Dgenfic,dc=3Dcom"
+checkpoint 32 30
+rootdn "cn=3DManager,dc=3Dgenfic,dc=3Dcom"
+rootpw "{SSHA}EzP6I82DZRnW+ou6lyiXHGxSpSOw2XO4" # See earlier s=
lappasswd command
+directory "/var/lib/openldap-ldbm"
+index objectClass eq
+
+## Synchronisation (pull from other LDAP server)
+syncrepl rid=3D000
+  provider=3Dldap://ldap2.genfic.com
+  type=3DrefreshAndPersist
+  retry=3D"5 5 300 +"
+  searchbase=3D"dc=3Dgenfic,dc=3Dcom"
+  attrs=3D"*,+"
+  bindmethod=3D"simple"
+  binddn=3D"cn=3Dldapreader,dc=3Dgenfic,dc=3Dcom"
+  credentials=3D"ldapsyncpass"
=20
-# BDB Database definition
+index entryCSN eq
+index entryUUID eq
=20
-database        hdb
-suffix          "dc=3Dgenfic,dc=3Dcom"
-checkpoint      32      30 # <kbyte> <min>
-rootdn          "cn=3DManager,dc=3Dgenfic,dc=3Dcom"
-rootpw          {SSHA}EzP6I82DZRnW+ou6lyiXHGxSpSOw2XO4
-directory       /var/lib/openldap-ldbm
-index           objectClass     eq
+mirrormode TRUE
+
+overlay syncprov
+syncprov-checkpoint 100 10
 
=20

@@ -223,17 +237,27 @@ (Add the following...) =20 BASE dc=3Dgenfic, dc=3Dcom -URI ldap://auth.genfic.com:389/ +URI ldap://ldap.genfic.com:389/ ldap://ldap1.genfic.com:389/ ld= ap://ldap2.genfic.com:389/ TLS_REQCERT allow +TIMELIMIT 2 =20

-Now edit /etc/conf.d/slapd and uncomment the following OPTS= line: +Now edit /etc/conf.d/slapd and set the following OPTS line:

=20
-# Note: we don't use cn=3Dconfig here, so stay with this line:<=
/comment>
-OPTS=3D"-F /etc/openldap/slapd.d -h 'ldaps:// ldap:// ldapi://%2fvar%2fr=
un%2fopenldap%2fslapd.sock'"
+OPTS=3D"-h 'ldaps:// ldap:// ldapi://%2fvar%2frun%2fopenldap%2fslapd.soc=
k'"
+
+ +

+Finally, create the /var/lib/openldap-ldbm structure: +

+ +
+~# mkdir -p /var/lib/openldap-ldbm
+~# chown ldap:ldap /var/lib/openldap-ldbm
+~# chmod 700 /var/lib/openldap-ldbm
 
=20

@@ -262,18 +286,153 @@ =20 +Replication +

+If you need high availability + + +

+If your environment requires high availability, then you need to setup +replication of changes across multiple LDAP systems. Replication within = OpenLDAP +is, in this guide, set up using a specific replication account +(ldapreader) which has read rights on the primary LDAP server and= which +pulls in changes from the primary LDAP server to the secundary. +

+ +

+This setup is then mirrored, allowing the secundary LDAP server to act a= s a +primary. Thanks to OpenLDAP's internal structure, changes are not re-app= lied if +they are already in the LDAP structure. +

+ + +
+
+Setting Up Replication + + +

+To setup replication, first setup a second OpenLDAP server, similarly as= above. +However take care that, in the configuration file,=20 +

+ +
    +
  • + the sync replication provider is pointing to the other= system +
  • +
  • + the serverID of each OpenLDAP system is different +
  • +
+ +

+Next, create the synchronisation account. We will create an LDIF file (t= he +format used as data input for LDAP servers) and add it to each LDAP serv= er: +

+ +
+~# slappasswd -s myreaderpassword
+ {SSHA}XvbdAv6rdskp9HgFaFL9YhGkJH3HSkiM
+
+~# cat ldapreader.ldif
+dn: cn=3Dldapreader,dc=3Dgenfic,dc=3Dcom
+userPassword: {SSHA}XvbdAv6rdskp9HgFaFL9YhGkJH3HSkiM
+objectClass: organizationalRole
+objectClass: simpleSecurityObject
+cn: ldapreader
+description: LDAP reader used for synchronization
+
+~# ldapadd -x -W -D "cn=3DManager,dc=3Dgenfic,dc=3Dcom" -f ldapreader=
.ldif
+Password: enter the administrative password
+
+ + +
+
+ + Client Configuration
Migrate existing data to ldap =20

+Configuring OpenLDAP for centralized administration and management of co= mmon +Linux/Unix items isn't easy, but thanks to some tools and scripts availa= ble on +the Internet, migrating a system from a single-system administrative +point-of-view towards an OpenLDAP-based, centralized managed system isn'= t hard +either. +

+ +

Go to http://www.padl.com= /OSS/MigrationTools.html -and fetch the scripts there. Configuration is stated on the page. We don= 't ship -this anymore because the scripts are a potential security hole if you le= ave -them on the system after porting. When you've finished migrating your da= ta, -continue to the next section. +and fetch the scripts there. You'll need the migration tools and the +make_master.sh script. +

+ +

+Next, extract the tools and copy the make_master.sh script inside= the +extracted location: +

+ +
+~# mktemp -d
+/tmp/tmp.zchomocO3Q
+~# cd /tmp/tmp.zchomocO3Q
+~# tar xvzf /path/to/MigrationTools.tgz
+~# mv /path/to/make_master.sh MigrationTools-47
+~# cd MigrationTools-47
+
+ +

+The next step now is to migrate the information of your system to OpenLD= AP. The +make_master.sh script will do this for you, after you have provid= ed it +with the information regarding your LDAP structure and environment. +

+ +

+At the time of writing, the tools require the following input: +

+ + + + + + + + + LDAP BaseDN + The base location (root) of your tree + dc=3Dgenfic,dc=3Dcom + + + Mail domain + Domain used in e-mail addresses + genfic.com + + + Mail host + FQDN of your mail server infrastructure + smtp.genfic.com + + + LDAP Root DN + Administrative account information for your LDAP structure + cn=3DManager,dc=3Dgenfic,dc=3Dcom + + + LDAP Root Password + + Password for the administrative account, cfr earlier slappasswd + command + + + +
InputDescriptionExample
+ +

+The tool will also ask you which accounts and settings you want to migra= te.

=20 @@ -310,7 +469,7 @@ #%PAM-1.0 =20 auth required pam_env.so -auth sufficient pam_unix.so try_first_pass likeauth nullok +auth sufficient pam_unix.so try_first_pass likeauth nullo= k auth sufficient pam_ldap.so use_first_pass auth required pam_deny.so =20 @@ -318,7 +477,7 @@ account required pam_unix.so =20 password required pam_cracklib.so difok=3D2 minlen=3D8 dcredit=3D2= ocredit=3D2 try_first_pass retry=3D3 -password sufficient pam_unix.so try_first_pass use_authtok nullok md= 5 shadow +password sufficient pam_unix.so try_first_pass use_authtok nu= llok md5 shadow password sufficient pam_ldap.so use_authtok use_first_pass password required pam_deny.so =20 @@ -338,20 +497,20 @@ =20 suffix "dc=3Dgenfic,dc=3Dcom" #rootbinddn uid=3Droot,ou=3DPeople,dc=3Dgenfic,dc=3Dcom - -uri ldap://auth.genfic.com/ -pam_password exop - +bind_policy soft +bind_timelimit 2 ldap_version 3 +nss_base_group ou=3DGroup,dc=3Dgenfic,dc=3Dcom +nss_base_hosts ou=3DHosts,dc=3Dgenfic,dc=3Dcom +nss_base_passwd ou=3DPeople,dc=3Dgenfic,dc=3Dcom +nss_base_shadow ou=3DPeople,dc=3Dgenfic,dc=3Dcom pam_filter objectclass=3DposixAccount pam_login_attribute uid pam_member_attribute memberuid -nss_base_passwd ou=3DPeople,dc=3Dgenfic,dc=3Dcom -nss_base_shadow ou=3DPeople,dc=3Dgenfic,dc=3Dcom -nss_base_group ou=3DGroup,dc=3Dgenfic,dc=3Dcom -nss_base_hosts ou=3DHosts,dc=3Dgenfic,dc=3Dcom - +pam_password exop scope one +timelimit 2 +uri ldap://ldap.genfic.com/ ldap://ldap1.genfic.com ldap://ldap2.genfic.= com =20

@@ -376,26 +535,14 @@ =20

-To test the changes, type: -

- -
-# getent passwd|grep 0:0
-
-(You should get two entries back:)
-root:x:0:0:root:/root:/bin/bash
-root:x:0:0:root:/root:/bin/bash
-
- -

If you noticed one of the lines you pasted into your /etc/ldap.con= f was commented out (the rootbinddn line): you don't need it unless= you want to change a user's password as superuser. In this case you need to = echo the root password to /etc/ldap.secret in plaintext. This is -DANGEROUS and should be chmoded to 600. What I do is keep= that -file blank and when I need to change someones password thats both in the= ldap -and /etc/passwd I put the pass in there for 10 seconds whil= e I -change it and remove it when I'm done. +DANGEROUS and should be chmoded to 600. What you might wa= nt to +do is keep that file blank and when you need to change someones password= thats +both in the ldap and /etc/passwd, put the pass in there for= 10 +seconds while changing the users password and remove it when done.

=20