Skip to content

Commit a5b5903

Browse files
authored
Merge pull request #14450 from Smouhoune/feat/crypto-policy-backend-path-overrides
Parameterize OpenSSH crypto-policy backend file paths via product properties
2 parents aa02db7 + 7a40d08 commit a5b5903

59 files changed

Lines changed: 117 additions & 32 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

linux_os/guide/services/ssh/ssh_server/sshd_include_crypto_policy/rule.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ description: |-
66
SSHD should follow the system cryptographic policy.
77
In order to accomplish this the SSHD configuration should include the configuration file provided by the system crypto policy.
88
The following line should be present in <tt>/etc/ssh/sshd_config</tt> or in a file included by this file (a file within the <tt>/etc/ssh/sshd_config.d</tt> directory):
9-
<pre>Include /etc/crypto-policies/back-ends/opensshserver.config</pre>
9+
<pre>Include {{{ openssh_server_crypto_policy_config_file }}}</pre>
1010
1111
1212
rationale: |-
@@ -28,8 +28,8 @@ checktext: |-
2828
<pre>sudo grep -R "Include /etc/ssh/sshd_config" /etc/ssh/sshd_config.d/
2929
3030
/etc/ssh/sshd_config:Include /etc/ssh/sshd_config.d/*.conf
31-
/etc/ssh/sshd_config.d/50-redhat.conf:Include /etc/crypto-policies/back-ends/opensshserver.config</pre>
32-
If "Include /etc/ssh/sshd_config.d/*.conf" or "Include /etc/crypto-policies/back-ends/opensshserver.config" are not included in the system sshd config or if the file "/etc/ssh/sshd_config.d/50-redhat.conf" is missing, this is a finding.
31+
/etc/ssh/sshd_config.d/50-redhat.conf:Include {{{ openssh_server_crypto_policy_config_file }}}</pre>
32+
If "Include /etc/ssh/sshd_config.d/*.conf" or "Include {{{ openssh_server_crypto_policy_config_file }}}" are not included in the system sshd config or if the file "/etc/ssh/sshd_config.d/50-redhat.conf" is missing, this is a finding.
3333
3434
fixtext: |-
3535
Configure the {{{ full_name }}} SSH daemon to use systemwide crypto policies.

linux_os/guide/services/ssh/ssh_server/sshd_use_approved_kex_ordered_stig/oval/shared.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{{% if product in ['ol8', 'rhel8'] %}}
2-
{{% set path='/etc/crypto-policies/back-ends/opensshserver.config' %}}
2+
{{% set path=openssh_server_crypto_policy_config_file %}}
33
{{% set prefix_conf="^\s*CRYPTO_POLICY\s*=.*-oKexAlgorithms=" %}}
44
{{% set kex_algos=["ecdh-sha2-nistp256","ecdh-sha2-nistp384",
55
"ecdh-sha2-nistp521","diffie-hellman-group-exchange-sha256",

linux_os/guide/services/ssh/ssh_server/sshd_use_approved_kex_ordered_stig/rule.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{{% if product in ['ol8', 'rhel8'] %}}
2-
{{% set path='/etc/crypto-policies/back-ends/opensshserver.config' %}}
2+
{{% set path=openssh_server_crypto_policy_config_file %}}
33
{{% set conf="CRYPTO_POLICY='-oKexAlgorithms=ecdh-sha2-nistp256,ecdh-sha2-nistp384" ~
44
",ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256" ~
55
",diffie-hellman-group14-sha256,diffie-hellman-group16-sha512" ~

linux_os/guide/system/software/integrity/crypto/harden_sshd_ciphers_openssh_conf_crypto_policy/ansible/shared.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@
44
# complexity = low
55
# disruption = low
66
{{{ ansible_instantiate_variables("sshd_approved_ciphers") }}}
7+
{{%- set openssh_client_policy_file = openssh_client_crypto_policy_config_file -%}}
78

89
{{{ ansible_set_config_file(
910
msg='Configure SSH Daemon to Use FIPS 140-2 Validated Ciphers: openssh.config',
10-
file='/etc/crypto-policies/back-ends/openssh.config',
11+
file=openssh_client_policy_file,
1112
parameter='Ciphers',
1213
value="{{ sshd_approved_ciphers }}",
1314
create='yes',

linux_os/guide/system/software/integrity/crypto/harden_sshd_ciphers_openssh_conf_crypto_policy/bash/shared.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
# platform = Oracle Linux 8,Oracle Linux 9,Red Hat Enterprise Linux 8,multi_platform_fedora
22

33
{{{ bash_instantiate_variables("sshd_approved_ciphers") }}}
4+
{{%- set openssh_client_policy_file = openssh_client_crypto_policy_config_file -%}}
45

56
{{{ set_config_file(
6-
path="/etc/crypto-policies/back-ends/openssh.config",
7+
path=openssh_client_policy_file,
78
parameter="Ciphers",
89
value="${sshd_approved_ciphers}",
910
create=true,

linux_os/guide/system/software/integrity/crypto/harden_sshd_ciphers_openssh_conf_crypto_policy/oval/shared.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{{%- set PATH = "/etc/crypto-policies/back-ends/openssh.config" -%}}
1+
{{%- set PATH = openssh_client_crypto_policy_config_file -%}}
22
<def-group>
33
<definition class="compliance" id="{{{ rule_id }}}" version="1">
44
{{{ oval_metadata("Limit the Ciphers to those which are FIPS-approved.", rule_title=rule_title) }}}

linux_os/guide/system/software/integrity/crypto/harden_sshd_ciphers_openssh_conf_crypto_policy/rule.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ description: |-
99
set up incorrectly.
1010
1111
To check that Crypto Policies settings for ciphers are configured correctly, ensure that
12-
<tt>/etc/crypto-policies/back-ends/openssh.config</tt> contains the following
12+
<tt>{{{ openssh_client_crypto_policy_config_file }}}</tt> contains the following
1313
line and is not commented out:
1414
<pre>Ciphers {{{ xccdf_value("sshd_approved_ciphers") }}}</pre>
1515
@@ -35,7 +35,7 @@ ocil_clause: 'Crypto Policy for OpenSSH client is not configured correctly'
3535

3636
ocil: |-
3737
To verify if the OpenSSH client uses defined Cipher suite in the Crypto Policy, run:
38-
<pre>$ grep -i ciphers /etc/crypto-policies/back-ends/openssh.config</pre>
38+
<pre>$ grep -i ciphers {{{ openssh_client_crypto_policy_config_file }}}</pre>
3939
and verify that the line matches:
4040
<pre>Ciphers {{{ xccdf_value("sshd_approved_ciphers") }}}</pre>
4141

linux_os/guide/system/software/integrity/crypto/harden_sshd_ciphers_opensshserver_conf_crypto_policy/ansible/shared.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@
44
# complexity = low
55
# disruption = low
66
{{{ ansible_instantiate_variables("sshd_approved_ciphers") }}}
7+
{{%- set openssh_server_policy_file = openssh_server_crypto_policy_config_file -%}}
78

89
- name: "{{{ rule_title }}}: Set relevant paths and correct value"
910
ansible.builtin.set_fact:
10-
opensshserver_path: /etc/crypto-policies/back-ends/opensshserver.config
11+
opensshserver_path: "{{{ openssh_server_policy_file }}}"
1112
local_path: /etc/crypto-policies/local.d/opensshserver-ssg.config
1213
correct_value: "-oCiphers={{ sshd_approved_ciphers }}"
1314

linux_os/guide/system/software/integrity/crypto/harden_sshd_ciphers_opensshserver_conf_crypto_policy/bash/shared.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
# platform = Oracle Linux 8,Red Hat Enterprise Linux 8,multi_platform_fedora
22

33
{{{ bash_instantiate_variables("sshd_approved_ciphers") }}}
4+
{{%- set openssh_server_policy_file = openssh_server_crypto_policy_config_file -%}}
45

5-
CONF_FILE=/etc/crypto-policies/back-ends/opensshserver.config
6+
CONF_FILE="{{{ openssh_server_policy_file }}}"
67
LOCAL_CONF_DIR=/etc/crypto-policies/local.d
78
LOCAL_CONF_FILE=${LOCAL_CONF_DIR}/opensshserver-ssg.config
89
correct_value="-oCiphers=${sshd_approved_ciphers}"

linux_os/guide/system/software/integrity/crypto/harden_sshd_ciphers_opensshserver_conf_crypto_policy/oval/shared.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{{%- set PATH = "/etc/crypto-policies/back-ends/opensshserver.config" -%}}
1+
{{%- set PATH = openssh_server_crypto_policy_config_file -%}}
22
<def-group>
33
<definition class="compliance" id="{{{ rule_id }}}" version="1">
44
{{{ oval_metadata("Limit the Ciphers to those which are FIPS-approved.", rule_title=rule_title) }}}

0 commit comments

Comments
 (0)