GNU/Linux >> Linux の 問題 >  >> Cent OS

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

この投稿では、CentOS/RHEL 6 および 7 の例として、HMAC MD5 および CBC 暗号を無効にする方法を示します。

CentOS/RHEL 7 の場合

詳細については、man ページを参照してください:

# man sshd_config

暗号

許可される暗号を指定します。複数の暗号はコンマで区切る必要があります。指定された値が「+」文字で始まる場合、指定された暗号は、それらを置き換える代わりにデフォルト セットに追加されます。

サポートされている暗号は次のとおりです:

3des-cbc
aes128-cbc
aes192-cbc
aes256-cbc
aes128-ctr
aes192-ctr
aes256-ctr
[email protected]
[email protected]
arcfour
arcfour128
arcfour256
blowfish-cbc
cast128-cbc
[email protected]

デフォルトは次のとおりです:

[email protected],
aes128-ctr,aes192-ctr,aes256-ctr,
[email protected],[email protected],
aes128-cbc,aes192-cbc,aes256-cbc,
blowfish-cbc,cast128-cbc,3des-cbc

利用可能な暗号のリストは、「ssh -Q cipher」を使用して取得することもできます。例:

# ssh -Q cipher
3des-cbc
blowfish-cbc
cast128-cbc
arcfour
arcfour128
arcfour256
aes128-cbc
aes192-cbc
aes256-cbc
[email protected]
aes128-ctr
aes192-ctr
aes256-ctr
[email protected]
[email protected]
[email protected]

CBC 暗号を無効にするには、/etc/ssh/sshd_config を更新してください CBC 暗号以外に必要な暗号を使用します。

CBC を無効にするには:

Ciphers [email protected],aes128-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected]

変更後、sshd サービスを再起動してください。

# systemctl restart sshd

MAC

MACs 使用可能な MAC (メッセージ認証コード) アルゴリズムを指定します。 MAC アルゴリズムは、データの完全性を保護するために使用されます。複数のアルゴリズムはコンマで区切る必要があります。指定された値が「+」文字で始まる場合、指定されたアルゴリズムは、それらを置き換える代わりにデフォルト セットに追加されます。

「-etm」を含むアルゴリズムは、暗号化後に MAC を計算します (encrypt-then-mac)。これらはより安全であると考えられており、その使用が推奨されています。サポートされている MAC は次のとおりです:

hmac-md5
hmac-md5-96
hmac-ripemd160
hmac-sha1
hmac-sha1-96
hmac-sha2-256
hmac-sha2-512
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]

デフォルトは次のとおりです:

[email protected],[email protected],
[email protected],[email protected],
[email protected],
[email protected],[email protected],
hmac-sha2-256,hmac-sha2-512,hmac-sha1,
[email protected]

利用可能な MAC アルゴリズムのリストは、「ssh -Q mac」を使用して取得することもできます。例:

# ssh -Q mac
hmac-sha1
hmac-sha1-96
hmac-sha2-256
hmac-sha2-512
hmac-md5
hmac-md5-96
hmac-ripemd160
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]

hmac-md5 MAC アルゴリズムを無効にするには、ecample 用の hmac-md5 以外の必要な Mac で /etc/ssh/sshd_config を更新してください:

MACs [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-sha1,[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-ripemd160

変更後、sshd サービスを再起動してください。

# systemctl restart sshd

CentOS/RHEL 6 の場合

CentOS/RHEL 6 では、利用可能な暗号と MAC を一覧表示するコマンドは「sshd -T | grep 暗号 | perl -pe 's/,/\n/g' | sort -u」および「nmap -vv –script=ssh2-enum-algos.nse -p 22 localhost」:

# sshd -T | grep ciphers | perl -pe 's/,/\n/g' | sort -u
nmap -vv --script=ssh2-enum-algos.nse -p 22 localhost

詳細については、man ページを参照してください:

# man sshd_config

暗号

プロトコル バージョン 2 で許可される暗号を指定します。複数の暗号はコンマで区切る必要があります。サポートされている暗号は次のとおりです:

3des-cbc
aes128-cbc
aes192-cbc
aes256-cbc
aes128-ctr
aes192-ctr
aes256-ctr
arcfour128
arcfour256
arcfour
blowfish-cbc
[email protected]
cast128-cbc

デフォルトは次のとおりです:

aes128-ctr
aes192-ctr
aes256-ctr
arcfour256
arcfour128
aes128-cbc
3des-cbc
blowfish-cbc
cast128-cbc
aes192-cbc
aes256-cbc
arcfour
[email protected]

CBC 暗号を無効にするには、CBC 暗号以外に必要な暗号で /etc/ssh/sshd_config を更新してください。

Ciphers aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,arcfour

変更後、sshd サービスを再起動します。

# service sshd restart

MAC

MACs 使用可能な MAC (メッセージ認証コード) アルゴリズムを指定します。 MAC アルゴリズムは、データの完全性を保護するためにプロトコル バージョン 2 で使用されます。複数のアルゴリズムはコンマで区切る必要があります。デフォルトは次のとおりです:

hmac-md5,hmac-sha1,[email protected],
hmac-ripemd160,hmac-sha1-96,hmac-md5-96,
hmac-sha2-256,hmac-sha2-512,[email protected]

hmac-md5 MAC アルゴリズムを無効にするには、ecample 用の hmac-md5 以外の必要な Mac で /etc/ssh/sshd_config を更新してください:

MACs hmac-sha1,[email protected],hmac-ripemd160,hmac-sha2-256,hmac-sha2-512,[email protected]

変更が完了したら、sshd サービスを再起動します。

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


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

  2. CentOS / RHEL 7 で IPv6 を無効にする方法

  3. CentOS / RHEL 7でfirewalldを無効にしてiptablesに切り替える方法

  1. CentOS/RHEL でユーザーとクライアント アドレスによって ssh ログインを制限する方法

  2. CentOS/RHEL 6 および 7 で rpc.quotad サービスを無効にする方法

  3. CentOS/RHEL 7 および 8 で CIFS モジュールのデバッグ オプションを有効にする方法

  1. CentOS / RHEL 7 :すべての tty コンソールを無効にして 1 つだけ有効にする方法

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

  3. CentOS/RHEL 7 および 8 でソース、サービス、およびポートをファイアウォール ゾーンに追加する方法