update README for hardening-basic

This commit is contained in:
Claudio Maradonna 2022-11-21 15:02:03 +01:00
parent 6a875bc851
commit 634ec86744
Signed by untrusted user who does not match committer: claudiomaradonna
GPG key ID: 0CBA58694C5680D9
3 changed files with 25 additions and 18 deletions

View file

@ -1,38 +1,42 @@
Role Name hardening-basic
========= =========
A brief description of the role goes here. This role harden a target with best practises for SSH, modprobe and sysctl
Requirements Requirements
------------ ------------
Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required. .
Role Variables Role Variables
-------------- --------------
A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well. - *hardening_sshd_enabled* (boolean): Enable or disable ssh hardening
- *hardening_sshd_port* (integer): Set the SSHD port
- *hardening_sshd_authorized_key_file* (string): Set the relative path for sshd authorized_key_file
- *hardening_sshd_tcp_forward* (boolean): Enable or disable sshd tcp forwarding
- *hardening_sshd_legal_banner* (boolean): Enable or disable sshd legal banner (/etc/issue.net)
- *hardening_sshd_permissions_set_sticky_bit* (boolean): Enable or disable the sticky bit for sshd directory and files (root)
- *hardening_sysctl_vm_swappiness* (integer): Set the value for sysctl vm.swappiness
- *hardening_sysctl_disable_ipv6* (boolean): Enable or disable ipv6 though sysctl
- *hardening_modprobe_disable_list* (dict): Array of sections. Each section contains an array of string: modules, protocols and so on that can be disabled through modprobe
Dependencies Dependencies
------------ ------------
A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles. .
Example Playbook Example Playbook
---------------- ----------------
Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too: `ansible-playbook -i inventory/example.yml handbook.yml --extra-vars="target=your_target" --tags hardening`
- hosts: servers
roles:
- { role: username.rolename, x: 42 }
License License
------- -------
BSD GPLv3
Author Information Author Information
------------------ ------------------
An optional section for the role authors to include contact information, or a website (HTML is not allowed). - [Claudio Maradonna](https://social.unitoo.it/claudio)

View file

@ -8,6 +8,9 @@ hardening_sshd_tcp_forward: false
hardening_sshd_legal_banner: false hardening_sshd_legal_banner: false
hardening_sshd_permissions_set_sticky_bit: true hardening_sshd_permissions_set_sticky_bit: true
hardening_sysctl_vm_swappiness: 15
hardening_sysctl_disable_ipv6: false
hardening_modprobe_disable_list: hardening_modprobe_disable_list:
ipv6: [ipv6] ipv6: [ipv6]
network_filesystems: [cifs,nfs,nfsv3,nfsv4,gfs2] network_filesystems: [cifs,nfs,nfsv3,nfsv4,gfs2]

View file

@ -14,7 +14,6 @@ kernel.randomize_va_space = 2
kernel.sysrq = 0 kernel.sysrq = 0
kernel.unprivileged_bpf_disabled = 1 kernel.unprivileged_bpf_disabled = 1
net.core.bpf_jit_harden = 2 net.core.bpf_jit_harden = 2
net.ipv4.conf.all.accept_redirects = 0 net.ipv4.conf.all.accept_redirects = 0
net.ipv4.conf.all.accept_source_route = 0 net.ipv4.conf.all.accept_source_route = 0
@ -52,10 +51,11 @@ kernel.yama.ptrace_scope=2
vm.mmap_rnd_bits=32 vm.mmap_rnd_bits=32
vm.mmap_rnd_compat_bits=16 vm.mmap_rnd_compat_bits=16
# Uncomment do disable ipv6 {% if hardening_sysctl_disable_ipv6 %}
#net.ipv6.conf.all.disable_ipv6=1 net.ipv6.conf.all.disable_ipv6=1
#net.ipv6.conf.default.disable_ipv6=1 net.ipv6.conf.default.disable_ipv6=1
#net.ipv6.conf.lo.disable_ipv6=1 net.ipv6.conf.lo.disable_ipv6=1
{% endif %}
net.ipv6.conf.all.accept_redirects = 0 net.ipv6.conf.all.accept_redirects = 0
net.ipv6.conf.all.accept_source_route = 0 net.ipv6.conf.all.accept_source_route = 0
@ -63,4 +63,4 @@ net.ipv6.conf.all.accept_source_route = 0
net.ipv6.conf.default.accept_redirects = 0 net.ipv6.conf.default.accept_redirects = 0
net.ipv6.conf.default.accept_source_route = 0 net.ipv6.conf.default.accept_source_route = 0
vm.swappiness = 15 vm.swappiness = {{ hardening_sysctl_vm_swappiness }}