Skip to content

Commit

Permalink
feat(linux): desktop SSH access server (storopoli#71)
Browse files Browse the repository at this point in the history
* feat(linux): desktop SSH access server

* fix: openssh is false by default
  • Loading branch information
storopoli committed Mar 27, 2024
1 parent a808c95 commit 8d436af
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 2 deletions.
2 changes: 2 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,8 @@
inputs.nixos-hardware.nixosModules.common-pc-ssd
# Filesystem
./linux/filesystem/desktop/filesystem.nix
# Server
./linux/ssh-server.nix
# Nvidia stuff
./linux/nvidia.nix
# Your home-manager configuration
Expand Down
2 changes: 0 additions & 2 deletions linux/networking.nix
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,6 @@
services = {
resolved.enable = true;

openssh.enable = false;

tor.enable = true;
};

Expand Down
43 changes: 43 additions & 0 deletions linux/ssh-server.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{ config, lib, pkgs, ... }:

{

# Enable SSH server with custom hardened configs
services.openssh = {
enable = true;

settings = {
# Modern ciphers/MACs
Ciphers = [
"chacha20-poly1305@openssh.com"
"aes256-gcm@openssh.com"
"aes128-gcm@openssh.com"
"aes256-ctr"
"aes192-ctr"
"aes128-ctr"
];
Macs = [
"hmac-sha2-512-etm@openssh.com"
"hmac-sha2-256-etm@openssh.com"
"umac-128-etm@openssh.com"
];

# require public key authentication for better security
PasswordAuthentication = false;
KbdInteractiveAuthentication = false;

# Only for the user `user`
AllowUsers = [ "user" ];

LogLevel = "INFO";
};
};

# Authorized Keys
users.users."user".openssh.authorizedKeys.keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKU4O0J7gdU1+0/IoVZUtajfmWGGNmA3TFXTsbnQfpwt openpgp:0xC116F831"
];

# Open port 22 in Firewall
networking.firewall.allowedTCPPorts = [ 22 ];
}

0 comments on commit 8d436af

Please sign in to comment.