cntlm: refactor to systemd service, fixes #11339

This commit is contained in:
Markus Wotringer 2015-11-29 01:30:42 +01:00 committed by Rok Garbas
parent f399ab50d8
commit 9a350d5f1e

View file

@ -73,29 +73,28 @@ in
###### implementation
config = mkIf config.services.cntlm.enable {
systemd.services.cntlm = {
description = "CNTLM is an NTLM / NTLM Session Response / NTLMv2 authenticating HTTP proxy";
after = [ "network.target" ];
wantedBy = [ "multi-user.target" ];
serviceConfig = {
Type = "forking";
User = "cntlm";
ExecStart = ''
${pkgs.cntlm}/bin/cntlm -U cntlm \
-c ${pkgs.writeText "cntlm_config" cfg.extraConfig}
'';
};
};
services.cntlm.netbios_hostname = mkDefault config.networking.hostName;
users.extraUsers = singleton {
users.extraUsers.cntlm = {
name = "cntlm";
description = "cntlm system-wide daemon";
home = "/var/empty";
};
jobs.cntlm =
{ description = "CNTLM is an NTLM / NTLM Session Response / NTLMv2 authenticating HTTP proxy";
startOn = "started network-interfaces";
daemonType = "fork";
exec =
''
${pkgs.cntlm}/bin/cntlm -U cntlm \
-c ${pkgs.writeText "cntlm_config" cfg.extraConfig}
'';
};
services.cntlm.extraConfig =
''
# Cntlm Authentication Proxy Configuration
@ -108,8 +107,7 @@ in
${concatMapStrings (port: ''
Listen ${toString port}
'') cfg.port}
'';
'';
};
}