All of lore.kernel.org
 help / color / mirror / Atom feed
From: pebenito@ieee.org (Chris PeBenito)
To: refpolicy@oss.tresys.com
Subject: [refpolicy] [PATCH v3] xserver: restrict executable memory permissions
Date: Fri, 30 Dec 2016 14:32:40 -0500	[thread overview]
Message-ID: <f298ca3b-0866-48d8-ed16-75109c89369f@ieee.org> (raw)
In-Reply-To: <1483058219.31174.0.camel@trentalancia.net>

On 12/29/16 19:36, Guido Trentalancia via refpolicy wrote:
> The dangerous execheap permission is removed from xdm and the
> dangerous execmem permission is only enabled for the Gnome
> Display Manager (gnome-shell running in gdm mode) through a
> new "gnome_xdm" boolean.
>
> This patch also updates the XKB libs file context with their
> default location, adds the ability to read udev pid files and
> finally adds a few permissions so that xconsole can run smoothly.
>
> Signed-off-by: Guido Trentalancia <guido@trentalancia.net>
> ---
>  policy/modules/services/xserver.fc |    2 ++
>  policy/modules/services/xserver.te |   24 +++++++++++++++++++-----
>  2 files changed, 21 insertions(+), 5 deletions(-)
>
> diff -pru a/policy/modules/services/xserver.fc b/policy/modules/services/xserver.fc
> --- a/policy/modules/services/xserver.fc	2016-12-22 23:12:47.782929703 +0100
> +++ b/policy/modules/services/xserver.fc	2016-12-30 01:25:51.383728583 +0100
> @@ -79,6 +79,8 @@ HOME_DIR/\.Xauthority.*	--	gen_context(s
>
>  /usr/sbin/lightdm	--	gen_context(system_u:object_r:xdm_exec_t,s0)
>
> +/usr/share/X11/xkb(/.*)?	gen_context(system_u:object_r:xkb_var_lib_t,s0)
> +
>  /usr/X11R6/bin/[xgkw]dm	--	gen_context(system_u:object_r:xdm_exec_t,s0)
>  /usr/X11R6/bin/iceauth	--	gen_context(system_u:object_r:iceauth_exec_t,s0)
>  /usr/X11R6/bin/X	--	gen_context(system_u:object_r:xserver_exec_t,s0)
> diff -pru a/policy/modules/services/xserver.te b/policy/modules/services/xserver.te
> --- a/policy/modules/services/xserver.te	2016-12-22 23:12:47.782929703 +0100
> +++ b/policy/modules/services/xserver.te	2016-12-30 01:30:43.634289624 +0100
> @@ -42,6 +42,14 @@ gen_tunable(xdm_sysadm_login, false)
>
>  ## <desc>
>  ## <p>
> +## Use gnome-shell in gdm mode as the
> +## X Display Manager (XDM)
> +## </p>
> +## </desc>
> +gen_tunable(gnome_xdm, false)

The tunable name should start with xserver.


> +## <desc>
> +## <p>
>  ## Support X userspace object manager
>  ## </p>
>  ## </desc>
> @@ -304,6 +312,7 @@ optional_policy(`
>  #
>
>  allow xdm_t self:capability { setgid setuid sys_resource kill sys_tty_config mknod chown dac_override dac_read_search fowner fsetid ipc_owner sys_nice sys_rawio net_bind_service };
> +dontaudit xdm_t self:capability sys_admin;
>  allow xdm_t self:process { setexec setpgid getsched setsched setrlimit signal_perms };
>  allow xdm_t self:fifo_file rw_fifo_file_perms;
>  allow xdm_t self:shm create_shm_perms;
> @@ -316,7 +325,7 @@ allow xdm_t self:socket create_socket_pe
>  allow xdm_t self:appletalk_socket create_socket_perms;
>  allow xdm_t self:key { search link write };
>
> -allow xdm_t xconsole_device_t:fifo_file { getattr setattr };
> +allow xdm_t xconsole_device_t:fifo_file read_fifo_file_perms;

The setattr permission is lost.

>  # Allow gdm to run gdm-binary
>  can_exec(xdm_t, xdm_exec_t)
> @@ -450,6 +459,10 @@ term_setattr_console(xdm_t)
>  term_use_unallocated_ttys(xdm_t)
>  term_setattr_unallocated_ttys(xdm_t)
>
> +# for xconsole
> +term_use_ptmx(xdm_t)
> +term_use_generic_ptys(xdm_t)

Looks like a pty needs to be properly labeled.


>  auth_domtrans_pam_console(xdm_t)
>  auth_manage_pam_pid(xdm_t)
>  auth_manage_pam_console_data(xdm_t)
> @@ -507,6 +520,10 @@ tunable_policy(`xdm_sysadm_login',`
>  #	allow xserver_t xdm_tmpfs_t:file rw_file_perms;
>  ')
>
> +tunable_policy(`gnome_xdm',`
> +	allow xdm_t self:process execmem;
> +')
> +
>  optional_policy(`
>  	alsa_domtrans(xdm_t)
>  ')
> @@ -586,10 +603,6 @@ optional_policy(`
>  optional_policy(`
>  	unconfined_domain(xdm_t)
>  	unconfined_domtrans(xdm_t)
> -
> -	ifndef(`distro_redhat',`
> -		allow xdm_t self:process { execheap execmem };
> -	')
>  ')
>
>  optional_policy(`
> @@ -803,6 +816,7 @@ optional_policy(`
>
>  optional_policy(`
>  	udev_read_db(xserver_t)
> +	udev_read_pid_files(xserver_t)
>  ')
>
>  optional_policy(`



-- 
Chris PeBenito

  parent reply	other threads:[~2016-12-30 19:32 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-28 17:20 [refpolicy] [PATCH] xserver: only run in confined mode and restrict execmem permissions Guido Trentalancia
2016-12-28 19:56 ` [refpolicy] [PATCH v2] xserver: restrict executable memory permissions (was "only run in confined mode and restrict execmem permissions") Guido Trentalancia
2016-12-30  0:36   ` [refpolicy] [PATCH v3] xserver: restrict executable memory permissions Guido Trentalancia
2016-12-30  1:06     ` cgzones
2016-12-30  1:19       ` Guido Trentalancia
2016-12-30  1:42       ` Guido Trentalancia
2016-12-30 16:07         ` cgzones
2016-12-30 17:04           ` Guido Trentalancia
2016-12-30 19:32     ` Chris PeBenito [this message]
2016-12-30 22:06       ` Guido Trentalancia
2016-12-30 22:07       ` [refpolicy] [PATCH v4] " Guido Trentalancia
2016-12-31 15:56         ` Chris PeBenito
2016-12-31 16:00           ` Guido Trentalancia
2016-12-31 16:02           ` [refpolicy] [PATCH v5] " Guido Trentalancia
2016-12-31 16:27             ` Chris PeBenito
2016-12-31 16:38               ` Guido Trentalancia
2016-12-31 16:43               ` [refpolicy] [PATCH v6] " Guido Trentalancia
2017-01-02 18:38                 ` Chris PeBenito

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f298ca3b-0866-48d8-ed16-75109c89369f@ieee.org \
    --to=pebenito@ieee.org \
    --cc=refpolicy@oss.tresys.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.