mirror of
https://github.com/SebastianStork/nixos-config.git
synced 2026-01-21 15:11:34 +01:00
nebula/sshd: Only allow key auth
This commit is contained in:
parent
2f4a83a906
commit
72ed799826
6 changed files with 57 additions and 10 deletions
|
|
@ -1,4 +1,9 @@
|
|||
{ config, lib, ... }:
|
||||
{
|
||||
config,
|
||||
self,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
let
|
||||
cfg = config.custom.services.nebula.node;
|
||||
in
|
||||
|
|
@ -25,13 +30,18 @@ in
|
|||
addr = cfg.address;
|
||||
inherit (cfg.sshd) port;
|
||||
};
|
||||
settings = {
|
||||
PasswordAuthentication = false;
|
||||
KbdInteractiveAuthentication = false;
|
||||
PermitRootLogin = "no";
|
||||
};
|
||||
};
|
||||
|
||||
nebula.networks.mesh.firewall.inbound =
|
||||
config.custom.services.nebula.peers
|
||||
|> lib.filter (node: node.isClient)
|
||||
|> lib.map (nebula: {
|
||||
port = "22";
|
||||
inherit (cfg.sshd) port;
|
||||
proto = "tcp";
|
||||
host = nebula.name;
|
||||
});
|
||||
|
|
@ -41,5 +51,14 @@ in
|
|||
requires = [ "nebula@mesh.service" ];
|
||||
after = [ "nebula@mesh.service" ];
|
||||
};
|
||||
|
||||
users.users.seb.openssh.authorizedKeys.keyFiles =
|
||||
self.nixosConfigurations
|
||||
|> lib.filterAttrs (name: _: name != config.networking.hostName)
|
||||
|> lib.attrValues
|
||||
|> lib.filter (value: value.config |> lib.hasAttr "home-manager")
|
||||
|> lib.map (value: value.config.home-manager.users.seb.custom.programs.ssh)
|
||||
|> lib.filter (ssh: ssh.enable)
|
||||
|> lib.map (ssh: ssh.publicKeyPath);
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue