nixos/iodine: passwordFile option #24288
This commit is contained in:
parent
16c5866cec
commit
276d10dae6
@ -32,7 +32,7 @@ in
|
|||||||
foo = {
|
foo = {
|
||||||
server = "tunnel.mdomain.com";
|
server = "tunnel.mdomain.com";
|
||||||
relay = "8.8.8.8";
|
relay = "8.8.8.8";
|
||||||
extraConfig = "-P mysecurepassword";
|
extraConfig = "-v";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
'';
|
'';
|
||||||
@ -57,7 +57,13 @@ in
|
|||||||
type = types.str;
|
type = types.str;
|
||||||
default = "";
|
default = "";
|
||||||
description = "Additional command line parameters";
|
description = "Additional command line parameters";
|
||||||
example = "-P mysecurepassword -l 192.168.1.10 -p 23";
|
example = "-l 192.168.1.10 -p 23";
|
||||||
|
};
|
||||||
|
|
||||||
|
passwordFile = mkOption {
|
||||||
|
type = types.str;
|
||||||
|
default = "";
|
||||||
|
description = "File that containts password";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}));
|
}));
|
||||||
@ -88,7 +94,13 @@ in
|
|||||||
type = types.str;
|
type = types.str;
|
||||||
default = "";
|
default = "";
|
||||||
description = "Additional command line parameters";
|
description = "Additional command line parameters";
|
||||||
example = "-P mysecurepassword -l 192.168.1.10 -p 23";
|
example = "-l 192.168.1.10 -p 23";
|
||||||
|
};
|
||||||
|
|
||||||
|
passwordFile = mkOption {
|
||||||
|
type = types.str;
|
||||||
|
default = "";
|
||||||
|
description = "File that containts password";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -108,10 +120,18 @@ in
|
|||||||
description = "iodine client - ${name}";
|
description = "iodine client - ${name}";
|
||||||
after = [ "network.target" ];
|
after = [ "network.target" ];
|
||||||
wantedBy = [ "multi-user.target" ];
|
wantedBy = [ "multi-user.target" ];
|
||||||
|
preStart = ''
|
||||||
|
cat > /run/iodine/${name}-script << EOF
|
||||||
|
#!/bin/sh
|
||||||
|
${pkgs.iodine}/bin/iodine -f -u ${iodinedUser} ${cfg.extraConfig} ${optionalString (cfg.passwordFile != "") "-P $(cat \"${cfg.passwordFile}\")"} ${cfg.relay} ${cfg.server}
|
||||||
|
EOF
|
||||||
|
chmod 700 /run/iodine/${name}-script
|
||||||
|
'';
|
||||||
|
script = "/run/iodine/${name}-script";
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
RestartSec = "30s";
|
RestartSec = "30s";
|
||||||
Restart = "always";
|
Restart = "always";
|
||||||
ExecStart = "${pkgs.iodine}/bin/iodine -f -u ${iodinedUser} ${cfg.extraConfig} ${cfg.relay} ${cfg.server}";
|
RuntimeDirectory = [ "iodine" ];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
@ -124,7 +144,15 @@ in
|
|||||||
description = "iodine, ip over dns server daemon";
|
description = "iodine, ip over dns server daemon";
|
||||||
after = [ "network.target" ];
|
after = [ "network.target" ];
|
||||||
wantedBy = [ "multi-user.target" ];
|
wantedBy = [ "multi-user.target" ];
|
||||||
serviceConfig.ExecStart = "${pkgs.iodine}/bin/iodined -f -u ${iodinedUser} ${cfg.server.extraConfig} ${cfg.server.ip} ${cfg.server.domain}";
|
preStart = ''
|
||||||
|
cat > /run/iodined/script << EOF
|
||||||
|
#!/bin/sh
|
||||||
|
${pkgs.iodine}/bin/iodined -f -u ${iodinedUser} ${cfg.server.extraConfig} ${optionalString (cfg.passwordFile != "") "-P $(cat \"${cfg.passwordFile}\")"} ${cfg.server.ip} ${cfg.server.domain}
|
||||||
|
EOF
|
||||||
|
chmod 700 /run/iodined/script
|
||||||
|
'';
|
||||||
|
script = "/run/iodined/script";
|
||||||
|
serviceConfig.RuntimeDirectory = [ "iodined" ];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user