Skip to content

Stabilization: Adjust file rules to not follow symlinks - #15031

Merged
jan-cerny merged 1 commit into
ComplianceAsCode:stabilizationfrom
Mab879:backport_15018
Aug 24, 2026
Merged

Stabilization: Adjust file rules to not follow symlinks#15031
jan-cerny merged 1 commit into
ComplianceAsCode:stabilizationfrom
Mab879:backport_15018

Conversation

@Mab879

@Mab879 Mab879 commented Aug 21, 2026

Copy link
Copy Markdown
Member

Backport #15018

Following symlinks can lead to issues
@Mab879 Mab879 added this to the 0.1.82 milestone Aug 21, 2026
@github-actions

Copy link
Copy Markdown

This datastream diff is auto generated by the check Compare DS/Generate Diff

Click here to see the full diff
ansible remediation for rule 'xccdf_org.ssgproject.content_rule_accounts_users_home_files_groupownership' differs.
--- xccdf_org.ssgproject.content_rule_accounts_users_home_files_groupownership
+++ xccdf_org.ssgproject.content_rule_accounts_users_home_files_groupownership
@@ -66,6 +66,7 @@
     path: '{{ item.0.value[4] }}'
     group: '{{ item.0.value[2] }}'
     recurse: true
+    follow: false
   loop: '{{ local_users|zip(path_exists.results)|list }}'
   when:
   - '"kernel-core" in ansible_facts.packages'

ansible remediation for rule 'xccdf_org.ssgproject.content_rule_accounts_users_home_files_ownership' differs.
--- xccdf_org.ssgproject.content_rule_accounts_users_home_files_ownership
+++ xccdf_org.ssgproject.content_rule_accounts_users_home_files_ownership
@@ -62,6 +62,7 @@
     path: '{{ item.0.value[4] }}'
     owner: '{{ item.0.value[1] }}'
     recurse: true
+    follow: false
   loop: '{{ local_users|zip(path_exists.results)|list }}'
   when:
   - '"kernel-core" in ansible_facts.packages'

bash remediation for rule 'xccdf_org.ssgproject.content_rule_accounts_users_netrc_file_permissions' differs.
--- xccdf_org.ssgproject.content_rule_accounts_users_netrc_file_permissions
+++ xccdf_org.ssgproject.content_rule_accounts_users_netrc_file_permissions
@@ -1,5 +1,5 @@
 
 for user in $(awk -F':' '{ if ($3 >= 1000 && $3 != 65534) print $1 }' /etc/passwd); do
     home_dir=$(getent passwd "$user" | cut -d: -f6)
-    find "${home_dir}/.netrc" -exec chmod 0600 {} \;
+    find "${home_dir}/.netrc" -type f -exec chmod 0600 {} \;
 done

ansible remediation for rule 'xccdf_org.ssgproject.content_rule_accounts_users_netrc_file_permissions' differs.
--- xccdf_org.ssgproject.content_rule_accounts_users_netrc_file_permissions
+++ xccdf_org.ssgproject.content_rule_accounts_users_netrc_file_permissions
@@ -47,7 +47,7 @@
     mode: '0600'
     state: file
   loop: '{{ path_exists.results }}'
-  when: item.stat is defined and item.stat.exists
+  when: item.stat is defined and item.stat.exists and not item.stat.islnk
   tags:
   - CCE-87369-5
   - accounts_users_netrc_file_permissions

@jan-cerny jan-cerny changed the title Adjust file rules to not follow symlinks Stabilization: Adjust file rules to not follow symlinks Aug 24, 2026
@jan-cerny jan-cerny self-assigned this Aug 24, 2026
@jan-cerny
jan-cerny merged commit d067187 into ComplianceAsCode:stabilization Aug 24, 2026
57 of 58 checks passed
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