Skip to main content

slapd.d generator

Project description

slapddgen

NOTE: This tool is very very alpha. Works for me, might work for you.

NOTE: Ensure your editor does not strip trailing whitespace if you open any of the files in cn=schema as that will break the ldif format.

slapddgen generates a slapd.d that you can load into an OpenLDAP server by pointing at it with slapd -F. This will start a server with online configuration, aka olc, meaning the configuration itself is stored in the directory server, not in slapd.conf.

The input for this tool is contained in config.json, or whatever --config_file is pointed at. There's too many things to do this with environment variables or CLI switches. Removing things from config.json is guaranteed to blow shit up, though for the modules, ACLs, indices and unique empty arrays should be fine.

Layout

The configuration that gets generated assumes the data in the directory server will be layed yout like this:

- {{suffix}}
--- {{baseOU}},{{suffix}}
----- ou=accounts,{{baseOU}},{{suffix}}
----- ou=groups,{{baseOU}},{{suffix}}
----- ou=policy,{{baseOU}},{{suffix}}

It also assumes there will be a cn=admin,{{suffix}} entity of the organizationalRole type who's member attribute will include the DN of anyone with full administrative access to the server.

The suffix should be self-explanatory but the baseOU typically raises some eyebrows. It's there to facilitate merging multiple LDAP environments later on (say merging two environments after an acquisition) and also allows for easy experimentation under a different base OU without being affected by the ACLs currently in place or risking affecting those ACLs.

Notes

The defaults target an OpenLDAP server running on Alpine, so you might have to adjust the paths in the ldap section of config.json.

It uses the RFC2307bis schema, this is not configurable. As such posixGroup is no longer structural and if you need something to just be a posixGroup you'll have to combine it with another object class. organizationalRole is a decent candidate as it only requires the cn attribute. In most cases you'll probably want to combine a posixGroup with a groupOfNames and use the member attribute with DNs instead of memberUid so that the referential integrity overlay can do its thing for you.

It does not load any data for you, but sets up a few useful defaults and configuration of some initial ACLs, the mdb database backend and a few of the overlays. The result should be an OpenLDAP server with a sensible base configuration that you can then go and tweak.

Note that once the configuration is generated you should not edit the files by hand (or if you do, update the # CRC32 preamble). Instead, once loaded into the server you can use ldapmodify to update the configuration.

The tool will always generate a configuration that uses CRYPT with SHA-512 and 50.000 rounds for the passwords. Though the format is configurable using ldap.saltFormat the use of CRYPT is not. This means that the configuration generated will not work on Windows machines where CRYPT is not available.

You can generate a hash with slappasswd -h '{CRYPT}' -c '$6$rounds=50000$%.16s' for the rootPW. If rootPW starts with {CRYPT} it'll be put into the generated configuration as such, if not it's assumed it's plain text and slapddgen will create a proper hash for it. The configuration additionally sets up the server in such a way that any time a plain text password is submitted to it, it will be hashed before it is actually stored.

The configuration does not include options for TLS, because these vary (unhelpfully) based on what TLS library the server was built with (GnuTLS vs Mozila NSS vs OpenSSL and derivatives). For those refer to man slapd-config and use ldapmodify to update the server after it's been started.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

slapddgen-0.1.0.tar.gz (15.6 kB view details)

Uploaded Source

Built Distribution

slapddgen-0.1.0-py3-none-any.whl (5.3 kB view details)

Uploaded Python 3

File details

Details for the file slapddgen-0.1.0.tar.gz.

File metadata

  • Download URL: slapddgen-0.1.0.tar.gz
  • Upload date:
  • Size: 15.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.0.0 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.7.0

File hashes

Hashes for slapddgen-0.1.0.tar.gz
Algorithm Hash digest
SHA256 a3f0b28cd1baf0a6de9eefd4a3ad82757fc0fdb9a8e681723626bbd6d3b99044
MD5 3d95fd5bc6c42d3da2b52b618f705b41
BLAKE2b-256 9b9d016fda51e92c6927a51b3043faea1e375274fe0579987df8042b0208eba5

See more details on using hashes here.

File details

Details for the file slapddgen-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: slapddgen-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 5.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.0.0 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.7.0

File hashes

Hashes for slapddgen-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2443a84edca781d9319b1fa9f2f8116e18c96f8baa7f3f200f3cd8d34ee44eb7
MD5 52b96acbd621919f1f3e8c85e70f4e96
BLAKE2b-256 88e75acbe7d936a5a1b0600f2b9e0454da6a059e1c5ac05356f40bab866f0221

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page