diff options
author | Franz Pletz <fpletz@fnordicwalking.de> | 2017-07-20 20:23:52 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-07-20 20:23:52 +0200 |
commit | 00b6ac7bd3f6909674a80b0c02ddf48afd415608 (patch) | |
tree | 67df7de2de16b6dd5ce1bf9a4b3bfa7cba294ef9 /nixos/modules/services/system | |
parent | e849c7645e130772b57fc04681b205d75419e9bd (diff) | |
parent | c3150412c3ed95ff55dd55180c02e227f5d0d371 (diff) |
Merge pull request #26419 from roblabla/feature-sasl
cyrus-sasl: Add saslauthd service and LDAP support
Diffstat (limited to 'nixos/modules/services/system')
-rw-r--r-- | nixos/modules/services/system/saslauthd.nix | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/nixos/modules/services/system/saslauthd.nix b/nixos/modules/services/system/saslauthd.nix new file mode 100644 index 00000000000..281716cf186 --- /dev/null +++ b/nixos/modules/services/system/saslauthd.nix @@ -0,0 +1,63 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + + nssModulesPath = config.system.nssModules.path; + cfg = config.services.saslauthd; + +in + +{ + + ###### interface + + options = { + + services.saslauthd = { + + enable = mkEnableOption "Whether to enable the Cyrus SASL authentication daemon."; + + package = mkOption { + default = pkgs.cyrus_sasl.bin; + defaultText = "pkgs.cyrus_sasl.bin"; + type = types.package; + description = "Cyrus SASL package to use."; + }; + + mechanism = mkOption { + type = types.str; + default = "pam"; + description = "Auth mechanism to use"; + }; + + config = mkOption { + type = types.lines; + default = ""; + description = "Configuration to use for Cyrus SASL authentication daemon."; + }; + + }; + + }; + + + ###### implementation + + config = mkIf cfg.enable { + + systemd.services.saslauthd = { + description = "Cyrus SASL authentication daemon"; + + wantedBy = [ "multi-user.target" ]; + + serviceConfig = { + ExecStart = "@${cfg.package}/sbin/saslauthd saslauthd -a ${cfg.mechanism} -O ${pkgs.writeText "saslauthd.conf" cfg.config}"; + Type = "forking"; + PIDFile = "/run/saslauthd/saslauthd.pid"; + Restart = "always"; + }; + }; + }; +} |