ssh: disable KbdInteractiveAuthentication by only allowing PubkeyAuthentication

This commit is contained in:
Daniel Langbein 2024-12-08 09:50:19 +01:00
parent 40ed2bc37b
commit 9d5337012d
Signed by: langfingaz
GPG Key ID: 6C47C753F0823002

View File

@ -18,10 +18,22 @@
# Enabling this is required for commands such as sftp and sshfs. # Enabling this is required for commands such as sftp and sshfs.
allowSFTP = false; allowSFTP = false;
settings = { # Only authentication method should be public key.
# Use authorized keys only. #
PasswordAuthentication = false; # https://man.archlinux.org/man/core/openssh/sshd_config.5.en#AuthenticationMethods
# - We change the default of AuthenticationMethods from `any` to `publickey`.
# - Furthermore, we explicitly PubkeyAuthentication to its default value `yes`.
#
# https://nixos.wiki/wiki/SSH_public_key_authentication#SSH_server_config
# Alternatively we could use
# settings.PasswordAuthentication = false;
# settings.KbdInteractiveAuthentication = false;
extraConfig = ''
AuthenticationMethods publickey
PubkeyAuthentication yes
'';
settings = {
# #
# https://infosec.mozilla.org/guidelines/openssh # https://infosec.mozilla.org/guidelines/openssh
# #