SELinux-Refpolicy Archive on lore.kernel.org
 help / Atom feed
* [PATCH] Allow init_t to read net_conf_t
@ 2019-02-18 15:15 Sugar, David
  2019-02-18 15:15 ` [PATCH] Allow systemd-hostnamed to set the hostname Sugar, David
  2019-02-20  3:31 ` [PATCH] Allow init_t to read net_conf_t Chris PeBenito
  0 siblings, 2 replies; 4+ messages in thread
From: Sugar, David @ 2019-02-18 15:15 UTC (permalink / raw)
  To: selinux-refpolicy

init (systemd) needs to read /etc/hostname during boot
to retreive the hostname to apply to the system.

Feb 06 18:37:06 localhost.localdomain kernel: type=1400 audit(1549478223.842:3): avc:  denied  { read } for  pid=1 comm="systemd" name="hostname" dev="dm-1" ino=1262975 scontext=system_u:system_r:init_t:s0 tcontext=system_u:object_r:net_conf_t:s0 tclass=file permissive=0

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

diff --git a/policy/modules/system/init.te b/policy/modules/system/init.te
index eabba1ed..735a3b81 100644
--- a/policy/modules/system/init.te
+++ b/policy/modules/system/init.te
@@ -409,6 +409,8 @@ ifdef(`init_systemd',`
 	# lvm2-activation-generator checks file labels
 	seutil_read_file_contexts(init_t)
 
+	sysnet_read_config(init_t)
+
 	systemd_getattr_updated_runtime(init_t)
 	systemd_manage_passwd_runtime_symlinks(init_t)
 	systemd_use_passwd_agent(init_t)
-- 
2.20.1


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

* [PATCH] Allow systemd-hostnamed to set the hostname
  2019-02-18 15:15 [PATCH] Allow init_t to read net_conf_t Sugar, David
@ 2019-02-18 15:15 ` Sugar, David
  2019-02-20  3:31   ` Chris PeBenito
  2019-02-20  3:31 ` [PATCH] Allow init_t to read net_conf_t Chris PeBenito
  1 sibling, 1 reply; 4+ messages in thread
From: Sugar, David @ 2019-02-18 15:15 UTC (permalink / raw)
  To: selinux-refpolicy

When calling hostnamectl to set the hostname it needs sys_admin
capability to actually set the hostname.

Feb 13 11:47:14 localhost.localdomain systemd-hostnamed[7221]: Failed to set host name: Operation not permitted
type=AVC msg=audit(1550058524.656:1988): avc:  denied  { sys_admin } for  pid=7873 comm="systemd-hostnam" capability=21  scontext=system_u:system_r:systemd_hostnamed_t:s0 tcontext=system_u:system_r:systemd_hostnamed_t:s0 tclass=capability permissive=0

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 2b25a7d5..b88bf232 100644
--- a/policy/modules/system/systemd.te
+++ b/policy/modules/system/systemd.te
@@ -331,6 +331,8 @@ seutil_search_default_contexts(systemd_coredump_t)
 # Hostnamed policy
 #
 
+allow systemd_hostnamed_t self:capability { sys_admin };
+
 kernel_read_kernel_sysctls(systemd_hostnamed_t)
 
 dev_read_sysfs(systemd_hostnamed_t)
-- 
2.20.1


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

* Re: [PATCH] Allow systemd-hostnamed to set the hostname
  2019-02-18 15:15 ` [PATCH] Allow systemd-hostnamed to set the hostname Sugar, David
@ 2019-02-20  3:31   ` Chris PeBenito
  0 siblings, 0 replies; 4+ messages in thread
From: Chris PeBenito @ 2019-02-20  3:31 UTC (permalink / raw)
  To: Sugar, David, selinux-refpolicy

On Mon, 2019-02-18 at 15:15 +0000, Sugar, David wrote:
> When calling hostnamectl to set the hostname it needs sys_admin
> capability to actually set the hostname.
> 
> Feb 13 11:47:14 localhost.localdomain systemd-hostnamed[7221]: Failed
> to set host name: Operation not permitted
> type=AVC msg=audit(1550058524.656:1988): avc:  denied  { sys_admin }
> for  pid=7873 comm="systemd-hostnam"
> capability=21  scontext=system_u:system_r:systemd_hostnamed_t:s0
> tcontext=system_u:system_r:systemd_hostnamed_t:s0 tclass=capability
> permissive=0
> 
> 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 2b25a7d5..b88bf232 100644
> --- a/policy/modules/system/systemd.te
> +++ b/policy/modules/system/systemd.te
> @@ -331,6 +331,8 @@
> seutil_search_default_contexts(systemd_coredump_t)
>  # Hostnamed policy
>  #
>  
> +allow systemd_hostnamed_t self:capability { sys_admin };
> +
>  kernel_read_kernel_sysctls(systemd_hostnamed_t)
>  
>  dev_read_sysfs(systemd_hostnamed_t)

Merged.

-- 
Chris PeBenito



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

* Re: [PATCH] Allow init_t to read net_conf_t
  2019-02-18 15:15 [PATCH] Allow init_t to read net_conf_t Sugar, David
  2019-02-18 15:15 ` [PATCH] Allow systemd-hostnamed to set the hostname Sugar, David
@ 2019-02-20  3:31 ` Chris PeBenito
  1 sibling, 0 replies; 4+ messages in thread
From: Chris PeBenito @ 2019-02-20  3:31 UTC (permalink / raw)
  To: Sugar, David, selinux-refpolicy

On Mon, 2019-02-18 at 15:15 +0000, Sugar, David wrote:
> init (systemd) needs to read /etc/hostname during boot
> to retreive the hostname to apply to the system.
> 
> Feb 06 18:37:06 localhost.localdomain kernel: type=1400
> audit(1549478223.842:3): avc:  denied  { read } for  pid=1
> comm="systemd" name="hostname" dev="dm-1" ino=1262975
> scontext=system_u:system_r:init_t:s0
> tcontext=system_u:object_r:net_conf_t:s0 tclass=file permissive=0
> 
> Signed-off-by: Dave Sugar <dsugar@tresys.com>
> ---
>  policy/modules/system/init.te | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/policy/modules/system/init.te
> b/policy/modules/system/init.te
> index eabba1ed..735a3b81 100644
> --- a/policy/modules/system/init.te
> +++ b/policy/modules/system/init.te
> @@ -409,6 +409,8 @@ ifdef(`init_systemd',`
>  	# lvm2-activation-generator checks file labels
>  	seutil_read_file_contexts(init_t)
>  
> +	sysnet_read_config(init_t)
> +
>  	systemd_getattr_updated_runtime(init_t)
>  	systemd_manage_passwd_runtime_symlinks(init_t)
>  	systemd_use_passwd_agent(init_t)

Merged.

-- 
Chris PeBenito



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

end of thread, back to index

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-18 15:15 [PATCH] Allow init_t to read net_conf_t Sugar, David
2019-02-18 15:15 ` [PATCH] Allow systemd-hostnamed to set the hostname Sugar, David
2019-02-20  3:31   ` Chris PeBenito
2019-02-20  3:31 ` [PATCH] Allow init_t to read net_conf_t Chris PeBenito

SELinux-Refpolicy Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/selinux-refpolicy/0 selinux-refpolicy/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 selinux-refpolicy selinux-refpolicy/ https://lore.kernel.org/selinux-refpolicy \
		selinux-refpolicy@vger.kernel.org selinux-refpolicy@archiver.kernel.org
	public-inbox-index selinux-refpolicy


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.selinux-refpolicy


AGPL code for this site: git clone https://public-inbox.org/ public-inbox