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/systemd.nix | 38 ++++++++++++++++++++++++-------------- 1 file changed, 24 insertions(+), 14 deletions(-) (limited to 'accounts/gkleen@sif/systemd.nix') 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