Skip to content

Commit a8e3499

Browse files
alegrey91rndmh3ro
andauthored
Mount proc filesystem using hidepid option (#283)
* Added task to mount proc fs using hidepid option Signed-off-by: alessio <[email protected]> Signed-off-by: alegrey91 <[email protected]> Signed-off-by: alessio <[email protected]> * Removed mount shell command due to ci problem Signed-off-by: alegrey91 <[email protected]> Signed-off-by: alessio <[email protected]> * Added task to create mount point before to add fstab entry Signed-off-by: alegrey91 <[email protected]> Signed-off-by: alessio <[email protected]> * Added check to ensure fstab exist Signed-off-by: alegrey91 <[email protected]> Signed-off-by: alessio <[email protected]> * Modified task title Signed-off-by: alegrey91 <[email protected]> Signed-off-by: alessio <[email protected]> * Fixed typo Signed-off-by: alegrey91 <[email protected]> Signed-off-by: alessio <[email protected]> * Fixed typo Signed-off-by: alegrey91 <[email protected]> Signed-off-by: alessio <[email protected]> * Fixed wrong indented lines Signed-off-by: alegrey91 <[email protected]> Signed-off-by: alessio <[email protected]> * Removed useless tasks and improved variables use Signed-off-by: alessio <[email protected]> * removed ansible test tag Signed-off-by: alessio <[email protected]> * removed trailing whitespace Signed-off-by: alessio <[email protected]> * updated documentation Signed-off-by: alessio <[email protected]> * fixed typo Signed-off-by: alessio <[email protected]> * Update README.md * Update vars/main.yml Co-authored-by: Sebastian Gumprich <[email protected]>
1 parent 476f2ec commit a8e3499

File tree

3 files changed

+13
-0
lines changed

3 files changed

+13
-0
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,8 @@ If you're using Docker / Kubernetes+Docker you'll need to override the ipv4 ip f
8080
| `ufw_default_forward_policy` | DROP | set default forward policy of ufw to `DROP` |
8181
| `os_auditd_enabled` | true | Set to false to disable installing and configuring auditd. |
8282
| `os_auditd_max_log_file_action` | `keep_logs` | Defines the behaviour of auditd when its log file is filled up. Possible other values are described in the auditd.conf man page. The most common alternative to the default may be `rotate`. |
83+
| `hidepid_option` | `2` | `0`: This is the default setting and gives you the default behaviour. `1`: With this option an normal user would not see other processes but their own about ps, top etc, but he is still able to see process IDs in /proc. `2`: Users are only able too see their own processes (like with hidepid=1), but also the other process IDs are hidden for them in /proc. |
84+
| `proc_mnt_options` | `rw,nosuid,nodev,noexec,relatime,hidepid={{ hidepid_option }}` | Mount proc with hardenized options, including `hidepid` with variable value. |
8385

8486
## Packages
8587

tasks/minimize_access.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,3 +48,11 @@
4848
group: 'root'
4949
mode: '0750'
5050
when: '"change_user" not in os_security_users_allow'
51+
52+
- name: set option hidepid for proc filesystem
53+
mount:
54+
path: /proc
55+
src: proc
56+
fstype: proc
57+
opts: '{{ proc_mnt_options }}'
58+
state: present

vars/main.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,3 +109,6 @@ os_security_suid_sgid_system_whitelist:
109109

110110
# system accounts that do not get their login disabled and pasword changed
111111
os_always_ignore_users: ['root', 'sync', 'shutdown', 'halt']
112+
113+
hidepid_option: '2' # allowed values: 0, 1, 2
114+
proc_mnt_options: 'rw,nosuid,nodev,noexec,relatime,hidepid={{ hidepid_option }}'

0 commit comments

Comments
 (0)