Merge pull request #26419 from roblabla/feature-sasl
cyrus-sasl: Add saslauthd service and LDAP support
This commit is contained in:
commit
00b6ac7bd3
nixos/modules
pkgs/development/libraries/cyrus-sasl
@ -567,6 +567,7 @@
|
|||||||
./services/system/earlyoom.nix
|
./services/system/earlyoom.nix
|
||||||
./services/system/kerberos.nix
|
./services/system/kerberos.nix
|
||||||
./services/system/nscd.nix
|
./services/system/nscd.nix
|
||||||
|
./services/system/saslauthd.nix
|
||||||
./services/system/uptimed.nix
|
./services/system/uptimed.nix
|
||||||
./services/torrent/deluge.nix
|
./services/torrent/deluge.nix
|
||||||
./services/torrent/flexget.nix
|
./services/torrent/flexget.nix
|
||||||
|
63
nixos/modules/services/system/saslauthd.nix
Normal file
63
nixos/modules/services/system/saslauthd.nix
Normal file
@ -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";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
@ -1,4 +1,4 @@
|
|||||||
{ lib, stdenv, fetchurl, openssl, kerberos, db, gettext, pam, fixDarwinDylibNames, autoreconfHook }:
|
{ lib, stdenv, fetchurl, openssl, openldap, kerberos, db, gettext, pam, fixDarwinDylibNames, autoreconfHook, enableLdap ? false }:
|
||||||
|
|
||||||
with stdenv.lib;
|
with stdenv.lib;
|
||||||
stdenv.mkDerivation rec {
|
stdenv.mkDerivation rec {
|
||||||
@ -14,6 +14,7 @@ stdenv.mkDerivation rec {
|
|||||||
|
|
||||||
buildInputs =
|
buildInputs =
|
||||||
[ openssl db gettext kerberos ]
|
[ openssl db gettext kerberos ]
|
||||||
|
++ lib.optional enableLdap openldap
|
||||||
++ lib.optional stdenv.isFreeBSD autoreconfHook
|
++ lib.optional stdenv.isFreeBSD autoreconfHook
|
||||||
++ lib.optional stdenv.isLinux pam
|
++ lib.optional stdenv.isLinux pam
|
||||||
++ lib.optional stdenv.isDarwin fixDarwinDylibNames;
|
++ lib.optional stdenv.isDarwin fixDarwinDylibNames;
|
||||||
@ -29,12 +30,11 @@ stdenv.mkDerivation rec {
|
|||||||
|
|
||||||
configureFlags = [
|
configureFlags = [
|
||||||
"--with-openssl=${openssl.dev}"
|
"--with-openssl=${openssl.dev}"
|
||||||
];
|
] ++ lib.optional enableLdap "--with-ldap=${openldap.dev}";
|
||||||
|
|
||||||
# Set this variable at build-time to make sure $out can be evaluated.
|
# Set this variable at build-time to make sure $out can be evaluated.
|
||||||
preConfigure = ''
|
preConfigure = ''
|
||||||
configureFlagsArray=( --with-plugindir=$out/lib/sasl2
|
configureFlagsArray=( --with-plugindir=$out/lib/sasl2
|
||||||
--with-configdir=$out/lib/sasl2
|
|
||||||
--with-saslauthd=/run/saslauthd
|
--with-saslauthd=/run/saslauthd
|
||||||
--enable-login
|
--enable-login
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user