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 in file_ownership_audit_configuration #12029

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,6 @@ template:
- /etc/audit/
- /etc/audit/rules.d/
file_regex:
- ^audit(\.rules|d\.conf)$
- ^.*audit(\.rules|d\.conf)$
- ^.*\.rules$
gid_or_name: '0'
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,6 @@ template:
- /etc/audit/
- /etc/audit/rules.d/
file_regex:
- ^audit(\.rules|d\.conf)$
- ^.*audit(\.rules|d\.conf)$
- ^.*\.rules$
fileuid: '0'
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ template:
- /etc/audit/
- /etc/audit/rules.d/
file_regex:
- .*audit\(\.rules\|d\.conf\)$
- .*\.rules$
- ^.*audit(\.rules|d\.conf)$
- ^.*\.rules$
allow_stricter_permissions: "true"
filemode: '0640'
2 changes: 1 addition & 1 deletion shared/templates/file_groupowner/ansible.template
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
{{%- endif %}}

- name: Find {{{ path }}} file(s) matching {{{ FILE_REGEX[loop.index0] }}}{{% if RECURSIVE %}} recursively{{% endif %}}
command: 'find -H {{{ path }}} {{{ FIND_RECURSE_ARGS }}} -type f ! -group {{{ GID_OR_NAME }}} -regex "{{{ FILE_REGEX[loop.index0] }}}"'
command: 'find -H {{{ path }}} {{{ FIND_RECURSE_ARGS }}} -type f ! -group {{{ GID_OR_NAME }}} -regextype posix-extended -regex "{{{ FILE_REGEX[loop.index0] }}}"'
register: files_found
changed_when: False
failed_when: False
Expand Down
2 changes: 1 addition & 1 deletion shared/templates/file_groupowner/bash.template
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
{{%- if IS_DIRECTORY %}}
{{%- if FILE_REGEX %}}

find {{{ path }}} {{{ FIND_RECURSE_ARGS }}} -type f ! -group {{{ GID_OR_NAME }}} -regex '{{{ FILE_REGEX[loop.index0] }}}' -exec chgrp {{{ GID_OR_NAME }}} {} \;
find {{{ path }}} {{{ FIND_RECURSE_ARGS }}} -type f ! -group {{{ GID_OR_NAME }}} -regextype posix-extended -regex '{{{ FILE_REGEX[loop.index0] }}}' -exec chgrp {{{ GID_OR_NAME }}} {} \;
{{%- else %}}
find -H {{{ path }}} {{{ FIND_RECURSE_ARGS }}} -type d -exec chgrp {{{ GID_OR_NAME }}} {} \;
{{%- endif %}}
Expand Down
2 changes: 1 addition & 1 deletion shared/templates/file_owner/ansible.template
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
{{%- endif %}}

- name: Find {{{ path }}} file(s) matching {{{ FILE_REGEX[loop.index0] }}}{{% if RECURSIVE %}} recursively{{% endif %}}
command: 'find -H {{{ path }}} {{{ FIND_RECURSE_ARGS }}} -type f ! -uid {{{ FILEUID }}} -regex "{{{ FILE_REGEX[loop.index0] }}}"'
command: 'find -H {{{ path }}} {{{ FIND_RECURSE_ARGS }}} -type f ! -uid {{{ FILEUID }}} -regextype posix-extended -regex "{{{ FILE_REGEX[loop.index0] }}}"'
register: files_found
changed_when: False
failed_when: False
Expand Down
2 changes: 1 addition & 1 deletion shared/templates/file_owner/bash.template
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
{{%- if IS_DIRECTORY %}}
{{%- if FILE_REGEX %}}

find {{{ path }}} {{{ FIND_RECURSE_ARGS }}} -type f ! -uid {{{ FILEUID }}} -regex '{{{ FILE_REGEX[loop.index0] }}}' -exec chown {{{ FILEUID }}} {} \;
find {{{ path }}} {{{ FIND_RECURSE_ARGS }}} -type f ! -uid {{{ FILEUID }}} -regextype posix-extended -regex '{{{ FILE_REGEX[loop.index0] }}}' -exec chown {{{ FILEUID }}} {} \;
{{%- else %}}
find -H {{{ path }}} {{{ FIND_RECURSE_ARGS }}} -type d -exec chown {{{ FILEUID }}} {} \;
{{%- endif %}}
Expand Down
2 changes: 1 addition & 1 deletion shared/templates/file_permissions/ansible.template
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
{{%- if FILE_REGEX %}}
{{% set STATE="file" %}}
{{% set FIND_TYPE="-type f" %}}
{{% set FIND_FILE_REGEX="-regex \"" ~ FILE_REGEX[loop.index0] ~ "\"" %}}
{{% set FIND_FILE_REGEX="-regextype posix-extended -regex \"" ~ FILE_REGEX[loop.index0] ~ "\"" %}}
{{%- else %}}
{{% set STATE="directory" %}}
{{% set FIND_TYPE="-type d" %}}
Expand Down
2 changes: 1 addition & 1 deletion shared/templates/file_permissions/bash.template
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
{{% for path in FILEPATH %}}
{{%- if IS_DIRECTORY %}}
{{%- if FILE_REGEX %}}
find -H {{{ path }}} {{{ FIND_RECURSE_ARGS }}} {{{ PERMS }}} {{{ EXCLUDED_FILES_ARGS }}} -type f -regex '{{{ FILE_REGEX[loop.index0] }}}' -exec chmod {{{ FILEMODE }}} {} \;
find -H {{{ path }}} {{{ FIND_RECURSE_ARGS }}} {{{ PERMS }}} {{{ EXCLUDED_FILES_ARGS }}} -type f -regextype posix-extended -regex '{{{ FILE_REGEX[loop.index0] }}}' -exec chmod {{{ FILEMODE }}} {} \;
{{%- else %}}
find -H {{{ path }}} {{{ FIND_RECURSE_ARGS }}} {{{ PERMS }}} -type d -exec chmod {{{ FILEMODE }}} {} \;
{{%- endif %}}
Expand Down
Loading