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

cis_4.2.1.x.yml failed with a RegEx Syntax Error #32

Closed
twadelij opened this issue Jun 26, 2023 · 1 comment
Closed

cis_4.2.1.x.yml failed with a RegEx Syntax Error #32

twadelij opened this issue Jun 26, 2023 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@twadelij
Copy link

Hi,
The cis_4.2.1.x.yml failed with the following error:
Syntax Error while loading YAML.
found unknown escape character
The error appears to be in '/etc/ansible/roles/UBUNTU22-CIS/tasks/section_4/cis_4.2.1.x.yml': line 114, column 25, but may be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:
path: "{{ systemd_conf_file | default('/usr/lib/tmpfiles.d/systemd.conf') }}"
regexp: "^z /var/log/journal/%m/system.journal (!?06(0|4)0) root"
^ here

Expected Behavior
No errors

Actual Behavior
After the error the role isn't run and stops

Control(s) Affected
All Controls

Environment (please complete the following information):

  • Ansible Version: 2.9.27
  • Host Python Version: 2.7.5
  • Ansible Server Python Version: 2.7.5
  • Additional Details:

Additional Notes
NA

Possible Solution
For me it worked when I changed double quotes to single quotes:
"^z /var/log/journal/%m/system.journal (!?06(0|4)0) root"

Into
'^z /var/log/journal/%m/system.journal (!?06(0|4)0) root'

But as you can see my Ansible version is ancient, so this may cause it to break on newer versions

@twadelij twadelij added the bug Something isn't working label Jun 26, 2023
@uk-bolly uk-bolly self-assigned this Jun 28, 2023
@uk-bolly
Copy link
Member

hi @twadelij

Thank you for taking the time to raise the issue and provide the details. It is with feedback we can improve. You are correct in your layout and while it should be ansible 2.10+ yours in the correct way.
I have amended this and a couple of other similar statements.
I will push this to the Jun23_updates branch which i hope we can merge to devel soon.

Many thanks

uk-bolly

uk-bolly added a commit that referenced this issue Jun 28, 2023
Signed-off-by: Mark Bolwell <mark.bollyuk@gmail.com>
uk-bolly added a commit that referenced this issue Jun 28, 2023
consistent lineinfile quotes

Signed-off-by: Mark Bolwell <mark.bollyuk@gmail.com>
@uk-bolly uk-bolly mentioned this issue Jun 28, 2023
@uk-bolly uk-bolly closed this as completed Sep 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants