Skip to content

Commit

Permalink
feat(nixos): Enable SSH server on PC
Browse files Browse the repository at this point in the history
  • Loading branch information
mrjones2014 committed Nov 26, 2024
1 parent 7dd173a commit c0f0b89
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 15 deletions.
1 change: 1 addition & 0 deletions hosts/pc/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
../../nixos-modules/desktop_environment.nix
../../nixos-modules/_1password.nix
../../nixos-modules/allowed-unfree.nix
../../nixos-modules/sshd.nix
./hardware-configuration.nix
];
boot.loader.efi.efiSysMountPoint = "/boot/efi";
Expand Down
13 changes: 1 addition & 12 deletions hosts/server/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
./containers.nix
./wireguard.nix
./gotify.nix
../../nixos-modules/sshd.nix
];

powerManagement.cpuFreqGovernor = "performance";
Expand All @@ -40,18 +41,6 @@
efi.efiSysMountPoint = "/boot";
};
};
services = {
fail2ban.enable = true;
openssh = {
enable = true;
settings = {
# only allow SSH key auth
PasswordAuthentication = false;
PermitRootLogin = "no";
AllowUsers = [ "mat" ];
};
};
};

# enable vaapi on OS-level
nixpkgs.config.packageOverrides = pkgs: {
Expand Down
3 changes: 0 additions & 3 deletions nixos-modules/common.nix
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,6 @@
"podman"
"dialout" # to connect to arduino
];
openssh.authorizedKeys.keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDsT6GLG7sY8YKX7JM+jqS3EAti3YMzwHKWViveqkZvu"
];
};
};
};
Expand Down
18 changes: 18 additions & 0 deletions nixos-modules/sshd.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
services = {
fail2ban.enable = true;
openssh = {
enable = true;
settings = {
# only allow SSH key auth
PasswordAuthentication = false;
PermitRootLogin = "no";
AllowUsers = [ "mat" ];
};
};
};

user.users.mat.openssh.authorizedKeys.keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDsT6GLG7sY8YKX7JM+jqS3EAti3YMzwHKWViveqkZvu"
];
}

0 comments on commit c0f0b89

Please sign in to comment.