-
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
align template systemd_dropin_configuration #12054
Merged
marcusburghardt
merged 13 commits into
ComplianceAsCode:master
from
vojtapolasek:fix_template_systemd_dropin
Jul 16, 2024
Merged
Changes from 1 commit
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
5ac946f
systemd_dropin_congiruation template OVAL: honor the section of the s…
vojtapolasek 00ed030
systemd_dropin_configuration bash: rewrite using already existing macro
vojtapolasek f4dfdda
honor the section of the systemd file also in tests and rules
vojtapolasek a0980ac
macro bash_ensure_ini_config: do not put space around equals sign
vojtapolasek ad9b073
update Ansible remediation of the template to be aligned with Bash
vojtapolasek 0226a25
honor the no_quotes parameter also when remediating
vojtapolasek 3413ae9
remove the component field from the template instantiation because it…
vojtapolasek 27d55c0
add documentation for systemd_dropin_configuration template
vojtapolasek 719bf66
modify the Ansible remediation so that Jinja is not evaluated in the …
vojtapolasek 0808946
change the file name used in remediations
vojtapolasek bab20e9
Ansible: update regex which checks for the section
vojtapolasek 7c709f1
update test scenarios to not preserve previous file content
vojtapolasek 4c5541b
Update docs/templates/template_reference.md
vojtapolasek File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
This
no_quotes
argument seems unnecessary since we can already determine if quotes are used or not by checking thevalue
. It would simplify the template call. Asking the user to specify thevalue
andno_quotes
seems redundant. Could you treat this within the macro without including an additional parameter? Also, do you have any example whereno_quotes
would befalse
?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.
My idea behind this change was alignment with the OVAL check counterpart of this macro in the scope of systemd_dropin_configuration template; oval_check_dropin_file. This macro honors no_quotes. Therefore, I think the remediation should honor no_quotes as well. Moreover, the macro I modify here is more generic, it is an ini file check. There is no standard if values should be quoted or not (https://en.wikipedia.org/wiki/INI_file#Quoted_values).
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.
It seems a good case for a new macro specific for systemd files, to treat the quotes and call the
systemd_dropin_configuration
macro. But I see your point regarding the alignment to OVAL.The ideal approach, in my perspective, would be to remove this unnecessary parameter in the whole template and macros and treat these predictable cases within the macro. However this is not the scope of this PR, not a simple refactoring and can be done later.
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.
By the way, the
no_quotes
is not even used inoval_check_dropin_file
macro. It is usedquotes
, which is not declared. We should definitely review these macros soon.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.
FYI @teacup-on-rockingchair
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 @marcusburghardt , see proposed change to
oval_check_dropin_file
in #12173