This commit is contained in:
Tasia Iso 2024-04-24 15:17:34 +02:00
parent 409d5f46ee
commit 0def55578e
Signed by: tasiaiso
SSH key fingerprint: SHA256:KiRjUay5C9i6objsEOIycygBHn54pDBB3Lj7fyJ0Elw
3 changed files with 24 additions and 7 deletions

View file

@ -10,13 +10,14 @@
settings = { settings = {
PermitRootLogin = "no"; PermitRootLogin = "no";
AllowUsers = ["user" "tasia"];
AllowUsers = [ "user" "tasia" ];
# Public key authentiation only # Public key authentiation only
PasswordAuthentication = false; PasswordAuthentication = false;
ChallengeResponseAuthentication = false;
ChallengeResponseAuthentication = true;
KbdInteractiveAuthentication = true; KbdInteractiveAuthentication = true;
AuthenticationMethods = "publickey,keyboard-interactive";
}; };
extraConfig = '' extraConfig = ''
# Only allow SSH v2 # Only allow SSH v2
@ -40,16 +41,25 @@
X11Forwarding no X11Forwarding no
AllowAgentForwarding no AllowAgentForwarding no
AllowStreamLocalForwarding no AllowStreamLocalForwarding no
AuthenticationMethods publickey
''; '';
}; };
security.pam = { security.pam.services = {
services.sshd.googleAuthenticator.enable = true; sshd.text = ''
account required pam_unix.so # unix (order 10900)
auth required ${pkgs.google-authenticator}/lib/security/pam_google_authenticator.so nullok no_increment_hotp # google_authenticator (order 12500)
# auth sufficient pam_permit.so
session required pam_env.so conffile=/etc/pam/environment readenv=0 # env (order 10100)
session required pam_unix.so # unix (order 10200)
session required pam_loginuid.so # loginuid (order 10300)
session optional ${pkgs.systemd}/lib/security/pam_systemd.so # systemd (order 12000)
'';
}; };
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
google-authenticator google-authenticator
]; ];
} }
# ssh R6: StrictHostKeyChecking ask # ssh R6: StrictHostKeyChecking ask

View file

@ -26,6 +26,7 @@
# Peripherals # Peripherals
allow id 046d:c08b serial "178D316C3832" name "G502 HERO Gaming Mouse" allow id 046d:c08b serial "178D316C3832" name "G502 HERO Gaming Mouse"
allow id 18d1:4ee1 serial "28051FDH200ATC" name "Pixel 7"
''; '';
}; };
} }

6
dotfiles/.gitconfig Normal file
View file

@ -0,0 +1,6 @@
[user]
signingkey = /home/tasia/.ssh/id_ed25519
[gpg]
format = ssh
[commit]
gpgsign = true