Skip to content

Commit

Permalink
Merge pull request #209 from dev-sec/speedup
Browse files Browse the repository at this point in the history
change minimize access tasks to speed them up
  • Loading branch information
rndmh3ro committed Mar 24, 2019
2 parents 6de1df0 + 51c75bb commit 66f6c3c
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 19 deletions.
12 changes: 0 additions & 12 deletions tasks/find_files.yml

This file was deleted.

2 changes: 1 addition & 1 deletion tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
---

- include_tasks: hardening.yml
- import_tasks: hardening.yml
when: os_hardening_enabled
22 changes: 16 additions & 6 deletions tasks/minimize_access.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,26 @@
---
# Using a two-pass approach for checking directories in order to support symlinks.
- include_tasks: find_files.yml
loop_control:
loop_var: outer_item
loop:
- name: find files with write-permissions for group
shell: "find -L {{ item }} -perm /go+w -type f"
with_flattened:
- '/usr/local/sbin'
- '/usr/local/bin'
- '/usr/sbin'
- '/usr/bin'
- '/sbin'
- '/bin'
- '{{ os_env_extra_user_paths }}'
- "{{ os_env_extra_user_paths }}"
register: minimize_access_directories
ignore_errors: true
changed_when: false

- name: minimize access on found files
file:
path: '{{ item.1 }}'
mode: 'go-w'
state: file
with_subelements:
- "{{minimize_access_directories.results }}"
- stdout_lines

- name: change shadow ownership to root and mode to 0600 | os-02
file:
Expand Down

0 comments on commit 66f6c3c

Please sign in to comment.