-
Notifications
You must be signed in to change notification settings - Fork 697
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
Update chronyd rules for bootable containers #12582
Conversation
This datastream diff is auto generated by the check Click here to see the full diffOVAL for rule 'xccdf_org.ssgproject.content_rule_chronyd_client_only' differs.
--- oval:ssg-chronyd_client_only:def:1
+++ oval:ssg-chronyd_client_only:def:1
@@ -1,3 +1,2 @@
criteria AND
-extend_definition oval:ssg-service_chronyd_enabled:def:1
criterion oval:ssg-test_chronyd_client_only:tst:1
bash remediation for rule 'xccdf_org.ssgproject.content_rule_chronyd_client_only' differs.
--- xccdf_org.ssgproject.content_rule_chronyd_client_only
+++ xccdf_org.ssgproject.content_rule_chronyd_client_only
@@ -1,5 +1,5 @@
# Remediation is applicable only in certain platforms
-if rpm --quiet -q kernel; then
+if rpm --quiet -q kernel && { rpm --quiet -q chrony; }; then
# Strip any search characters in the key arg so that the key can be replaced without
# adding any search characters to the config file.
ansible remediation for rule 'xccdf_org.ssgproject.content_rule_chronyd_client_only' differs.
--- xccdf_org.ssgproject.content_rule_chronyd_client_only
+++ xccdf_org.ssgproject.content_rule_chronyd_client_only
@@ -41,7 +41,9 @@
regexp: (?i)^\s*port\s+
line: port 0
state: present
- when: '"kernel" in ansible_facts.packages'
+ when:
+ - '"kernel" in ansible_facts.packages'
+ - '"chrony" in ansible_facts.packages'
tags:
- CCE-82988-7
- DISA-STIG-RHEL-08-030741
Platform has been changed for rule 'xccdf_org.ssgproject.content_rule_chronyd_client_only'
--- xccdf_org.ssgproject.content_rule_chronyd_client_only
+++ xccdf_org.ssgproject.content_rule_chronyd_client_only
@@ -1 +1 @@
-
+oval:ssg-package_chrony:def:1
OVAL for rule 'xccdf_org.ssgproject.content_rule_chronyd_no_chronyc_network' differs.
--- oval:ssg-chronyd_no_chronyc_network:def:1
+++ oval:ssg-chronyd_no_chronyc_network:def:1
@@ -1,3 +1,2 @@
criteria AND
-extend_definition oval:ssg-service_chronyd_enabled:def:1
criterion oval:ssg-test_chronyd_no_chronyc_network:tst:1
bash remediation for rule 'xccdf_org.ssgproject.content_rule_chronyd_no_chronyc_network' differs.
--- xccdf_org.ssgproject.content_rule_chronyd_no_chronyc_network
+++ xccdf_org.ssgproject.content_rule_chronyd_no_chronyc_network
@@ -1,5 +1,5 @@
# Remediation is applicable only in certain platforms
-if rpm --quiet -q kernel; then
+if rpm --quiet -q kernel && { rpm --quiet -q chrony; }; then
# Strip any search characters in the key arg so that the key can be replaced without
# adding any search characters to the config file.
ansible remediation for rule 'xccdf_org.ssgproject.content_rule_chronyd_no_chronyc_network' differs.
--- xccdf_org.ssgproject.content_rule_chronyd_no_chronyc_network
+++ xccdf_org.ssgproject.content_rule_chronyd_no_chronyc_network
@@ -40,7 +40,9 @@
regexp: (?i)^\s*cmdport\s+
line: cmdport 0
state: present
- when: '"kernel" in ansible_facts.packages'
+ when:
+ - '"kernel" in ansible_facts.packages'
+ - '"chrony" in ansible_facts.packages'
tags:
- CCE-82840-0
- DISA-STIG-RHEL-08-030742
Platform has been changed for rule 'xccdf_org.ssgproject.content_rule_chronyd_no_chronyc_network'
--- xccdf_org.ssgproject.content_rule_chronyd_no_chronyc_network
+++ xccdf_org.ssgproject.content_rule_chronyd_no_chronyc_network
@@ -1 +1 @@
-
+oval:ssg-package_chrony:def:1
OVAL for rule 'xccdf_org.ssgproject.content_rule_chronyd_or_ntpd_specify_multiple_servers' differs.
--- oval:ssg-chronyd_or_ntpd_specify_multiple_servers:def:1
+++ oval:ssg-chronyd_or_ntpd_specify_multiple_servers:def:1
@@ -1,7 +1,3 @@
criteria OR
-criteria AND
-extend_definition oval:ssg-service_chronyd_enabled:def:1
extend_definition oval:ssg-chronyd_specify_multiple_servers:def:1
-criteria AND
-extend_definition oval:ssg-service_ntpd_enabled:def:1
extend_definition oval:ssg-ntpd_specify_multiple_servers:def:1
bash remediation for rule 'xccdf_org.ssgproject.content_rule_chronyd_or_ntpd_specify_multiple_servers' differs.
--- xccdf_org.ssgproject.content_rule_chronyd_or_ntpd_specify_multiple_servers
+++ xccdf_org.ssgproject.content_rule_chronyd_or_ntpd_specify_multiple_servers
@@ -1,5 +1,5 @@
# Remediation is applicable only in certain platforms
-if rpm --quiet -q kernel; then
+if rpm --quiet -q kernel && { ( rpm --quiet -q chrony || rpm --quiet -q ntp ); }; then
var_multiple_time_servers=''
ansible remediation for rule 'xccdf_org.ssgproject.content_rule_chronyd_or_ntpd_specify_multiple_servers' differs.
--- xccdf_org.ssgproject.content_rule_chronyd_or_ntpd_specify_multiple_servers
+++ xccdf_org.ssgproject.content_rule_chronyd_or_ntpd_specify_multiple_servers
@@ -25,7 +25,9 @@
path: /etc
patterns: chrony.conf
register: chrony_server_config
- when: '"kernel" in ansible_facts.packages'
+ when:
+ - '"kernel" in ansible_facts.packages'
+ - ( "chrony" in ansible_facts.packages or "ntp" in ansible_facts.packages )
tags:
- CCE-80764-4
- NIST-800-53-AU-12(1)
@@ -49,6 +51,7 @@
loop: '{{ var_multiple_time_servers.split(",") }}'
when:
- '"kernel" in ansible_facts.packages'
+ - ( "chrony" in ansible_facts.packages or "ntp" in ansible_facts.packages )
- chrony_server_config.matched == 1
tags:
- CCE-80764-4
@@ -69,7 +72,9 @@
path: /etc
patterns: ntp.conf
register: ntp_server_config
- when: '"kernel" in ansible_facts.packages'
+ when:
+ - '"kernel" in ansible_facts.packages'
+ - ( "chrony" in ansible_facts.packages or "ntp" in ansible_facts.packages )
tags:
- CCE-80764-4
- NIST-800-53-AU-12(1)
@@ -93,6 +98,7 @@
loop: '{{ var_multiple_time_servers.split(",") }}'
when:
- '"kernel" in ansible_facts.packages'
+ - ( "chrony" in ansible_facts.packages or "ntp" in ansible_facts.packages )
- ntp_server_config.matched == 1
tags:
- CCE-80764-4
Platform has been changed for rule 'xccdf_org.ssgproject.content_rule_chronyd_or_ntpd_specify_multiple_servers'
--- xccdf_org.ssgproject.content_rule_chronyd_or_ntpd_specify_multiple_servers
+++ xccdf_org.ssgproject.content_rule_chronyd_or_ntpd_specify_multiple_servers
@@ -1 +1,2 @@
-
+oval:ssg-package_chrony:def:1
+oval:ssg-package_ntp:def:1
OVAL for rule 'xccdf_org.ssgproject.content_rule_chronyd_or_ntpd_specify_remote_server' differs.
--- oval:ssg-chronyd_or_ntpd_specify_remote_server:def:1
+++ oval:ssg-chronyd_or_ntpd_specify_remote_server:def:1
@@ -1,7 +1,3 @@
criteria OR
-criteria AND
-extend_definition oval:ssg-service_chronyd_enabled:def:1
extend_definition oval:ssg-chronyd_specify_remote_server:def:1
-criteria AND
-extend_definition oval:ssg-service_ntpd_enabled:def:1
extend_definition oval:ssg-ntpd_specify_remote_server:def:1 |
I think that these checks for packages and services should be replaced by assigning a CPE platform to the rule. |
38043f2
to
5828582
Compare
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.
I have run the STIG build and run and the chronyd rules are passing now. But, please fix the CI fails.
The rules used `service_chronyd_enabled` or `service_ntpd_enabled` in their OVALs to not only check the services configuration but to also check if the services are enabled. This approach is unnecessary and it won't work in the bootable container build environment where systemd services don't run. Therefore, we update OVALs of these rules and remove the mentioned service enabled checks and we rather use CPE platforms to make the rules applicable only in cases when `chrony` or `ntp` packages are installed. This shouldn't be a big change as if `chrony` or `ntp` packages are installed their service config files should exist and in case `chronyd` or `ntpd` services are enabled later they will already run with the expected configuration.
5828582
to
40262a8
Compare
Code Climate has analyzed commit 40262a8 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 60.9% (0.0% change). View more on Code Climate. |
The rules used
service_chronyd_enabled
orservice_ntpd_enabled
in their OVALs to not only check the services configuration but to
also check if the services are enabled.
This approach is unnecessary and it won't work in the bootable
container build environment where systemd services don't run.
Therefore, we update OVALs of these rules and remove the mentioned
service enabled checks and we rather use CPE platforms to make the
rules applicable only in cases when
chrony
orntp
packages areinstalled. This shouldn't be a big change as if
chrony
orntp
packages are installed their service config files should exist and
in case
chronyd
orntpd
services are enabled later they willalready run with the expected configuration.