Skip to contentSkip to conversation

systemd-resolved policy updates

PATCH New Dave Sugar 2 participants 6 messages Jun 6, 2018 – Jun 7, 2018

lore
Share & tools
lore

Dave Sugar

author
#0 lore raw

cover systemd-resolved policy updates

Updates to allow systemd-resolved to start without denials

Dave Sugar (4):
Allow systemd-resolved to read sysctl
Allow systemd_resolved to read systemd_networkd runtime files Allow systemd-resolved to connect to system dbusd systemd-resolved uses notify to indicate status

 policy/modules/system/systemd.if | 19 +++++++++++++++++++
 policy/modules/system/systemd.te |  8 ++++++++
 2 files changed, 27 insertions(+)
Signature · 1 line
2.14.3
author
#1 lore raw

PATCH 1/4 Allow systemd-resolved to read sysctl

type=AVC msg=audit(1527698300.007:150): avc:  denied  { search } for  pid=1193 comm="systemd-resolve" name="net" dev="proc" ino=8515 scontext=system_u:system_r:systemd_resolved_t:s0 tcontext=system_u:object_r:sysctl_net_t:s0 tclass=dir
type=AVC msg=audit(1527698300.007:150): avc:  denied  { read } for  pid=1193 comm="systemd-resolve" name="disable_ipv6" dev="proc" ino=7988 scontext=system_u:system_r:systemd_resolved_t:s0 tcontext=system_u:object_r:sysctl_net_t:s0 tclass=file
type=AVC msg=audit(1527698300.007:150): avc:  denied  { open } for  pid=1193 comm="systemd-resolve" path="/proc/sys/net/ipv6/conf/all/disable_ipv6" dev="proc" ino=7988 scontext=system_u:system_r:systemd_resolved_t:s0 tcontext=system_u:object_r:sysctl_net_t:s0 tclass=file
type=AVC msg=audit(1527698300.007:151): avc:  denied  { getattr } for  pid=1193 comm="systemd-resolve" path="/proc/sys/net/ipv6/conf/all/disable_ipv6" dev="proc" ino=7988 scontext=system_u:system_r:systemd_resolved_t:s0 tcontext=system_u:object_r:sysctl_net_t:s0 tclass=file
type=AVC msg=audit(1527698300.006:148): avc:  denied  { read } for  pid=1193 comm="systemd-resolve" name="disable" dev="sysfs" ino=2111 scontext=system_u:system_r:systemd_resolved_t:s0 tcontext=system_u:object_r:sysfs_t:s0 tclass=file
type=AVC msg=audit(1527698300.006:148): avc:  denied  { open } for  pid=1193 comm="systemd-resolve" path="/sys/module/ipv6/parameters/disable" dev="sysfs" ino=2111 scontext=system_u:system_r:systemd_resolved_t:s0 tcontext=system_u:object_r:sysfs_t:s0 tclass=file
type=AVC msg=audit(1527698300.007:149): avc:  denied  { getattr } for  pid=1193 comm="systemd-resolve" path="/sys/module/ipv6/parameters/disable" dev="sysfs" ino=2111 scontext=system_u:system_r:systemd_resolved_t:s0 tcontext=system_u:object_r:sysfs_t:s0 tclass=file
---
 policy/modules/system/systemd.te | 3 +++
 1 file changed, 3 insertions(+)
policy/modules/system/systemd.te +3 -0
index 0cf54f54..708b9f23 100644
@@ -842,8 +842,11 @@ manage_dirs_pattern(systemd_resolved_t, systemd_resolved_var_run_t, systemd_reso
 manage_files_pattern(systemd_resolved_t, systemd_resolved_var_run_t, systemd_resolved_var_run_t)
 init_pid_filetrans(systemd_resolved_t, systemd_resolved_var_run_t, dir)
 
+dev_read_sysfs(systemd_resolved_t)
+
 kernel_read_crypto_sysctls(systemd_resolved_t)
 kernel_read_kernel_sysctls(systemd_resolved_t)
+kernel_read_net_sysctls(systemd_resolved_t)
 
 corenet_tcp_bind_generic_node(systemd_resolved_t)
 corenet_tcp_bind_llmnr_port(systemd_resolved_t)
Signature · 1 line
2.14.3
author
#2 lore raw

PATCH 2/4 Allow systemd_resolved to read systemd_networkd runtime files

In reply to Dave Sugar
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
---
 policy/modules/system/systemd.if | 19 +++++++++++++++++++
 policy/modules/system/systemd.te |  1 +
 2 files changed, 20 insertions(+)
policy/modules/system/systemd.if +19 -0
index 866838fe..c605602a 100644
@@ -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>
policy/modules/system/systemd.te +1 -0
index 708b9f23..79774dd3 100644
@@ -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)
Signature · 1 line
2.14.3
author
#3 lore raw

