-
Notifications
You must be signed in to change notification settings - Fork 696
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
Add special conditions for bootable containers #12531
Add special conditions for bootable containers #12531
Conversation
This commit adds 2 new Jinja macros: `bootc_build` and `not_bootc_build`. These macros define Bash conditional expressions that are evaluated as true or false if the remediation is performed during a build of a bootable container image or not performed during a build of a bootable container image. These macros can be used in Bash remediation code. They can be used to control the remediation behavior in the bootable container build environment. This commit changes the Bash remediation in rule `disable_ctrlaltdel_reboot` to demonstrate usefulness of the new macros.
This datastream diff is auto generated by the check Click here to see the full diffbash remediation for rule 'xccdf_org.ssgproject.content_rule_disable_ctrlaltdel_reboot' differs.
--- xccdf_org.ssgproject.content_rule_disable_ctrlaltdel_reboot
+++ xccdf_org.ssgproject.content_rule_disable_ctrlaltdel_reboot
@@ -1,8 +1,13 @@
# Remediation is applicable only in certain platforms
if rpm --quiet -q kernel; then
-systemctl disable --now ctrl-alt-del.target
-systemctl mask --now ctrl-alt-del.target
+if [[ "$OSCAP_BOOTC_BUILD" == "YES" ]] ; then
+ systemctl disable ctrl-alt-del.target
+ systemctl mask ctrl-alt-del.target
+else
+ systemctl disable --now ctrl-alt-del.target
+ systemctl mask --now ctrl-alt-del.target
+fi
else
>&2 echo 'Remediation is not applicable, nothing was done' |
/retest |
shared/macros/10-bash.jinja
Outdated
This macro defines a conditional expression that is evaluated as true | ||
if the remediation is performed during a build of a bootable container image. | ||
#}} | ||
{{%- macro bootc_build() -%}} |
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.
Should we prefix with bash_
?
I have add |
Code Climate has analyzed commit 0834570 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. |
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!
/retest |
This commit adds 2 new Jinja macros:
bootc_build
andnot_bootc_build
. These macros define Bash conditional expressions that are evaluated as true or false if the remediation is performed during a build of a bootable container image or not performed during a build of a bootable container image. These macros can be used in Bash remediation code. They can be used to control the remediation behavior in the bootable container build environment.The code relies on new OpenSCAP feature implemented in OpenSCAP/openscap#2170.
This commit changes the Bash remediation in rule
disable_ctrlaltdel_reboot
to demonstrate usefulness of the new macros.