26.4. sshd RHEL システムロールを使用して SSH サーバー上のシステム全体の暗号化ポリシーをオーバーライド
sshd
RHEL システムロールを使用して、SSH サーバー上のシステム全体の暗号化ポリシーをオーバーライドできます。
前提条件
- コントロールノードと管理対象ノードを準備している。
- 管理対象ノードで Playbook を実行できるユーザーとしてコントロールノードにログインしている。
-
管理対象ノードへの接続に使用するアカウントに、そのノードに対する
sudo
権限がある。
手順
次の内容を含む Playbook ファイル (例:
~/playbook.yml
) を作成します。- name: Overriding the system-wide cryptographic policy hosts: managed-node-01.example.com roles: - rhel_system_roles.sshd vars: sshd_sysconfig: true sshd_sysconfig_override_crypto_policy: true sshd_KexAlgorithms: ecdh-sha2-nistp521 sshd_Ciphers: aes256-ctr sshd_MACs: hmac-sha2-512-etm@openssh.com sshd_HostKeyAlgorithms: rsa-sha2-512,rsa-sha2-256
-
sshd_KexAlgorithms
:ecdh-sha2-nistp256
、ecdh-sha2-nistp384
、ecdh-sha2-nistp521
、diffie-hellman-group14-sha1
、diffie-hellman-group-exchange-sha256
などの鍵交換アルゴリズムを選択できます。 -
sshd_Ciphers
:aes128-ctr
、aes192-ctr
、aes256-ctr
などの暗号を選択できます。 -
sshd_MACs
:hmac-sha2-256
、hmac-sha2-512
、hmac-sha1
などの MAC を選択できます。 -
sshd_HostKeyAlgorithms
:ecdsa-sha2-nistp256
、ecdsa-sha2-nistp384
、ecdsa-sha2-nistp521
、ssh-rsa
、ssh-dss
などの公開鍵アルゴリズムを選択できます。
RHEL 9 管理対象ノードでは、システムロールによって設定が
/etc/ssh/sshd_config.d/00-ansible_system_role.conf
ファイルに書き込まれ、暗号化オプションが自動的に適用されます。sshd_config_file
変数を使用してファイルを変更できます。ただし、設定を確実に有効にするために、設定された暗号化ポリシーが含まれる/etc/ssh/sshd_config.d/50-redhat.conf
ファイルよりも辞書式順序で前に来るようなファイル名を使用してください。RHEL 8 管理対象ノードでは、
sshd_sysconfig_override_crypto_policy
変数とsshd_sysconfig
変数をtrue
に設定してオーバーライドを有効にする必要があります。-
Playbook の構文を検証します。
$ ansible-playbook --syntax-check ~/playbook.yml
このコマンドは構文を検証するだけであり、有効だが不適切な設定から保護するものではないことに注意してください。
Playbook を実行します。
$ ansible-playbook ~/playbook.yml
検証
詳細なログを表示する SSH 接続を使用して手順が成功したかどうかを検証し、定義した変数を以下の出力で確認できます。
$ ssh -vvv <ssh_server> ... debug2: peer server KEXINIT proposal debug2: KEX algorithms: ecdh-sha2-nistp521 debug2: host key algorithms: rsa-sha2-512,rsa-sha2-256 debug2: ciphers ctos: aes256-ctr debug2: ciphers stoc: aes256-ctr debug2: MACs ctos: hmac-sha2-512-etm@openssh.com debug2: MACs stoc: hmac-sha2-512-etm@openssh.com ...
関連情報
-
/usr/share/ansible/roles/rhel-system-roles.sshd/README.md
ファイル -
/usr/share/doc/rhel-system-roles/sshd/
ディレクトリー