2015-05-26 19:53:55 +00:00
|
|
|
---
|
2015-05-31 15:51:57 +00:00
|
|
|
- name: remove suid/sgid bit from binaries in blacklist
|
2015-06-23 10:54:48 +00:00
|
|
|
file: path='{{item}}' mode='a-s' state=file follow=yes
|
2015-05-31 15:51:57 +00:00
|
|
|
ignore_errors: true
|
|
|
|
with_items:
|
|
|
|
- '{{ os_security_suid_sgid_system_blacklist }}'
|
|
|
|
- '{{ os_security_suid_sgid_blacklist }}'
|
2015-05-26 19:53:55 +00:00
|
|
|
|
2015-05-31 15:51:57 +00:00
|
|
|
- name: find binaries with suid/sgid set
|
|
|
|
shell: find / -xdev \( -perm -4000 -o -perm -2000 \) -type f ! -path '/proc/*' -print 2>/dev/null
|
|
|
|
register: sbit_binaries
|
|
|
|
when: os_security_suid_sgid_remove_from_unknown
|
2015-06-17 17:17:04 +00:00
|
|
|
changed_when: False
|
2015-05-31 15:51:57 +00:00
|
|
|
|
|
|
|
- name: gather files from which to remove suids/sgids and remove system white-listed files
|
|
|
|
set_fact:
|
|
|
|
suid: '{{ sbit_binaries.stdout_lines | difference(os_security_suid_sgid_system_whitelist) }}'
|
|
|
|
when: os_security_suid_sgid_remove_from_unknown
|
|
|
|
|
2015-06-01 19:36:37 +00:00
|
|
|
- name: remove suid/sgid bit from all binaries except in system and user whitelist
|
2015-06-23 10:54:48 +00:00
|
|
|
file: path='{{item}}' mode='a-s' state=file follow=yes
|
2015-05-31 15:51:57 +00:00
|
|
|
with_items:
|
2015-06-01 19:36:37 +00:00
|
|
|
- '{{ suid | difference(os_security_suid_sgid_whitelist) }}'
|
2015-06-01 21:46:05 +00:00
|
|
|
when: os_security_suid_sgid_remove_from_unknown
|