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 incorrect file mode #12535

Closed

Conversation

alanmcanonical
Copy link
Contributor

Description:

  • Fix incorrect file mode for dir_permissions_library_dirs and file_permissions_library_dirs

Rationale:

  • The 7 as special mode is incorrect for those file and path

@openshift-ci openshift-ci bot added the needs-ok-to-test Used by openshift-ci bot. label Oct 24, 2024
Copy link

openshift-ci bot commented Oct 24, 2024

Hi @alanmcanonical. Thanks for your PR.

I'm waiting for a ComplianceAsCode member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

Copy link

Start a new ephemeral environment with changes proposed in this pull request:

rhel8 (from CTF) Environment (using Fedora as testing environment)
Open in Gitpod

Fedora Testing Environment
Open in Gitpod

Oracle Linux 8 Environment
Open in Gitpod

Copy link

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

Click here to see the full diff
bash remediation for rule 'xccdf_org.ssgproject.content_rule_dir_permissions_library_dirs' differs.
--- xccdf_org.ssgproject.content_rule_dir_permissions_library_dirs
+++ xccdf_org.ssgproject.content_rule_dir_permissions_library_dirs
@@ -3,10 +3,10 @@
 
 
 
-find -H /lib/  -perm /g+w,o+w -type d -exec chmod g-w,o-w {} \;
+find -H /lib/  -perm /u+s,g+ws,o+wt -type d -exec chmod u-s,g-ws,o-wt {} \;
 
-find -H /lib64/  -perm /g+w,o+w -type d -exec chmod g-w,o-w {} \;
+find -H /lib64/  -perm /u+s,g+ws,o+wt -type d -exec chmod u-s,g-ws,o-wt {} \;
 
-find -H /usr/lib/  -perm /g+w,o+w -type d -exec chmod g-w,o-w {} \;
+find -H /usr/lib/  -perm /u+s,g+ws,o+wt -type d -exec chmod u-s,g-ws,o-wt {} \;
 
-find -H /usr/lib64/  -perm /g+w,o+w -type d -exec chmod g-w,o-w {} \;
+find -H /usr/lib64/  -perm /u+s,g+ws,o+wt -type d -exec chmod u-s,g-ws,o-wt {} \;

ansible remediation for rule 'xccdf_org.ssgproject.content_rule_dir_permissions_library_dirs' differs.
--- xccdf_org.ssgproject.content_rule_dir_permissions_library_dirs
+++ xccdf_org.ssgproject.content_rule_dir_permissions_library_dirs
@@ -1,5 +1,5 @@
 - name: Find /lib/ file(s) recursively
-  command: 'find -H /lib/  -perm /g+w,o+w  -type d '
+  command: 'find -H /lib/  -perm /u+s,g+ws,o+wt  -type d '
   register: files_found
   changed_when: false
   failed_when: false
@@ -20,7 +20,7 @@
 - name: Set permissions for /lib/ file(s)
   file:
     path: '{{ item }}'
-    mode: g-w,o-w
+    mode: u-s,g-ws,o-wt
     state: directory
   with_items:
   - '{{ files_found.stdout_lines }}'
@@ -38,7 +38,7 @@
   - no_reboot_needed
 
 - name: Find /lib64/ file(s) recursively
-  command: 'find -H /lib64/  -perm /g+w,o+w  -type d '
+  command: 'find -H /lib64/  -perm /u+s,g+ws,o+wt  -type d '
   register: files_found
   changed_when: false
   failed_when: false
@@ -59,7 +59,7 @@
 - name: Set permissions for /lib64/ file(s)
   file:
     path: '{{ item }}'
-    mode: g-w,o-w
+    mode: u-s,g-ws,o-wt
     state: directory
   with_items:
   - '{{ files_found.stdout_lines }}'
@@ -77,7 +77,7 @@
   - no_reboot_needed
 
 - name: Find /usr/lib/ file(s) recursively
-  command: 'find -H /usr/lib/  -perm /g+w,o+w  -type d '
+  command: 'find -H /usr/lib/  -perm /u+s,g+ws,o+wt  -type d '
   register: files_found
   changed_when: false
   failed_when: false
@@ -98,7 +98,7 @@
 - name: Set permissions for /usr/lib/ file(s)
   file:
     path: '{{ item }}'
-    mode: g-w,o-w
+    mode: u-s,g-ws,o-wt
     state: directory
   with_items:
   - '{{ files_found.stdout_lines }}'
@@ -116,7 +116,7 @@
   - no_reboot_needed
 
 - name: Find /usr/lib64/ file(s) recursively
-  command: 'find -H /usr/lib64/  -perm /g+w,o+w  -type d '
+  command: 'find -H /usr/lib64/  -perm /u+s,g+ws,o+wt  -type d '
   register: files_found
   changed_when: false
   failed_when: false
@@ -137,7 +137,7 @@
 - name: Set permissions for /usr/lib64/ file(s)
   file:
     path: '{{ item }}'
-    mode: g-w,o-w
+    mode: u-s,g-ws,o-wt
     state: directory
   with_items:
   - '{{ files_found.stdout_lines }}'

bash remediation for rule 'xccdf_org.ssgproject.content_rule_file_permissions_library_dirs' differs.
--- xccdf_org.ssgproject.content_rule_file_permissions_library_dirs
+++ xccdf_org.ssgproject.content_rule_file_permissions_library_dirs
@@ -3,10 +3,10 @@
 
 
 
