From 8001c55931ba6c467f717a6353eeba31697ef082 Mon Sep 17 00:00:00 2001 From: Miguel Palhas Date: Sun, 6 Oct 2024 11:52:19 +0100 Subject: [PATCH] Adding ssh --- home/arrakis/default.nix | 1 + home/common/features/ssh-agent.nix | 4 ++++ hosts/arrakis/default.nix | 8 ++++++++ hosts/common/global/ssh.nix | 11 +++++++++-- 4 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 home/common/features/ssh-agent.nix diff --git a/home/arrakis/default.nix b/home/arrakis/default.nix index c841c5f..17518e8 100644 --- a/home/arrakis/default.nix +++ b/home/arrakis/default.nix @@ -18,6 +18,7 @@ ../common/programs/eww ../common/programs/kitty.nix ../common/features/colorscheme.nix + ../common/features/ssh-agent.nix ]; home.sessionVariables = { diff --git a/home/common/features/ssh-agent.nix b/home/common/features/ssh-agent.nix new file mode 100644 index 0000000..5991ef1 --- /dev/null +++ b/home/common/features/ssh-agent.nix @@ -0,0 +1,4 @@ +{ ... }: +{ + programs.ssh.startAgent = true; +} diff --git a/hosts/arrakis/default.nix b/hosts/arrakis/default.nix index 34abaab..5dc5bad 100644 --- a/hosts/arrakis/default.nix +++ b/hosts/arrakis/default.nix @@ -45,5 +45,13 @@ in ]; shell = pkgs.zsh; initialHashedPassword = "$y$j9T$uRTzF/sBdrqVGZTRhPuR00$wgLgEGlq.lEmlCPiy69jkbtfC9HKpyaVPDHDdBGtE5D"; + openssh.authorizedKeys.keys = + let + authorizedKeys = pkgs.fetchurl { + url = "https://github.com/naps62.keys"; + sha256 = "sha256-dP8LjaburPwfIr2jhly9rMwOLJyUkQP7Em5IKH/qXbY="; + }; + in + pkgs.lib.splitString "\n" (builtins.readFile authorizedKeys); }; } diff --git a/hosts/common/global/ssh.nix b/hosts/common/global/ssh.nix index eefe655..17fa924 100644 --- a/hosts/common/global/ssh.nix +++ b/hosts/common/global/ssh.nix @@ -1,4 +1,11 @@ -{ inputs, pkgs, ... }: +{ pkgs, ... }: { - environment.systemPackages = [ pkgs.openssh ]; + services.openssh = { + enable = true; + settings = { + PasswordAuthentication = false; + KbdInteractiveAuthentication = false; + PermitRootLogin = "no"; + }; + }; }