From 0ddccc81ad64af693b53e6589c9d3374b94cfb53 Mon Sep 17 00:00:00 2001 From: Dave Sugar Date: Wed, 6 Jun 2018 10:25:07 -0400 Subject: [PATCH] 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 --- 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 866838fee..b053242a6 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 708b9f233..79774dd31 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)