Skip to content

Commit

Permalink
Merge pull request dev-sec#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 authored Mar 24, 2019
2 parents 0d4274a + ececa0e commit b6022d5
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 b6022d5

Please sign in to comment.