From: cpebenito@tresys.com (Christopher J. PeBenito)
To: refpolicy@oss.tresys.com
Subject: [refpolicy] [PATCH v2 2/2] Allow init scripts to create /run/mysqld and /run/dbus
Date: Tue, 14 Aug 2012 08:19:16 -0400 [thread overview]
Message-ID: <502A4244.2010802@tresys.com> (raw)
In-Reply-To: <20120810172855.GB13453@siphos.be>
On 08/10/12 13:28, Sven Vermeulen wrote:
> On Tue, Aug 07, 2012 at 01:42:22PM -0400, Christopher J. PeBenito wrote:
>>> """
>>> type mysqld_var_run_t;
>>> files_pid_file(mysqld_var_run_t)
>>> files_dynamic_run_dir(mysqld_var_run_t, "mysqld")
>>> """
>>>
>>> This would then just have automatic file transitions for /run. period:
>>>
>>> interface(`files_dynamic_run_dir',`
>>> gen_require(`
>>> type var_run_t;
>>> ')
>>> filetrans_pattern(domain, var_run_t, $1, dir, $2)
>>> ')
>>>
>>> So if an init script, named init script, application domain or user
>>> does something like "mkdir /run/mysqld" then it automatically becomes
>>> mysqld_var_run_t.
>>
>> Well I wouldn't go with the above because its way too broad, unnecessarily
>> gives access to all domains, and breaks encapsulation. But the idea might
>> make more sense if we create a daemon pid file concept and allow initrc_t
>> to create all daemon pid file dirs. It would be similarly structured as
>> your above examples.
>
> So I've been thinking about this. Let's say we define an attribute called
> "daemonrundir" (or "daemonpidfile" [1]) and provide a transformation
> interface for that. In order to allow initrc_t to create these directories,
> we need to assign the name of the directory to use simultaneously with it.
>
> # $1 = rundir type, $2 = name of directory
> interface(`files_daemon_run_dir',`
> gen_require(`
> attribute daemonrundir;
> ')
>
> typeattribute $1 daemonrundir;
>
> init_generic_run_filetrans_specified_run_dir($1, $2)
> ')
>
> Another interface would allow creating directories of types that have the
> daemonrundir attribute set:
>
> # $1 = domain allowed access
> interface(`files_create_daemon_run_dir',`
> gen_require(`
> attribute daemonrundir;
> ')
>
> create_dirs_pattern($1, daemonrundir, daemonrundir)
> ')
>
> The final one is the "weird" one, for which I don't know a good naming
> convention for:
>
> # $1 = specified rundir type, $2 = name of the directory for which transition occurs
> interface(`init_generic_run_filetrans_specified_run_dir',`
> gen_require(`
> type initrc_t;
> ')
>
> files_pid_filetrans(initrc_t, $1, dir, $2)
> ')
>
> Is this about what you had in mind (or could go for)?
I had something like this in mind, except in my mind daemonpidfile was going to live in init module, so the implementation would be simpler. The daemon concept already exists in init, so it makes sense to me.
--
Chris PeBenito
Tresys Technology, LLC
www.tresys.com | oss.tresys.com
prev parent reply other threads:[~2012-08-14 12:19 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-31 17:46 [refpolicy] [PATCH v2 0/2] More /run changes Sven Vermeulen
2012-07-31 17:46 ` [refpolicy] [PATCH v2 1/2] DHCP client's hooks create /run/dhcpc directory Sven Vermeulen
2012-08-07 17:22 ` Christopher J. PeBenito
2012-07-31 17:46 ` [refpolicy] [PATCH v2 2/2] Allow init scripts to create /run/mysqld and /run/dbus Sven Vermeulen
2012-08-07 17:20 ` Christopher J. PeBenito
2012-08-07 17:35 ` Sven Vermeulen
2012-08-07 17:42 ` Christopher J. PeBenito
2012-08-07 17:59 ` Sven Vermeulen
2012-08-07 18:04 ` Dominick Grift
2012-08-07 18:28 ` Christopher J. PeBenito
2012-08-10 17:28 ` Sven Vermeulen
2012-08-14 12:19 ` Christopher J. PeBenito [this message]
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=502A4244.2010802@tresys.com \
--to=cpebenito@tresys.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.