commit:     3f528d57501507ca95e24e88e0c29c36bd216bef
Author:     Dave Sugar <dsugar <AT> tresys <DOT> com>
AuthorDate: Wed Jun  6 14:25:07 2018 +0000
Commit:     Jason Zaman <perfinion <AT> gentoo <DOT> org>
CommitDate: Fri Jun  8 09:21:01 2018 +0000
URL:        
https://gitweb.gentoo.org/proj/hardened-refpolicy.git/commit/?id=3f528d57

Allow systemd_resolved to read systemd_networkd runtime files

type=AVC msg=audit(1527698299.999:144): avc:  denied  { read } for  pid=1193 
comm="systemd-resolve" name="links" dev="tmpfs" ino=16229 
scontext=system_u:system_r:systemd_resolved_t:s0 
tcontext=system_u:object_r:systemd_networkd_var_run_t:s0 tclass=dir
type=AVC msg=audit(1527698299.999:145): avc:  denied  { read } for  pid=1193 
comm="systemd-resolve" name="3" dev="tmpfs" ino=18857 
scontext=system_u:system_r:systemd_resolved_t:s0 
tcontext=system_u:object_r:systemd_networkd_var_run_t:s0 tclass=file
type=AVC msg=audit(1527698299.999:145): avc:  denied  { open } for  pid=1193 
comm="systemd-resolve" path="/run/systemd/netif/links/3" dev="tmpfs" ino=18857 
scontext=system_u:system_r:systemd_resolved_t:s0 
tcontext=system_u:object_r:systemd_networkd_var_run_t:s0 tclass=file
type=AVC msg=audit(1527698300.000:146): avc:  denied  { getattr } for  pid=1193 
comm="systemd-resolve" path="/run/systemd/netif/links/3" dev="tmpfs" ino=18857 
scontext=system_u:system_r:systemd_resolved_t:s0 
tcontext=system_u:object_r:systemd_networkd_var_run_t:s0 tclass=file
type=AVC msg=audit(1527702014.276:183): avc:  denied  { search } for  pid=1180 
comm="systemd-resolve" name="netif" dev="tmpfs" ino=16878 
scontext=system_u:system_r:systemd_resolved_t:s0 
tcontext=system_u:object_r:systemd_networkd_var_run_t:s0 tclass=dir
type=AVC msg=audit(1527704163.181:152): avc:  denied  { open } for  pid=1236 
comm="systemd-resolve" path="/run/systemd/netif/links/5" dev="tmpfs" ino=19562 
scontext=system_u:system_r:systemd_resolved_t:s0 
tcontext=system_u:object_r:systemd_networkd_var_run_t:s0 tclass=file
type=AVC msg=audit(1527704163.181:153): avc:  denied  { getattr } for  pid=1236 
comm="systemd-resolve" path="/run/systemd/netif/links/5" dev="tmpfs" ino=19562 
scontext=system_u:system_r:systemd_resolved_t:s0 
tcontext=system_u:object_r:systemd_networkd_var_run_t:s0 tclass=file
type=AVC msg=audit(1527704163.604:173): avc:  denied  { read } for  pid=1236 
comm="systemd-resolve" name="5" dev="tmpfs" ino=19562 
scontext=system_u:system_r:systemd_resolved_t:s0 
tcontext=system_u:object_r:systemd_networkd_var_run_t:s0 tclass=file

Signed-off-by: Dave Sugar <dsugar <AT> tresys.com>

 policy/modules/system/systemd.if | 19 +++++++++++++++++++
 policy/modules/system/systemd.te |  1 +
 2 files changed, 20 insertions(+)

diff --git a/policy/modules/system/systemd.if b/policy/modules/system/systemd.if
index 866838fe..b053242a 100644
--- a/policy/modules/system/systemd.if
+++ b/policy/modules/system/systemd.if
@@ -523,6 +523,25 @@ interface(`systemd_rw_networkd_netlink_route_sockets',`
        allow $1 systemd_networkd_t:netlink_route_socket 
client_stream_socket_perms;
 ')
 
+#######################################
+## <summary>
+##  Allow domain to read files generated by systemd_networkd
+## </summary>
+## <param name="domain">
+## <summary>
+##  domain allowed access
+## </summary>
+## </param>
+#
+
+interface(`systemd_read_networkd_runtime',`
+       gen_require(`
+               type systemd_networkd_var_run_t;
+       ')
+
+       list_dirs_pattern($1, systemd_networkd_var_run_t, 
systemd_networkd_var_run_t)
+       read_files_pattern($1, systemd_networkd_var_run_t, 
systemd_networkd_var_run_t)
+')
 
 ########################################
 ## <summary>

diff --git a/policy/modules/system/systemd.te b/policy/modules/system/systemd.te
index 708b9f23..79774dd3 100644
--- a/policy/modules/system/systemd.te
+++ b/policy/modules/system/systemd.te
@@ -858,6 +858,7 @@ auth_use_nsswitch(systemd_resolved_t)
 seutil_read_file_contexts(systemd_resolved_t)
 
 systemd_log_parse_environment(systemd_resolved_t)
+systemd_read_networkd_runtime(systemd_resolved_t)
 
 optional_policy(`
        dbus_system_bus_client(systemd_resolved_t)

Reply via email to