Skip to content
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

modify regexp in bash remediation of chronyd_specify_remote_server #10591

Conversation

vojtapolasek
Copy link
Collaborator

Description:

  • change the regex so that is correctly matches the line, I think matching the space characters was the problem

Rationale:

Review Hints:

./build_product rhel8
cd tests
python automatus.py rule --libvirt qemu:///system rhel8 chronyd_specify_remote_server

previously, new lines were inserted into the file no matter if there were some correct lines before
@vojtapolasek vojtapolasek added bugfix Fixes to reported bugs. Bash Bash remediation update. labels May 19, 2023
@vojtapolasek vojtapolasek added this to the 0.1.68 milestone May 19, 2023
@github-actions
Copy link

Start a new ephemeral environment with changes proposed in this pull request:

rhel8 (from CTF) Environment (using Fedora as testing environment)
Open in Gitpod

Fedora Testing Environment
Open in Gitpod

Oracle Linux 8 Environment
Open in Gitpod

@github-actions
Copy link

This datastream diff is auto generated by the check Compare DS/Generate Diff

Click here to see the full diff
bash remediation for rule 'xccdf_org.ssgproject.content_rule_chronyd_specify_remote_server' differs.
--- xccdf_org.ssgproject.content_rule_chronyd_specify_remote_server
+++ xccdf_org.ssgproject.content_rule_chronyd_specify_remote_server
@@ -6,7 +6,7 @@
 
 config_file="/etc/chrony.conf"
 
-if ! grep -q '^[\s]*(?:server|pool)[\s]+[\w]+' "$config_file" ; then
+if ! grep -q '^[[:space:]]*\(server\|pool\)[[:space:]]\+[[:graph:]]\+' "$config_file" ; then
 if ! grep -q '#[[:space:]]*server' "$config_file" ; then
 for server in $(echo "$var_multiple_time_servers" | tr ',' '\n') ; do
 printf '\nserver %s' "$server" >> "$config_file"

@codeclimate
Copy link

codeclimate bot commented May 19, 2023

Code Climate has analyzed commit e24d57a 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 52.5% (0.0% change).

View more on Code Climate.

@marcusburghardt marcusburghardt self-assigned this May 22, 2023
Copy link
Member

@marcusburghardt marcusburghardt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this fix.

@marcusburghardt marcusburghardt merged commit 5eec6d5 into ComplianceAsCode:master May 22, 2023
32 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bash Bash remediation update. bugfix Fixes to reported bugs.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants