ddclient service: use environment.etc
The ddclient daemon requires that the configuration file is only accessible by the ddclient user. This since it typically contains login information.
This commit is contained in:
parent
781cd33f3b
commit
9f4775dbb5
@ -7,22 +7,8 @@ let
|
|||||||
|
|
||||||
stateDir = "/var/spool/ddclient";
|
stateDir = "/var/spool/ddclient";
|
||||||
ddclientUser = "ddclient";
|
ddclientUser = "ddclient";
|
||||||
ddclientFlags = "-foreground -verbose -noquiet -file ${ddclientCfg}";
|
ddclientFlags = "-foreground -verbose -noquiet -file /etc/ddclient.conf";
|
||||||
ddclientPIDFile = "${stateDir}/ddclient.pid";
|
ddclientPIDFile = "${stateDir}/ddclient.pid";
|
||||||
ddclientCfg = pkgs.writeText "ddclient.conf" ''
|
|
||||||
daemon=600
|
|
||||||
cache=${stateDir}/ddclient.cache
|
|
||||||
pid=${ddclientPIDFile}
|
|
||||||
use=${config.services.ddclient.use}
|
|
||||||
login=${config.services.ddclient.username}
|
|
||||||
password=${config.services.ddclient.password}
|
|
||||||
protocol=${config.services.ddclient.protocol}
|
|
||||||
server=${config.services.ddclient.server}
|
|
||||||
ssl=${if config.services.ddclient.ssl then "yes" else "no"}
|
|
||||||
wildcard=YES
|
|
||||||
${config.services.ddclient.domain}
|
|
||||||
${config.services.ddclient.extraConfig}
|
|
||||||
'';
|
|
||||||
|
|
||||||
in
|
in
|
||||||
|
|
||||||
@ -122,10 +108,30 @@ in
|
|||||||
home = stateDir;
|
home = stateDir;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
environment.etc."ddclient.conf" = {
|
||||||
|
uid = config.ids.uids.ddclient;
|
||||||
|
mode = "0600";
|
||||||
|
text = ''
|
||||||
|
daemon=600
|
||||||
|
cache=${stateDir}/ddclient.cache
|
||||||
|
pid=${ddclientPIDFile}
|
||||||
|
use=${config.services.ddclient.use}
|
||||||
|
login=${config.services.ddclient.username}
|
||||||
|
password=${config.services.ddclient.password}
|
||||||
|
protocol=${config.services.ddclient.protocol}
|
||||||
|
server=${config.services.ddclient.server}
|
||||||
|
ssl=${if config.services.ddclient.ssl then "yes" else "no"}
|
||||||
|
wildcard=YES
|
||||||
|
${config.services.ddclient.domain}
|
||||||
|
${config.services.ddclient.extraConfig}
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
systemd.services.ddclient = {
|
systemd.services.ddclient = {
|
||||||
description = "Dynamic DNS Client";
|
description = "Dynamic DNS Client";
|
||||||
wantedBy = [ "multi-user.target" ];
|
wantedBy = [ "multi-user.target" ];
|
||||||
after = [ "network.target" ];
|
after = [ "network.target" ];
|
||||||
|
restartTriggers = [ config.environment.etc."ddclient.conf".source ];
|
||||||
|
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
# Uncomment this if too many problems occur:
|
# Uncomment this if too many problems occur:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user