All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ivan Gyurdiev <ivg2@cornell.edu>
To: antoine <antoine@nagafix.co.uk>
Cc: SELinux <selinux@tycho.nsa.gov>
Subject: Re: mdadm policy
Date: Thu, 23 Jun 2005 21:50:46 -0400	[thread overview]
Message-ID: <1119577846.20101.26.camel@localhost.localdomain> (raw)
In-Reply-To: <1119569243.9390.77.camel@localhost>

[-- Attachment #1: Type: text/plain, Size: 1222 bytes --]

On Fri, 2005-06-24 at 00:27 +0100, antoine wrote:
> I was looking for a policy for mdadm, I know there is one in Fedora, but
> I use gentoo and I couldn't download it without getting the whole rpm,

Policy is attached, and I recommend using something similar
over the one you have.

> so I ended up writing one (attached) - it is also a good learning
> exercise. Shouldn't it be in serefpolicy.sourceforge.net?
> 
> Works for me (tm)

The following things are wrong with this policy:

(1) It allows everything the program wants to do, regardless
of whether it is a good idea.

(2) It is not organized in any sensible way. Sensible way means
making use of existing macros, grouping rules together,
and commenting *everything* with the purpose for adding
that rule (or better yet group of rules) - this is the
overall action that you want to allow with this block of rules.

(3) It adds primitive rules for things already present in macros.
For example, the daemon_domain covers the transition.

(4)...and there's numerous specific things wrong with it,
that I won't go into....starting from lack of exec_type on
the bin_type, not following naming conventions, etc..

-- 
Ivan Gyurdiev <ivg2@cornell.edu>
Cornell University

[-- Attachment #2: mdadm.te --]
[-- Type: text/plain, Size: 1279 bytes --]

#DESC mdadm - Linux RAID tool
#
# Author: Colin Walters <walters@redhat.com>
#

daemon_base_domain(mdadm, `, fs_domain')
role sysadm_r types mdadm_t;

allow initrc_t mdadm_var_run_t:file create_file_perms;

# Kernel filesystem permissions
r_dir_file(mdadm_t, proc_t)
allow mdadm_t proc_mdstat_t:file rw_file_perms;
read_sysctl(mdadm_t)
r_dir_file(mdadm_t, sysfs_t) 

# Configuration
allow mdadm_t { etc_t etc_runtime_t }:file { getattr read };
read_locale(mdadm_t)

# Linux capabilities
allow mdadm_t self:capability { dac_override sys_admin ipc_lock };

# Helper program access
can_exec(mdadm_t, { bin_t sbin_t })

# RAID block device access
allow mdadm_t fixed_disk_device_t:blk_file create_file_perms;
allow mdadm_t device_t:lnk_file { getattr read };

# Ignore attempts to read every device file
dontaudit mdadm_t device_type:{ chr_file blk_file } getattr;
dontaudit mdadm_t device_t:{ fifo_file file dir chr_file blk_file } { read getattr };
dontaudit mdadm_t devpts_t:dir r_dir_perms;

# Ignore attempts to read/write sysadmin tty
dontaudit mdadm_t sysadm_tty_device_t:chr_file rw_file_perms;

# Other random ignores
dontaudit mdadm_t tmpfs_t:dir r_dir_perms;
dontaudit mdadm_t initctl_t:fifo_file getattr;
var_run_domain(mdadm)
allow mdadm_t var_t:dir { getattr search };

  reply	other threads:[~2005-06-24  1:57 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-06-23 23:27 mdadm policy antoine
2005-06-24  1:50 ` Ivan Gyurdiev [this message]
2005-06-24  9:35   ` antoine
2005-06-24 15:41     ` Ivan Gyurdiev
2005-06-24 15:58       ` Colin Walters
2005-06-24 16:35       ` antoine
2005-06-24 17:46         ` Ivan Gyurdiev
2005-06-24 18:02           ` antoine
2005-06-24 19:05             ` Ivan Gyurdiev
2005-06-24 19:27               ` antoine
2005-06-24 19:29                 ` Ivan Gyurdiev
2005-06-24 19:43                 ` Stephen Smalley
2005-06-25  3:42                 ` Daniel J Walsh
2005-06-24 19:47               ` Stephen Smalley
2005-06-24 11:29 ` Stephen Smalley

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=1119577846.20101.26.camel@localhost.localdomain \
    --to=ivg2@cornell.edu \
    --cc=antoine@nagafix.co.uk \
    --cc=selinux@tycho.nsa.gov \
    /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.