SELinux-Refpolicy Archive on lore.kernel.org
 help / color / Atom feed
From: Chris PeBenito <pebenito@ieee.org>
To: Jason Zaman <jason@perfinion.com>, selinux-refpolicy@vger.kernel.org
Subject: Re: [PATCH 02/10] udev: Add watch perms
Date: Mon, 17 Feb 2020 13:27:06 -0500
Message-ID: <fba1b85a-6b33-8f93-4439-be4d8691a3ba@ieee.org> (raw)
In-Reply-To: <20200216200319.39337-2-jason@perfinion.com>

On 2/16/20 3:03 PM, Jason Zaman wrote:
> Udev watches all the fixed_disks and udevadm watches the runtime dir.
> 
> udevd[3010]: inotify_add_watch(6, /dev/sde, 10) failed: Permission denied
> 
> avc:  denied  { watch } for  pid=4669 comm="udevadm" path="/run/udev" dev="tmpfs" ino=19464 scontext=system_u:system_r:udevadm_t:s0 tcontext=system_u:object_r:udev_runtime_t:s0 tclass=dir permissive=0
> avc:  denied  { watch } for  pid=3022 comm="udevd" path="/dev/loop3" dev="devtmpfs" ino=10247 scontext=system_u:system_r:udev_t:s0-s0:c0.c1023 tcontext=system_u:object_r:fixed_disk_device_t:s0 tclass=blk_file permissive=0
> Signed-off-by: Jason Zaman <jason@perfinion.com>
> ---
>   policy/modules/kernel/storage.if | 20 ++++++++++++++++++++
>   policy/modules/system/udev.te    |  3 +++
>   2 files changed, 23 insertions(+)
> 
> diff --git a/policy/modules/kernel/storage.if b/policy/modules/kernel/storage.if
> index c14bb13b..f9dcbaf5 100644
> --- a/policy/modules/kernel/storage.if
> +++ b/policy/modules/kernel/storage.if
> @@ -364,6 +364,26 @@ interface(`storage_swapon_fixed_disk',`
>   	allow $1 fixed_disk_device_t:blk_file getattr;
>   ')
>   
> +########################################
> +## <summary>
> +##	Watch fixed disk device nodes.
> +## </summary>
> +## <param name="domain">
> +##	<summary>
> +##	Domain allowed access.
> +##	</summary>
> +## </param>
> +#
> +interface(`storage_watch_fixed_disk',`
> +	gen_require(`
> +		type fixed_disk_device_t;
> +	')
> +
> +	dev_list_all_dev_nodes($1)
> +	allow $1 fixed_disk_device_t:blk_file watch;
> +	allow $1 fixed_disk_device_t:chr_file watch;
> +')
> +
>   ########################################
>   ## <summary>
>   ##	Allow the caller to get the attributes
> diff --git a/policy/modules/system/udev.te b/policy/modules/system/udev.te
> index 0ccbcb51..e0e27a9d 100644
> --- a/policy/modules/system/udev.te
> +++ b/policy/modules/system/udev.te
> @@ -154,6 +154,8 @@ selinux_compute_create_context(udev_t)
>   selinux_compute_relabel_context(udev_t)
>   selinux_compute_user_contexts(udev_t)
>   
> +storage_watch_fixed_disk(udev_t)
> +
>   auth_read_pam_console_data(udev_t)
>   auth_domtrans_pam_console(udev_t)
>   auth_use_nsswitch(udev_t)
> @@ -401,6 +403,7 @@ delete_files_pattern(udevadm_t, udev_runtime_t, udev_runtime_t)
>   delete_lnk_files_pattern(udevadm_t, udev_runtime_t, udev_runtime_t)
>   list_dirs_pattern(udevadm_t, udev_runtime_t, udev_runtime_t)
>   read_files_pattern(udevadm_t, udev_runtime_t, udev_runtime_t)
> +allow udevadm_t udev_runtime_t:dir watch;
>   
>   list_dirs_pattern(udevadm_t, udev_tbl_t, udev_tbl_t)
>   read_files_pattern(udevadm_t, udev_tbl_t, udev_tbl_t)

Merged.

-- 
Chris PeBenito

  reply index

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-16 20:03 [PATCH 01/10] fstools: add zfs-auto-snapshot Jason Zaman
2020-02-16 20:03 ` [PATCH 02/10] udev: Add watch perms Jason Zaman
2020-02-17 18:27   ` Chris PeBenito [this message]
2020-02-16 20:03 ` [PATCH 03/10] accountsd: " Jason Zaman
2020-02-17 18:27   ` Chris PeBenito
2020-02-16 20:03 ` [PATCH 04/10] cron: watch cron spool Jason Zaman
2020-02-17 18:28   ` Chris PeBenito
2020-02-16 20:03 ` [PATCH 05/10] colord: add watch perms Jason Zaman
2020-02-17 18:27   ` Chris PeBenito
2020-02-16 20:03 ` [PATCH 06/10] policykit devicekit: Add " Jason Zaman
2020-02-17 18:28   ` Chris PeBenito
2020-02-16 20:03 ` [PATCH 07/10] userdomain: Add watch on home dirs Jason Zaman
2020-02-17 18:31   ` Chris PeBenito
2020-02-16 20:03 ` [PATCH 08/10] dbus: add watch perms Jason Zaman
2020-02-17 18:28   ` Chris PeBenito
2020-02-16 20:03 ` [PATCH 09/10] chromium: watch etc dirs Jason Zaman
2020-02-16 20:03 ` [PATCH 10/10] gpg: add watch perms for agent Jason Zaman
2020-02-17 18:26 ` [PATCH 01/10] fstools: add zfs-auto-snapshot Chris PeBenito
  -- strict thread matches above, loose matches on Subject: below --
2020-02-16  8:54 Jason Zaman
2020-02-16  8:54 ` [PATCH 02/10] udev: Add watch perms Jason Zaman

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=fba1b85a-6b33-8f93-4439-be4d8691a3ba@ieee.org \
    --to=pebenito@ieee.org \
    --cc=jason@perfinion.com \
    --cc=selinux-refpolicy@vger.kernel.org \
    /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

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
	public-inbox-index selinux-refpolicy

Example config snippet for mirrors

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.git