From: dsugar@tresys.com (Dave Sugar) Date: Wed, 6 Jun 2018 10:25:07 -0400 Subject: [refpolicy] [PATCH 2/4] Allow systemd_resolved to read systemd_networkd runtime files In-Reply-To: <20180606142509.30199-1-dsugar@tresys.com> References: <20180606142509.30199-1-dsugar@tresys.com> Message-ID: <20180606142509.30199-3-dsugar@tresys.com> To: refpolicy@oss.tresys.com List-Id: refpolicy.oss.tresys.com 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 --- 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..c605602a 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; ') +####################################### +## +## Allow domain to read files generated by systemd_networkd +## +## +## +## domain allowed access +## +## +# + +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) +') ######################################## ## 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) -- 2.14.3