diff options
| author | Alejandro Soto <alejandro@34project.org> | 2023-03-13 14:06:38 -0600 |
|---|---|---|
| committer | Alejandro Soto <alejandro@34project.org> | 2023-03-13 14:06:38 -0600 |
| commit | 4403ea9c920fc8b737d82222ba4637b2963c5bfa (patch) | |
| tree | 483ca7ef97a0fac3359784980c0504ec55d34e43 | |
| parent | 37d81d915370304bc060abf6d5ff15dc1095f0fb (diff) | |
sys/auth: fix SSH OATH
Diffstat (limited to '')
| -rw-r--r-- | sys/auth.nix | 35 |
1 files changed, 33 insertions, 2 deletions
diff --git a/sys/auth.nix b/sys/auth.nix index e85543e..e9723a7 100644 --- a/sys/auth.nix +++ b/sys/auth.nix @@ -1,4 +1,4 @@ -{ lib, config, ... }: +{ config, lib, pkgs, ... }: with lib; let cfg = config.local; in @@ -18,10 +18,11 @@ in enable = true; openFirewall = false; ports = [ 2234 ]; + startWhenNeeded = true; forwardX11 = true; permitRootLogin = "no"; - passwordAuthentication = false; + passwordAuthentication = true; # Necesario para oath, no reemplaza a oath hostKeys = [ { @@ -39,8 +40,38 @@ in type = "ecdsa"; } ]; + + extraConfig = '' + # User 'tunnel' has no password. Use PAM OATH + # and connect with -N, forward with -R. + Match User tunnel + AllowTcpForwarding remote + AllowStreamLocalForwarding no + X11Forwarding no + PermitTunnel no + GatewayPorts no + AllowAgentForwarding no + PermitOpen none + PermitListen 60220 60221 60222 60223 60224 60225 60226 60227 60228 60229 + + Banner ${pkgs.writeText "tunnel-banner" '' + This is a reverse tunnel + ''} + ''; }; networking.firewall.allowedTCPPorts = [ 2234 ]; + + users.users.tunnel = { + uid = 1100; + group = "nogroup"; + isSystemUser = true; + + # Requiere oath + password = "tunnel"; + + home = "/var/empty"; + shell = "${pkgs.coreutils}/bin/true"; + }; }; } |
