1 { pkgs, lib, config, hosts, ... }:
3 /* Wireguard is used instead
4 systemd.services.ssh-mermet-reverse = {
5 after = [ "network-online.target" ];
6 wantedBy = [ "multi-user.target" ];
9 # Require services.openssh.gatewayPorts = "clientspecified";
11 ExecStart = ''${pkgs.openssh}/bin/ssh -v -g -N -T \
12 -o ServerAliveInterval=10 \
13 -o ExitOnForwardFailure=yes \
14 -R *:10022:localhost:22 \
15 ${hosts.mermet.extraArgs.ipv4}
22 boot.initrd.network.ssh = {
25 authorizedKeys = config.users.users.root.openssh.authorizedKeys.keys;
26 hostKeys = [ "/root/initrd/ssh.key" ];
38 services.upnpc.redirections =
40 { description = "SSH";
41 externalPort = 22; protocol = "TCP"; duration = 30 * 60;
42 service.wantedBy = ["sshd.service"];
43 service.partOf = ["sshd.service"];
45 { description = "Mosh"; externalPort = 60000; protocol = "UDP"; duration = 30 * 60; service.wantedBy = ["sshd.service"]; }
46 { description = "Mosh"; externalPort = 60001; protocol = "UDP"; duration = 30 * 60; service.wantedBy = ["sshd.service"]; }
47 { description = "Mosh"; externalPort = 60002; protocol = "UDP"; duration = 30 * 60; service.wantedBy = ["sshd.service"]; }
48 { description = "Mosh"; externalPort = 60003; protocol = "UDP"; duration = 30 * 60; service.wantedBy = ["sshd.service"]; }
50 { description = "SSH (boot)";
51 externalPort = 2222; protocol = "TCP"; duration = 0;
52 service.wantedBy = ["sshd.service"];