===== What? ===== Deploy an openldap server rhel7, used for ldap authentication/authorization. We have now 2 ways to configure openldap: * via slapd.conf * via configtree The latter allows configuration onthefly, but the first way is more convinient. Many instructions are also only provided in slapd.conf syntax, so I focus on deploying an initial slapd.conf, and then convert it to configtree syntax after changes. * admin guide: https://www.openldap.org/doc/admin24/ ===== setup openldap on RHEL7 ===== yum -y install openldap-servers openldap-clients # deploy a simple slapd.conf file cat >/etc/openldap/slapd.conf< ===== populate openldap ===== * see the [[snippets/linux_quickshotsetups/ldap_auth_server_populate|ldap_auth_server_populate page]] # add initial OUs, users, groups ldapadd -x -h 127.0.0.1 -D cn=manager,dc=fluxcoil,dc=net \ -w secret -f initial.ldif # verify they are available ldapsearch -x -h 127.0.0.1 -b dc=fluxcoil,dc=net \ -D cn=manager,dc=fluxcoil,dc=net -w secret ===== verify config ===== cp /etc/openldap/cacert.pem /etc/openldap/cacerts/ echo 'TLS_CACERT /etc/openldap/cacerts/cacert.pem' >>/etc/openldap/ldap.conf ldapsearch -x -b dc=fluxcoil,dc=net -H ldap://rhel6b.site ldapsearch -x -b dc=fluxcoil,dc=net -H ldap://rhel6b.site -ZZZ ===== errors and solutions ===== === dn error === [root@rhel7u2a cn=schema]# ldapadd -c -Y EXTERNAL -H ldapi:/// -f cn\=\{1\}cosine.ldif SASL/EXTERNAL authentication started SASL username: gidNumber=0+uidNumber=0,cn=peercred,cn=external,cn=auth SASL SSF: 0 adding new entry "cn={1}cosine" ldap_add: Server is unwilling to perform (53) additional info: no global superior knowledge [root@rhel7u2a cn=schema]# When this error occurs, the first part of the schema ldif file needs to be modified. For example, change as follows for the inetorgperson schema file: dn: cn={11}inetorgperson objectClass: olcSchemaConfig cn: {11}inetorgperson into dn: cn={11}inetorgperson,cn=schema,cn=config objectClass: olcSchemaConfig cn: {11}inetorgperson === permissions === [root@rhel7u2a cn=schema]# ldapadd -c -Y EXTERNAL -H ldapi:/// -f *misc* SASL/EXTERNAL authentication started SASL username: gidNumber=0+uidNumber=0,cn=peercred,cn=external,cn=auth SASL SSF: 0 adding new entry "cn={8}misc,cn=schema,cn=config" ldap_add: Constraint violation (19) additional info: structuralObjectClass: no user modification allowed [root@rhel7u2a cn=schema]# When this error occurs, remove the last part of the ldif file: structuralObjectClass: olcSchemaConfig entryUUID: 286b0120-e418-1035-834b-c51fc6ee8bf2 creatorsName: cn=config createTimestamp: 20160722052324Z entryCSN: 20160722052324.908916Z#000000#000#000000 modifiersName: cn=config modifyTimestamp: 20160722052324Z === missing berkleydb files === 58ec6f1e bdb_db_open: database "dc=fluxcoil2,dc=net": recovery skipped in read-only mode. Run manual recovery if errors are encountered. 58ec6f1e bdb_db_open: database "dc=fluxcoil2,dc=net": db_open(/var/lib/ldap2/id2entry.bdb) failed: No such file or directory (2). 58ec6f1e backend_startup_one (type=bdb, suffix="dc=fluxcoil2,dc=net"): bi_db_open failed! (2) slap_startup failed (test would succeed using the -u switch) Here berkley-db files are missing, start slapd directly with the slapd.conf file to get them created: [root@rhel7u2a openldap]# slapd -f slapd.conf [root@rhel7u2a openldap]# [root@rhel7u2a openldap]# pgrep slapd 14296 [root@rhel7u2a openldap]# kill 14296 [root@rhel7u2a openldap]#