nixos/openldap: use upstream unit defaults
OpenLDAP since version 2.5.4¹ supports sd_notify, so we should make use of it. Also updates the unit description and documentation with the values upstream provides. Starts slapd only after reaching `network-online.target`, which ensures binding to specific ip addresses is possible, since `network.target` only guarantees interfaces exist, but not that addressing is finished. [1] https://bugs.openldap.org/show_bug.cgi?id=8707
This commit is contained in:
parent
925219f62b
commit
885d4e047b
1 changed files with 8 additions and 3 deletions
|
@ -268,9 +268,14 @@ in {
|
||||||
};
|
};
|
||||||
|
|
||||||
systemd.services.openldap = {
|
systemd.services.openldap = {
|
||||||
description = "LDAP server";
|
description = "OpenLDAP Server Daemon";
|
||||||
|
documentation = [
|
||||||
|
"man:slapd"
|
||||||
|
"man:slapd-config"
|
||||||
|
"man:slapd-mdb"
|
||||||
|
];
|
||||||
wantedBy = [ "multi-user.target" ];
|
wantedBy = [ "multi-user.target" ];
|
||||||
after = [ "network.target" ];
|
after = [ "network-online.target" ];
|
||||||
preStart = let
|
preStart = let
|
||||||
settingsFile = pkgs.writeText "config.ldif" (lib.concatStringsSep "\n" (attrsToLdif "cn=config" cfg.settings));
|
settingsFile = pkgs.writeText "config.ldif" (lib.concatStringsSep "\n" (attrsToLdif "cn=config" cfg.settings));
|
||||||
|
|
||||||
|
@ -306,7 +311,7 @@ in {
|
||||||
"${openldap}/libexec/slapd" "-u" cfg.user "-g" cfg.group "-F" configDir
|
"${openldap}/libexec/slapd" "-u" cfg.user "-g" cfg.group "-F" configDir
|
||||||
"-h" (lib.concatStringsSep " " cfg.urlList)
|
"-h" (lib.concatStringsSep " " cfg.urlList)
|
||||||
]);
|
]);
|
||||||
Type = "forking";
|
Type = "notify";
|
||||||
PIDFile = cfg.settings.attrs.olcPidFile;
|
PIDFile = cfg.settings.attrs.olcPidFile;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue