2014-05-05 20:58:51 +02:00
|
|
|
{pkgs, config, lib, ...}:
|
2010-08-06 10:49:08 +02:00
|
|
|
|
|
|
|
let
|
|
|
|
|
2014-05-05 20:58:51 +02:00
|
|
|
inherit (lib) mkOption mkIf singleton;
|
2010-08-06 10:49:08 +02:00
|
|
|
|
|
|
|
inherit (pkgs) heimdal;
|
|
|
|
|
|
|
|
stateDir = "/var/heimdal";
|
|
|
|
in
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
###### interface
|
2011-09-14 20:20:50 +02:00
|
|
|
|
2010-08-06 10:49:08 +02:00
|
|
|
options = {
|
2011-09-14 20:20:50 +02:00
|
|
|
|
2010-08-06 10:49:08 +02:00
|
|
|
services.kerberos_server = {
|
|
|
|
|
|
|
|
enable = mkOption {
|
|
|
|
default = false;
|
|
|
|
description = ''
|
|
|
|
Enable the kerberos authentification server.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
###### implementation
|
|
|
|
|
|
|
|
config = mkIf config.services.kerberos_server.enable {
|
2011-09-14 20:20:50 +02:00
|
|
|
|
2010-08-06 10:49:08 +02:00
|
|
|
environment.systemPackages = [ heimdal ];
|
2011-09-14 20:20:50 +02:00
|
|
|
|
2010-08-06 10:49:08 +02:00
|
|
|
services.xinetd.enable = true;
|
2014-05-05 20:58:51 +02:00
|
|
|
services.xinetd.services = lib.singleton
|
2010-08-06 10:49:08 +02:00
|
|
|
{ name = "kerberos-adm";
|
|
|
|
flags = "REUSE NAMEINARGS";
|
|
|
|
protocol = "tcp";
|
|
|
|
user = "root";
|
2012-11-29 15:16:30 +01:00
|
|
|
server = "${pkgs.tcp_wrappers}/sbin/tcpd";
|
2010-08-06 10:49:08 +02:00
|
|
|
serverArgs = "${pkgs.heimdal}/sbin/kadmind";
|
|
|
|
};
|
|
|
|
|
2016-01-06 07:50:18 +01:00
|
|
|
systemd.services.kdc = {
|
|
|
|
description = "Kerberos Domain Controller daemon";
|
|
|
|
wantedBy = [ "multi-user.target" ];
|
|
|
|
preStart = ''
|
|
|
|
mkdir -m 0755 -p ${stateDir}
|
|
|
|
'';
|
|
|
|
script = "${heimdal}/sbin/kdc";
|
|
|
|
};
|
2010-08-06 10:49:08 +02:00
|
|
|
|
2016-01-06 07:50:18 +01:00
|
|
|
systemd.services.kpasswdd = {
|
|
|
|
description = "Kerberos Domain Controller daemon";
|
|
|
|
wantedBy = [ "multi-user.target" ];
|
|
|
|
script = "${heimdal}/sbin/kpasswdd";
|
|
|
|
};
|
2010-08-06 10:49:08 +02:00
|
|
|
};
|
2011-09-14 20:20:50 +02:00
|
|
|
|
2010-08-06 10:49:08 +02:00
|
|
|
}
|