Last active
June 1, 2022 08:42
-
-
Save blues-man/7c3a45e6474f6fdb46a4d69c2525c3be to your computer and use it in GitHub Desktop.
SELinux blocks timedatectl to update timezone, SELinux script to unblock it
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# timedatectl set-timezone Europe/Berlin | |
Failed to set time zone: Access denied | |
# grep denied /var/log/audit/audit.log | |
type=AVC msg=audit(1530808024.058:35494): avc: denied { unlink } for pid=32035 comm="systemd-timedat" name="localtime" dev="vda1" ino=74 scontext=system_u:system_r:systemd_timedated_t:s0 tcontext=system_u:object_r:etc_t:s0 tclass=lnk_file | |
# cat /var/log/audit/audit.log | audit2allow -M timezone | |
#============= systemd_timedated_t ============== | |
#!!!! WARNING: 'etc_t' is a base type. | |
allow systemd_timedated_t etc_t:lnk_file unlink; | |
I modified the resulting timezone.te because it contained other things | |
# timezone.te | |
module timezone 1.0; | |
require { | |
type systemd_timedated_t; | |
type etc_t; | |
class lnk_file unlink; | |
class system module_request; | |
} | |
# checkmodule -M -m -o timezone.mod timezone.te | |
# semodule_package -o timezone.pp -m timezone.mod | |
# semodule -i timezone.pp | |
# timedatectl set-timezone Europe/Berlin | |
# timedatectl | |
... | |
Time zone: Europe/Berlin (CEST, +0200) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment