added guardrails on enabled and state flags to systemd mask tasks#435
Open
numericillustration wants to merge 2 commits intoansible-lockdown:develfrom
Open
added guardrails on enabled and state flags to systemd mask tasks#435numericillustration wants to merge 2 commits intoansible-lockdown:develfrom
numericillustration wants to merge 2 commits intoansible-lockdown:develfrom
Conversation
…only disable and stop when the package is installed, otherwise just mask to prevent the service from ever starting should it get installed at a later time. This allows hardening to proceed when the service doesn't exist but masking has been requested. Otherwise the playbook run will fail at a step when the service which comes with the package doesn't already exist Signed-off-by: Michael Hicks <[email protected]>
Signed-off-by: Michael Hicks <[email protected]>
dd6c65a to
c88d3de
Compare
This was referenced Mar 4, 2026
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Overall Review of Changes:
I added guardrails on enabled and state flags to systemd mask tasks to only disable and stop when the package is installed, o therwise just mask to prevent the service from ever starting should it get installed at a later time. This allows hardening to proceed when the service doesn't exist but masking has been requested. Otherwise the playbook run will fail at a step when the service which comes with the package doesn't already exist
NOTE that I found this method already done in the RHEL7 version of these mask tasks.
Issue Fixes:
[Please list (using linking) any open issues this PR addresses
this fixes #434
Enhancements:
This fixes the same issue for all the other mask tasks for which there are not bugs filed
How has this been tested?:
Please give an overview of how these changes were tested. If they were not please use N/A
example testing scenario: net-snmp is not installed:
run CIS hardening scoped to this tag and see output note change
and the reset of the tasking continues rather than an error. Final state on host is that the service is masked despite the package not being installed