From 6afabe971fe856ce9e4e2de5d699f4a7a4834e30 Mon Sep 17 00:00:00 2001 From: Luca Boccassi Date: Tue, 18 Feb 2020 15:13:29 +0000 Subject: [PATCH 1/2] journald: allow to remove /run/log/journal it happens when switching from tmpfs to persistent storage Signed-off-by: Luca Boccassi --- policy/modules/system/logging.te | 3 +++ 1 file changed, 3 insertions(+) diff --git a/policy/modules/system/logging.te b/policy/modules/system/logging.te index 15ae581ca..64406f650 100644 --- a/policy/modules/system/logging.te +++ b/policy/modules/system/logging.te @@ -529,6 +529,9 @@ ifdef(`init_systemd',` allow syslogd_t self:capability { chown setgid setuid sys_ptrace }; allow syslogd_t self:netlink_audit_socket { getattr getopt read setopt write }; + # remove /run/log/journal when switching to permanent storage + allow syslogd_t var_log_t:dir rmdir; + kernel_getattr_dgram_sockets(syslogd_t) kernel_read_ring_buffer(syslogd_t) kernel_rw_stream_sockets(syslogd_t) From 6e9c1cd1872ae0314166f6513cc640f25f84c466 Mon Sep 17 00:00:00 2001 From: Luca Boccassi Date: Wed, 19 Feb 2020 10:57:21 +0000 Subject: [PATCH 2/2] logging: add interface to start/stop syslog units Required for example to start/stop systemd-journal-flush.service which moves the journal storage back and forth between tmpfs and permanent storage. Signed-off-by: Luca Boccassi --- policy/modules/system/logging.if | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/policy/modules/system/logging.if b/policy/modules/system/logging.if index b2bba9849..9215579e8 100644 --- a/policy/modules/system/logging.if +++ b/policy/modules/system/logging.if @@ -427,6 +427,24 @@ interface(`logging_domtrans_syslog',` ') ') +######################################## +## +## Allow specified domain to start/stop syslog units +## +## +## +## Domain allowed access. +## +## +# +interface(`logging_startstop_syslog',` + gen_require(` + type syslogd_unit_t; + class service { start stop }; + ') + allow $1 syslogd_unit_t:service { start stop }; +') + ######################################## ## ## Allow specified domain to check status of syslog unit