Compare commits

...
9 Commits
Author SHA1 Message Date
Sebastian Gumprich ddce9eccd9 use fqn for with_flattened
Signed-off-by: Sebastian Gumprich <[email protected]>
2022-07-15 12:07:24 +02:00
Sebastian Gumprich 92afe6e336 use fqn for with_flattened
Signed-off-by: Sebastian Gumprich <[email protected]>
2022-07-15 11:38:06 +02:00
Sebastian Gumprich 41982c15a8 Revert "add more tests to the os-hardening vm tests"
This reverts commit c05fe8b520.

Signed-off-by: Sebastian Gumprich <[email protected]>
2022-07-15 09:23:43 +02:00
Sebastian Gumprich c05fe8b520 add more tests to the os-hardening vm tests
Signed-off-by: Sebastian Gumprich <[email protected]>
2022-07-15 09:10:47 +02:00
Sebastian Gumprich 26e37cabc5 add more conditionals to when auditd show be hardened
Signed-off-by: Sebastian Gumprich <[email protected]>
2022-07-15 09:08:26 +02:00
Sebastian Gumprich 862edbbe40 Update roles/os_hardening/tasks/minimize_access.yml 2022-07-14 15:03:34 +02:00
David James 9d6903e7ad Only run harding if /var/log/audit exists
Signed-off-by: GitHub <[email protected]>
2022-07-13 17:58:20 +00:00
dev-sec CI b6f32948ec update galaxy.yml with new version 2022-07-11 21:14:56 +00:00
dev-sec CI 0a25d486a0 update changelog 2022-07-11 19:59:01 +00:00
6 changed files with 29 additions and 15 deletions

No files matched your search

+3 -1
View File
@@ -1,6 +1,6 @@
# Changelog
## [7.15.0](https://github.com/dev-sec/ansible-collection-hardening/tree/7.15.0) (2022-07-08)
## [7.15.0](https://github.com/dev-sec/ansible-collection-hardening/tree/7.15.0) (2022-07-11)
[Full Changelog](https://github.com/dev-sec/ansible-collection-hardening/compare/7.14.3...7.15.0)
@@ -10,6 +10,8 @@
**Fixed bugs:**
- os\_hardening gpg-check enabled fails on success [\#549](https://github.com/dev-sec/ansible-collection-hardening/issues/549) [[os_hardening](https://github.com/dev-sec/ansible-collection-hardening/labels/os_hardening)]
- add VM tests for os\_hardening [\#547](https://github.com/dev-sec/ansible-collection-hardening/pull/547) [[os_hardening](https://github.com/dev-sec/ansible-collection-hardening/labels/os_hardening)] ([schurzi](https://github.com/schurzi))
- Linting [\#546](https://github.com/dev-sec/ansible-collection-hardening/pull/546) [[mysql_hardening](https://github.com/dev-sec/ansible-collection-hardening/labels/mysql_hardening)] [[os_hardening](https://github.com/dev-sec/ansible-collection-hardening/labels/os_hardening)] [[ssh_hardening](https://github.com/dev-sec/ansible-collection-hardening/labels/ssh_hardening)] [[nginx_hardening](https://github.com/dev-sec/ansible-collection-hardening/labels/nginx_hardening)] ([rndmh3ro](https://github.com/rndmh3ro))
## [7.14.3](https://github.com/dev-sec/ansible-collection-hardening/tree/7.14.3) (2022-06-29)
+1 -2
View File
@@ -1,7 +1,6 @@
---
namespace: devsec
name: hardening
version: 7.14.3
version: 7.15.0
readme: README.md
authors:
- dev-sec <[email protected]>
+16 -3
View File
@@ -4,16 +4,17 @@
# still getting found and the permissions minimized in the next task.
# This is also the reason why there's ignore_errors: true on the task.
# also see: https://github.com/dev-sec/ansible-os-hardening/issues/219
- name: Find files with write-permissions for group
shell: "find -L {{ item }} -perm /go+w -type f" # noqa command-instead-of-shell
with_flattened:
loop:
- '/usr/local/sbin'
- '/usr/local/bin'
- '/usr/sbin'
- '/usr/bin'
- '/sbin'
- '/bin'
- "{{ os_env_extra_user_paths }}" # noqa deprecated-bare-vars
- "{{ os_env_extra_user_paths | flatten }}" # noqa deprecated-bare-vars
register: minimize_access_directories
ignore_errors: true
changed_when: false
@@ -208,6 +209,11 @@
group: 'root'
mode: '{{ os_mnt_var_log_dir_mode }}'
- name: Check if /var/log/audit exists
stat:
path: /var/log/audit
register: var_log_audit_exists
- name: Mount /var/log/audit with hardened options
mount:
path: /var/log/audit
@@ -216,7 +222,10 @@
opts: '{{ os_mnt_var_log_audit_options }}'
state: present
register: varlogauditmount
when: os_mnt_var_log_audit_enabled | bool
when:
- os_mnt_var_log_audit_enabled | bool
- var_log_audit_exists.stat.exists | bool
- os_auditd_enabled | bool
- name: Harden permissions for /var/log/audit directory
file:
@@ -224,6 +233,10 @@
owner: 'root'
group: 'root'
mode: '{{ os_mnt_var_log_audit_dir_mode }}'
when:
- os_mnt_var_log_audit_enabled | bool
- var_log_audit_exists.stat.exists | bool
- os_auditd_enabled | bool
- name: Mount /var/tmp with hardened options
mount:
+2 -2
View File
@@ -9,7 +9,7 @@
file:
dest: '~{{ item }}/.rhosts'
state: 'absent'
with_flattened: '{{ users_accounts.stdout_lines | default([]) }}'
loop: '{{ users_accounts.stdout_lines | default([]) | flatten }}'
- name: Delete hosts.equiv from system | os-01
file:
@@ -20,4 +20,4 @@
file:
dest: '~{{ item }}/.netrc'
state: 'absent'
with_flattened: '{{ users_accounts.stdout_lines | default([]) }}'
loop: '{{ users_accounts.stdout_lines | default([]) | flatten }}'
+5 -5
View File
@@ -6,9 +6,9 @@
state: 'file'
follow: 'yes'
failed_when: false
with_flattened:
- '{{ os_security_suid_sgid_system_blacklist }}'
- '{{ os_security_suid_sgid_blacklist }}'
loop:
- '{{ os_security_suid_sgid_system_blacklist | flatten }}'
- '{{ os_security_suid_sgid_blacklist | flatten }}'
- name: Find binaries with suid/sgid set | os-06
shell: find / -xdev \( -perm -4000 -o -perm -2000 \) -type f ! -path '/proc/*' -print 2>/dev/null
@@ -27,6 +27,6 @@
mode: 'a-s'
state: 'file'
follow: 'yes'
with_flattened:
- '{{ suid | default([]) | difference(os_security_suid_sgid_whitelist) }}'
loop:
- '{{ suid | default([]) | difference(os_security_suid_sgid_whitelist) | flatten }}'
when: os_security_suid_sgid_remove_from_unknown | bool
+2 -2
View File
@@ -43,8 +43,8 @@
shell: '{{ os_nologin_shell_path }}'
password: '*'
createhome: false
with_flattened:
- '{{ sys_accs_cond | default([]) | difference(os_ignore_users) | list }}'
loop:
- '{{ sys_accs_cond | default([]) | difference(os_ignore_users) | list | flatten }}'
- name: get all home directories in /home, but skip ignored users
find: