All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Paris <eparis@parisplace.org>
To: Karl MacMillan <kmacmillan@mentalrootkit.com>
Cc: James Morris <jmorris@namei.org>,
	selinux@tycho.nsa.gov, Joshua Brindle <method@manicmethod.com>,
	Daniel J Walsh <dwalsh@redhat.com>
Subject: Re: secmark integration
Date: Fri, 30 Mar 2007 17:47:20 -0400	[thread overview]
Message-ID: <1175291240.20396.36.camel@localhost.localdomain> (raw)
In-Reply-To: <1175286967.3602.31.camel@localhost.localdomain>

On Fri, 2007-03-30 at 16:36 -0400, Karl MacMillan wrote:
> On Fri, 2007-03-30 at 16:25 -0400, Eric Paris wrote:
> > On Fri, 2007-03-30 at 15:47 -0400, Karl MacMillan wrote:
> > > On Mon, 2007-03-19 at 10:57 -0400, James Morris wrote:
> > > > Following some discussion of secmark integration at the developer summit, 
> > > > one of the ideas proposed by Joshua (IIRC) was that it would be desirable 
> > > > to have a separate table for managing the secmark rules.
> > > > 
[snip]
> > > > Is there a consensus, particularly from distro folk, that having a 
> > > > separate table would be of great benefit ?  I can post a rudimentary patch 
> > > > soon, if needed.
> > > > 
> > > 
> > > Is this really needed as long as the distro provides a way to customize
> > > the iptables rules?
> > 
> > It's not just that.  The reason a new table was proposed was because
> > people may want to iptables -F and flush their rules.  If the secmark
> > stuff is on the main tables (filter and nat) that people use it will get
> > blown away and there will be no automation of a boolean setting you talk
> > about later.
> > 
> 
> If we add the custom table won't we need a way to flush that? 

Sure it would still be flushable, just not how people normally go about
turning off iptables rules.  Now to flush rules users would

iptables -F
iptables -F -t nat

to get the secmark stuff they would also have to do
iptables -F -t secmark

> If so,
> would we add an iptables --no-really-flush command? If we want to
> preserve the iptables with no rules means all traffic is allowed
> semantic we need to somehow coordinate rule removal with the policy.

I agree that coordination between rule removal and policy unlabeled_t
boolean flipping is a good thing, but having the labeling rules on their
own table would allow people and tools to deal with the firewall as they
always have and not 'accidentally' mess up the secmark rules.  If
iptables people are already used to having to explicitly work on the nat
table i don't see why they would have have a problem working explicitly
on the secmark table for local network labeling.

> Options I see:
> 
> 1) Change iptables to flip a boolean. This sucks because we need some
> way for iptables to know which boolean to flip.

something tells me this is not upstreamable.  Would need to be a tool on
top of iptables, which then some people wouldn't want to use...

> 
> 2) Have the kernel mechanism stop enforcement of rules that rely on
> secmark when the tables are empty / flushed.

this one isn't so easy.  i don't like the idea of selective enforcement
although it does maintain the notion of 'allow when off' that users
expect from iptables.  Probably would be better as 'deny unlabeled_t if
some other label may exist.'  That would also have the implication that
setting up labeling of some sort of one domain would then disable the
unlabeled for every other domain.  Nothing in the secmark table is going
to say that httpd_packet_t is only used by the httpd_t and squid_t
domain.  How can the kernel know that it shouldn't enforce things for
autofs_t but should for those 2.  No no, i'm liking selective
enforcement in kernel less and less.

> 
> 3) Tell people to not do this - instead use distro scripts with
> integration. This seems unlikely to work.

oh yeah, tell people to only use system-config-network instead of being
like me and writing my own huge scripts.  you're right, that'll happen
</sarcasm>.

4) Find some guy who works in userspace and get him to write a tool that
will allow you to fill in some blanks and it will create the policy,
iptables labeling rule, and boolean settings for you.  If someone does
go back and explicitly break the secmark table its their own fault and
they get to hold the pieces.  If they use this new tool that someone
*cough*karl*cough* writes then everything works.  When they flush the
secmark rules in this tool it cleans up the policy, the custom table,
and sets the booleans.  

****

Getting secmark to work properly is a 3 step process right?  Define a
new type and allow the domain in question to use that type in a policy
module.  Disable the boolean in policy that already lets that domain use
the unlabeled_t type.  Create a secmark rule to label network traffic
with the type you defined in part1.

Maybe at some point we can ship labeling rules by default (and i don't
know if these belong with the other 'normal' firewall rules as opposed
to a seperate init script which just sets the secmark rules) which match
little other than we already match in the name_{bind,connect} checks and
can eliminate the boolean step.  But for now it seems that making it so
that a user won't accidentally shoot themselves in the foot and products
like 'webmin' can't hurt anything would be a good step....

-Eric


--
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:[~2007-03-30 21:48 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-03-19 14:57 secmark integration James Morris
2007-03-30 19:47 ` Karl MacMillan
2007-03-30 20:25   ` Eric Paris
2007-03-30 20:36     ` Karl MacMillan
2007-03-30 21:47       ` Eric Paris [this message]
2007-04-02 17:23         ` Karl MacMillan
2007-04-02 19:44           ` James Morris
2007-03-31  2:09     ` James Morris
2007-04-02 14:45       ` Daniel J Walsh
2007-04-02 14:55         ` Eric Paris
2007-04-02 15:15           ` Christopher J. PeBenito
2007-04-02 17:15             ` Karl MacMillan
2007-04-04 17:22               ` Christopher J. PeBenito
2007-04-04 20:08                 ` Karl MacMillan
2007-04-04 20:51                   ` Daniel J Walsh
2007-04-05 15:48                     ` Karl MacMillan
2007-04-05 17:06                       ` Christopher J. PeBenito
2007-04-05 17:40                         ` Karl MacMillan
2007-04-05 17:47                           ` Stephen Smalley
2007-04-05 18:02                             ` Christopher J. PeBenito
2007-04-05 17:59                               ` Stephen Smalley
2007-04-05 18:46                                 ` Christopher J. PeBenito
2007-04-05 18:48                                   ` Joshua Brindle
2007-04-05 19:22                                   ` Stephen Smalley
2007-04-05 19:53                                     ` Eamon Walsh
2007-04-05 19:59                                       ` Stephen Smalley
2007-04-05 18:49                                 ` Stephen Smalley
2007-04-02 16:16           ` James Morris
2007-04-02 17:14             ` Joshua Brindle
2007-04-02 17:28               ` Karl MacMillan
2007-04-02 19:47                 ` James Morris
2007-04-02 19:52                   ` Karl MacMillan
2007-04-02 14:52       ` Paul Moore

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=1175291240.20396.36.camel@localhost.localdomain \
    --to=eparis@parisplace.org \
    --cc=dwalsh@redhat.com \
    --cc=jmorris@namei.org \
    --cc=kmacmillan@mentalrootkit.com \
    --cc=method@manicmethod.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.