extra principals for SSH host certs
This commit is contained in:
@@ -63,6 +63,10 @@ in
|
|||||||
sops.defaultSopsFile = ../../../keys/secrets.yaml;
|
sops.defaultSopsFile = ../../../keys/secrets.yaml;
|
||||||
step-ssh-host = {
|
step-ssh-host = {
|
||||||
hostname = hostname;
|
hostname = hostname;
|
||||||
|
extraPrincipals = [
|
||||||
|
"192.168.1.244"
|
||||||
|
"fded:fb16:653e:25da:be24:11ff:fea0:753f"
|
||||||
|
];
|
||||||
};
|
};
|
||||||
mtls = {
|
mtls = {
|
||||||
enable = true;
|
enable = true;
|
||||||
@@ -73,6 +77,10 @@ in
|
|||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# users.users."${username}".openssh.authorizedKeys.keys = [
|
||||||
|
# "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMOkGLo4N/L3RYvaIZ1FmePlxa1HK0fMciZxKtRhN58F root@janus"
|
||||||
|
# ];
|
||||||
|
|
||||||
home-manager.users."${username}" = {
|
home-manager.users."${username}" = {
|
||||||
imports = with inputs.self.modules.homeManager; [
|
imports = with inputs.self.modules.homeManager; [
|
||||||
mysops
|
mysops
|
||||||
|
|||||||
@@ -5,6 +5,12 @@
|
|||||||
provisionerPasswordPath = config.sops.secrets."janus/admin_jwk".path;
|
provisionerPasswordPath = config.sops.secrets."janus/admin_jwk".path;
|
||||||
sshKeyPath = "/etc/ssh/ssh_host_ed25519_key";
|
sshKeyPath = "/etc/ssh/ssh_host_ed25519_key";
|
||||||
sshCertPath = "${sshKeyPath}-cert.pub";
|
sshCertPath = "${sshKeyPath}-cert.pub";
|
||||||
|
mkPrincipalArgs = principals:
|
||||||
|
lib.concatMapStringsSep " " (principal: ''--principal "${principal}"'') principals;
|
||||||
|
principalArgs = mkPrincipalArgs ([
|
||||||
|
cfg.hostname
|
||||||
|
"${cfg.hostname}.john-stream.com"
|
||||||
|
] ++ cfg.extraPrincipals);
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
# NixOS Options
|
# NixOS Options
|
||||||
@@ -18,6 +24,11 @@
|
|||||||
type = lib.types.str;
|
type = lib.types.str;
|
||||||
default = "admin";
|
default = "admin";
|
||||||
};
|
};
|
||||||
|
extraPrincipals = lib.mkOption {
|
||||||
|
description = "Additional SSH host certificate principals to include per host";
|
||||||
|
type = with lib.types; listOf str;
|
||||||
|
default = [ ];
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
imports = with inputs.self.modules.nixos; [ ssh ];
|
imports = with inputs.self.modules.nixos; [ ssh ];
|
||||||
@@ -39,8 +50,7 @@
|
|||||||
--host --sign \
|
--host --sign \
|
||||||
--provisioner "${cfg.provisioner}" \
|
--provisioner "${cfg.provisioner}" \
|
||||||
--provisioner-password-file "${provisionerPasswordPath}" \
|
--provisioner-password-file "${provisionerPasswordPath}" \
|
||||||
--principal "${cfg.hostname}" \
|
${principalArgs} \
|
||||||
--principal "${cfg.hostname}.john-stream.com" \
|
|
||||||
"${cfg.hostname}" "${sshKeyPath}.pub"
|
"${cfg.hostname}" "${sshKeyPath}.pub"
|
||||||
'')
|
'')
|
||||||
(writeShellScriptBin "ssh-host-cert-check" "${lib.getExe' pkgs.openssh "ssh-keygen"} -Lf ${sshCertPath}")
|
(writeShellScriptBin "ssh-host-cert-check" "${lib.getExe' pkgs.openssh "ssh-keygen"} -Lf ${sshCertPath}")
|
||||||
|
|||||||
Reference in New Issue
Block a user