PATCH 3/4 Allow systemd-resolved to connect to system dbusd

In reply to Dave Sugar

type=USER_AVC msg=audit(1527726267.150:134): pid=1170 uid=81 auid=4294967295 ses=4294967295 subj=system_u:system_r:system_dbusd_t:s0-s0:c0.c1023 msg='avc: denied { acquire_svc } for service=org.freedesktop.resolve1 spid=1208 scontext=system_u:system_r:systemd_resolved_t:s0 tcontext=system_u:system_r:system_dbusd_t:s0-s0:c0.c1023 tclass=dbus exe="/usr/bin/dbus-daemon" sauid=81 hostname=? addr=? terminal=?'

---
 policy/modules/system/systemd.te | 1 +
 1 file changed, 1 insertion(+)
policy/modules/system/systemd.te +1 -0
index 79774dd3..60651a9e 100644
@@ -861,6 +861,7 @@ systemd_log_parse_environment(systemd_resolved_t)
 systemd_read_networkd_runtime(systemd_resolved_t)
 
 optional_policy(`
+	dbus_connect_system_bus(systemd_resolved_t)
 	dbus_system_bus_client(systemd_resolved_t)
 ')
 
Signature · 1 line
2.14.3
author
#4 lore raw

PATCH 4/4 systemd-resolved uses notify to indicate status

In reply to Dave Sugar
type=AVC msg=audit(1528207926.219:1609): avc:  denied  { write } for  pid=2689 comm="systemd-resolve" name="notify" dev="tmpfs" ino=6277 scontext=system_u:system_r:systemd_resolved_t:s0 tcontext=system_u:object_r:init_var_run_t:s0 tclass=sock_file
type=AVC msg=audit(1528208016.448:1702): avc:  denied  { sendto } for  pid=2689 comm="systemd-resolve" path="/run/systemd/notify" scontext=system_u:system_r:systemd_resolved_t:s0 tcontext=system_u:system_r:kernel_t:s0 tclass=unix_dgram_socket
---
 policy/modules/system/systemd.te | 3 +++
 1 file changed, 3 insertions(+)
policy/modules/system/systemd.te +3 -0
index 60651a9e..cf2c3296 100644
@@ -844,6 +844,7 @@ init_pid_filetrans(systemd_resolved_t, systemd_resolved_var_run_t, dir)
 
 dev_read_sysfs(systemd_resolved_t)
 
+kernel_dgram_send(systemd_resolved_t)
 kernel_read_crypto_sysctls(systemd_resolved_t)
 kernel_read_kernel_sysctls(systemd_resolved_t)
 kernel_read_net_sysctls(systemd_resolved_t)
@@ -855,6 +856,8 @@ corenet_udp_bind_llmnr_port(systemd_resolved_t)
 
 auth_use_nsswitch(systemd_resolved_t)
 
+init_dgram_send(systemd_resolved_t)
+
 seutil_read_file_contexts(systemd_resolved_t)
 
 systemd_log_parse_environment(systemd_resolved_t)
Signature · 1 line
2.14.3
#5 lore raw

cover systemd-resolved policy updates

In reply to Dave Sugar
Quoted 11 lines · Dave Sugar via refpolicy

Updates to allow systemd-resolved to start without denials

Dave Sugar (4):
Allow systemd-resolved to read sysctl
Allow systemd_resolved to read systemd_networkd runtime files Allow systemd-resolved to connect to system dbusd systemd-resolved uses notify to indicate status

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

Merged.

Signature · 1 line
Chris PeBenito