selinux-refpolicy.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Allow systemd-networkd to get IP address from dhcp server
@ 2019-02-07 21:15 Sugar, David
  2019-02-07 21:15 ` [PATCH] Separate domain for systemd-modules-load Sugar, David
  2019-02-09 14:07 ` [PATCH] Allow systemd-networkd to get IP address from dhcp server Chris PeBenito
  0 siblings, 2 replies; 4+ messages in thread
From: Sugar, David @ 2019-02-07 21:15 UTC (permalink / raw)
  To: selinux-refpolicy

I'm seeing the following denials when attempting to get a DHCP address.

type=AVC msg=audit(1549471325.440:199): avc:  denied  { name_bind } for pid=6964 comm="systemd-network" src=68 scontext=system_u:system_r:systemd_networkd_t:s0 tcontext=system_u:object_r:dhcpc_port_t:s0 tclass=udp_socket permissive=1
type=AVC msg=audit(1549471325.440:199): avc:  denied  { node_bind } for pid=6964 comm="systemd-network" saddr=10.1.12.61 src=68 scontext=system_u:system_r:systemd_networkd_t:s0 tcontext=system_u:object_r:node_t:s0 tclass=udp_socket permissive=1
type=AVC msg=audit(1549471325.440:199): avc:  denied  { net_bind_service } for  pid=6964 comm="systemd-network" capability=10 scontext=system_u:system_r:systemd_networkd_t:s0 tcontext=system_u:system_r:systemd_networkd_t:s0 tclass=capability permissive=1
type=SYSCALL msg=audit(1549471325.440:199): arch=c000003e syscall=49 success=yes exit=0 a0=b a1=7fff09388780 a2=10 a3=7fff09388778 items=0 ppid=1 pid=6964 auid=4294967295 uid=192 gid=192 euid=192 suid=192 fsuid=192 egid=192 sgid=192 fsgid=192 tty=(none) ses=4294967295 comm="systemd-network" exe="/usr/lib/systemd/systemd-networkd" subj=system_u:system_r:systemd_networkd_t:s0 key=(null)

Signed-off-by: Dave Sugar <dsugar@tresys.com>
---
 policy/modules/system/systemd.te | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/policy/modules/system/systemd.te b/policy/modules/system/systemd.te
index 64e36c66..cd88e621 100644
--- a/policy/modules/system/systemd.te
+++ b/policy/modules/system/systemd.te
@@ -651,6 +651,8 @@ corecmd_bin_entry_type(systemd_networkd_t)
 corecmd_exec_bin(systemd_networkd_t)
 
 corenet_rw_tun_tap_dev(systemd_networkd_t)
+corenet_udp_bind_dhcpc_port(systemd_networkd_t)
+corenet_udp_bind_generic_node(systemd_networkd_t)
 
 dev_read_urand(systemd_networkd_t)
 dev_read_sysfs(systemd_networkd_t)
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH] Separate domain for systemd-modules-load
  2019-02-07 21:15 [PATCH] Allow systemd-networkd to get IP address from dhcp server Sugar, David
@ 2019-02-07 21:15 ` Sugar, David
  2019-02-09 14:07   ` Chris PeBenito
  2019-02-09 14:07 ` [PATCH] Allow systemd-networkd to get IP address from dhcp server Chris PeBenito
  1 sibling, 1 reply; 4+ messages in thread
From: Sugar, David @ 2019-02-07 21:15 UTC (permalink / raw)
  To: selinux-refpolicy

systemd-modules-load is used to pre-load kernal modules as the system comes up.
It was running initc_t which didn't have permissions to actually load kernel
modules.  This change sets up a new domain for this service and grants permission
necessary to load kernel modules.

Feb 05 03:38:20 4c4c4544-0052-5410-8043-b1c04f503232 kernel: type=1400 audit(1549337898.886:10): avc:  denied  { read } for  pid=4257 comm="systemd-modules" name="fuse.ko.xz" dev="dm-1" ino=2390271 scontext=system_u:system_r:initrc_t:s0 tcontext=system_u:object_r:modules_object_t:s0 tclass=file permissive=1
Feb 05 03:38:20 4c4c4544-0052-5410-8043-b1c04f503232 kernel: type=1400 audit(1549337898.886:11): avc:  denied  { open } for  pid=4257 comm="systemd-modules" path="/usr/lib/modules/3.10.0-957.1.3.el7.x86_64/kernel/fs/fuse/fuse.ko.xz" dev="dm-1" ino=2390271 scontext=system_u:system_r:initrc_t:s0 tcontext=system_u:object_r:modules_object_t:s0 tclass=file permissive=1

Signed-off-by: Dave Sugar <dsugar@tresys.com>
---
 policy/modules/system/systemd.fc |  1 +
 policy/modules/system/systemd.te | 15 +++++++++++++++
 2 files changed, 16 insertions(+)

diff --git a/policy/modules/system/systemd.fc b/policy/modules/system/systemd.fc
index 22cfe4e6..3b0302b6 100644
--- a/policy/modules/system/systemd.fc
+++ b/policy/modules/system/systemd.fc
@@ -26,6 +26,7 @@
 /usr/lib/systemd/systemd-localed	--	gen_context(system_u:object_r:systemd_locale_exec_t,s0)
 /usr/lib/systemd/systemd-logind		--	gen_context(system_u:object_r:systemd_logind_exec_t,s0)
 /usr/lib/systemd/systemd-machined	--	gen_context(system_u:object_r:systemd_machined_exec_t,s0)
+/usr/lib/systemd/systemd-modules-load	--	gen_context(system_u:object_r:systemd_modules_load_exec_t,s0)
 /usr/lib/systemd/systemd-networkd	--	gen_context(system_u:object_r:systemd_networkd_exec_t,s0)
 /usr/lib/systemd/systemd-resolved	--	gen_context(system_u:object_r:systemd_resolved_exec_t,s0)
 /usr/lib/systemd/systemd-rfkill		--	gen_context(system_u:object_r:systemd_rfkill_exec_t,s0)
diff --git a/policy/modules/system/systemd.te b/policy/modules/system/systemd.te
index a6f09dfd..64e36c66 100644
--- a/policy/modules/system/systemd.te
+++ b/policy/modules/system/systemd.te
@@ -119,6 +119,10 @@ type systemd_machined_var_run_t;
 files_pid_file(systemd_machined_var_run_t)
 init_daemon_pid_file(systemd_machined_var_run_t, dir, "machines")
 
+type systemd_modules_load_t;
+type systemd_modules_load_exec_t;
+init_daemon_domain(systemd_modules_load_t, systemd_modules_load_exec_t)
+
 type systemd_networkd_t;
 type systemd_networkd_exec_t;
 init_system_domain(systemd_networkd_t, systemd_networkd_exec_t)
@@ -606,6 +610,17 @@ optional_policy(`
 	dbus_system_bus_client(systemd_machined_t)
 ')
 
