Skip to content

Commit

Permalink
Merge pull request dev-sec#351 from sprat/fix-umask
Browse files Browse the repository at this point in the history
make the os_env_umask variable usable
  • Loading branch information
schurzi authored Dec 16, 2020
2 parents 98c7553 + ea471b3 commit 9e8e0bc
Show file tree
Hide file tree
Showing 9 changed files with 12 additions and 9 deletions.
4 changes: 2 additions & 2 deletions roles/os_hardening/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ We know that this is the case on Raspberry Pi.
- Default: `[]`
- Description: add additional paths to the user's `PATH` variable (default is empty).
- `os_env_umask`
- Default: `027`
- Description: set default permissions for new files to `750`
- Default: `027` or `077` depending on the platform.
- Description: set default permissions for new files to `750` or `700`.
- `os_auth_pw_max_age`
- Default: `60`
- Description: maximum password age (set to `99999` to effectively disable it)
Expand Down
3 changes: 3 additions & 0 deletions roles/os_hardening/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,9 @@ os_filesystem_whitelist: []
# the Ansible role dependency mechanism.
os_hardening_enabled: true

# Set the umask you want to apply, or leave empty to use the defaults.
os_env_umask: ''

# Set to false to disable installing and configuring auditd.
os_auditd_enabled: true
os_auditd_max_log_file_action: keep_logs
Expand Down
2 changes: 1 addition & 1 deletion roles/os_hardening/templates/etc/login.defs.j2
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ KILLCHAR 025
# Prefix these values with `0` to get octal, `0x` to get hexadecimal.
# `022` is the "historical" value in Debian for UMASK
# `027`, or even `077`, could be considered better for privacy.
UMASK {{ os_env_umask }}
UMASK {{ os_env_umask | default(os_env_umask_default, true) }}

# Enable setting of the umask group bits to be the same as owner bits (examples: `022` -> `002`, `077` -> `007`) for non-root users, if the uid is the same as gid, and username is the same as the primary group name.
# If set to yes, userdel will remove the user´s group if it contains no more members, and useradd will create by default a group with the name of the user.
Expand Down
2 changes: 1 addition & 1 deletion roles/os_hardening/vars/Archlinux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ os_passwd_perms:
group: root
mode: '0644'

os_env_umask: '027'
os_env_umask_default: '027'

os_auth_uid_min: 1000
os_auth_gid_min: 1000
Expand Down
2 changes: 1 addition & 1 deletion roles/os_hardening/vars/Debian.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ os_passwd_perms:
group: root
mode: '0644'

os_env_umask: '027'
os_env_umask_default: '027'

os_auth_uid_min: 1000
os_auth_gid_min: 1000
Expand Down
2 changes: 1 addition & 1 deletion roles/os_hardening/vars/Fedora.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ os_passwd_perms:
group: root
mode: '0644'

os_env_umask: '027'
os_env_umask_default: '027'

os_auth_uid_min: 1000
os_auth_gid_min: 1000
Expand Down
2 changes: 1 addition & 1 deletion roles/os_hardening/vars/Oracle Linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ os_passwd_perms:
group: root
mode: '0644'

os_env_umask: '077'
os_env_umask_default: '077'

os_auth_uid_min: 1000
os_auth_gid_min: 1000
Expand Down
2 changes: 1 addition & 1 deletion roles/os_hardening/vars/RedHat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ os_passwd_perms:
group: root
mode: '0644'

os_env_umask: '077'
os_env_umask_default: '077'

os_auth_uid_min: 1000
os_auth_gid_min: 1000
Expand Down
2 changes: 1 addition & 1 deletion roles/os_hardening/vars/Suse.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ os_passwd_perms:
group: root
mode: '0644'

os_env_umask: '027'
os_env_umask_default: '027'

os_auth_uid_min: 1000
os_auth_gid_min: 1000
Expand Down

0 comments on commit 9e8e0bc

Please sign in to comment.