Compare commits

...
17 Commits
Author SHA1 Message Date
lbayerleinandLudwig Bayerlein 1a97c6cf87 new feautre tmout in a new pr (#516)
Signed-off-by: Ludwig Bayerlein <[email protected]>

Co-authored-by: Ludwig Bayerlein <[email protected]>
2021-12-16 11:39:24 +01:00
dev-sec CI 73d319cc79 update changelog 2021-12-10 21:12:13 +00:00
Sebastian Gumprich 8f22ce788c Feature coredump (#513)
* restructure limits-tasks

* disable coredumps in tests

* use notify-task for systemd-reload

Signed-off-by: rndmh3ro <[email protected]>

* add notify to another task

Signed-off-by: rndmh3ro <[email protected]>

* rm obsolete task and rename handler

Signed-off-by: rndmh3ro <[email protected]>
2021-12-10 22:10:14 +01:00
dev-sec CI 945d00fd91 update changelog 2021-12-08 13:27:41 +00:00
lbayerleinandLudwig Bayerlein bb8e3e375e add feature to disable coredump to limit task (#511)
Signed-off-by: Ludwig Bayerlein <[email protected]>

Co-authored-by: Ludwig Bayerlein <[email protected]>
2021-12-08 14:25:49 +01:00
dev-sec CI db78f612f5 update changelog 2021-11-30 09:24:20 +00:00
schurzi 82be5db515 Merge pull request #510 from alegrey91/master
change hidepid mount task state to mounted
2021-11-30 10:22:24 +01:00
alegrey91 8805d9c14a fix: change hidepid mount task state to mounted 2021-11-29 22:37:21 +01:00
dev-sec CI ed17a6370a update changelog 2021-11-29 09:27:29 +00:00
schurzi ad43f908df prettify nginx options (#509)
Signed-off-by: Martin Schurz <[email protected]>
2021-11-29 10:25:43 +01:00
dev-sec CI 530069ae88 update changelog 2021-11-28 10:40:22 +00:00
schurzi cb3574ed56 Merge pull request #501 from ksaadDE/patch-3
Updated dh_params to 4096
2021-11-28 11:38:39 +01:00
dev-sec CI e95729b431 update changelog 2021-11-26 10:34:51 +00:00
duffn 1d25d4185c Update nginx_add_header README to match default (#506)
Signed-off-by: Nicholas Duffy <[email protected]>
2021-11-26 11:31:47 +01:00
tekicat 88893a5d4a Fix duplicate sysctl config (#505)
Signed-off-by: tekicat <[email protected]>
Signed-off-by: gk <[email protected]>
Signed-off-by: Tekicat <[email protected]>
2021-11-26 11:30:50 +01:00
dev-sec CI b67a28bd09 update galaxy.yml with new version 2021-11-23 10:49:03 +00:00
Karim f84ff572ac Updated dh_params to 4096
Updated dh_params to 4096
2021-11-15 19:02:59 +00:00
13 changed files with 108 additions and 30 deletions

No files matched your search

+30
View File
@@ -1,5 +1,35 @@
# Changelog
## [7.14.0](https://github.com/dev-sec/ansible-collection-hardening/tree/7.14.0) (2021-12-10)
[Full Changelog](https://github.com/dev-sec/ansible-collection-hardening/compare/7.13.2...7.14.0)
**Implemented enhancements:**
- add feature to disable coredump to limit task [\#511](https://github.com/dev-sec/ansible-collection-hardening/pull/511) [[os_hardening](https://github.com/dev-sec/ansible-collection-hardening/labels/os_hardening)] ([lbayerlein](https://github.com/lbayerlein))
- Updated dh\_params to 4096 [\#501](https://github.com/dev-sec/ansible-collection-hardening/pull/501) [[nginx_hardening](https://github.com/dev-sec/ansible-collection-hardening/labels/nginx_hardening)] ([ksaadDE](https://github.com/ksaadDE))
**Fixed bugs:**
- Fix duplicate sysctl config in fs [\#505](https://github.com/dev-sec/ansible-collection-hardening/pull/505) [[os_hardening](https://github.com/dev-sec/ansible-collection-hardening/labels/os_hardening)] ([tekicat](https://github.com/tekicat))
**Closed issues:**
- Roll back the changes [\#512](https://github.com/dev-sec/ansible-collection-hardening/issues/512)
- Installing collection at tag 7.13.2 is defaulting to 7.12.0 each time [\#508](https://github.com/dev-sec/ansible-collection-hardening/issues/508)
- Duplication of sysctl default parameter fs.protected\_hardlinks and fs.protected\_symlinks [\#502](https://github.com/dev-sec/ansible-collection-hardening/issues/502)
**Merged pull requests:**
- Feature coredump [\#513](https://github.com/dev-sec/ansible-collection-hardening/pull/513) [[os_hardening](https://github.com/dev-sec/ansible-collection-hardening/labels/os_hardening)] ([rndmh3ro](https://github.com/rndmh3ro))
- change hidepid mount task state to mounted [\#510](https://github.com/dev-sec/ansible-collection-hardening/pull/510) [[os_hardening](https://github.com/dev-sec/ansible-collection-hardening/labels/os_hardening)] ([alegrey91](https://github.com/alegrey91))
- prettify nginx options [\#509](https://github.com/dev-sec/ansible-collection-hardening/pull/509) [[nginx_hardening](https://github.com/dev-sec/ansible-collection-hardening/labels/nginx_hardening)] ([schurzi](https://github.com/schurzi))
- Update nginx\_add\_header README to match default [\#506](https://github.com/dev-sec/ansible-collection-hardening/pull/506) [[nginx_hardening](https://github.com/dev-sec/ansible-collection-hardening/labels/nginx_hardening)] ([duffn](https://github.com/duffn))
## [7.13.2](https://github.com/dev-sec/ansible-collection-hardening/tree/7.13.2) (2021-11-23)
[Full Changelog](https://github.com/dev-sec/ansible-collection-hardening/compare/7.13.1...7.13.2)
## [7.13.1](https://github.com/dev-sec/ansible-collection-hardening/tree/7.13.1) (2021-11-23)
[Full Changelog](https://github.com/dev-sec/ansible-collection-hardening/compare/7.13.0...7.13.1)
+1 -1
View File
@@ -1,6 +1,6 @@
namespace: devsec
name: hardening
version: 7.12.0
version: 7.13.2
readme: README.md
authors:
- dev-sec <[email protected]>
+1 -1
View File
@@ -16,7 +16,7 @@
name: os_hardening
vars:
os_security_users_allow: change_user
os_security_kernel_enable_core_dump: true
os_security_kernel_enable_core_dump: false
os_security_suid_sgid_remove_from_unknown: true
os_auth_pam_passwdqc_enable: false
os_auth_lockout_time: 15
+2 -2
View File
@@ -61,8 +61,8 @@ It works with the following nginx-roles, including, but not limited to:
- Default: `default 5`
- Description: Sets the shared memory zone and the maximum allowed number of connections for a given key value.
- [nginx_add_header][]
- Default: `[ "X-Frame-Options SAMEORIGIN", "X-Content-Type-Options nosniff", "X-XSS-Protection \"1; mode=block\"" ]`
- Description:Adds the specified field to a response header provided that the response code equals 200, 201, 204, 206, 301, 302, 303, 304, or 307.
- Default: `[ "X-Frame-Options SAMEORIGIN", "X-Content-Type-Options nosniff", "X-XSS-Protection \"1; mode=block\"", Content-Security-Policy \"script-src 'self'; object-src 'self'\" ]`
- Description: Adds the specified field to a response header provided that the response code equals 200, 201, 204, 206, 301, 302, 303, 304, or 307.
- [nginx_ssl_protocols][]
- Default: `TLSv1.2`
- Description: Specifies the SSL protocol which should be used.
+10 -10
View File
@@ -11,19 +11,19 @@ nginx_client_header_timeout: "10"
nginx_send_timeout: "10"
nginx_limit_conn_zone: "$binary_remote_addr zone=default:10m"
nginx_limit_conn: "default 5"
nginx_add_header: [
# vvoid clickjacking
"X-Frame-Options SAMEORIGIN",
# disable content-type sniffing
"X-Content-Type-Options nosniff",
# XSS filter
"X-XSS-Protection \"1; mode=block\"",
"Strict-Transport-Security max-age=15768000",
"Content-Security-Policy \"script-src 'self'; object-src 'self'\"" ]
nginx_add_header:
# avoid clickjacking
- X-Frame-Options SAMEORIGIN
# disable content-type sniffing
- X-Content-Type-Options nosniff
# XSS filter
- X-XSS-Protection "1; mode=block"
- Strict-Transport-Security max-age=15768000
- Content-Security-Policy "script-src 'self'; object-src 'self'"
nginx_set_cookie_flag: "* HttpOnly secure"
nginx_ssl_prefer_server_ciphers: "on"
nginx_ssl_protocols: "TLSv1.2 TLSv1.3"
nginx_ssl_ciphers: "ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256"
nginx_ssl_session_tickets: "off"
nginx_dh_size: "2048"
nginx_dh_size: "4096"
+3
View File
@@ -250,6 +250,9 @@ We know that this is the case on Raspberry Pi.
- `os_profile_enabled`
- Default: `true`
- Description: Set to false to disable installing and configuring profile.
- `os_security_auto_logout`
- Default: `0`
- Description: Set timeout in seconds for logout users automatically after time. Setting this to `0` disables the timeout.
- `os_securetty_enabled`
- Default: `true`
- Description: Set to false to disable installing and configuring securetty.
+9 -10
View File
@@ -69,6 +69,12 @@ sysctl_config:
# filenames (generally seen as "/tmp file race" vulnerabilities).
fs.protected_hardlinks: 1
fs.protected_symlinks: 1
# For more info on the following settings see: https://www.kernel.org/doc/html/latest/admin-guide/sysctl/fs.html
# Restrict FIFO special device creation behavior
fs.protected_fifos: 1
# Restrict regular files creation behavior
fs.protected_regular: 2
# Prevent core dumps with SUID. These are usually only
# needed by developers and may contain sensitive information. | sysctl-31
@@ -290,16 +296,6 @@ sysctl_config:
# Mitigates CVE-2021-33909 and other exploits.
kernel.unprivileged_userns_clone: 0
# For more info on the following settings see: https://www.kernel.org/doc/html/latest/admin-guide/sysctl/fs.html
# Restrict FIFO special device creation behavior
fs.protected_fifos: 1
# Restrict hardlink creation behavior
fs.protected_hardlinks: 1
# Restrict regular files creation behavior
fs.protected_regular: 2
# Restrict symlink following behavior
fs.protected_symlinks: 1
# Do not delete the following line or otherwise the playbook will fail
# at task 'create a combined sysctl-dict if overwrites are defined'
sysctl_overwrite:
@@ -368,6 +364,9 @@ os_profile_enabled: true
# Set to false to disable installing and configuring securetty.
os_securetty_enabled: true
# Set timeout in seconds for logout users automatically after time. Setting this to `0` disables the timeout.
os_security_auto_logout: 0
# Set to false to disable installing and configuring sysctl.
os_sysctl_enabled: true
+4
View File
@@ -7,3 +7,7 @@
cmd: 'service auditd restart' # rhel: see: https://access.redhat.com/solutions/2664811
warn: false # sadly 'service' module fails in that case also by using 'use: service'
when: molecule_yml is not defined # restarting auditd in a container does not work
- name: Reload systemd
systemd:
daemon_reload: yes
+34 -5
View File
@@ -1,5 +1,6 @@
---
- block:
- name: disable coredumps
block:
- name: Create limits.d-directory if it does not exist | sysctl-31a, sysctl-31b
file:
path: '/etc/security/limits.d'
@@ -27,10 +28,38 @@
modification_time: preserve
access_time: preserve
- name: create coredump.conf.d-directory if it does not exist
file:
path: '/etc/systemd/coredump.conf.d'
owner: root
group: root
mode: 0755
state: directory
when: ansible_service_mgr == "systemd"
- name: create custom.conf for disabling coredumps
template:
src: 'etc/systemd/coredump.conf.d/coredumps.conf.j2'
dest: '/etc/systemd/coredump.conf.d/custom.conf'
owner: root
group: root
mode: 0644
when: ansible_service_mgr == "systemd"
notify: Reload systemd
when: not os_security_kernel_enable_core_dump | bool
- name: Remove 10.hardcore.conf config file
file:
path: /etc/security/limits.d/10.hardcore.conf
state: absent
- name: enable coredumps
block:
- name: Remove coredump.conf.d directory with files
file:
path: /etc/systemd/coredump.conf.d
state: absent
when: ansible_service_mgr == "systemd"
notify: Reload systemd
- name: Remove 10.hardcore.conf config file
file:
path: /etc/security/limits.d/10.hardcore.conf
state: absent
when: os_security_kernel_enable_core_dump | bool
+1 -1
View File
@@ -79,4 +79,4 @@
src: proc
fstype: proc
opts: '{{ proc_mnt_options }}'
state: present
state: mounted
+8
View File
@@ -13,3 +13,11 @@
path: /etc/profile.d/pinerolo_profile.sh
state: absent
when: os_security_kernel_enable_core_dump | bool
- name: Add autologout to profile env
template:
src: 'etc/profile.d/tmout.sh.j2'
dest: '/etc/profile.d/tmout.sh'
owner: 'root'
group: 'root'
mode: '0750'
@@ -0,0 +1,3 @@
# Logout Timeout
export TMOUT={{ os_security_auto_logout }}
readonly TMOUT
@@ -0,0 +1,2 @@
[Coredump]
Storage=none