diff options
| author | Gregor Kleen <gkleen@yggdrasil.li> | 2025-03-16 17:49:46 +0100 |
|---|---|---|
| committer | Gregor Kleen <gkleen@yggdrasil.li> | 2025-03-16 17:49:46 +0100 |
| commit | d39f5c9752645f913bdaeb51acbc35518be43540 (patch) | |
| tree | ab38596d7eac6393030454028eeef1b30657d888 /accounts/gkleen@sif | |
| parent | 804533cde06189bb2109c063092d59b2d53ee4db (diff) | |
| download | nixos-d39f5c9752645f913bdaeb51acbc35518be43540.tar nixos-d39f5c9752645f913bdaeb51acbc35518be43540.tar.gz nixos-d39f5c9752645f913bdaeb51acbc35518be43540.tar.bz2 nixos-d39f5c9752645f913bdaeb51acbc35518be43540.tar.xz nixos-d39f5c9752645f913bdaeb51acbc35518be43540.zip | |
...
Diffstat (limited to 'accounts/gkleen@sif')
| -rw-r--r-- | accounts/gkleen@sif/default.nix | 2 | ||||
| -rw-r--r-- | accounts/gkleen@sif/ssh-hosts.nix | 40 | ||||
| -rw-r--r-- | accounts/gkleen@sif/systemd.nix | 6 |
3 files changed, 25 insertions, 23 deletions
diff --git a/accounts/gkleen@sif/default.nix b/accounts/gkleen@sif/default.nix index 1254b6db..a30fb35c 100644 --- a/accounts/gkleen@sif/default.nix +++ b/accounts/gkleen@sif/default.nix | |||
| @@ -86,7 +86,7 @@ in { | |||
| 86 | 86 | ||
| 87 | programs = { | 87 | programs = { |
| 88 | ssh = { | 88 | ssh = { |
| 89 | matchBlocks = import ./ssh-hosts.nix { inherit pkgs; }; # customUtils.nixImport { dir = ./ssh-hosts; }; | 89 | matchBlocks = import ./ssh-hosts.nix inputs; # customUtils.nixImport { dir = ./ssh-hosts; }; |
| 90 | extraConfig = '' | 90 | extraConfig = '' |
| 91 | Match host uniworx3.ifi.lmu.de,uniworx4.ifi.lmu.de,uniworx5.ifi.lmu.de,uni2workgw.ifi.lmu.de,blackbeard.tcs.ifi.lmu.de,gitlab2.rz.ifi.lmu.de,oregon.tcs.ifi.lmu.de !exec "nc -z -w 1 %h %p &>/dev/null" | 91 | Match host uniworx3.ifi.lmu.de,uniworx4.ifi.lmu.de,uniworx5.ifi.lmu.de,uni2workgw.ifi.lmu.de,blackbeard.tcs.ifi.lmu.de,gitlab2.rz.ifi.lmu.de,oregon.tcs.ifi.lmu.de !exec "nc -z -w 1 %h %p &>/dev/null" |
| 92 | ProxyJump remote.cip.ifi.lmu.de | 92 | ProxyJump remote.cip.ifi.lmu.de |
diff --git a/accounts/gkleen@sif/ssh-hosts.nix b/accounts/gkleen@sif/ssh-hosts.nix index 4ca9e052..871b7350 100644 --- a/accounts/gkleen@sif/ssh-hosts.nix +++ b/accounts/gkleen@sif/ssh-hosts.nix | |||
| @@ -1,5 +1,7 @@ | |||
| 1 | { pkgs, ... }: | 1 | { lib, pkgs, ... }: |
| 2 | { | 2 | let |
| 3 | autosshProxy = port: "${lib.getExe pkgs.socat} - SOCKS4A:127.0.0.1:%h:%p,socksport=${toString port}"; | ||
| 4 | in { | ||
| 3 | "git.ymir" = | 5 | "git.ymir" = |
| 4 | { hostname = "ymir.yggdrasil.li"; | 6 | { hostname = "ymir.yggdrasil.li"; |
| 5 | user = "gitolite"; | 7 | user = "gitolite"; |
| @@ -290,15 +292,15 @@ | |||
| 290 | }; | 292 | }; |
| 291 | "mathw0d" = | 293 | "mathw0d" = |
| 292 | { hostname = "mathw0d.mathinst.loc"; | 294 | { hostname = "mathw0d.mathinst.loc"; |
| 293 | proxyJump = "mathw0h"; | 295 | proxyCommand = autosshProxy 8122; |
| 294 | }; | 296 | }; |
| 295 | "mathw0e" = | 297 | "mathw0e" = |
| 296 | { hostname = "mathw0e.mathinst.loc"; | 298 | { hostname = "mathw0e.mathinst.loc"; |
| 297 | proxyJump = "mathw0h"; | 299 | proxyCommand = autosshProxy 8122; |
| 298 | }; | 300 | }; |
| 299 | "mathw0f" = | 301 | "mathw0f" = |
| 300 | { hostname = "mathw0f.mathinst.loc"; | 302 | { hostname = "mathw0f.mathinst.loc"; |
| 301 | proxyJump = "mathw0h"; | 303 | proxyCommand = autosshProxy 8122; |
| 302 | }; | 304 | }; |
| 303 | "mathw0g" = | 305 | "mathw0g" = |
| 304 | { hostname = "mathw0g.mathinst.loc"; | 306 | { hostname = "mathw0g.mathinst.loc"; |
| @@ -381,31 +383,31 @@ | |||
| 381 | }; | 383 | }; |
| 382 | "tts-www01" = | 384 | "tts-www01" = |
| 383 | { hostname = "tts-www01.mathinst.loc"; | 385 | { hostname = "tts-www01.mathinst.loc"; |
| 384 | proxyJump = "mathw0h"; | 386 | proxyCommand = autosshProxy 8122; |
| 385 | user = "root"; | 387 | user = "root"; |
| 386 | }; | 388 | }; |
| 387 | "vpn-wg01" = | 389 | "vpn-wg01" = |
| 388 | { hostname = "vpn-wg01.mathinst.loc"; | 390 | { hostname = "vpn-wg01.mathinst.loc"; |
| 389 | proxyJump = "mathw0h"; | 391 | proxyCommand = autosshProxy 8122; |
| 390 | user = "root"; | 392 | user = "root"; |
| 391 | }; | 393 | }; |
| 392 | "repo-apt01" = | 394 | "repo-apt01" = |
| 393 | { hostname = "repo-apt01.mathinst.loc"; | 395 | { hostname = "repo-apt01.mathinst.loc"; |
| 394 | proxyJump = "mathw0h"; | 396 | proxyCommand = autosshProxy 8122; |
| 395 | user = "root"; | 397 | user = "root"; |
| 396 | }; | 398 | }; |
| 397 | "ldap-lmumr01" = | 399 | "ldap-lmumr01" = |
| 398 | { hostname = "ldap-lmumr01.mathinst.loc"; | 400 | { hostname = "ldap-lmumr01.mathinst.loc"; |
| 399 | proxyJump = "mathw0h"; | 401 | proxyCommand = autosshProxy 8122; |
| 400 | user = "root"; | 402 | user = "root"; |
| 401 | }; | 403 | }; |
| 402 | "mail-mi01" = | 404 | "mail-mi01" = |
| 403 | { hostname = "mail-mi01.mathinst.loc"; | 405 | { hostname = "mail-mi01.mathinst.loc"; |
| 404 | proxyJump = "mathw0h"; | 406 | proxyCommand = autosshProxy 8122; |
| 405 | }; | 407 | }; |
| 406 | "mail-www02" = | 408 | "mail-www02" = |
| 407 | { hostname = "mail-www02.mathinst.loc"; | 409 | { hostname = "mail-www02.mathinst.loc"; |
| 408 | proxyJump = "mathw0h"; | 410 | proxyCommand = autosshProxy 8122; |
| 409 | }; | 411 | }; |
| 410 | "dpl-fai01" = | 412 | "dpl-fai01" = |
| 411 | { hostname = "dpl-fai01.mathinst.loc"; | 413 | { hostname = "dpl-fai01.mathinst.loc"; |
| @@ -413,7 +415,7 @@ | |||
| 413 | }; | 415 | }; |
| 414 | "math05" = | 416 | "math05" = |
| 415 | { hostname = "math05.mathinst.loc"; | 417 | { hostname = "math05.mathinst.loc"; |
| 416 | proxyJump = "mathw0h"; | 418 | proxyCommand = autosshProxy 8122; |
| 417 | extraOptions.KexAlgorithms = "+diffie-hellman-group1-sha1"; | 419 | extraOptions.KexAlgorithms = "+diffie-hellman-group1-sha1"; |
| 418 | }; | 420 | }; |
| 419 | "switch01" = | 421 | "switch01" = |
| @@ -439,20 +441,20 @@ | |||
| 439 | }; | 441 | }; |
| 440 | "www-mi01" = | 442 | "www-mi01" = |
| 441 | { hostname = "www-mi01.mathinst.loc"; | 443 | { hostname = "www-mi01.mathinst.loc"; |
| 442 | proxyJump = "mathw0h"; | 444 | proxyCommand = autosshProxy 8122; |
| 443 | }; | 445 | }; |
| 444 | "cip04" = | 446 | "cip04" = |
| 445 | { hostname = "cip04.cipmath.loc"; | 447 | { hostname = "cip04.cipmath.loc"; |
| 446 | proxyJump = "mathw0h"; | 448 | proxyCommand = autosshProxy 8122; |
| 447 | }; | 449 | }; |
| 448 | "mgmt-cls01" = | 450 | "mgmt-cls01" = |
| 449 | { user = "root"; | 451 | { user = "root"; |
| 450 | hostname = "mgmt-cls01.cipmath.loc"; | 452 | hostname = "mgmt-cls01.cipmath.loc"; |
| 451 | proxyJump = "ssh.math.lmu.de"; | 453 | proxyCommand = autosshProxy 8118; |
| 452 | }; | 454 | }; |
| 453 | "mgmt01" = | 455 | "mgmt01" = |
| 454 | { hostname = "mgmt01.mathinst.loc"; | 456 | { hostname = "mgmt01.mathinst.loc"; |
| 455 | proxyJump = "mathw0h"; | 457 | proxyCommand = autosshProxy 8122; |
| 456 | user = "root"; | 458 | user = "root"; |
| 457 | }; | 459 | }; |
| 458 | "ssh-lb01" = | 460 | "ssh-lb01" = |
| @@ -471,17 +473,17 @@ | |||
| 471 | "rdlx02" = { hostname = "rdlx02.mathinst.loc"; proxyJump = "mgmt01"; }; | 473 | "rdlx02" = { hostname = "rdlx02.mathinst.loc"; proxyJump = "mgmt01"; }; |
| 472 | "math0d" = | 474 | "math0d" = |
| 473 | { hostname = "math0d.mathinst.loc"; | 475 | { hostname = "math0d.mathinst.loc"; |
| 474 | proxyJump = "mathw0h"; | 476 | proxyCommand = autosshProxy 8122; |
| 475 | }; | 477 | }; |
| 476 | "dhcp01" = | 478 | "dhcp01" = |
| 477 | { hostname = "dhcp01.mathinst.loc"; | 479 | { hostname = "dhcp01.mathinst.loc"; |
| 478 | user = "root"; | 480 | user = "root"; |
| 479 | proxyJump = "mathw0h"; | 481 | proxyCommand = autosshProxy 8122; |
| 480 | }; | 482 | }; |
| 481 | "dhcp02" = | 483 | "dhcp02" = |
| 482 | { hostname = "dhcp02.mathinst.loc"; | 484 | { hostname = "dhcp02.mathinst.loc"; |
| 483 | user = "root"; | 485 | user = "root"; |
| 484 | proxyJump = "mathw0h"; | 486 | proxyCommand = autosshProxy 8122; |
| 485 | }; | 487 | }; |
| 486 | "cc-gpu-l01" = | 488 | "cc-gpu-l01" = |
| 487 | { hostname = "cc-gpu-l01.mathinst.loc"; | 489 | { hostname = "cc-gpu-l01.mathinst.loc"; |
diff --git a/accounts/gkleen@sif/systemd.nix b/accounts/gkleen@sif/systemd.nix index 14669a1e..886f6da1 100644 --- a/accounts/gkleen@sif/systemd.nix +++ b/accounts/gkleen@sif/systemd.nix | |||
| @@ -20,7 +20,7 @@ let | |||
| 20 | cmd+=(--) | 20 | cmd+=(--) |
| 21 | fi | 21 | fi |
| 22 | 22 | ||
| 23 | cmd+=(${lib.getExe' pkgs.openssh "ssh"} -vN -D localhost:''${port} "''${host}") | 23 | cmd+=(${lib.getExe' pkgs.openssh "ssh"} -vN -D 127.0.0.1:''${port} "''${host}") |
| 24 | 24 | ||
| 25 | ( exec -a "''${cmd[1]}" -- ''${cmd} ) & | 25 | ( exec -a "''${cmd[1]}" -- ''${cmd} ) & |
| 26 | pid=$! | 26 | pid=$! |
| @@ -364,11 +364,11 @@ in { | |||
| 364 | }; | 364 | }; |
| 365 | } // listToAttrs (map ({host, port}: nameValuePair "proxy-to-autossh-socks@${toString port}" { | 365 | } // listToAttrs (map ({host, port}: nameValuePair "proxy-to-autossh-socks@${toString port}" { |
| 366 | Unit = { | 366 | Unit = { |
| 367 | Requires = ["autossh-socks@${host}:${toString (port + 1)}.service" "proxy-to-autossh-socks@${toString port}.socket"]; | 367 | BindsTo = ["autossh-socks@${host}:${toString (port + 1)}.service" "proxy-to-autossh-socks@${toString port}.socket"]; |
| 368 | After = ["autossh-socks@${host}:${toString (port + 1)}.service" "proxy-to-autossh-socks@${toString port}.socket"]; | 368 | After = ["autossh-socks@${host}:${toString (port + 1)}.service" "proxy-to-autossh-socks@${toString port}.socket"]; |
| 369 | }; | 369 | }; |
| 370 | Service = { | 370 | Service = { |
| 371 | ExecStart = "${config.systemd.package}/lib/systemd/systemd-socket-proxyd --exit-idle-time=10s localhost:${toString (port + 1)}"; | 371 | ExecStart = "${config.systemd.package}/lib/systemd/systemd-socket-proxyd --exit-idle-time=10s 127.0.0.1:${toString (port + 1)}"; |
| 372 | }; | 372 | }; |
| 373 | }) [{ host = "proxy.ssh.math.lmu.de"; port = 8118; } { host = "proxy.vidhar"; port = 8120; } { host = "proxy.mathw0h"; port = 8122; }]); | 373 | }) [{ host = "proxy.ssh.math.lmu.de"; port = 8118; } { host = "proxy.vidhar"; port = 8120; } { host = "proxy.mathw0h"; port = 8122; }]); |
| 374 | sockets = listToAttrs (map (port: nameValuePair "proxy-to-autossh-socks@${toString port}" { | 374 | sockets = listToAttrs (map (port: nameValuePair "proxy-to-autossh-socks@${toString port}" { |
