mirror of
https://github.com/Unkn0wnCat/dotfiles.git
synced 2025-07-30 09:18:21 +02:00
Add ssh configuration
This commit is contained in:
parent
a46d297fc7
commit
2e48cc8833
5 changed files with 49 additions and 6 deletions
|
@ -8,6 +8,7 @@ in {
|
|||
./audio.nix
|
||||
./desktop.nix
|
||||
./yubikey.nix
|
||||
./ssh.nix
|
||||
];
|
||||
|
||||
options.kevin = {
|
||||
|
@ -21,14 +22,15 @@ in {
|
|||
({
|
||||
nixpkgs.config.allowUnfree = true;
|
||||
i18n.defaultLocale = "en_US.UTF-8";
|
||||
|
||||
kevin.ssh.server.enable = true;
|
||||
|
||||
console = {
|
||||
font = "Lat2-Terminus16";
|
||||
keyMap = "de";
|
||||
};
|
||||
|
||||
services.xserver.layout = "de";
|
||||
|
||||
services.xserver.layout = "de";
|
||||
|
||||
environment.systemPackages = with pkgs; [
|
||||
vim
|
||||
wget
|
||||
|
@ -77,6 +79,7 @@ in {
|
|||
description = "Kevin Kandlbinder";
|
||||
extraGroups = [ "wheel" "docker" "dialout" ];
|
||||
};
|
||||
kevin.ssh.authorized.kevin = true;
|
||||
})
|
||||
(mkIf (cfg.defaults == "laptop") {
|
||||
kevin.power.mode = "laptop";
|
||||
|
|
|
@ -6,6 +6,7 @@ in {
|
|||
options.kevin.networking = {
|
||||
enable = mkEnableOption "kevins networking";
|
||||
avahi.enable = mkEnableOption "avahi";
|
||||
ssh.enable = mkEnableOption "ssh";
|
||||
firewall.wireguard = mkEnableOption "wireguard exceptions";
|
||||
firewall.syncthing = mkEnableOption "syncthing exceptions";
|
||||
};
|
||||
|
@ -24,6 +25,17 @@ in {
|
|||
|
||||
networking.firewall.allowedUDPPorts = [ 5353 ];
|
||||
})
|
||||
(mkIf cfg.ssh.enable {
|
||||
services.openssh = {
|
||||
enable = true;
|
||||
# require public key authentication for better security
|
||||
passwordAuthentication = false;
|
||||
kbdInteractiveAuthentication = false;
|
||||
#permitRootLogin = "yes";
|
||||
};
|
||||
|
||||
networking.firewall.allowedTCPPorts = [ 22 ];
|
||||
})
|
||||
(mkIf cfg.firewall.wireguard {
|
||||
networking.firewall = {
|
||||
# if packets are still dropped, they will show up in dmesg
|
||||
|
|
21
nixos/modules/ssh.nix
Normal file
21
nixos/modules/ssh.nix
Normal file
|
@ -0,0 +1,21 @@
|
|||
{ lib, pkgs, config, ... }:
|
||||
with lib;
|
||||
let
|
||||
cfg = config.kevin.ssh;
|
||||
in {
|
||||
options.kevin.ssh = {
|
||||
server.enable = mkEnableOption "kevins ssh";
|
||||
authorized.kevin = mkEnableOption "set authorized for kevin";
|
||||
};
|
||||
|
||||
config = mkMerge [
|
||||
(mkIf cfg.server.enable {
|
||||
kevin.networking.ssh.enable = true;
|
||||
})
|
||||
(mkIf cfg.authorized.kevin {
|
||||
users.users."kevin".openssh.authorizedKeys.keyFiles = [
|
||||
/etc/nixos/ssh/kevin/authorized_keys
|
||||
];
|
||||
})
|
||||
];
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue