Compare commits

..
8 Commits
Author SHA1 Message Date
Claudius Heine 384c097f8a feat(os_hardening): extend file permission tasks to cover more files (#489)
The tasks `Change shadow ownership to root and mode to 0600` and `Change
passwd ownership to root and mode to 0644` only handle
`/etc/shadow` and `/etc/passwd` respectively. But there multiple
adjacent files that should be handled with these rules as well:

- `/etc/gshadow`
- `/etc/shadow-`
- `/etc/gshadow-`
- `/etc/group`
- `/etc/shadow-`
- `/etc/group-`

This change adds those files to the rules, so that permissions are
handled in the same way.

Closes: #488

Signed-off-by: Claudius Heine <[email protected]>
2021-10-21 09:51:20 +02:00
dev-sec CI 999e5fa210 update changelog 2021-10-18 19:14:34 +00:00
schurzi 215c8042ad Merge pull request #490 from dev-sec/change_baseline_urlsa
change baseline urls to full zip-url
2021-10-18 21:04:05 +02:00
dev-sec CI 21ca7c533a update changelog 2021-10-18 18:57:06 +00:00
Sina Tak TehraniandSebastian Gumprich 5debcc0c6f fix filter error in ansible.builtin.file mode parameter (#486)
* fix filter error in ansible.builtin.file mode parameter

* Change cinc supermarket

* fix link to baseline

* fix typo

Co-authored-by: Sebastian Gumprich <[email protected]>
2021-10-18 20:55:24 +02:00
rndmh3ro 92bd94a0cf change baseline urls to full zip-url
the other urls that use git don't work anymore

Signed-off-by: rndmh3ro <[email protected]>
2021-10-18 20:28:19 +02:00
dev-sec CI aea4499805 update galaxy.yml with new version 2021-10-15 13:46:33 +00:00
dev-sec CI 29945527b8 update changelog 2021-08-30 13:47:56 +00:00
8 changed files with 49 additions and 10 deletions

No files matched your search

+16 -1
View File
@@ -1,6 +1,20 @@
# Changelog # Changelog
## [7.11.0](https://github.com/dev-sec/ansible-collection-hardening/tree/7.11.0) (2021-08-28) ## [7.11.1](https://github.com/dev-sec/ansible-collection-hardening/tree/7.11.1) (2021-10-18)
[Full Changelog](https://github.com/dev-sec/ansible-collection-hardening/compare/7.11.0...7.11.1)
**Fixed bugs:**
- change baseline urls to full zip-url [\#490](https://github.com/dev-sec/ansible-collection-hardening/pull/490) [[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))
- fix filter error in ansible.builtin.file mode parameter [\#486](https://github.com/dev-sec/ansible-collection-hardening/pull/486) [[ssh_hardening](https://github.com/dev-sec/ansible-collection-hardening/labels/ssh_hardening)] ([ssttehrani](https://github.com/ssttehrani))
**Closed issues:**
- os\_hardening fails on "Create a combined sysctl-dict if overwrites are defined" task [\#482](https://github.com/dev-sec/ansible-collection-hardening/issues/482)
- Improve changelog generation [\#381](https://github.com/dev-sec/ansible-collection-hardening/issues/381)
## [7.11.0](https://github.com/dev-sec/ansible-collection-hardening/tree/7.11.0) (2021-08-30)
[Full Changelog](https://github.com/dev-sec/ansible-collection-hardening/compare/7.10.0...7.11.0) [Full Changelog](https://github.com/dev-sec/ansible-collection-hardening/compare/7.10.0...7.11.0)
@@ -16,6 +30,7 @@
**Merged pull requests:** **Merged pull requests:**
- ssh\_allow\_tcp\_forwarding is not a boolean [\#480](https://github.com/dev-sec/ansible-collection-hardening/pull/480) [[ssh_hardening](https://github.com/dev-sec/ansible-collection-hardening/labels/ssh_hardening)] ([ReinerNippes](https://github.com/ReinerNippes))
- chore\(ssh\_hardening\): set min\_ansible\_version to \>=2.9.10 [\#479](https://github.com/dev-sec/ansible-collection-hardening/pull/479) [[ssh_hardening](https://github.com/dev-sec/ansible-collection-hardening/labels/ssh_hardening)] ([bufferoverflow](https://github.com/bufferoverflow)) - chore\(ssh\_hardening\): set min\_ansible\_version to \>=2.9.10 [\#479](https://github.com/dev-sec/ansible-collection-hardening/pull/479) [[ssh_hardening](https://github.com/dev-sec/ansible-collection-hardening/labels/ssh_hardening)] ([bufferoverflow](https://github.com/bufferoverflow))
## [7.10.0](https://github.com/dev-sec/ansible-collection-hardening/tree/7.10.0) (2021-08-15) ## [7.10.0](https://github.com/dev-sec/ansible-collection-hardening/tree/7.10.0) (2021-08-15)
+1 -1
View File
@@ -1,6 +1,6 @@
namespace: devsec namespace: devsec
name: hardening name: hardening
version: 7.10.0 version: 7.11.0
readme: README.md readme: README.md
authors: authors:
- dev-sec <[email protected]> - dev-sec <[email protected]>
+1 -1
View File
@@ -44,7 +44,7 @@
shell: "bash /tmp/install.sh -s -- -P cinc-auditor -v 4" shell: "bash /tmp/install.sh -s -- -P cinc-auditor -v 4"
- name: Execute cinc-auditor tests - name: Execute cinc-auditor tests
command: "/opt/cinc-auditor/bin/cinc-auditor exec --no-show-progress --no-color --no-distinct-exit supermarket://dev-sec/mysql-baseline" command: "/opt/cinc-auditor/bin/cinc-auditor exec --no-show-progress --no-color --no-distinct-exit https://github.com/dev-sec/mysql-baseline/archive/refs/heads/master.zip"
register: test_results register: test_results
changed_when: false changed_when: false
ignore_errors: true ignore_errors: true
+1 -1
View File
@@ -47,7 +47,7 @@
shell: "bash /tmp/install.sh -s -- -P cinc-auditor -v 4" shell: "bash /tmp/install.sh -s -- -P cinc-auditor -v 4"
- name: Execute cinc-auditor tests - name: Execute cinc-auditor tests
command: "/opt/cinc-auditor/bin/cinc-auditor exec --no-show-progress --no-color --no-distinct-exit supermarket://dev-sec/nginx-baseline" command: "/opt/cinc-auditor/bin/cinc-auditor exec --no-show-progress --no-color --no-distinct-exit https://github.com/dev-sec/nginx-baseline/archive/refs/heads/master.zip"
register: test_results register: test_results
changed_when: false changed_when: false
ignore_errors: true ignore_errors: true
+1 -1
View File
@@ -51,7 +51,7 @@
shell: "bash /tmp/install.sh -s -- -P cinc-auditor -v 4" shell: "bash /tmp/install.sh -s -- -P cinc-auditor -v 4"
- name: Execute cinc-auditor tests - name: Execute cinc-auditor tests
command: "/opt/cinc-auditor/bin/cinc-auditor exec --no-show-progress --no-color --no-distinct-exit supermarket://dev-sec/linux-baseline" command: "/opt/cinc-auditor/bin/cinc-auditor exec --no-show-progress --no-color --no-distinct-exit https://github.com/dev-sec/linux-baseline/archive/refs/heads/master.zip"
register: test_results register: test_results
changed_when: false changed_when: false
ignore_errors: true ignore_errors: true
+1 -1
View File
@@ -42,7 +42,7 @@
shell: "bash /tmp/install.sh -s -- -P cinc-auditor -v 4" shell: "bash /tmp/install.sh -s -- -P cinc-auditor -v 4"
- name: Execute cinc-auditor tests - name: Execute cinc-auditor tests
command: "/opt/cinc-auditor/bin/cinc-auditor exec --no-show-progress --no-color --no-distinct-exit supermarket://dev-sec/nginx-baseline" command: "/opt/cinc-auditor/bin/cinc-auditor exec --no-show-progress --no-color --no-distinct-exit https://github.com/dev-sec/ssh-baseline/archive/refs/heads/master.zip"
register: test_results register: test_results
changed_when: false changed_when: false
ignore_errors: true ignore_errors: true
+26 -2
View File
@@ -27,19 +27,43 @@
- "{{ minimize_access_directories.results }}" - "{{ minimize_access_directories.results }}"
- stdout_lines - stdout_lines
- name: Find shadow files
stat:
path: "{{ item }}"
loop:
- '/etc/shadow'
- '/etc/gshadow'
- '/etc/shadow-'
- '/etc/gshadow-'
register: minimize_access_shadow_files
- name: Change shadow ownership to root and mode to 0600 | os-02 - name: Change shadow ownership to root and mode to 0600 | os-02
file: file:
dest: '/etc/shadow' dest: "{{ item.item }}"
owner: '{{ os_shadow_perms.owner }}' owner: '{{ os_shadow_perms.owner }}'
group: '{{ os_shadow_perms.group }}' group: '{{ os_shadow_perms.group }}'
mode: '{{ os_shadow_perms.mode }}' mode: '{{ os_shadow_perms.mode }}'
when: item.stat.exists
loop: "{{ minimize_access_shadow_files.results }}"
- name: Find passwd files
stat:
path: "{{ item }}"
loop:
- '/etc/passwd'
- '/etc/group'
- '/etc/passwd-'
- '/etc/group-'
register: minimize_access_passwd_files
- name: Change passwd ownership to root and mode to 0644 | os-03 - name: Change passwd ownership to root and mode to 0644 | os-03
file: file:
dest: '/etc/passwd' dest: "{{ item.item }}"
owner: '{{ os_passwd_perms.owner }}' owner: '{{ os_passwd_perms.owner }}'
group: '{{ os_passwd_perms.group }}' group: '{{ os_passwd_perms.group }}'
mode: '{{ os_passwd_perms.mode }}' mode: '{{ os_passwd_perms.mode }}'
when: item.stat.exists
loop: "{{ minimize_access_passwd_files.results }}"
- name: Change su-binary to only be accessible to user and group root - name: Change su-binary to only be accessible to user and group root
file: file:
@@ -11,7 +11,7 @@
- name: Create ssh authorized principals directories - name: Create ssh authorized principals directories
file: file:
path: '{{ item.path | dirname }}' path: '{{ item.path | dirname }}'
mode: '{{ item.directorymode | default(0700) }}' mode: '{{ item.directorymode | default("700") }}'
owner: '{{ item.directoryowner | default(ssh_owner) }}' owner: '{{ item.directoryowner | default(ssh_owner) }}'
group: '{{ item.directorygroup | default(ssh_group) }}' group: '{{ item.directorygroup | default(ssh_group) }}'
state: directory state: directory
@@ -21,7 +21,7 @@
template: template:
src: 'authorized_principals.j2' src: 'authorized_principals.j2'
dest: '{{ item.path }}' dest: '{{ item.path }}'
mode: '{{ item.filemode | default(0600) }}' mode: '{{ item.filemode | default("600") }}'
owner: '{{ item.owner| default(ssh_owner) }}' owner: '{{ item.owner| default(ssh_owner) }}'
group: '{{ item.group | default(ssh_group) }}' group: '{{ item.group | default(ssh_group) }}'
loop: '{{ ssh_authorized_principals }}' loop: '{{ ssh_authorized_principals }}'