+########################################
+#
+# modules-load local policy
+#
+
+files_load_kernel_modules(systemd_modules_load_t)
+files_read_etc_files(systemd_modules_load_t)
+
+init_read_state(systemd_modules_load_t)
+init_search_run(systemd_modules_load_t)
+
 ########################################
 #
 # networkd local policy
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] Allow systemd-networkd to get IP address from dhcp server
  2019-02-07 21:15 [PATCH] Allow systemd-networkd to get IP address from dhcp server Sugar, David
  2019-02-07 21:15 ` [PATCH] Separate domain for systemd-modules-load Sugar, David
@ 2019-02-09 14:07 ` Chris PeBenito
  1 sibling, 0 replies; 4+ messages in thread
From: Chris PeBenito @ 2019-02-09 14:07 UTC (permalink / raw)
  To: Sugar, David, selinux-refpolicy

On 2/7/19 4:15 PM, Sugar, David wrote:
> I'm seeing the following denials when attempting to get a DHCP address.
> 
> type=AVC msg=audit(1549471325.440:199): avc:  denied  { name_bind } for pid=6964 comm="systemd-network" src=68 scontext=system_u:system_r:systemd_networkd_t:s0 tcontext=system_u:object_r:dhcpc_port_t:s0 tclass=udp_socket permissive=1
> type=AVC msg=audit(1549471325.440:199): avc:  denied  { node_bind } for pid=6964 comm="systemd-network" saddr=10.1.12.61 src=68 scontext=system_u:system_r:systemd_networkd_t:s0 tcontext=system_u:object_r:node_t:s0 tclass=udp_socket permissive=1
> type=AVC msg=audit(1549471325.440:199): avc:  denied  { net_bind_service } for  pid=6964 comm="systemd-network" capability=10 scontext=system_u:system_r:systemd_networkd_t:s0 tcontext=system_u:system_r:systemd_networkd_t:s0 tclass=capability permissive=1
> type=SYSCALL msg=audit(1549471325.440:199): arch=c000003e syscall=49 success=yes exit=0 a0=b a1=7fff09388780 a2=10 a3=7fff09388778 items=0 ppid=1 pid=6964 auid=4294967295 uid=192 gid=192 euid=192 suid=192 fsuid=192 egid=192 sgid=192 fsgid=192 tty=(none) ses=4294967295 comm="systemd-network" exe="/usr/lib/systemd/systemd-networkd" subj=system_u:system_r:systemd_networkd_t:s0 key=(null)
> 
> Signed-off-by: Dave Sugar <dsugar@tresys.com>
> ---
>   policy/modules/system/systemd.te | 2 ++
>   1 file changed, 2 insertions(+)
> 
> diff --git a/policy/modules/system/systemd.te b/policy/modules/system/systemd.te
> index 64e36c66..cd88e621 100644
> --- a/policy/modules/system/systemd.te
> +++ b/policy/modules/system/systemd.te
> @@ -651,6 +651,8 @@ corecmd_bin_entry_type(systemd_networkd_t)
>   corecmd_exec_bin(systemd_networkd_t)
>   
>   corenet_rw_tun_tap_dev(systemd_networkd_t)
> +corenet_udp_bind_dhcpc_port(systemd_networkd_t)
> +corenet_udp_bind_generic_node(systemd_networkd_t)
>   
>   dev_read_urand(systemd_networkd_t)
>   dev_read_sysfs(systemd_networkd_t)

