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

Fix regex to prevent swallowing closing quote in bootloader config. #133

Merged

Conversation

kdebisschop
Copy link
Contributor

@kdebisschop kdebisschop commented Jan 14, 2024

Overall Review of Changes:
Fix regex to prevent swallowing closing quote in bootloader config.

Issue Fixes:
#132

Enhancements:
Please list any enhancements/features that are not open issue tickets: None

How has this been tested?:
Ran against and existing system. Quote was no longer removed from output.

before:

$ git -C roles/UBUNTU20-CIS checkout devel
Already on 'devel'
Your branch is up to date with 'origin/devel'.
$ ansible-playbook -i inventory.yml -l ... -e ubtu20cis_section1_patch=true cis-ubuntu20.yml  -CD

PLAY [ubuntu] ************************************************************************************************************************************************

TASK [UBUNTU20-CIS : 1.6.1.2 | PATCH | Ensure AppArmor is enabled in the bootloader configuration | Set apparmor settings if none exist | Replace apparmor settings when exists] ***
--- before: /etc/default/grub
+++ after: /etc/default/grub
@@ -30,5 +30,5 @@
 
 # Uncomment to get a beep at grub start
 #GRUB_INIT_TUNE="480 440 1"
-GRUB_CMDLINE_LINUX="audit=1 audit_backlog_limit=8192 apparmor=1 security=apparmor"
+GRUB_CMDLINE_LINUX="audit=1 audit_backlog_limit=8192 apparmor=1 security=apparmor
 

changed: [...] => (item={'regexp': 'security=\\S+', 'replace': 'security=apparmor'})

After

$ git -C roles/UBUNTU20-CIS checkout AppArmor-bootloader-quoting
Switched to branch 'AppArmor-bootloader-quoting'
Your branch is up to date with 'fork/AppArmor-bootloader-quoting'.
$ ansible-playbook -i inventory.yml -l use1-dev-app0.bioraft.net -e ubtu20cis_section1_patch=true cis-ubuntu20.yml  -CD

PLAY [ubuntu] ************************************************************************************************************************************************

PLAY RECAP ***************************************************************************************************************************************************
use1-dev-app0.bioraft.net  : ok=75   changed=0    unreachable=0    failed=0    skipped=482  rescued=0    ignored=0   

Copy link
Member

@uk-bolly uk-bolly left a comment

Choose a reason for hiding this comment

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

nice pick up

@uk-bolly uk-bolly merged commit 61dc2e2 into ansible-lockdown:devel Jan 26, 2024
4 checks passed
@kdebisschop kdebisschop deleted the AppArmor-bootloader-quoting branch January 28, 2024 21:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants