All of lore.kernel.org
 help / color / mirror / Atom feed
From: Joshua Brindle <jbrindle@tresys.com>
To: selinux <selinux@tycho.nsa.gov>
Cc: selinux-dev@tresys.com
Subject: [RFC] Module language syntax
Date: Fri, 27 May 2005 14:17:33 -0400	[thread overview]
Message-ID: <1117217853.9785.22.camel@localhost> (raw)

Late last year we announced a prototype of the SELinux loadable policy
modules (previously called binary policy modules). That prototype
included several language changes to enable features like optional
policy blocks and modules dependency information. Only after starting to
write policy with these language extensions did it become apparent that
there were some shortcomings. For those who have never seen the module
language here is an example of the new syntax:

module foo 1.0;

require {
	type user_t, user_home_dir_t;
	class file { read write };
}
allow user_t user_home_dir_t : file { read write };

optional {
	require {
		type user_home_ssh_t;
	}
	allow user_t user_home_ssh_t : file { read };
} 


With this syntax macros can add their dependencies at the same time
they add the rules, and the same macros can be used in the global
scope as well as inside optionals.

The modules separate the development environment from the production
environment. Ideally the modules are compiled in a development
environment, tested and then sent to the production environment for
installation. The production environment then does not need a build
environment such as make, m4 and so on. The module tools will allow
these modules to be "linked in" to the current policy. It's at this link
time that both the modules dependencies and the optional dependencies
are determined and optionals with fulfilled dependencies are enabled.

All optionals are considered discrete entities with their own sets of
dependencies. The existence of these dependencies is checked at module
link time.

optionals my also have an else branch:

optional {
	require {
		type a, b, c;
	}
	allow {a c} b : file read;
} else {
	#no require for else
	allow foo bar : file read;
}

the else branch will not have a require block, and will use the modules
global scope.

The scoping rules are the same as the initial module work, the global
scope consists of symbols either declared outside of optionals and
symbols in require blocks outside of optionals. Each optional now has
it's own scope which is not shared with any other optional, this
consists of symbols declared inside that block and symbols in the
require blocks inside that optional.

For additional information on Loadable policy modules and the language
syntax please visit

http://sepolicy-server.sourceforge.net/index.php?page=modules
http://sepolicy-server.sourceforge.net/index.php?page=module-overview

More pages will be added shortly.

We believe this syntax is much more friendly to policy writers and would
like any comments or suggestions about the syntax. If this syntax seems
reasonable to everyone we should have a patch to implement it shortly.
Thank you


Joshua Brindle
Tresys Technology


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

             reply	other threads:[~2005-05-27 18:21 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-05-27 18:17 Joshua Brindle [this message]
2005-05-27 18:53 ` [RFC] Module language syntax Luke Kenneth Casson Leighton
2005-05-27 18:54   ` Joshua Brindle
2005-05-27 20:05     ` Luke Kenneth Casson Leighton
2005-06-14  5:12     ` Russell Coker
2005-06-14 12:20       ` Joshua Brindle

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=1117217853.9785.22.camel@localhost \
    --to=jbrindle@tresys.com \
    --cc=selinux-dev@tresys.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.