Ssh

debian 上 sshd 配置中的 HostKeyAlgorithms - 守護程序重新載入失敗

  • May 5, 2017

我有一個 Debian Jessie 伺服器,我想驗證伺服器上關於 DNS SSHFP 記錄的 ssh 密鑰的指紋。這很好用,但是如果客戶端通過 ssh 連接到伺服器,伺服器會提供ssh-ecdsa算法。我想配置只有 ssh-ed25519 並且ssh-rsa 是受支持算法的 ssh 守護程序。對於 Ubuntu 16.04,我使用 ssh 配置密鑰HostKeyAlgorithms,但如果我在 Debian 上使用此密鑰,我將無法啟動守護程序。

為什麼守護程序不支持此配置密鑰,或者我必須使用其他配置密鑰來僅支持 ssh-ed25519 和 ssh-rsa 算法?

這是我的 sshd_config

AcceptEnv LANG LC_*
AuthorizedKeysFile  %h/.ssh/authorized_keys
ChallengeResponseAuthentication no
HostbasedAuthentication no
HostKey         /etc/ssh/ssh_host_rsa_key
HostKey         /etc/ssh/ssh_host_dsa_key
HostKey         /etc/ssh/ssh_host_ecdsa_key
HostKey         /etc/ssh/ssh_host_ed25519_key
#HostKeyAlgorithms  ssh-ed25519,ssh-rsa
KeyRegenerationInterval 3600
LoginGraceTime      120
LogLevel                INFO
MaxAuthTries        10
MaxSessions     5
PasswordAuthentication  no
PermitEmptyPasswords    no
PermitRootLogin     without-password
Port            22
PrintMotd               no
PrintLastLog        no
Protocol        2
RSAAuthentication   no
PubkeyAuthentication    yes
ServerKeyBits       4096
StrictModes     yes
SyslogFacility          AUTH
RhostsRSAAuthentication no
Subsystem       sftp /usr/lib/openssh/sftp-server
TCPKeepAlive        yes
UsePAM          no
UsePrivilegeSeparation  yes

HostKeyAlgorithms在 OpenSSH 6.7p1 中實現,它在 Debian Jessie 中可用。

我想配置只支持 ssh-ed25519 和 ssh-rsa 的算法的 ssh 守護程序

如果您從配置中刪除相應的密鑰,HostKey伺服器將不會提供該密鑰(以下行):

HostKey         /etc/ssh/ssh_host_dsa_key
HostKey         /etc/ssh/ssh_host_ecdsa_key

引用自:https://serverfault.com/questions/848045