destructure params in ssh service
This commit is contained in:
parent
9c30b6f882
commit
99f68e5421
@ -3,9 +3,21 @@
|
|||||||
, dropbear
|
, dropbear
|
||||||
, lib
|
, lib
|
||||||
}:
|
}:
|
||||||
{authorizedKeys, ...} @ p :
|
{
|
||||||
|
address,
|
||||||
|
allowLocalPortForward,
|
||||||
|
allowPasswordLogin,
|
||||||
|
allowPasswordLoginForRoot,
|
||||||
|
allowRemoteConnectionToForwardedPorts,
|
||||||
|
allowRemotePortForward,
|
||||||
|
allowRoot,
|
||||||
|
authorizedKeys,
|
||||||
|
port,
|
||||||
|
extraConfig
|
||||||
|
}:
|
||||||
let
|
let
|
||||||
name = "sshd";
|
name = "sshd";
|
||||||
|
inherit (builtins) toString;
|
||||||
inherit (liminix.services) longrun;
|
inherit (liminix.services) longrun;
|
||||||
inherit (lib) concatStringsSep mapAttrs mapAttrsToList;
|
inherit (lib) concatStringsSep mapAttrs mapAttrsToList;
|
||||||
options =
|
options =
|
||||||
@ -16,18 +28,18 @@ let
|
|||||||
"-P /run/dropbear.pid"
|
"-P /run/dropbear.pid"
|
||||||
"-F" # don't fork into background
|
"-F" # don't fork into background
|
||||||
] ++
|
] ++
|
||||||
(lib.optional (! p.allowRoot) "-w") ++
|
(lib.optional (! allowRoot) "-w") ++
|
||||||
(lib.optional (! p.allowPasswordLogin) "-s") ++
|
(lib.optional (! allowPasswordLogin) "-s") ++
|
||||||
(lib.optional (! p.allowPasswordLoginForRoot) "-g") ++
|
(lib.optional (! allowPasswordLoginForRoot) "-g") ++
|
||||||
(lib.optional (! p.allowLocalPortForward) "-j") ++
|
(lib.optional (! allowLocalPortForward) "-j") ++
|
||||||
(lib.optional (! p.allowRemotePortForward) "-k") ++
|
(lib.optional (! allowRemotePortForward) "-k") ++
|
||||||
(lib.optional (! p.allowRemoteConnectionToForwardedPorts) "-a") ++
|
(lib.optional (! allowRemoteConnectionToForwardedPorts) "-a") ++
|
||||||
(lib.optionals (authorizedKeys != null)
|
(lib.optionals (authorizedKeys != null)
|
||||||
["-U" "/run/${name}/authorized_keys/%n"]) ++
|
["-U" "/run/${name}/authorized_keys/%n"]) ++
|
||||||
[(if p.address != null
|
[(if address != null
|
||||||
then "-p ${p.address}:${p.port}"
|
then "-p ${address}:${toString port}"
|
||||||
else "-p ${builtins.toString p.port}")] ++
|
else "-p ${toString port}")] ++
|
||||||
[p.extraConfig];
|
[extraConfig];
|
||||||
authKeysConcat =
|
authKeysConcat =
|
||||||
if authorizedKeys != null
|
if authorizedKeys != null
|
||||||
then mapAttrs
|
then mapAttrs
|
||||||
|
Loading…
Reference in New Issue
Block a user