fix user public keys

This commit is contained in:
Dennis Wuitz 2023-12-25 18:54:38 +01:00
parent dd4466b5a3
commit 7fcf8af4ad
7 changed files with 26 additions and 23 deletions

6
flake.lock generated
View File

@ -7,11 +7,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1703368619, "lastModified": 1703499046,
"narHash": "sha256-ZGPMYL7FMA6enhuwby961bBANmoFX14EA86m2/Jw5Jo=", "narHash": "sha256-A6wclPJCOMEYuD28KBOBTwHEVOKy3f9yvuMFAJ55dco=",
"owner": "nix-community", "owner": "nix-community",
"repo": "home-manager", "repo": "home-manager",
"rev": "a2523ea0343b056ba240abbac90ab5f116a7aa7b", "rev": "d5a917bab40daf4e5f82cd27162b8a6656d3beab",
"type": "github" "type": "github"
}, },
"original": { "original": {

View File

@ -52,18 +52,25 @@
] ++ modules ++ fileList "modules" ] ++ modules ++ fileList "modules"
++ map(user: { config, lib, pkgs, ... }@args: { ++ map(user: { config, lib, pkgs, ... }@args: {
users.users.${user} = import ./users/${user} (args // { name = "${user}"; }); users.users.${user} = import ./users/${user} (args // { name = "${user}"; });
boot.initrd.network.ssh.authorizedKeys = config.users.users.${user}.openssh.authorizedKeys.keys;
}) users }) users
++ map(user: { home-manager.users.${user} = import ./users/${user}/home.nix; }) users; ++ map(user: { home-manager.users.${user} = import ./users/${user}/home.nix; }) users;
}; };
in { in {
photon = constructSystem { photon = constructSystem {
hostname = "photon"; hostname = "photon";
users = ["dennis"]; users = [
"alice"
"dennis"
];
}; };
palatine-hill = constructSystem { palatine-hill = constructSystem {
hostname = "palatine-hill"; hostname = "palatine-hill";
users = ["alice"]; users = [
"alice"
"dennis"
];
}; };
}; };
}; };

View File

@ -14,6 +14,7 @@ in
description = "The cpu-type installed on the server."; description = "The cpu-type installed on the server.";
}; };
amdGPU = libS.mkOpinionatedOption "the system contains a AMD GPU"; amdGPU = libS.mkOpinionatedOption "the system contains a AMD GPU";
fullDiskEncryption = libS.mkOpinionatedOption "use luks full disk encrytion";
}; };
}; };
@ -22,19 +23,15 @@ in
# networking for netcard kernelModules = [ "e1000e" ]; # networking for netcard kernelModules = [ "e1000e" ];
kernelModules = lib.mkIf cfg.amdGPU [ "amdgpu" ]; kernelModules = lib.mkIf cfg.amdGPU [ "amdgpu" ];
network.enable = true; network = lib.mkIf cfg.fullDiskEncryption {
network.ssh = { enable = true;
ssh = {
enable = true; enable = true;
hostKeys = [ hostKeys = [
"/root/ssh_key" "/root/ssh_key"
]; ];
port = 2222; port = 2222;
}; };
luks = {
devices."cryptroot" = {
device = "/dev/sda1";
preLVM = true;
};
}; };
}; };

View File

@ -21,7 +21,6 @@
enable = true; enable = true;
fixPermissions = true; fixPermissions = true;
extraConfig = ''StreamLocalBindUnlink yes''; extraConfig = ''StreamLocalBindUnlink yes'';
authorizedKeysFiles = [ "../users/dennis/keys/yubikey.pub" ];
settings = { settings = {
PermitRootLogin = "no"; PermitRootLogin = "no";
PasswordAuthentication = false; PasswordAuthentication = false;

View File

@ -2,9 +2,8 @@
{ {
time.timeZone = "America/New_York"; time.timeZone = "America/New_York";
console.keyMap = "us"; console.keyMap = "us";
boot.zfs.extraPools = [ "ZFS-primary" ];
networking.hostId = "dc2f9781"; networking.hostId = "dc2f9781";
boot.initrd.network.ssh.authorizedKeys = [ "ssh-ed25519 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" ]; boot.zfs.extraPools = [ "ZFS-primary" ];
virtualisation = { virtualisation = {
docker = { docker = {

View File

@ -1,5 +1,7 @@
{ pkgs, lib, config, name, ... }: { pkgs, lib, config, name, ... }:
import ../default.nix { import ../default.nix {
inherit pkgs lib config name; inherit pkgs lib config name;
pubKeys = [ "ed25516-AAAAAAA" ]; publicKeys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOGcqhLaKsjwAnb6plDavAhEyQHNvFS9Uh5lMTuwMhGF alice@parthenon-7588"
];
} }

View File

@ -3,14 +3,13 @@
config, config,
pkgs, pkgs,
name, name,
pubKeys ? [], publicKeys ? [],
defaultShell ? "zsh", defaultShell ? "zsh",
}: }:
{ {
inherit name; inherit name;
isNormalUser = true; isNormalUser = true;
uid = 1000;
extraGroups = [ extraGroups = [
"wheel" "wheel"
"media" "media"
@ -24,5 +23,5 @@
"uaccess" "uaccess"
]; ];
shell = pkgs.${defaultShell}; shell = pkgs.${defaultShell};
openssh.authorizedKeys.keys = pubKeys; openssh.authorizedKeys.keys = publicKeys;
} }