mirror of https://cgit.krebsco.de/krops/
target: use default port from SSH config
This is the expected behavior. The SSH config is also implicitly used for other SSH-related settings.
This commit is contained in:
parent
05f0d3b5c1
commit
9fc8cbf8e8
|
@ -57,9 +57,9 @@ let {
|
||||||
elemAt' = xs: i: if lib.length xs > i then lib.elemAt xs i else null;
|
elemAt' = xs: i: if lib.length xs > i then lib.elemAt xs i else null;
|
||||||
filterNull = lib.filterAttrs (n: v: v != null);
|
filterNull = lib.filterAttrs (n: v: v != null);
|
||||||
in {
|
in {
|
||||||
user = lib.getEnv "LOGNAME";
|
user = lib.maybeEnv "LOGNAME" null;
|
||||||
host = lib.maybeEnv "HOSTNAME" (lib.maybeHostName "localhost");
|
host = lib.maybeEnv "HOSTNAME" (lib.maybeHostName "localhost");
|
||||||
port = "22";
|
port = null;
|
||||||
path = "/var/src";
|
path = "/var/src";
|
||||||
sudo = false;
|
sudo = false;
|
||||||
extraOptions = [];
|
extraOptions = [];
|
||||||
|
@ -70,6 +70,10 @@ let {
|
||||||
path = elemAt' parse 6;
|
path = elemAt' parse 6;
|
||||||
} else s);
|
} else s);
|
||||||
|
|
||||||
|
mkUserPortSSHOpts = target:
|
||||||
|
(lib.optionals (target.user != null) ["-l" target.user]) ++
|
||||||
|
(lib.optionals (target.port != null) ["-p" target.port]);
|
||||||
|
|
||||||
shell = let
|
shell = let
|
||||||
isSafeChar = lib.testString "[-+./0-9:=A-Z_a-z]";
|
isSafeChar = lib.testString "[-+./0-9:=A-Z_a-z]";
|
||||||
quoteChar = c:
|
quoteChar = c:
|
||||||
|
|
|
@ -20,8 +20,7 @@ in
|
||||||
else
|
else
|
||||||
writers.writeDash "krops.${target.host}.${lib.firstWord command}" ''
|
writers.writeDash "krops.${target.host}.${lib.firstWord command}" ''
|
||||||
exec ${openssh}/bin/ssh ${lib.escapeShellArgs (lib.flatten [
|
exec ${openssh}/bin/ssh ${lib.escapeShellArgs (lib.flatten [
|
||||||
(lib.optionals (target.user != "") ["-l" target.user])
|
(lib.mkUserPortSSHOpts target)
|
||||||
"-p" target.port
|
|
||||||
(if allocateTTY then "-t" else "-T")
|
(if allocateTTY then "-t" else "-T")
|
||||||
target.extraOptions
|
target.extraOptions
|
||||||
target.host
|
target.host
|
||||||
|
|
|
@ -224,8 +224,7 @@ let
|
||||||
|
|
||||||
ssh' = target: concatMapStringsSep " " quote (flatten [
|
ssh' = target: concatMapStringsSep " " quote (flatten [
|
||||||
"${openssh}/bin/ssh"
|
"${openssh}/bin/ssh"
|
||||||
(optionals (target.user != "") ["-l" target.user])
|
(mkUserPortSSHOpts target)
|
||||||
"-p" target.port
|
|
||||||
"-T"
|
"-T"
|
||||||
target.extraOptions
|
target.extraOptions
|
||||||
]);
|
]);
|
||||||
|
|
Loading…
Reference in New Issue