Как отключить алгоритмы sshd?

В моем программном обеспечении для сканирования уязвимостей я получаю этот флаг/сообщение

The following weak key exchange algorithms are enabled : 

  diffie-hellman-group-exchange-sha1
  diffie-hellman-group1-sha1

Я хочу отключить эти два алгоритма.

Я запросил конфигурацию sshd_...

[root@vm01 ~]# sshd -T | grep "\(ciphers\|macs\|kexalgorithms\)"
gssapikexalgorithms gss-gex-sha1-,gss-group1-sha1-,gss-group14-sha1-
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,hmac-sha2-512,hmac-sha2-256
kexalgorithms curve25519-sha256,curve25519-sha256@libssh.org,diffie-hellman-group14-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,ecdh-sha2-nistp521,ecdh-sha2-nistp384,ecdh-sha2-nistp256,diffie-hellman-group-exchange-sha256
[root@vm01 ~]# ssh -Q kex
diffie-hellman-group1-sha1
diffie-hellman-group14-sha1
diffie-hellman-group14-sha256
diffie-hellman-group16-sha512
diffie-hellman-group18-sha512
diffie-hellman-group-exchange-sha1
diffie-hellman-group-exchange-sha256
ecdh-sha2-nistp256
ecdh-sha2-nistp384
ecdh-sha2-nistp521
curve25519-sha256
curve25519-sha256@libssh.org
gss-gex-sha1-
gss-group1-sha1-
gss-group14-sha1-
[root@vm01 ~]# sshd -T | grep kex
gssapikexalgorithms gss-gex-sha1-,gss-group1-sha1-,gss-group14-sha1-
kexalgorithms curve25519-sha256,curve25519-sha256@libssh.org,diffie-hellman-group14-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,ecdh-sha2-nistp521,ecdh-sha2-nistp384,ecdh-sha2-nistp25

Как видно из вывода, клиенты могут использовать эти алгоритмы. В конфигурации sshd_нет упоминания об ошибочных алгоритмах, даже в разделе Ciphers:

Ciphers chacha20-poly1305@openssh.com,aes256-gcm@openssh.com,aes128-gcm@openssh.com,aes256-ctr,aes192-ctr,aes128-ctr

. Любая помощь приветствуется.

Примечание. Я использую OpenSSH 7.4

sshd_config

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,hmac-sha2-512,hmac-sha2-256
KexAlgorithms curve25519-sha256,curve25519-sha256@libssh.org,diffie-hellman-group14-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,ecdh-sha2-nistp521,ecdh-sha2-nistp384,ecdh-sha2-nistp256,diffie-hellman-group-exchange-sha256,-diffie-hellman-group1-sha1,diffie-hellman-group-exchange-sha1
1
задан 9 November 2021 в 09:18
1 ответ

Насколько я знаю, OpenSHH поддерживает отключение определенных алгоритмов обмена ключами или шифров (а на самом деле это две разные вещи), предваряя список алгоритмов, которые вы хотите отключить, дефисом / минусом -, хотя более распространенным является явная настройка того, что вы хотите разрешить.

См.: https://man.openbsd.org/sshd_config#KexAlgorithms

Если KexAlgorithms в данный момент не установлен, то ваш сервер использует настройки по умолчанию. Вы можете оставить значения по умолчанию и отключить эти два нарушающих алгоритма обмена слабыми ключами с помощью:

# sshd_config
...
KexAlgorithms -diffie-hellman-group1-sha1,diffie-hellman-group-exchange-sha1

Или вы можете установить более явные сильные настройки, такие как (которые могут нарушить обратную совместимость со старыми клиентами):

# sshd_config
...
KexAlgorithms curve25519-sha256@libssh.org,diffie-hellman-group-exchange-sha256
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,hmac-sha2-512,hmac-sha2-256,umac-128@openssh.com
    
1
ответ дан 9 November 2021 в 09:41

Теги

Похожие вопросы