diff --git a/home/programs/ssh/default.nix b/home/programs/ssh/default.nix index d629d7a..afbd190 100644 --- a/home/programs/ssh/default.nix +++ b/home/programs/ssh/default.nix @@ -25,18 +25,18 @@ in enableDefaultConfig = false; - matchBlocks."*" = { - forwardAgent = false; - addKeysToAgent = "no"; - compression = false; - serverAliveInterval = 0; - serverAliveCountMax = 3; - hashKnownHosts = false; - userKnownHostsFile = "~/.ssh/known_hosts"; - # controlPersist = "10m"; - controlPersist = "no"; - controlMaster = "auto"; - controlPath = "${controlMastersDir}/%n%C"; + settings."*" = { + ForwardAgent = false; + AddKeysToAgent = "no"; + Compression = false; + ServerAliveInterval = 0; + ServerAliveCountMax = 3; + HashKnownHosts = false; + UserKnownHostsFile = "~/.ssh/known_hosts"; + ControlPersist = "10m"; + # ControlPersist = "no"; + ControlMaster = "auto"; + ControlPath = "${controlMastersDir}/%n%C"; }; }; diff --git a/home/programs/ssh/home.nix b/home/programs/ssh/home.nix index 182b303..bd02874 100644 --- a/home/programs/ssh/home.nix +++ b/home/programs/ssh/home.nix @@ -1,25 +1,25 @@ { ... }: { - programs.ssh.matchBlocks = { + programs.ssh.settings = { suiseir = { - user = "h7x4"; - hostname = "heimen.hopto.me"; - port = 23934; + User = "h7x4"; + Hostname = "heimen.hopto.me"; + Port = 23934; }; pir = { - user = "h7x4"; - hostname = "gingakei.loginto.me"; - port = 41348; + User = "h7x4"; + Hostname = "gingakei.loginto.me"; + Port = 41348; }; tsukir = { - user = "h7x4"; - hostname = "gingakei.loginto.me"; - port = 45497; + User = "h7x4"; + Hostname = "gingakei.loginto.me"; + Port = 45497; }; "git.nani.wtf git.tsuki.local git.seiun.cloud" = { - user = "git"; - hostname = "gingakei.loginto.me"; - port = 45497; + User = "git"; + Hostname = "gingakei.loginto.me"; + Port = 45497; }; }; } diff --git a/home/programs/ssh/kyoto-u.nix b/home/programs/ssh/kyoto-u.nix index ea3514d..77fdc2b 100644 --- a/home/programs/ssh/kyoto-u.nix +++ b/home/programs/ssh/kyoto-u.nix @@ -1,16 +1,16 @@ { lib, ... }: let default = { - user = "oysteikt"; - identityFile = [ "~/.ssh/id_ed25519" ]; + User = "oysteikt"; + IdentityFile = [ "~/.ssh/id_ed25519" ]; }; in { - programs.ssh.matchBlocks = { + programs.ssh.settings = { "io" = default // { hostname = "io.kuis.kyoto-u.ac.jp"; # SOCKS proxy for access to internal web. - dynamicForwards = [{ port = 8080; }]; + # dynamicForwards = [{ port = 8080; }]; }; } // (lib.genAttrs [ "argo" @@ -19,7 +19,7 @@ in "vega" "leo" ] (name: default // { - hostname = "${name}.fos.kuis.kyoto-u.ac.jp"; - proxyJump = "io"; + Hostname = "${name}.fos.kuis.kyoto-u.ac.jp"; + ProxyJump = "io"; })); } diff --git a/home/programs/ssh/other.nix b/home/programs/ssh/other.nix index 21d1fb5..658be6a 100644 --- a/home/programs/ssh/other.nix +++ b/home/programs/ssh/other.nix @@ -1,34 +1,34 @@ { lib, ... }: { - programs.ssh.matchBlocks = { + programs.ssh.settings = { "ntnu" = { - user = "oysteikt"; - hostname = "login.stud.ntnu.no"; - proxyJump = "pvv"; + User = "oysteikt"; + Hostname = "login.stud.ntnu.no"; + ProxyJump = "pvv"; }; "github" = { - user = "git"; - hostname = "github.com"; - identityFile = [ "~/.ssh/id_rsa" ]; + User = "git"; + Hostname = "github.com"; + IdentityFile = [ "~/.ssh/id_rsa" ]; }; "gitlab.stud.idi.ntnu.no" = { - user = "git"; - proxyJump = "pvv"; + User = "git"; + ProxyJump = "pvv"; }; "pascal wack" = { - user = "h7x4"; - hostname = "wiki.wackattack.eu"; - port = 1337; + User = "h7x4"; + Hostname = "wiki.wackattack.eu"; + Port = 1337; }; "garp" = { - user = "h7x4"; - hostname = "garp.pbsds.net"; - proxyJump = "pvv"; + User = "h7x4"; + Hostname = "garp.pbsds.net"; + ProxyJump = "pvv"; }; "bolle" = { - user = "h7x4"; - hostname = "bolle.pbsds.net"; - proxyJump = "pvv"; + User = "h7x4"; + Hostname = "bolle.pbsds.net"; + ProxyJump = "pvv"; }; }; } diff --git a/home/programs/ssh/pvv.nix b/home/programs/ssh/pvv.nix index baa6736..3b6341d 100644 --- a/home/programs/ssh/pvv.nix +++ b/home/programs/ssh/pvv.nix @@ -2,14 +2,14 @@ let # http://www.pvv.ntnu.no/pvv/Maskiner normalMachines = [ { - names = [ "hildring" "pvv-login" ]; - proxyJump = lib.mkDefault null; - addressFamily = "inet"; + _names = [ "hildring" "pvv-login" ]; + ProxyJump = lib.mkDefault null; + AddressFamily = "inet"; } { - names = [ "drolsum" "pvv-login2" "pvv" ]; - proxyJump = lib.mkDefault null; - addressFamily = "inet"; + _names = [ "drolsum" "pvv-login2" "pvv" ]; + ProxyJump = lib.mkDefault null; + AddressFamily = "inet"; } "bakke" [ "bekkalokk" "pvv-web" "pvv-wiki" "pvv-webmail" ] @@ -31,9 +31,9 @@ let # http://www.pvv.ntnu.no/pvv/Maskiner "lupine-4" "lupine-5" { - names = [ "microbel" "pvv-users" "pvv-mail" ]; - proxyJump = lib.mkDefault null; - addressFamily = "inet"; + _names = [ "microbel" "pvv-users" "pvv-mail" ]; + ProxyJump = lib.mkDefault null; + AddressFamily = "inet"; } "mirage" "orchid" @@ -57,8 +57,8 @@ let # http://www.pvv.ntnu.no/pvv/Maskiner [ "principal" "pvv-backup" ] [ "skrott" "dibbler" ] { - names = [ "sleipner" "pvv-salt" ]; - user = "oysteikt/admin"; + _names = [ "sleipner" "pvv-salt" ]; + User = "oysteikt/admin"; } "buskerud" "smask" @@ -69,37 +69,41 @@ let # http://www.pvv.ntnu.no/pvv/Maskiner overrideIfNotExists = b: a: a // (builtins.removeAttrs b (builtins.attrNames a)); - coerce = user: machines: lib.pipe machines [ - (m: if builtins.isString m then { names = [m]; } else m) - (m: if builtins.isList m then { names = m; } else m) - (overrideIfNotExists { inherit user; }) + coerce = User: machines: lib.pipe machines [ + (m: if builtins.isString m then { _names = [m]; } else m) + (m: if builtins.isList m then { _names = m; } else m) + (overrideIfNotExists { inherit User; }) ]; normalUser = "oysteikt"; matchConfig = let - machines = (map (coerce normalUser) normalMachines) ++ (map (coerce "root") rootMachines); - setVars = orig@{ names, ... }: { - name = builtins.concatStringsSep " " names; + machines = (map (coerce normalUser) normalMachines) ++ (map (m: (coerce "root" m) // { + SetEnv = { + LOGNAME_OVERRIDE = "%u"; + }; + }) rootMachines); + setVars = orig@{ _names, ... }: { + name = builtins.concatStringsSep " " _names; value = overrideIfNotExists { - hostname = "${builtins.head names}.pvv.ntnu.no"; - proxyJump = "microbel"; - addressFamily = "inet"; - } (builtins.removeAttrs orig ["names"]); + Hostname = "${builtins.head _names}.pvv.ntnu.no"; + ProxyJump = "microbel"; + AddressFamily = "inet"; + } (builtins.removeAttrs orig ["_names"]); }; in builtins.listToAttrs (map setVars machines); in { - programs.ssh.matchBlocks = lib.mergeAttrsList [ + programs.ssh.settings = lib.mergeAttrsList [ matchConfig { "pvv-git git.pvv.ntnu.no" = { - hostname = "git.pvv.ntnu.no"; - user = "gitea"; - addressFamily = "inet"; - port = 2222; - proxyJump = "microbel"; + Hostname = "git.pvv.ntnu.no"; + User = "gitea"; + AddressFamily = "inet"; + Port = 2222; + ProxyJump = "microbel"; }; } ];