-
Notifications
You must be signed in to change notification settings - Fork 711
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix ssh include cryptopolicy #12931
base: master
Are you sure you want to change the base?
Fix ssh include cryptopolicy #12931
Conversation
This datastream diff is auto generated by the check Click here to see the full diffNew content has different text for rule 'xccdf_org.ssgproject.content_rule_sshd_include_crypto_policy'.
--- xccdf_org.ssgproject.content_rule_sshd_include_crypto_policy
+++ xccdf_org.ssgproject.content_rule_sshd_include_crypto_policy
@@ -4,7 +4,9 @@
[description]:
SSHD should follow the system cryptographic policy.
-In order to accomplish this the SSHD configuration should include the system
+In order to accomplish this the SSHD configuration should include the configuration file provided by the system crypto policy.
+The following line should be present in /etc/ssh/sshd_config or in a file included by this file (a file within the /etc/ssh/sshd_config.d directory):
+Include /etc/crypto-policies/back-ends/opensshserver.config
[reference]:
CCI-001453
bash remediation for rule 'xccdf_org.ssgproject.content_rule_sshd_include_crypto_policy' differs.
--- xccdf_org.ssgproject.content_rule_sshd_include_crypto_policy
+++ xccdf_org.ssgproject.content_rule_sshd_include_crypto_policy
@@ -1,8 +1,9 @@
# Remediation is applicable only in certain platforms
if rpm --quiet -q kernel; then
-echo "Include /etc/ssh/sshd_config.d/*.conf" >> /etc/ssh/sshd_config
-echo "Include /etc/crypto-policies/back-ends/opensshserver.config" >> /etc/ssh/ssh_config.d/50-redhat.conf
+dnf -y remove openssh-server
+dnf -y install openssh-server
+systemctl restart sshd.service
else
>&2 echo 'Remediation is not applicable, nothing was done'
ansible remediation for rule 'xccdf_org.ssgproject.content_rule_sshd_include_crypto_policy' differs.
--- xccdf_org.ssgproject.content_rule_sshd_include_crypto_policy
+++ xccdf_org.ssgproject.content_rule_sshd_include_crypto_policy
@@ -12,13 +12,11 @@
- no_reboot_needed
- sshd_include_crypto_policy
-- name: SSHD Must Include System Crypto Policy Config File - Ensure That Drop In SSH
- Config Files are Included
- ansible.builtin.lineinfile:
- path: /etc/ssh/sshd_config
- line: Include /etc/ssh/sshd_config.d/*.conf
- regexp: ^Include /etc/ssh/sshd_config.d/\*.conf
- state: present
+- name: SSHD Must Include System Crypto Policy Config File - reinstall the openssh-server
+ package
+ ansible.builtin.shell:
+ cmd: dnf -y remove openssh-server; dnf -y install openssh-server; systemctl restart
+ sshd.service
when: '"kernel" in ansible_facts.packages'
tags:
- CCE-90566-1
@@ -30,22 +28,3 @@
- medium_severity
- no_reboot_needed
- sshd_include_crypto_policy
-
-- name: SSHD Must Include System Crypto Policy Config File - Ensure That System Crypto
- Policies are Included
- ansible.builtin.lineinfile:
- path: /etc/ssh/ssh_config.d/50-redhat.conf
- regexp: Include /etc/crypto-policies/back-ends/opensshserver.config
- line: Include /etc/crypto-policies/back-ends/opensshserver.config
- state: present
- when: '"kernel" in ansible_facts.packages'
- tags:
- - CCE-90566-1
- - DISA-STIG-RHEL-09-255055
- - NIST-800-53-AC-17 (2)
- - configure_strategy
- - low_complexity
- - low_disruption
- - medium_severity
- - no_reboot_needed
- - sshd_include_crypto_policy |
Change in Ansible Please consider using more suitable Ansible module than |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Automatus passes locally:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Something odd is going on. Please review the test farm results.
I know what is going on. The problem is in rule ordering. The following happens:
A solution is either a second remediation or modifying ordering of rules, I will try to propose it. |
I pushed changes to rule ordering. |
Change in Ansible Please consider using more suitable Ansible module than |
This rule remediates through reinstalling of openssh-server. This step reinstates some configuration files in /etc/ssh/sshd_config.d directory. Some content in these files is later modified by remediations, especially removing unwanted options. To prevent necessity of double remediation, this rule which reinstalls openssh-server is sorted first.
d576169
to
18be095
Compare
Change in Ansible Please consider using more suitable Ansible module than |
Code Climate has analyzed commit 18be095 and detected 0 issues on this pull request. The test coverage on the diff in this pull request is 100.0% (50% is the threshold). This pull request will bring the total coverage in the repository to 61.9% (0.0% change). View more on Code Climate. |
Looks like you need to set the permissions the file you create. See the testing farm error for the STIG profile for more details. |
Description:
Rationale: