All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Christopher J. PeBenito" <cpebenito@tresys.com>
To: Aleks Kissinger <aleks0@gmail.com>
Cc: selinux@tycho.nsa.gov
Subject: Re: Using scripting languages to "macro" policy
Date: Fri, 01 Sep 2006 14:43:34 -0400	[thread overview]
Message-ID: <1157136215.3199.180.camel@sgc> (raw)
In-Reply-To: <46ffa45f0609010930h403bf000k6cbf561c1334dfef@mail.gmail.com>

On Fri, 2006-09-01 at 11:30 -0500, Aleks Kissinger wrote:
> I've been poking around with the idea of using Ruby and some
> meta-programming to specify policy.  The complaint I've heard voiced
> by a couple of people is that while many of the m4-based abstractions
> present in refpolicy are pretty intuitive and useful, the limitation
> of m4 as a language is that you cannot maintain relationships and
> resolve conflicts automatically.  Therefore, in many cases you need to
> result to naming conventions to do that work.

What you're talking about is what I would call policy patterns.  Policy
patterns is one thing I plan on attacking once the role infrastructure
has been completed, but on a smaller scale.  Here are a couple patterns
I made on the side:

define(`manage_files_pattern',`
        allow $1 $2:dir rw_dir_perms;
        allow $1 $3:file manage_file_perms;
')

define(`stream_connect_pattern',`
        allow $1 $2:dir search_dir_perms;
        allow $1 $3:sock_file { getattr write };
        allow $1 $4:unix_stream_socket connectto;
')

define(`send_audit_msgs_pattern',`
        allow $1 self:capability audit_write;
        allow $1 self:netlink_audit_socket { create_netlink_socket_perms nlmsg_relay };
')

> The idea I put forward here is to create a set of base objects in
> Ruby, Python, or something of that ilk that can be extended and used
> to define policy in an organized, error-checking, and namespaced
> manner.  Heres a quick little example:
> 
> class LogDir < FileType
>   pattern '/var/log/.*'
> end
> 
> class SomeProgam < Application
>   executable '/usr/bin/someprog'
>   allow_role SysadminRole
>   allow self, LogDir, File, File.perms(:r, :w)
> end

I'm not sure that this is actually easier, in fact its confusing to me
(what does :r and :w mean? just read and write?).  It seems like an
unnecessary abstraction, for example allow_role.

-- 
Chris PeBenito
Tresys Technology, LLC
(410) 290-1411 x150


--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to majordomo@tycho.nsa.gov with
the words "unsubscribe selinux" without quotes as the message.

  parent reply	other threads:[~2006-09-01 18:42 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-09-01 16:30 Using scripting languages to "macro" policy Aleks Kissinger
2006-09-01 18:32 ` Lorenzo Hernández García-Hierro
2006-09-01 18:43 ` Christopher J. PeBenito [this message]
2006-09-01 19:02 ` Erich Schubert
2006-09-01 23:10   ` Aleks Kissinger

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=1157136215.3199.180.camel@sgc \
    --to=cpebenito@tresys.com \
    --cc=aleks0@gmail.com \
    --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.