-find -H /lib/  -perm /g+w,o+w  -type f -regextype posix-extended -regex '^.*$' -exec chmod g-w,o-w {} \;
+find -H /lib/  -perm /u+s,g+ws,o+wt  -type f -regextype posix-extended -regex '^.*$' -exec chmod u-s,g-ws,o-wt {} \;
 
-find -H /lib64/  -perm /g+w,o+w  -type f -regextype posix-extended -regex '^.*$' -exec chmod g-w,o-w {} \;
+find -H /lib64/  -perm /u+s,g+ws,o+wt  -type f -regextype posix-extended -regex '^.*$' -exec chmod u-s,g-ws,o-wt {} \;
 
-find -H /usr/lib/  -perm /g+w,o+w  -type f -regextype posix-extended -regex '^.*$' -exec chmod g-w,o-w {} \;
+find -H /usr/lib/  -perm /u+s,g+ws,o+wt  -type f -regextype posix-extended -regex '^.*$' -exec chmod u-s,g-ws,o-wt {} \;
 
-find -H /usr/lib64/  -perm /g+w,o+w  -type f -regextype posix-extended -regex '^.*$' -exec chmod g-w,o-w {} \;
+find -H /usr/lib64/  -perm /u+s,g+ws,o+wt  -type f -regextype posix-extended -regex '^.*$' -exec chmod u-s,g-ws,o-wt {} \;

ansible remediation for rule 'xccdf_org.ssgproject.content_rule_file_permissions_library_dirs' differs.
--- xccdf_org.ssgproject.content_rule_file_permissions_library_dirs
+++ xccdf_org.ssgproject.content_rule_file_permissions_library_dirs
@@ -1,6 +1,6 @@
 - name: Find /lib/ file(s) recursively
-  command: find -H /lib/  -perm /g+w,o+w  -type f -regextype posix-extended -regex
-    "^.*$"
+  command: find -H /lib/  -perm /u+s,g+ws,o+wt  -type f -regextype posix-extended
+    -regex "^.*$"
   register: files_found
   changed_when: false
   failed_when: false
@@ -22,7 +22,7 @@
 - name: Set permissions for /lib/ file(s)
   file:
     path: '{{ item }}'
-    mode: g-w,o-w
+    mode: u-s,g-ws,o-wt
     state: file
   with_items:
   - '{{ files_found.stdout_lines }}'
@@ -41,8 +41,8 @@
   - no_reboot_needed
 
 - name: Find /lib64/ file(s) recursively
-  command: find -H /lib64/  -perm /g+w,o+w  -type f -regextype posix-extended -regex
-    "^.*$"
+  command: find -H /lib64/  -perm /u+s,g+ws,o+wt  -type f -regextype posix-extended
+    -regex "^.*$"
   register: files_found
   changed_when: false
   failed_when: false
@@ -64,7 +64,7 @@
 - name: Set permissions for /lib64/ file(s)
   file:
     path: '{{ item }}'
-    mode: g-w,o-w
+    mode: u-s,g-ws,o-wt
     state: file
   with_items:
   - '{{ files_found.stdout_lines }}'
@@ -83,8 +83,8 @@
   - no_reboot_needed
 
 - name: Find /usr/lib/ file(s) recursively
-  command: find -H /usr/lib/  -perm /g+w,o+w  -type f -regextype posix-extended -regex
-    "^.*$"
+  command: find -H /usr/lib/  -perm /u+s,g+ws,o+wt  -type f -regextype posix-extended
+    -regex "^.*$"
   register: files_found
   changed_when: false
   failed_when: false
@@ -106,7 +106,7 @@
 - name: Set permissions for /usr/lib/ file(s)
   file:
     path: '{{ item }}'
-    mode: g-w,o-w
+    mode: u-s,g-ws,o-wt
     state: file
   with_items:
   - '{{ files_found.stdout_lines }}'
@@ -125,7 +125,7 @@
   - no_reboot_needed
 
 - name: Find /usr/lib64/ file(s) recursively
-  command: find -H /usr/lib64/  -perm /g+w,o+w  -type f -regextype posix-extended
+  command: find -H /usr/lib64/  -perm /u+s,g+ws,o+wt  -type f -regextype posix-extended
     -regex "^.*$"
   register: files_found
   changed_when: false
@@ -148,7 +148,7 @@
 - name: Set permissions for /usr/lib64/ file(s)
   file:
     path: '{{ item }}'
-    mode: g-w,o-w
+    mode: u-s,g-ws,o-wt
     state: file
   with_items:
   - '{{ files_found.stdout_lines }}'

Copy link

Change in Ansible shell module found.

Please consider using more suitable Ansible module than shell if possible.

Copy link

codeclimate bot commented Oct 24, 2024

Code Climate has analyzed commit 85fe24e and detected 0 issues on this pull request.

The test coverage on the diff in this pull request is 100.0% (50% is the threshold).

This pull request will bring the total coverage in the repository to 60.9% (0.0% change).

View more on Code Climate.

@alanmcanonical alanmcanonical marked this pull request as draft October 24, 2024 11:05
@openshift-ci openshift-ci bot added the do-not-merge/work-in-progress Used by openshift-ci bot. label Oct 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
do-not-merge/work-in-progress Used by openshift-ci bot. needs-ok-to-test Used by openshift-ci bot.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant