sarnoldthanks for coming everyone; the talk of the hour is going to be given by chris wright, discussing the Linux Security Modules interface, currently being worked into the 2.5 series of kernels
sarnoldthere are spanish translations in #redes, dutch in #taee....
sarnoldquestions and comments should be directed in #qc
sarnoldand with that, cdub, please take us away.. :)
cdubthank you sarnold
cdubtoday i'm speaking of the linux security modules project (LSM)
cdubthank you all for atttending.
cdubI would like to start with a brief overview of where LSM came from.  Some hisorical perspective
cdubthe 2001 kernel summit is the logical place to look to.
riel_one small housekeeping message: if you have questions about the lecture, you can ask them in #qc  (sorry)
cduba member of the SELinux team, Pete Loscoco, presented SELinux to the kernel summit for inclusion into the linux kernel.
cdublinus and others expressed concern that SELinux was too invasive, and solved a specific problem.  leaving other security projects out in the cold.
cdubas a consequence, linus requested a framework that could support various security projects with pluggable modules.
cdubthis was the birth of the LSM project.
cdubpromptly, members from various security projects began collaborating and designing a framework to support the various existing security projects.
cdubthis framework was built on a set of assumptions:
cdub1.  the framework should be generic enough that it can support varioius security models.
cdub2. it should be light weight, and not impose unnecessary overhead.
cdub3.  it would support only Access Control security models (meaning full audit, often necessary for accredidation, isn't supported)
cdub4. it needed to support the pre-existing capabilities
cdubthis lead the LSM project to the current design, which is partially merged with the 2.5 mainline kernel.
cdub<rene:#qc> more explanation of "access control" versus "full audit"?
cdubsure.
cduboften, things like Common Criteria, or Orange Book certifications require a variety of security enhancements.
cdubone being fairly obvious, access control
cdubanother aspect of certification is often the ability to real-time audit the transactions in a system.
cdubso, not just restricting access for foo process to bar object, but also logging this event in a structured way.
cduband this logging/audting is beyond the scope of the current LSM project's charter.
cdubso, let me begin breaking down the aspects of the LSM design.
cdubbut first, a quick qeustion:
cdubyes.
cdub;-)
cdubAlright, so here are some of the basic qualities of the LSM framework.
cdub1. It provides the ability to register a new security module.
cdub2. It provides the in-kernle hooks required for the the module to enforce access control
cdubregistration is very simple, the module simple fills out the callbacks required, and calls register_security()
cdub<zanshin:#qc> Is there a list af objects for which security modules can be written?                                              
cdubthat's where i'm headed ;-)
cdubsure.
cdublet me give a quick look at the list of objects that are protected, then look at the syscall issue.
cdubthe LSM framework monitors access to some basic kernel objects, like super blocks, inodes, binprm (during program execution), ipc objects: semaphores, mqueues, shared mem
cdubit also, hooks into the network stack at a couple levels (sockets level, transport layer, network layer, ...)
cdubso, defining the core kernel objects is intrinisically far away from the syscall entry points
cdubthe syscall entry point defines a nice abstraction for userspace to interact with the services the kernel provides.
cdubhowever, it does not work with kernel primitives (such as dentry's and inode's).
cdubso the syscall entry point takes user supplied data, (often strings in the fs layer), and converts them to kernel objects.  throught pathname resolutoin.
cdubthe kernel copies in this data and translates it in a non-atomic way, so it is race prone to just use the syscall entry point.
cdubfinally, the syscall entry point _does_ describe much of what the user can do to the system.
cdubso LSM must protect against all these actions.
cdubtherefore, it is not uncommon to see a LSM hook that looks suspicisously similar to the syuscall entry point.
cdubinfact, the sockets internal api is basically just the socket syscall api...
cdubriel_: does that answer your question?
cdub <rene:#qc> cdub: could you give an example of a race here?
cdubyes, open ("foo")
cdubfoo is copied in to kernel, and looked up.  if the LSM interface was before translation, it could look up foo, grant access.
cdubthen another thread could modify foo.  and the kernel would then see "newfoo", know that it passed lsm, look it up...
cdubblam...
cdubalright, just to recap, since there were questions interspersed...
cdubthe LSM framework is a simple hooking API.  it provides the registration, and in-kernel callbacks
cdubno, userspace.
cdub <nab:#qc> cdub: Is it possible to use multiple security modules at the same time,  and if so what are the limitations in doing so.
cdubnab: that's an interesting question.
cdublet me digress shortly before answering.
cdubone of the things that the LSM interface provides is the ability to label kernel objects with security id's
cdubthis is core to the ability to decide if an action is safe.  the LSM module could compare the task's security id with the inode's security id, for example.
cdubbecause of security labelling, it is difficult for multiple security models to share the LSM space at one time.
cdub(without adding some smarts to the interface that knows which module is querying the object).
cdublinus specifically didn't want this.
cduband in fact, security research shows that arbitrary security models compose and produce arbitrary results
cdubnot satisfactory for security.
cdubso...the LSM interface provides the ability to stack modules, but requires a module to handle the stacking.  basically someone in charge of deciding how to compose the results of the various security deccisions
cdubsuch a module has been written, although it is not part of the LSM tree.
cdubthis is an area where future development will likely change the current behaviour.
cdubbut for now, we follow, KISS
cdub<zanshin:#qc> are syscall hooks and callbacks pointers to fuctions one should fill in when registering a security module?      
cdubthe LSM interface is a structure of callback pointers.  this is all you have to fill in to register.
cdubsome of the callback pointers very closely mimic the syscall entry point they are protecting, but not all.
cdubwe could look at a sample call flow to see how this looks in terms of code.
cdubmost security models will care, for example, about the creation of a new task, and specifically execve() which can change your exectuoin domains.
cdub<nab:#qc> cdub:  How much overhead is associated in using the various hooks,  in what section of the kernel (fs ops, socket ops, etc) do the largest performance drawbacks lie?
cdubnab: the overhead measured in macro benchmarks is very low.
cdubnab: often in th 0-2% range.
cdub <nab:#qc> cdub: or would this be more related to the implemenation of the hooks inside the security module?
cdubabsolutely.
cdubthe network hooks tend to cause more overhead
cdubbut, a poorly coded hook could serialize an operation that must highly concurrent and optimized.
cdubso the module itself is critical in system perf measurements.
cdubbut, it is possible to create a very simple module to stress just the framework.
cdubthere we see, as i mentioned, the network stack having more impact.
cdubalso, our numbers showed stat open/close and unlink to be heavier than other fs hooks.
cdubconsider anything that has to look up the kernel path (or dentry) will do multiple permisison checks, on at each directory, plus a check on the final object, so this is not a surprise.
cdubalright, so i was showing a simple call flow...
cdubexecve("/bin/foo")
cdubthis will first look up the bin/foo object and turn it into a kernel file pointer
cdubthis lookup will triggeer a couple permission checks on "/" and "/bin" and "/bin/foo"
cdubthen, assuming one has access to the full path, the binformat handlers are queried.
cdubduring this stage, a binprm structre is created, and then LSM labels it.
cdubthis becomes clear if you think of a UNIX setuid program.
cdubthe task would have one label (uid 500 == chris, for example)
cdubbut the binprm structure would have another label (uid 0, for example).
cdublater the module is queried if it's ok to execute the new program.  this include perhaps transtioning the current task to a new security domain.
cdubthis one could be elevated or lowered...
cdubto follow this in code, one would look at the bprm based LSM hooks.
cdubonce the task is labelled, either via fork, or exec, all future access to kernel objects (superblocks via mount(2), files via open/read/write.., network via sockets api)
cdubmust go through LSM module, and the labels on the kernel objects are compared against the task label
cdubthis is the fundamental behaviour of LSM.
cdub <pdp:#qc> But why allow upped sec-levels from un "unsecured sec-level by the Main sec-level ?  ??
cdubi'm not sure i understand the question.  this is a security policy question.
cdubfor example, it may be ok for the /bin/foo security domain (from execve("/bin/foo")
cdubto call /bin/bar
cduband according to the policy, it may be a way for increased privs.  but it may not.  it is all determined by the policy codified in the security module
cdubin fact, that is one of the critical features of LSM.
cduball policy is in the module.
cdubthe framework just doesn't care.
cdub<riel_:#qc> cdub: does LSM handle passing of filedescriptors via unix domain sockets ?                                        
cdubabsolutely
cdubit is possible to control the passing of fd's.
cdubsome policies may allow it, but if you get a lower security level fd, perhaps your tasks security domain will bbe lowered
cdubor perhaps you simply wouldn't allow the fd to be passed at all.
cduba common question is: "aren't modules insecure?"
cdubthis is a debatable question.  but LSM doesn't have to be modular.  it can be compiled statically, just as other modules.  so this is not a real issue.
cduband, of course, the security module controls the loading and unloading of modules, so it can run a tight ship.
cdubalright, as i mentioned earlier, LSM is for access control.
cdubit is largely used for Macdatory Access Control (MAC), but is not limited to this.
cdubas such, the standard UNIX Discretionary Access Control (DAC) mechanism is still in tact.
cduband there is an ordering issue between DAC and MAC.
cdubin general, we place LSM hooks were there already exists kernel permissoin checking logic
cduband we check LSM before falling back to the DAC checks (as is typically required by MAC).
cdubandre had a couple questions that i'd like to discuss now
cdub<andre:#qc> cdub: how is the addition of LSM against any other bolt on
cdubAPI different, regardless if it is natively adopted
cdubwell, the primary difference is the level of intrusiveness.
cdubmost API's are smaller and live in their own corner of the kernel
cdubhowever, given the nature of LSM, it touches much of the core kernel
cduband therefore it is different, esp when it comes to GPL and kernel code.
cdubmost kernel developers are very concerned about the GPL and don't want their code exploited in a non-GPL way.
cdubso the LSM API is exported as a GPL only API.
cdubthis is because it touches so much of the core kernel, it is important to make it clear that security module is in the core kernel code
cduband is a derived work of the linux kernel
cdubinsert appropriate "I am not a lawyer" disclaimer here.
cdubi'm not sure what people may have missed during the netsplits
cdubso perhaps, i'll take some questions now
cdubfeel free to ask questions in #qc
cdub<andre:#qc> now are all LSM additions derived works and this forced to GPL thus removing the viable secret nature of LSM operations
cdub<andre:#qc> now if the secret sauce of each discrete LSM is disclosed, what is the use of LSM period
cdubalright, this is an important question, but i hope not to fall to far into license wars.
cdubfirst of all, the use of the LSM interface itself is very core to the linux kernel.
cdubit hooks around linux kernel core objects, and allows/disallows access
cdubthus one could argue that the use of the LSM interface is clearly a derived work of the linux kernel
cdubfurthermore...
cdubin this case, we are talking of security
cdubit is a well-known security concern that secrets are not good for security
cdubwhile that doesn't dictate that the code itself be open, at least the algorithm should be disclosed and well-understood
cdubotherwise you are on the verge of security through obscurity
cdubso, if disclosing your security module compromises the security of the module, then it's likely the module is insecure to begin with (license aside
cdubback to the license side...the LSM project doesn't really care one way or the other.
cdubwe care about adding a security infrastructure to the linux kernel
cdublinus said what he wanted, and we gave it to him
cduband he believes the LSM api should be exported GPL_ONLY
cdubthis is a sacrifice we are willing to make, to ensure that LSM does not get removed from the kernel
cdubi hope that answers the question.  it is a very contentious topic, and often sparks emotional rather than techinal arguments
cdub<andre:#qc> cdub: invalid argument, only future releases can be removed not older versions
cdubalright, point taken.
cdubhowever, consider that LSM is largely out of tree
cdubwe are only about halfway merged
cdubso, what we care about is full merging
cduband 2.5 is not 2.6 yet, so things can still change.
cdublinus as good as said, it will be GPL_ONLY or I will rip it out.  period.  it's his tree, we do what he (and other copyright holders) want
cduband the stuff that is in the LSM tree exists as a patch to the kernel.  and the licesnse restriction there tends to be considered GPl by definition
cdubalright, are there any other questions.
cdubthe talk has been a little fragmented, so please feel free to speak up if there are things that are unclear
cdub <rene:#qc> cdub: you mentioned compatibility with capabilities as a requirement; how do they fit in? just another policy?  
cdubrene: that's a good question
cdublinux (before LSM) supported some portion of the POSIX.1e draft for Capabilities
cdubso, we needed to preserve that
cdubcapabilities are a slight enhancement on UID == 0 policy (super user policy)
cdubhowever, a tasks capabilities are reasonably static
cdubso, capabilities are done both as a module and inline coded in the kernel
cdubwe separated all the capabilities logic out, put it behind functions that can be called from the security module
cdubthen, recently, gregkh made it possible to compile away LSM, which leaves you with the old style kernel
cdubthis calls the capabilities functions that we separated out inline, rather than through the LSM interface.
cdubhowever, one are of capabilities is not in LSM
cdubthe task label which is used  to identify the security domain is not used by capabilities
cdubinstead, it still uses the task_struct native capabilties data structures
cdubso, capabilities is the odd duck.  it is half-in, half-out.
cduband it's primary roll is to override security deciisions
cdubin other words, most MAC models restrict access..."can i have access" yes/no
cdubhowever capabilities typically override:  "i wasn't supposed to have access, but...please?" yes/no
cdubso, capabilities compatiblity has made lsm a different APi than we originally imagined.
cdubrene: sure ;-)
cdubi guess there is one other small area that i didn't cover.
cdubLSM tries to stick to the core kernel.
cdubthis means it is largely not present in drivers, filesystems, etc.
cdub(of course, the exception is capable() which is present all over ;-)
cduband, most of the LSM hooks are called from process context
cdubthis means, most the LSM hooks are called on behalf of a system call.
cdubhowever some are called in interrupt context.
cdubspecifically, some of the async io data ready events are delivered (and LSM filtered) here
cdubalso, arriving network packets
cdubso, when one codes an LSM module they need to be aware of the contexts the hook can be called from.
cdubi should also mention what we have today.
cdubthe LSM interface is roughly 150 callbacks.
cdubabout half of those are merged with linus' tree.
cdubthe networking code is up for merging, but it will be a challenge to get it in (due to the performance impact).
cdubthankfully, gregkh made LSM compilable away, so we hope this helps with the perf. argument.
cdubalso, there are about 5 modules that have been developed.
cdubthe first two are simple: super user, and capabilities.
cdubthe third adds a bit of the Openwall kernel patch.
cdub(ok there are six ;-)
cdubthe last three are much more complex.
cdubaiee.. (ok there are 7 ;-)
cdubgregkh wrote an example module, showing how you could enforce a policy by requiring a specific USB device to be present to get root privs (or somthing along those lines)
cdubthe last three, LIDS, DTE and SELInux are more complicated examples of usage of LSM.
cdubSELinux uses the most of the interface.
cduband it allows you to effectively control every access to every object.
cdubit allows you to do MAC, TE, MLS.  things that are important when many users have access to a machine, and it has confidential (read: often military) information.
cdubalso, there are some out of tree modules, for example SubDomain, and whatever HP and SGI are working on.  Also, some new modules should show up from IBM security research.
cdub <rene:#qc> TE/MLS?
cdubType Enforcement
cdubMulti Level Security
cdubi'd suggest google to get complete defintions.
cdub <zanshin:#qc> Can you explain the part about id's and registering id's once more... when is an object registerd?. And when is it referenced if a syscall is made? And how are the internal hooks hooked on userland syscalls? pffieuw :)            
cdubwell, i'll give it a quick shot.  otherwise we can talk offline
cdubthe LSM interface provides a structure of callbacks (function pointers)
cdubthe module fills out a structure with its policy specific callbacks
cdubthen it registers with the framework
cdubfrom that point forward, the LSM hooks that are in the kernel
cdubwill callback (through the fucntion pointer) to the module
cdubthe callbacks do things like tell the module that a new object is being created
cdubone is being destroyed
cdubor one is being accessed
cdubwhen  a new object is created (a new inode for example)
cdubthe kernel creates the object, then calls to the module to allocate module specific space
cdubin the object for the module to maintain a security label
cdubthe label is typically the security ID
cduband later, when the object is accessed
cdubthe current security domain (typically that of the current running process that made the syscall, for example)
cdubcan be compared with the objects label
cdubdepending on the policy, this information is used to grant/deny access to the object
cdubthat's it in a nutshell
cdubhope that was clearer
cdubso, LSM is far from done
cdubaside for continuing to clean up, and merge with the kernel
cdubwe are looking for ways to fit more cleanly into the kernel's infrastucture
cdubthis could help keep the module interface clean, and easy to maintain.  right now it is very much a bolt on (as andre said)
cdubalso, we are hoping to incorporate new modules
cduband ideas from similar projects.  for example, RSBAC (for linux) and TrustedBSD (bsd obvsiously) have some nice ideas that we'd like to see how we can use.
cdubif you are interested in helping out, please take a look at lsm.immunix.org.  it has code, docs, mail list links, irc links, etc.
cdubi'm happy to take more questions.
cdubwell, i'll take that to mean you've all fallen asleep ;-)
cdubheh, thanks very much for your time.
viXardim trying to write my Q
fernand0plas plas plas plas plas plas plas plas plas plast
<fernand0> plas plas plas plas plas plas plas plas plas plast
fernand0plas plas plas plas plas plas plas plas plas plast
viXardPLAS PLAS PLAS PLAS PLAS PLAS :))))
viXardPLAS PLAS PLAS PLAS PLAS PLAS :))))
fernand0plas plas plas plas plas plas plas plas plas plast
viXardPLAS PLAS PLAS PLAS PLAS PLAS :))))
viXardPLAS PLAS PLAS PLAS PLAS PLAS :))))
BorZungthanks you cdub for your time
viXardPLAS PLAS PLAS PLAS PLAS PLAS :))))
Pummelplas plas plas plas plas plas
pdpclap clap clap clap
zanshinclap clap clap clap clap :0)
fernand0plas plas plas plas plas plas plas plas plas plast
renein dutch, that's "pee pee pee" ...
renewe say "klap"
cdub<viXard:#qc> Are these modules arch careless?
viXard:#qcforgive my english :)
cdubviXard: almost
Taigeruwse say "bis", just to force you to repeat everything :)
cdubptrace is typicall arch specific.  in most other cases, we are arch independent.
pdpencore encore!
cdubs/typicall/typically/
* zanshin loves these presentations on irc.
cdubagain, thanks
<cdub> and feel free to bug me on irc or on the mailing list
sarnoldcdub: thanks :)
viXardso, you think LSM will be the official Linus tree security module? (sorry if the question is dumb )
cdubzanshin: yes i do to.  very nice medium for presentations.  uninet does a great job!
pdptnx  cuagn
cdubviXard: LSM is not one module, but a framework to support many modules
zanshinhope there will be more on a regular basis.
cduba little bit like the VFS, which allows pluggable filesystems
viXardok, itīll be the official one?
sarnoldzanshin: we hope to have an INFOSEC talk around april
cdubso, LSM should be in linus' tree (it is already half way in)
* viXard freeze out !
zanshinnice... looking forward to it.
cduband who knows what would be the most popular module.  SELinux is certainly well known
viXardarrg, infosec :$
sarnoldzanshin: maybe we will have a 6fevu (ipv6) conference somewhere around here....
sarnoldviXard: you'll have fun. :-P  :)
fernand0and of course, anybody willing to talk here is invited to do so whenever he wants
cdubheh ;-)
sarnoldzanshin: uninet also hosts other conferences, such as doctors and pathologists and math and ....
viXardlaw
viXardlawyers
renecdub: many thanks again!
cdubrene sure
zanshinsarnold: are there also talks about education and opensource? I hope to get an opensource project started at my school.
sarnoldzanshin: heh, that probably would have fit into umeet pretty well :)

Generated by irclog2html.pl by Jeff Waugh - find it at freshmeat.net!