GNU/Linux >> Linux の 問題 >  >> Linux

弱い鍵交換アルゴリズム、SSHのCBCモードを無効にする

Nessus脆弱性スキャナーが報告されました–SSHウィークキー交換アルゴリズムが有効でSSHサーバーCBCモード暗号が有効です。詳細なメッセージは、SSHサーバーが弱いと見なされる鍵交換アルゴリズムを許可し、攻撃者が暗号文から平文を回復できる可能性のある暗号ブロック連鎖(CBC)暗号化をサポートすることを示唆しています。このチュートリアルは、CentOSStream8のSSHサーバーで弱鍵交換アルゴリズムとCBC暗号化モードを無効にする方法に関するものです。

以下は、Nessusレポートのスクリーンショットです。

SSHで弱い鍵交換アルゴリズムとCBCモードを無効にする方法

ステップ1: /etc/sysconfig/sshdを編集します 次の行のコメントを解除します。

#CRYPTO_POLICY=

CRYPTO_POLICY=

そうすることで、サーバーによって設定された暗号化ポリシーをオプトアウトすることになります。システム全体の暗号化ポリシーを使用する場合は、CRYPTO_POLICY=にコメントする必要があります update-crypto-policiesを使用します ポリシーを有効/無効にするコマンド。暗号ポリシーの詳細をご覧ください。

ステップ2 :次の暗号、MAC、およびKexAlgorithmsを/etc/ssh/sshd_configにコピーします 。

KexAlgorithms curve25519-sha256@libssh.org,ecdh-sha2-nistp521,ecdh-sha2-nistp384,ecdh-sha2-nistp256,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

ステップ3: SSHサーバーを再起動する前に構成ファイルを確認してください。

sshd -t

ステップ4: エラーが報告されていない場合は、SSHDサービスを再起動します。

# systemctl restart sshd

ステップ5: 以下のコマンドを実行して、弱いCBC暗号をテストします。

ssh -vv -oCiphers=3des-cbc,aes128-cbc,aes192-cbc,aes256-cbc [user@server-ip]

例:

$ ssh -vv -oCiphers=3des-cbc,aes128-cbc,aes192-cbc,aes256-cbc centos@192.168.10.141
:::::::::::::::::::::::::::::::::::::::
debug2: KEX algorithms: curve25519-sha256,curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512
debug2: host key algorithms: rsa-sha2-512,rsa-sha2-256,ecdsa-sha2-nistp256,ssh-ed25519
debug2: ciphers ctos: aes256-gcm@openssh.com,chacha20-poly1305@openssh.com,aes256-ctr
debug2: ciphers stoc: aes256-gcm@openssh.com,chacha20-poly1305@openssh.com,aes256-ctr
debug2: MACs ctos: hmac-sha2-256-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha2-256,umac-128@openssh.com,hmac-sha2-512
debug2: MACs stoc: hmac-sha2-256-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha2-256,umac-128@openssh.com,hmac-sha2-512
debug2: compression ctos: none,zlib@openssh.com
debug2: compression stoc: none,zlib@openssh.com
debug2: languages ctos:
debug2: languages stoc:
debug2: first_kex_follows 0
debug2: reserved 0
debug1: kex: algorithm: curve25519-sha256
debug1: kex: host key algorithm: ecdsa-sha2-nistp256
Unable to negotiate with 192.168.10.141 port 22: no matching cipher found. Their offer: aes256-gcm@openssh.com,chacha20-poly1305@openssh.com,aes256-ctr

上記のエラーは、弱い暗号が無効になっていることを意味します。パスワードプロンプトが表示された場合は、弱い暗号が有効になっていることを意味します。


Linux
  1. SSHキーを設定する方法

  2. Ssh:弱い暗号を無効にする方法は?

  3. Ssh – Debian 8.0でDiffie-hellman-group1-sha1キー交換を有効にする方法は?

  1. LinuxでSSHを使い始める

  2. パスワードでSSHログインを無効にする方法

  3. CentOS/RHEL 8 の SSH サービスで弱い暗号と安全でない HMAC アルゴリズムを無効にする方法

  1. プライバシーのためにSSHを構成する3つの方法

  2. Ssh –スクリプトにパスワードを渡す?

  3. CentOS/RHEL 6 および 7 の SSH サービスで弱い暗号と安全でない HMAC アルゴリズムを無効にする方法