You are familiar that
posixGroup
schema in LDAP is structural. This has some disadvantages like you have to synchronise two structural entries of Object Class posixGroup
and groupOfNames
if you need both Object Class for representing the same Group with the same users. Some further discussion here.
For this purpose the old nis (rfc2307) scheme has been extended under the name rfc2307bis. The rfc2307bis schema remove the structural flag from the posixGroup
and make it auxilary. With the rfc2307bis schema you can simply add the posixGroup
Object Class to a already existing groupOfName
(or a similar one) entry to make the group also a unix group
This guide was tested on Ubuntu Server 12.04.4 LTS and 14.04.1 LTS with OpenLDAP 2.14.31 but should also work on all openLDAP installations.
Installtion Type
Fresh Installtion
Normally on a fresh installation of the slapd
package you had to simply add the rfc2307bis.ldif
schema to your configuration and you are finshed. But the rfc2307 schema is a core schema; quite every other schema depend on it, so this and some other ones are directly initialized during the package install:
- core
- cosine
- inetorgperson
- nis (rfc2307)
nis
schema ...
Production System
Well if you had already posixGroup
entries in your LDAP directory, then the things are more complicated. With the change from structural to auxilary every 'posixGroup' became invalid and the slapd*
won't start. The Procedure should be as following:
-
Make a backup!! There are many reasons why the transformation could fail. Especially if you use dynamic configuration with
cn=config
. Any mistake in your configuraton prevents the start ofslapd
and the server must run to do a configuration, so with no backup you have no other choise then purging your data. -
convert
posixGroup
togroupOfNames
- make a list of all
posixGroup
and their containig users. - delete all
posixGroup
and creategroupOfNames
instead. - ** (!) Make sure that tere is no
posixGroup
left in your LDAP directory**. That's important!
- make a list of all
- Replace nis (rfc2307) with rfc2307bis (e.g. this guide)
- Iterate through your list and add the now auxilary Object Class
posixGroup
to your structuralgroupOfNames
entries
sudo slapcat -n 0 > config.ldifWhat teh file includes depends on your already added schemas, but it schould contain at least the following schemas:
- dn: cn=schema,cn=config
- dn: cn={0}core,cn=schema,cn=config
- dn: cn={1}cosine,cn=schema,cn=config
- dn: cn={2}nis,cn=schema,cn=config
- dn: cn={3}inetorgperson,cn=schema,cn=config
- dn: olcBackend={0}hdb,cn=config
- dn: olcDatabase={-1}frontend,cn=config
- dn: olcDatabase={0}config,cn=config
- dn: olcDatabase={1}hdb,cn=config
config.ldif
delete all from
n: cn={2}nis,cn=schema,cn=config objectClass: olcSchemaConfig cn: {2}nis olcAttributeTypes: {0}( 1.3.6.1.1.1.1.2 NAME ...until (inclusive) right before
dn: cn={3}inetorgperson,cn=schema,cn=config
schema
structuralObjectClass: olcSchemaConfig entryUUID: 5827577a-b34f-1033-8297-1948286386c7 creatorsName: cn=config createTimestamp: 20140808135504Z entryCSN: 20140808135505.000499Z#000000#000#000000 modifiersName: cn=config modifyTimestamp: 20140808135504ZNow you had to get the rfc2307bis schema. There are many pages from where you can download it, but there is also a package wich include it:
sudo apt-get install gosa-schemaThis package contains some schemas, that are needed by the gui frontend gosa² for LDAP, but the package only contains schemas, so you must not install gosa² itself or any other schema included in the package. copy the content of the file (on some other destributions like Debian the dir is
/etc/openldap/...
)
/etc/ldap/schema/gosa/rfc2307bis.ldifto the place in
config.ldif
to the same place where you removed the nis schema (The oder is important!)
Then change the rfc3207bis header from
dn: cn=rfc2307bis,cn=schema,cn=config objectClass: olcSchemaConfig cn: rfc2307bisto
dn: cn={2}rfc2307bis,cn=schema,cn=config objectClass: olcSchemaConfig cn: {2}rfc2307bisstop deamon
sudo service slapd stopdelete your old configuration
sudo rm -r /etc/ldap/slapd.d/*restore your
config.ldif
with the new schema
sudo slapadd -F /etc/ldap/slapd.d -n 0 -l config.ldifif successfull the output should be
_#################### 100.00% eta none elapsed none fast! Closing DB...correct permissions, so
slap
can read the files (on some other distributions like Debian the user/group is called ldap
)
sudo chown -R openldap:openldap /etc/ldap/slapd.d/start deamon
sudo service slapd startAnd that it! Congratulations you have now the rfc2307bis schema! further notes if you like to use a gui then your selection is limited in contrast to the old nis schema. The most of them support it, but its often a premium paid feature. gosa² supports it for free, but it required many additional schemas and force to set many attributes, wich you might not want. Its not really flexable ...