Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

os_hardening is setting wrong ownership for /var/log on Ubuntu #614

Closed
stdtom opened this issue Jan 2, 2023 · 0 comments · Fixed by #615
Closed

os_hardening is setting wrong ownership for /var/log on Ubuntu #614

stdtom opened this issue Jan 2, 2023 · 0 comments · Fixed by #615
Labels

Comments

@stdtom
Copy link
Contributor

stdtom commented Jan 2, 2023

Description

os_hardening is setting group=root for /var/log (and every other mount point). This is hard-coded in

- name: Harden permissions for /var/log directory
file:
dest: /var/log
owner: 'root'
group: 'root'
mode: '{{ os_mnt_var_log_dir_mode }}'
for all OSes.

However, in Ubuntu rsyslog is running as user syslogby default and/var/loghasgroup=syslog` and permission 775 by default.

So with the current implementation os_hardening will prevent rsyslog from creating new logfiles e.g. after installing Postifx or any other MTA.

Reproduction steps

1. Create a new Ubuntu server (22.04)
2. Apply role `devsec.hardening.os_hardening`
3. Execute `ls -la /var/log`

Current Behavior

root@test:/var/log# ls -la /var/log
total 1108
drwxr-xr-x   9 root      root              4096 Jan  2 18:37 .

Expected Behavior

root@test:/var/log# ls -la /var/log
total 1108
drwxrwxr-x   9 root      syslog            4096 Jan  2 19:15 .

OS / Environment

Ubuntu 22.04

Ansible Version

2.13

Collection Version

8.4.0

Additional information

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant