This commit is contained in:
alsaiduq-lab 2025-03-16 03:05:52 -06:00
parent de4de77a87
commit b4cf61bc23
25 changed files with 287 additions and 100 deletions

View file

@ -1,36 +0,0 @@
{ config, lib, pkgs, ... }:
{
environment.systemPackages = with pkgs; [
autossh
];
systemd.services.autossh-redbot = {
description = "Persistent SSH Tunnel to Cloud Server";
after = [ "network-online.target" ];
wants = [ "network-online.target" ];
wantedBy = [ "multi-user.target" ];
serviceConfig = {
User = "cobray";
Group = "cobray";
Restart = "always";
RestartSec = 30;
EnvironmentFile = "/home/cobray/.secrets/autossh-redbot.conf";
Environment = [
"AUTOSSH_GATETIME=0"
"AUTOSSH_POLL=60"
"AUTOSSH_FIRST_POLL=30"
"AUTOSSH_PORT=0"
];
ExecStart = ''
${pkgs.autossh}/bin/autossh -M 0 -N \
-o "ServerAliveInterval 60" \
-o "ServerAliveCountMax 3" \
-o "ExitOnForwardFailure=yes" \
-o "ConnectTimeout=10" \
-R "0.0.0.0:$REMOTE_PORT:localhost:$LOCAL_PORT" \
root@$REMOTE_HOST
'';
};
};
}