SELinux-Refpolicy Archive on lore.kernel.org
 help / Atom feed
* [PATCH] mls stuff
@ 2019-01-08  8:52 Russell Coker
  2019-01-10  0:24 ` Chris PeBenito
  0 siblings, 1 reply; 2+ messages in thread
From: Russell Coker @ 2019-01-08  8:52 UTC (permalink / raw)
  To: selinux-refpolicy

Here are the patches I used last time I tried to get MLS going on Debian.

Index: refpolicy-2.20180701/policy/modules/kernel/kernel.te
===================================================================
--- refpolicy-2.20180701.orig/policy/modules/kernel/kernel.te
+++ refpolicy-2.20180701/policy/modules/kernel/kernel.te
@@ -39,6 +39,7 @@ role unconfined_r;
 ifdef(`enable_mls',`
 	role secadm_r;
 	role auditadm_r;
+	mls_process_set_level(kernel_t)
 ')
 
 #
Index: refpolicy-2.20180701/policy/modules/system/systemd.te
===================================================================
--- refpolicy-2.20180701.orig/policy/modules/system/systemd.te
+++ refpolicy-2.20180701/policy/modules/system/systemd.te
@@ -251,7 +251,13 @@ systemd_log_parse_environment(systemd_gp
 
 allow systemd_cgroups_t self:capability net_admin;
 
-kernel_domtrans_to(systemd_cgroups_t, systemd_cgroups_exec_t)
+ifdef(`enable_mls',`
+	kernel_ranged_domtrans_to(systemd_cgroups_t, systemd_cgroups_exec_t, s0 - mls_systemhigh)
+	mls_fd_use_all_levels(systemd_cgroups_t)
+',`
+	kernel_domtrans_to(systemd_cgroups_t, systemd_cgroups_exec_t)
+')
+
 kernel_dgram_send(systemd_cgroups_t)
 # for /proc/cmdline
 kernel_read_system_state(systemd_cgroups_t)
Index: refpolicy-2.20180701/policy/modules/system/init.te
===================================================================
--- refpolicy-2.20180701.orig/policy/modules/system/init.te
+++ refpolicy-2.20180701/policy/modules/system/init.te
@@ -191,6 +191,7 @@ mls_file_read_all_levels(init_t)
 mls_file_write_all_levels(init_t)
 mls_process_write_all_levels(init_t)
 mls_fd_use_all_levels(init_t)
+mls_process_set_level(init_t)
 
 # the following one is needed for libselinux:is_selinux_enabled()
 # otherwise the call fails and sysvinit tries to load the policy
@@ -384,6 +385,8 @@ ifdef(`init_systemd',`
 
 	# systemd_socket_activated policy
 	mls_socket_write_all_levels(init_t)
+	# read from systemd-journal and similar
+	mls_socket_read_to_clearance(init_t)
 
 	selinux_unmount_fs(init_t)
 	selinux_validate_context(init_t)
Index: refpolicy-2.20180701/policy/modules/system/logging.if
===================================================================
--- refpolicy-2.20180701.orig/policy/modules/system/logging.if
+++ refpolicy-2.20180701/policy/modules/system/logging.if
@@ -422,6 +422,9 @@ interface(`logging_domtrans_syslog',`
 
 	corecmd_search_bin($1)
 	domtrans_pattern($1, syslogd_exec_t, syslogd_t)
+	ifdef(`enable_mls',`
+		range_transition $1 syslogd_exec_t:process mls_systemhigh;
+	')
 ')
 
 ########################################

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

* Re: [PATCH] mls stuff
  2019-01-08  8:52 [PATCH] mls stuff Russell Coker
@ 2019-01-10  0:24 ` Chris PeBenito
  0 siblings, 0 replies; 2+ messages in thread
From: Chris PeBenito @ 2019-01-10  0:24 UTC (permalink / raw)
  To: Russell Coker, selinux-refpolicy

On 1/8/19 3:52 AM, Russell Coker wrote:
> Here are the patches I used last time I tried to get MLS going on Debian.
> 
> Index: refpolicy-2.20180701/policy/modules/kernel/kernel.te
> ===================================================================
> --- refpolicy-2.20180701.orig/policy/modules/kernel/kernel.te
> +++ refpolicy-2.20180701/policy/modules/kernel/kernel.te
> @@ -39,6 +39,7 @@ role unconfined_r;
>   ifdef(`enable_mls',`
>   	role secadm_r;
>   	role auditadm_r;
> +	mls_process_set_level(kernel_t)
>   ')
>   
>   #
> Index: refpolicy-2.20180701/policy/modules/system/systemd.te
> ===================================================================
> --- refpolicy-2.20180701.orig/policy/modules/system/systemd.te
> +++ refpolicy-2.20180701/policy/modules/system/systemd.te
> @@ -251,7 +251,13 @@ systemd_log_parse_environment(systemd_gp
>   
>   allow systemd_cgroups_t self:capability net_admin;
>   
> -kernel_domtrans_to(systemd_cgroups_t, systemd_cgroups_exec_t)
> +ifdef(`enable_mls',`
> +	kernel_ranged_domtrans_to(systemd_cgroups_t, systemd_cgroups_exec_t, s0 - mls_systemhigh)
> +	mls_fd_use_all_levels(systemd_cgroups_t)
> +',`
> +	kernel_domtrans_to(systemd_cgroups_t, systemd_cgroups_exec_t)
> +')
> +
>   kernel_dgram_send(systemd_cgroups_t)
>   # for /proc/cmdline
>   kernel_read_system_state(systemd_cgroups_t)
> Index: refpolicy-2.20180701/policy/modules/system/init.te
> ===================================================================
> --- refpolicy-2.20180701.orig/policy/modules/system/init.te
> +++ refpolicy-2.20180701/policy/modules/system/init.te
> @@ -191,6 +191,7 @@ mls_file_read_all_levels(init_t)
>   mls_file_write_all_levels(init_t)
>   mls_process_write_all_levels(init_t)
>   mls_fd_use_all_levels(init_t)
> +mls_process_set_level(init_t)
>   
>   # the following one is needed for libselinux:is_selinux_enabled()
>   # otherwise the call fails and sysvinit tries to load the policy
> @@ -384,6 +385,8 @@ ifdef(`init_systemd',`
>   
>   	# systemd_socket_activated policy
>   	mls_socket_write_all_levels(init_t)
> +	# read from systemd-journal and similar
> +	mls_socket_read_to_clearance(init_t)
>   
>   	selinux_unmount_fs(init_t)
>   	selinux_validate_context(init_t)
> Index: refpolicy-2.20180701/policy/modules/system/logging.if
> ===================================================================
> --- refpolicy-2.20180701.orig/policy/modules/system/logging.if
> +++ refpolicy-2.20180701/policy/modules/system/logging.if
> @@ -422,6 +422,9 @@ interface(`logging_domtrans_syslog',`
>   
>   	corecmd_search_bin($1)
>   	domtrans_pattern($1, syslogd_exec_t, syslogd_t)
> +	ifdef(`enable_mls',`
> +		range_transition $1 syslogd_exec_t:process mls_systemhigh;
> +	')
>   ')
>   
>   ########################################
> 

Merged, though I changed the style a bit.


-- 
Chris PeBenito

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

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-08  8:52 [PATCH] mls stuff Russell Coker
2019-01-10  0:24 ` 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