1
0

profiles/common-ssh: Migrate common SSH config to profile and pin SSH public hosts keys for net.clerie.de

This commit is contained in:
2025-11-16 14:22:50 +01:00
parent 2d9836f793
commit f17a94c578
5 changed files with 31 additions and 19 deletions

View File

@@ -8,7 +8,6 @@
./locale.nix
./networking.nix
./programs.nix
./ssh.nix
./systemd.nix
./user.nix
];

View File

@@ -1,16 +0,0 @@
{ lib, ... }:
{
services.openssh.enable = true;
services.openssh.settings = {
PasswordAuthentication = false;
KbdInteractiveAuthentication = false;
PermitRootLogin = lib.mkDefault "no";
};
services.openssh.hostKeys = lib.mkForce [
# Only create ed25519 host keys
{ type = "ed25519"; path = "/etc/ssh/ssh_host_ed25519_key"; }
];
}

View File

@@ -0,0 +1,29 @@
{ config, lib, pkgs, ... }:
with lib;
{
options.profiles.clerie.common-ssh = {
enable = mkEnableOption "Common ssh config";
};
config = mkIf config.profiles.clerie.common-ssh.enable {
services.openssh.enable = true;
services.openssh.settings = {
PasswordAuthentication = false;
KbdInteractiveAuthentication = false;
PermitRootLogin = lib.mkDefault "no";
};
services.openssh.hostKeys = lib.mkForce [
# Only create ed25519 host keys
{ type = "ed25519"; path = "/etc/ssh/ssh_host_ed25519_key"; }
];
programs.ssh.knownHostsFiles = [
(pkgs.clerie-ssh-known-hosts + "/known_hosts")
];
};
}

View File

@@ -11,10 +11,9 @@ with lib;
config = mkIf config.profiles.clerie.common.enable {
profiles.clerie.common-dns.enable = mkDefault true;
profiles.clerie.common-networking.enable = mkDefault true;
profiles.clerie.common-nix.enable = mkDefault true;
profiles.clerie.common-ssh.enable = mkDefault true;
profiles.clerie.common-webserver.enable = mkDefault true;
profiles.clerie.hetzner-storage-box-client.enable = mkDefault true;

View File

@@ -7,6 +7,7 @@
./common-dns
./common-networking
./common-nix
./common-ssh
./common-webserver
./cybercluster-vm
./desktop