diff --git a/nixos/hosts/asxpio-ops/default.nix b/nixos/hosts/asxpio-ops/default.nix index 217a176..db58434 100644 --- a/nixos/hosts/asxpio-ops/default.nix +++ b/nixos/hosts/asxpio-ops/default.nix @@ -18,6 +18,11 @@ networking.hostName = lib.mkDefault "asxpio-ops"; networking.domain = "asxp.io"; asxpio.privateIPv4 = "10.10.0.10"; + + # Break-glass for the conversion (MIGRATION.md, Phase 2): root from the + # admin's exit address (services' IPv4, through Xray), in case WireGuard + # does not come back. REMOVE after Phase 2. + asxpio.rootSshFromExtra = lib.mkDefault [ "46.62.228.216/32" ]; system.stateVersion = "26.05"; systemd.network.networks."10-public".address = [ "2a01:4f9:c013:3258::1/64" ]; diff --git a/nixos/modules/base.nix b/nixos/modules/base.nix index e4813c0..01c54aa 100644 --- a/nixos/modules/base.nix +++ b/nixos/modules/base.nix @@ -32,6 +32,12 @@ in description = "Networks shell users may log in from."; }; + options.asxpio.rootSshFromExtra = lib.mkOption { + type = lib.types.listOf lib.types.str; + default = [ ]; + description = "Extra addresses root alone may log in from (break-glass)."; + }; + # Units that own data start only once /var/lib/.data-in-place exists, # so a fresh install never creates empty state where a restore is about # to land. Create the file after the data is in place. @@ -98,15 +104,17 @@ in ]; # Shell users only from the trusted networks; the Hetzner # firewall is the outer layer - AllowUsers = lib.concatMap ( - net: - map (u: "${u}@${net}") [ - "root" - "asxpi" - "deploy" - "zerrtika" - ] - ) config.asxpio.sshFrom; + AllowUsers = + lib.concatMap ( + net: + map (u: "${u}@${net}") [ + "root" + "asxpi" + "deploy" + "zerrtika" + ] + ) config.asxpio.sshFrom + ++ map (net: "root@${net}") config.asxpio.rootSshFromExtra; }; }; services.fail2ban.enable = true;