All of lore.kernel.org
 help / color / mirror / Atom feed
From: Luke Kenneth Casson Leighton <lkcl@lkcl.net>
To: Russell Coker <russell@coker.com.au>
Cc: SE Linux <selinux@tycho.nsa.gov>,
	samba-tng@lists.samba-tng.org, samba-technical@samba.org
Subject: Re: samba
Date: Thu, 3 Jun 2004 19:11:32 +0000	[thread overview]
Message-ID: <20040603191131.GC3856@lkcl.net> (raw)
In-Reply-To: <200406031543.15551.russell@coker.com.au>

uhm.

my apologies for being sufficiently rusty on samba stuff for it to take
several days to remember things.

it occurred to me that there are other locations where seteuid() calls
will be used: in the emulation of NT's DCE/RPC services.

under certain circumstances, for example in an NT printer client,
an NT program will cause an NT system to make an authenticated
DCE/RPC connection over an already authenticated SMB connection.

there are two circumstances in which i definitely know that this
occurs: as mentioned already the first is when viewing a print job:
one thread does the printing and another thread deals with print
monitoring (like famd only in a polling fashion).

the two threads use DIFFERENT security contexts.

the other circumstance that i am aware of is when a user presses
ctrl-alt-delete and then changes their password: _any_ user may
use that dialog to change their password, and so you get an
authenticated DCE/RPC connection made over someone else's
authenticated SMB session.

_there may be other circumstances where this is done_.

now, why am i mentioning this?

the reason is because not only is there a seteuid done in the
SMB connection, but also due to the authenticated DCE/RPC connection
which is piggy-backed over the SMB authenticated transport, there
is also ANOTHER seteuid in the DCE/RPC layer.


therefore, it is necessary to consider context separation at the
DCE/RPC level as well.

and funnily enough, the Samba TNG design has already split out
all of its DCE/RPC services into separate daemons.

therefore, the way to guarantee a working secure se-samba system
with an absolute minimum of coding is:

- to use samba(4) as the front-end

- to use samba-tng as the back-end

- to use samba-tng's NT domain DCE/RPC services.


samba(3) is a monolithic design which runs all DCE/RPC services in a
single process.

therefore, as it stands, it cannot be used for se-samba without
also taking care of the seteuid calls in the DCE/RPC layer as well.


On Thu, Jun 03, 2004 at 03:43:15PM +1000, Russell Coker wrote:
> When discussing SE Linux and Samba with Andrew Tridgell last night we came up 
> with an idea that should work reasonably well without hurting performance 
> much.
> 
> Firstly we consider Samba to be a trusted object manager, so there is no plan 
> to prevent any Samba process from exceeding it's access (IE we are not 
> protecting against a buffer overflow or other attack to make the Samba daemon 
> perform inappropriate actions).
> 
> For operations which require access to a directory tree (IE every operation 
> that does not involve an open file handle - open, creat, unlink, rename, 
> stat, chmod, chown, truncate, etc) we can have a separate samba process 
> that's run in a different context (eg smbd_user_t, smbd_staff_t, etc).  The 
> operations that result in an open file handle (open() and creat()) can then 
> pass back a file handle to the parent process over a Unix domain socket.  For 
> read/write/ioctl/fstat/ftruncate operations the main Samba process can query 
> the SE Linux kernel (or maybe use user space AVC code) as to whether the 
> operations are permitted.
> 
> This was one of many possible ways of doing this that we discussed.  I don't 
> think it was Andrew's favourite, but I think it works best with what we are 
> trying to do.

 as i have mentioned before, andrew's knowledge of unix system
 programming is extremely comprehensive, and if anyone can implement
 it in a secure manner, it's going to be andrew.


 it's not the simplest "get-it-working" approach.  using samba(4)
 as the front-end and samba-tng as the back-end is definitely the
 simplest.


> Another possibility is to just not permit multiple SMB identities over the 
> same TCP socket, there's apparently a registry setting that can be used on 
> each SMB client machine to make it use a separate TCP socket per connection.  

 that does not take care of DCE/RPC services which cannot be stopped
 from using the SMB layer to seteuid or provide threaded  support.


> In which case we just need to change the Samba code from fork/setuid to 
> fork/setuid/exec (which will not be fun).
> 
> -- 
> http://www.coker.com.au/selinux/   My NSA Security Enhanced Linux packages
> http://www.coker.com.au/bonnie++/  Bonnie++ hard drive benchmark
> http://www.coker.com.au/postal/    Postal SMTP/POP benchmark
> http://www.coker.com.au/~russell/  My home page
> 
> --
> 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.

-- 
-- 
expecting email to be received and understood is a bit like
picking up the telephone and immediately dialing without
checking for a dial-tone; speaking immediately without listening
for either an answer or ring-tone; hanging up immediately and
believing that you have actually started a conversation.
--
<a href="http://lkcl.net">      lkcl.net      </a> <br />
<a href="mailto:lkcl@lkcl.net"> lkcl@lkcl.net </a> <br />


--
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:[~2004-06-03 19:14 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-06-03  5:43 samba Russell Coker
2004-06-03 19:11 ` Luke Kenneth Casson Leighton [this message]
2004-06-03 21:04 ` samba Luke Kenneth Casson Leighton
  -- strict thread matches above, loose matches on Subject: below --
2004-01-27  5:21 Samba beolach
2004-01-25 16:35 Samba Josh Lamb
2004-01-25 20:47 ` Samba caszonyi
2004-01-26 19:56 ` Samba Theo. Sean Schulze
2003-09-04  6:51 samba Fritz Mesedilla
2002-10-28 15:22 samba Daniel Provin
2002-10-05  6:18 samba Gertjan Vinkesteijn
2002-10-05  8:41 ` samba Rudy Zijlstra
2002-10-05 13:03 ` samba Ed Tomlinson
2002-10-05 15:51   ` samba Gertjan Vinkesteijn
2002-10-05 17:55     ` samba Dieter Nützel
2002-10-06  0:20 ` samba system_lists
2002-10-05  9:26   ` samba darren
1999-12-29  7:08 Samba Mike Pecen

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=20040603191131.GC3856@lkcl.net \
    --to=lkcl@lkcl.net \
    --cc=russell@coker.com.au \
    --cc=samba-technical@samba.org \
    --cc=samba-tng@lists.samba-tng.org \
    --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.