services: openvpn: servers: authUserPass: allow to be a path
This allows using an agenix file.
This commit is contained in:
parent
673e19dd21
commit
5f33d95144
@ -53,12 +53,15 @@ let
|
|||||||
${optionalString (
|
${optionalString (
|
||||||
cfg.down != "" || cfg.updateResolvConf
|
cfg.down != "" || cfg.updateResolvConf
|
||||||
) "down ${pkgs.writeShellScript "openvpn-${name}-down" downScript}"}
|
) "down ${pkgs.writeShellScript "openvpn-${name}-down" downScript}"}
|
||||||
${optionalString (cfg.authUserPass != null)
|
${optionalString (cfg.authUserPass != null) (
|
||||||
|
if isAttrs cfg.authUserPass then
|
||||||
"auth-user-pass ${pkgs.writeText "openvpn-credentials-${name}" ''
|
"auth-user-pass ${pkgs.writeText "openvpn-credentials-${name}" ''
|
||||||
${cfg.authUserPass.username}
|
${cfg.authUserPass.username}
|
||||||
${cfg.authUserPass.password}
|
${cfg.authUserPass.password}
|
||||||
''}"
|
''}"
|
||||||
}
|
else
|
||||||
|
"auth-user-pass ${cfg.authUserPass}"
|
||||||
|
)}
|
||||||
'';
|
'';
|
||||||
|
|
||||||
in
|
in
|
||||||
@ -202,11 +205,15 @@ in
|
|||||||
This option can be used to store the username / password credentials
|
This option can be used to store the username / password credentials
|
||||||
with the "auth-user-pass" authentication method.
|
with the "auth-user-pass" authentication method.
|
||||||
|
|
||||||
WARNING: Using this option will put the credentials WORLD-READABLE in the Nix store!
|
You can either provide an attribute set of `username` and `password`,
|
||||||
|
or the path to a file containing the credentials on two lines.
|
||||||
|
|
||||||
|
WARNING: If you use an attribute set, this option will put the credentials WORLD-READABLE into the Nix store!
|
||||||
'';
|
'';
|
||||||
type = types.nullOr (
|
type = types.nullOr (
|
||||||
types.submodule {
|
types.oneOf [
|
||||||
|
types.singleLineStr
|
||||||
|
(types.submodule {
|
||||||
options = {
|
options = {
|
||||||
username = mkOption {
|
username = mkOption {
|
||||||
description = "The username to store inside the credentials file.";
|
description = "The username to store inside the credentials file.";
|
||||||
@ -218,7 +225,8 @@ in
|
|||||||
type = types.str;
|
type = types.str;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
})
|
||||||
|
]
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user