From: dac.override@gmail.com (Dominick Grift)
To: refpolicy@oss.tresys.com
Subject: [refpolicy] [PATCH] fstools: add in filetrans for /run dir
Date: Mon, 13 Apr 2015 18:10:00 +0200 [thread overview]
Message-ID: <20150413160959.GA32570@x131e> (raw)
In-Reply-To: <1428939695-20296-1-git-send-email-jason@perfinion.com>
On Mon, Apr 13, 2015 at 07:41:35PM +0400, Jason Zaman wrote:
> the blkid tool writes to /run/blkid/. This creates the "fstools_run_t"
> type an allows the transition in /run.
>
> type=AVC msg=audit(1428929528.885:149519): avc: denied { write } for
> pid=5590 comm="mkfs.ext4" name="/" dev="tmpfs" ino=17656
> scontext=staff_u:sysadm_r:fsadm_t tcontext=system_u:object_r:var_run_t
> tclass=dir permissive=0
>
> In permissive:
> avc: denied { write } for pid=18595 comm="mkfs.ext4" name="blkid.tab"
> dev="tmpfs" ino=5441676 scontext=root:sysadm_r:fsadm_t
> tcontext=root:object_r:var_run_t tclass=file permissive=1
> avc: denied { write } for pid=18595 comm="mkfs.ext4" name="blkid"
> dev="tmpfs" ino=370936 scontext=root:sysadm_r:fsadm_t
> tcontext=root:object_r:var_run_t tclass=dir permissive=1
> avc: denied { add_name } for pid=18595 comm="mkfs.ext4"
> name="blkid.tab-ZaM0Am" scontext=root:sysadm_r:fsadm_t
> tcontext=root:object_r:var_run_t tclass=dir permissive=1
> avc: denied { create } for pid=18595 comm="mkfs.ext4"
> name="blkid.tab-ZaM0Am" scontext=root:sysadm_r:fsadm_t
> tcontext=root:object_r:var_run_t tclass=file permissive=1
> ---
> policy/modules/system/fstools.fc | 2 ++
> policy/modules/system/fstools.te | 7 +++++++
> 2 files changed, 9 insertions(+)
>
> diff --git a/policy/modules/system/fstools.fc b/policy/modules/system/fstools.fc
> index d10368d..cba4184 100644
> --- a/policy/modules/system/fstools.fc
> +++ b/policy/modules/system/fstools.fc
> @@ -62,3 +62,5 @@
> /usr/sbin/smartctl -- gen_context(system_u:object_r:fsadm_exec_t,s0)
>
> /var/log/fsck(/.*)? gen_context(system_u:object_r:fsadm_log_t,s0)
> +
> +/var/run/blkid(/.*)? gen_context(system_u:object_r:fsadm_run_t,s0)
Should probably also cover /var/run/fsck
> diff --git a/policy/modules/system/fstools.te b/policy/modules/system/fstools.te
> index a0cfb1d..cbaa18b 100644
> --- a/policy/modules/system/fstools.te
> +++ b/policy/modules/system/fstools.te
> @@ -16,6 +16,9 @@ logging_log_file(fsadm_log_t)
> type fsadm_tmp_t;
> files_tmp_file(fsadm_tmp_t)
>
> +type fsadm_run_t;
> +files_pid_file(fsadm_run_t)
> +
> type swapfile_t; # customizable
> files_type(swapfile_t)
>
> @@ -45,6 +48,10 @@ allow fsadm_t fsadm_tmp_t:dir manage_dir_perms;
> allow fsadm_t fsadm_tmp_t:file manage_file_perms;
> files_tmp_filetrans(fsadm_t, fsadm_tmp_t, { file dir })
>
> +allow fsadm_t fsadm_run_t:dir manage_dir_perms;
> +allow fsadm_t fsadm_run_t:file manage_file_perms;
> +files_pid_filetrans(fsadm_t, fsadm_run_t, { file dir })
> +
The transition should only be needed on "dir" (/var/run/blkid and /var/run/fsck)
files_pid_filetrans(fsadm_t, fsadm_run_t, dir)
I think it is important do this properly since it makes it sensible. Adding rules that do not make
sense only make it harder to understand what is going on and it needlessly inflates the policy.
> # log files
> allow fsadm_t fsadm_log_t:dir setattr;
> manage_files_pattern(fsadm_t, fsadm_log_t, fsadm_log_t)
> --
> 2.0.5
>
> _______________________________________________
> refpolicy mailing list
> refpolicy at oss.tresys.com
> http://oss.tresys.com/mailman/listinfo/refpolicy
--
02DFF788
4D30 903A 1CF3 B756 FB48 1514 3148 83A2 02DF F788
http://keys.gnupg.net/pks/lookup?op=vindex&search=0x314883A202DFF788
Dominick Grift
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 648 bytes
Desc: not available
Url : http://oss.tresys.com/pipermail/refpolicy/attachments/20150413/c86bab71/attachment.bin
next prev parent reply other threads:[~2015-04-13 16:10 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-13 15:41 [refpolicy] [PATCH] fstools: add in filetrans for /run dir Jason Zaman
2015-04-13 16:10 ` Dominick Grift [this message]
2015-04-13 16:20 ` Dominick Grift
-- strict thread matches above, loose matches on Subject: below --
2015-04-13 18:13 Jason Zaman
2015-04-15 17:29 ` Christopher J. 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=20150413160959.GA32570@x131e \
--to=dac.override@gmail.com \
--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.