34 lines
772 B
Nix
34 lines
772 B
Nix
{ lib, config, ... }:
|
|
let
|
|
sshPort = 22;
|
|
in
|
|
|
|
{
|
|
services.openssh = {
|
|
enable = true;
|
|
ports = [ sshPort ];
|
|
authorizedKeysFiles = lib.mkForce ["/etc/ssh/authorized_keys.d/%u"];
|
|
hostKeys = [{
|
|
path = "/persist/etc/ssh/ssh_host_ed25519_key";
|
|
type = "ed25519";
|
|
}];
|
|
settings = {
|
|
PasswordAuthentication = false;
|
|
PermitRootLogin = "no";
|
|
PubKeyAuthentication = "yes";
|
|
StreamLocalBindUnlink = "yes";
|
|
UsePAM = true;
|
|
};
|
|
};
|
|
security.pam = {
|
|
sshAgentAuth.enable = true;
|
|
};
|
|
programs.ssh.extraConfig = ''
|
|
Host git.bitlab21.com
|
|
IdentitiesOnly yes
|
|
StrictHostKeyChecking no
|
|
IdentityFile /etc/ssh/deploy_key-ssh-ed25519
|
|
'';
|
|
networking.firewall.allowedTCPPorts = [ sshPort ];
|
|
}
|