From ca4548ad71aa906b516b1c37dcc65b3963e41130 Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Mon, 27 Dec 2021 16:35:57 +0100 Subject: gkleen@sif: socks proxy vidhar --- accounts/gkleen@sif/ssh-hosts.nix | 10 ++++++++++ accounts/gkleen@sif/systemd.nix | 38 ++++++++++++++++++++++++-------------- 2 files changed, 34 insertions(+), 14 deletions(-) (limited to 'accounts/gkleen@sif') diff --git a/accounts/gkleen@sif/ssh-hosts.nix b/accounts/gkleen@sif/ssh-hosts.nix index ff319d02..e2bd2375 100644 --- a/accounts/gkleen@sif/ssh-hosts.nix +++ b/accounts/gkleen@sif/ssh-hosts.nix @@ -267,6 +267,16 @@ ControlMaster = "no"; }; }; + "proxy.vidhar" = + { hostname = "vidhar.yggdrasil"; + identityFile = "~/.ssh/gkleen@sif.midgard.yggdrasil"; + extraOptions = { + ControlPath = "none"; + ExitOnForwardFailure = "yes"; + ServerAliveCountMax = "15"; + ServerAliveInterval = "2"; + }; + }; "math60" = { hostname = "math60.math.lmu.de"; }; diff --git a/accounts/gkleen@sif/systemd.nix b/accounts/gkleen@sif/systemd.nix index a32e61b2..06eaef4f 100644 --- a/accounts/gkleen@sif/systemd.nix +++ b/accounts/gkleen@sif/systemd.nix @@ -90,26 +90,36 @@ in { StartLimitBurst = 7; }; }; - "proxy-to-autossh-socks@8118" = { - Unit = { - Requires = ["autossh-socks@proxy.mathw0h:8119.service" "proxy-to-autossh-socks@8118.socket"]; - After = ["autossh-socks@proxy.mathw0h:8119.service" "proxy-to-autossh-socks@8118.socket"]; - }; + "autossh-socks@proxy.mathw0h:8121" = { Service = { - ExecStart = "${pkgs.systemd}/lib/systemd/systemd-socket-proxyd --exit-idle-time=10s localhost:8119"; + Type = "notify"; + NotifyAccess = "all"; + WorkingDirectory = "~"; + Restart = "always"; + RestartSec = "2s"; + ExecStart = "${autossh-socks-script} \"%I\""; + }; + Unit = { + StopWhenUnneeded = true; }; }; - }; - sockets = { - "proxy-to-autossh-socks@8118" = { - Socket = { - ListenStream = "%I"; + } // listToAttrs (map (port: nameValuePair "proxy-to-autossh-socks@${port}" { + Unit = { + Requires = ["autossh-socks@proxy.mathw0h:${port + 1}.service" "proxy-to-autossh-socks@${port}.socket"]; + After = ["autossh-socks@proxy.mathw0h:${port + 1}.service" "proxy-to-autossh-socks@${port}.socket"]; }; - Install = { - WantedBy = ["default.target"]; + Service = { + ExecStart = "${pkgs.systemd}/lib/systemd/systemd-socket-proxyd --exit-idle-time=10s localhost:${port + 1}"; }; + }) [8118 8120]); + sockets = listToAttrs (map (port: nameValuePair "proxy-to-autossh-socks@${port}" { + Socket = { + ListenStream = "%I"; }; - }; + Install = { + WantedBy = ["default.target"]; + }; + }) [8118 8120]); timers = { sync-keepass = { Timer = { -- cgit v1.2.3