diff options
author | Sandro <sandro.jaeckel@gmail.com> | 2022-01-09 21:43:19 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-09 21:43:19 +0100 |
commit | 8928525bd8b8cdc1235a92a89b72cbbe5bd8a00d (patch) | |
tree | cba7e7d04a4dd525f02526b06ea06bcef723b65b /nixos | |
parent | a85f163c46f4315df772946796a6527069789bc7 (diff) | |
parent | 51967ca77a23215df766a4cf72a56ac219e49d2a (diff) | |
download | nixpkgs-8928525bd8b8cdc1235a92a89b72cbbe5bd8a00d.tar nixpkgs-8928525bd8b8cdc1235a92a89b72cbbe5bd8a00d.tar.gz nixpkgs-8928525bd8b8cdc1235a92a89b72cbbe5bd8a00d.tar.bz2 nixpkgs-8928525bd8b8cdc1235a92a89b72cbbe5bd8a00d.tar.lz nixpkgs-8928525bd8b8cdc1235a92a89b72cbbe5bd8a00d.tar.xz nixpkgs-8928525bd8b8cdc1235a92a89b72cbbe5bd8a00d.tar.zst nixpkgs-8928525bd8b8cdc1235a92a89b72cbbe5bd8a00d.zip |
Merge pull request #154124 from Mic92/ddclient
Diffstat (limited to 'nixos')
-rw-r--r-- | nixos/modules/services/networking/ddclient.nix | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/nixos/modules/services/networking/ddclient.nix b/nixos/modules/services/networking/ddclient.nix index 8a2c0fc7080..0bb8c87b38e 100644 --- a/nixos/modules/services/networking/ddclient.nix +++ b/nixos/modules/services/networking/ddclient.nix @@ -13,7 +13,7 @@ let foreground=YES use=${cfg.use} login=${cfg.username} - password= + password=${lib.optionalString (cfg.protocol == "nsupdate") "/run/${RuntimeDirectory}/ddclient.key"} protocol=${cfg.protocol} ${lib.optionalString (cfg.script != "") "script=${cfg.script}"} ${lib.optionalString (cfg.server != "") "server=${cfg.server}"} @@ -29,8 +29,10 @@ let configFile = if (cfg.configFile != null) then cfg.configFile else configFile'; preStart = '' - install ${configFile} /run/${RuntimeDirectory}/ddclient.conf - ${lib.optionalString (cfg.configFile == null) (if (cfg.passwordFile != null) then '' + install --owner ddclient -m600 ${configFile} /run/${RuntimeDirectory}/ddclient.conf + ${lib.optionalString (cfg.configFile == null) (if (cfg.protocol == "nsupdate") then '' + install --owner ddclient -m600 ${cfg.passwordFile} /run/${RuntimeDirectory}/ddclient.key + '' else if (cfg.passwordFile != null) then '' password=$(printf "%q" "$(head -n 1 "${cfg.passwordFile}")") sed -i "s|^password=$|password=$password|" /run/${RuntimeDirectory}/ddclient.conf '' else '' @@ -85,7 +87,9 @@ with lib; }; username = mkOption { - default = ""; + # For `nsupdate` username contains the path to the nsupdate executable + default = lib.optionalString (config.services.ddclient.protocol == "nsupdate") "${pkgs.bind.dnsutils}/bin/nsupdate"; + defaultText = ""; type = str; description = '' User name. @@ -96,7 +100,7 @@ with lib; default = null; type = nullOr str; description = '' - A file containing the password. + A file containing the password or a TSIG key in named format when using the nsupdate protocol. ''; }; |