fix and cleanup
This commit is contained in:
parent
b4cf61bc23
commit
f52aee3469
18 changed files with 45 additions and 133 deletions
|
|
@ -1,21 +1,16 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
{
|
||||
environment.systemPackages = with pkgs; [
|
||||
autossh
|
||||
];
|
||||
home.packages = with pkgs; [ autossh ];
|
||||
|
||||
systemd.services.autossh-redbot = {
|
||||
description = "Persistent SSH Tunnel to server";
|
||||
after = [ "network-online.target" ];
|
||||
wants = [ "network-online.target" ];
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
systemd.user.services.autossh-redbot = {
|
||||
unitConfig = {
|
||||
Description = "Persistent SSH Tunnel to server";
|
||||
WantedBy = "default.target";
|
||||
};
|
||||
serviceConfig = {
|
||||
User = "cobray";
|
||||
Group = "cobray";
|
||||
Restart = "always";
|
||||
RestartSec = 30;
|
||||
EnvironmentFile = "/home/cobray/.secrets/autossh-redbot.conf";
|
||||
RestartSec = "30";
|
||||
EnvironmentFile = "/home/cobray/nix/.secrets/autossh-redbot.conf";
|
||||
Environment = [
|
||||
"AUTOSSH_GATETIME=0"
|
||||
"AUTOSSH_POLL=60"
|
||||
|
|
@ -23,13 +18,13 @@
|
|||
"AUTOSSH_PORT=0"
|
||||
];
|
||||
ExecStart = ''
|
||||
${pkgs.autossh}/bin/autossh -M 0 -N \
|
||||
/nix/store/abc123-autossh-1.4g/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
|
||||
-R "0.0.0.0:2222:localhost:22" \
|
||||
root@your-real-host.com
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue