Add module to configure sshd

This commit is contained in:
Pim Kunis 2024-11-09 16:54:33 +01:00
parent 14e269c02c
commit 59b58faeb5
4 changed files with 50 additions and 5 deletions

View file

@ -1,4 +1,8 @@
{lib, ...}: { {
config,
lib,
...
}: {
config = { config = {
pim = { pim = {
cinnamon.enable = true; cinnamon.enable = true;
@ -6,8 +10,15 @@
facter.reportPath = ./facter.json; facter.reportPath = ./facter.json;
networking.hostName = "gamepc"; networking.hostName = "gamepc";
users.users.pim.password = ""; services.openssh.enable = true;
users.users.root.password = "";
users.users = {
root.password = "";
pim = {
openssh.authorizedKeys.keys = config.pim.ssh.keys.pim;
password = "";
};
};
boot.loader.grub = { boot.loader.grub = {
enable = true; enable = true;

View file

@ -1,6 +1,12 @@
{lib, ...}: { {
config,
lib,
...
}: let
cfg = config.pim.cinnamon;
in {
options.pim.cinnamon.enable = lib.mkEnableOption "cinnamon"; options.pim.cinnamon.enable = lib.mkEnableOption "cinnamon";
config = { config = lib.mkIf cfg.enable {
services = { services = {
displayManager.defaultSession = "cinnamon"; displayManager.defaultSession = "cinnamon";
libinput.enable = true; libinput.enable = true;

View file

@ -20,6 +20,7 @@
./tailscale.nix ./tailscale.nix
./compliance.nix ./compliance.nix
./cinnamon.nix ./cinnamon.nix
./ssh.nix
]; ];
time.timeZone = "Europe/Amsterdam"; time.timeZone = "Europe/Amsterdam";

27
nixos/ssh.nix Normal file
View file

@ -0,0 +1,27 @@
{lib, ...}: {
options = {
pim.ssh.keys = lib.mkOption {
type = lib.types.attrsOf (lib.types.listOf lib.types.str);
};
};
config = {
pim.ssh.keys = {
pim = ["ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOodpLr+FDRyKyHjucHizNLVFHZ5AQmE9GmxMnOsSoaw pimkunis@thinkpadpim"];
niels = ["ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINUZp4BCxf7uLa1QWonx/Crf8tYZ5MKIZ+EuaBa82LrV user@user-laptop"];
};
services = {
openssh = {
openFirewall = true;
settings = {
PasswordAuthentication = false;
KbdInteractiveAuthentication = false;
GSSAPIAuthentication = false;
UseDns = false;
};
};
};
};
}