Merged.

-- 
Chris PeBenito

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Separate domain for systemd-modules-load
  2019-02-07 21:15 ` [PATCH] Separate domain for systemd-modules-load Sugar, David
@ 2019-02-09 14:07   ` Chris PeBenito
  0 siblings, 0 replies; 4+ messages in thread
From: Chris PeBenito @ 2019-02-09 14:07 UTC (permalink / raw)
  To: Sugar, David, selinux-refpolicy

On 2/7/19 4:15 PM, Sugar, David wrote:
> systemd-modules-load is used to pre-load kernal modules as the system comes up.
> It was running initc_t which didn't have permissions to actually load kernel
> modules.  This change sets up a new domain for this service and grants permission
> necessary to load kernel modules.
> 
> Feb 05 03:38:20 4c4c4544-0052-5410-8043-b1c04f503232 kernel: type=1400 audit(1549337898.886:10): avc:  denied  { read } for  pid=4257 comm="systemd-modules" name="fuse.ko.xz" dev="dm-1" ino=2390271 scontext=system_u:system_r:initrc_t:s0 tcontext=system_u:object_r:modules_object_t:s0 tclass=file permissive=1
> Feb 05 03:38:20 4c4c4544-0052-5410-8043-b1c04f503232 kernel: type=1400 audit(1549337898.886:11): avc:  denied  { open } for  pid=4257 comm="systemd-modules" path="/usr/lib/modules/3.10.0-957.1.3.el7.x86_64/kernel/fs/fuse/fuse.ko.xz" dev="dm-1" ino=2390271 scontext=system_u:system_r:initrc_t:s0 tcontext=system_u:object_r:modules_object_t:s0 tclass=file permissive=1
> 
> Signed-off-by: Dave Sugar <dsugar@tresys.com>
> ---
>   policy/modules/system/systemd.fc |  1 +
>   policy/modules/system/systemd.te | 15 +++++++++++++++
>   2 files changed, 16 insertions(+)
> 
> diff --git a/policy/modules/system/systemd.fc b/policy/modules/system/systemd.fc
> index 22cfe4e6..3b0302b6 100644
> --- a/policy/modules/system/systemd.fc
> +++ b/policy/modules/system/systemd.fc
> @@ -26,6 +26,7 @@
>   /usr/lib/systemd/systemd-localed	--	gen_context(system_u:object_r:systemd_locale_exec_t,s0)
>   /usr/lib/systemd/systemd-logind		--	gen_context(system_u:object_r:systemd_logind_exec_t,s0)
>   /usr/lib/systemd/systemd-machined	--	gen_context(system_u:object_r:systemd_machined_exec_t,s0)
> +/usr/lib/systemd/systemd-modules-load	--	gen_context(system_u:object_r:systemd_modules_load_exec_t,s0)
>   /usr/lib/systemd/systemd-networkd	--	gen_context(system_u:object_r:systemd_networkd_exec_t,s0)
>   /usr/lib/systemd/systemd-resolved	--	gen_context(system_u:object_r:systemd_resolved_exec_t,s0)
>   /usr/lib/systemd/systemd-rfkill		--	gen_context(system_u:object_r:systemd_rfkill_exec_t,s0)
> diff --git a/policy/modules/system/systemd.te b/policy/modules/system/systemd.te
> index a6f09dfd..64e36c66 100644
> --- a/policy/modules/system/systemd.te
> +++ b/policy/modules/system/systemd.te
> @@ -119,6 +119,10 @@ type systemd_machined_var_run_t;
>   files_pid_file(systemd_machined_var_run_t)
>   init_daemon_pid_file(systemd_machined_var_run_t, dir, "machines")
>   
> +type systemd_modules_load_t;
> +type systemd_modules_load_exec_t;
> +init_daemon_domain(systemd_modules_load_t, systemd_modules_load_exec_t)
> +
>   type systemd_networkd_t;
>   type systemd_networkd_exec_t;
>   init_system_domain(systemd_networkd_t, systemd_networkd_exec_t)
> @@ -606,6 +610,17 @@ optional_policy(`
>   	dbus_system_bus_client(systemd_machined_t)
>   ')
>   
> +########################################
> +#
> +# modules-load local policy
> +#
> +
> +files_load_kernel_modules(systemd_modules_load_t)
> +files_read_etc_files(systemd_modules_load_t)
> +
> +init_read_state(systemd_modules_load_t)
> +init_search_run(systemd_modules_load_t)
> +
>   ########################################
>   #
>   # networkd local policy

Merged.

-- 
Chris PeBenito

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-02-09 14:07 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-07 21:15 [PATCH] Allow systemd-networkd to get IP address from dhcp server Sugar, David
2019-02-07 21:15 ` [PATCH] Separate domain for systemd-modules-load Sugar, David
2019-02-09 14:07   ` Chris PeBenito
2019-02-09 14:07 ` [PATCH] Allow systemd-networkd to get IP address from dhcp server Chris PeBenito

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).