1. 13 Nov, 2008 31 commits
  2. 12 Nov, 2008 1 commit
  3. 11 Nov, 2008 8 commits
    • Eric Paris's avatar
      Currently SELinux jumps through some ugly hoops to not audit a capbility · 06674679
      Eric Paris authored
      check when determining if a process has additional powers to override
      memory limits or when trying to read/write illegal file labels.  Use
      the new noaudit call instead.
      Signed-off-by: default avatarEric Paris <eparis@redhat.com>
      Acked-by: default avatarStephen Smalley <sds@tycho.nsa.gov>
      Signed-off-by: default avatarJames Morris <jmorris@namei.org>
      06674679
    • Eric Paris's avatar
      The oomkiller calculations make decisions based on capabilities. Since · a2f2945a
      Eric Paris authored
      these are not security decisions and LSMs should not record if they fall
      the request they should use the new has_capability_noaudit() interface so
      the denials will not be recorded.
      Signed-off-by: default avatarEric Paris <eparis@redhat.com>
      Acked-by: default avatarStephen Smalley <sds@tycho.nsa.gov>
      Signed-off-by: default avatarJames Morris <jmorris@namei.org>
      a2f2945a
    • Eric Paris's avatar
      Add a new capable interface that will be used by systems that use audit to · 06112163
      Eric Paris authored
      make an A or B type decision instead of a security decision.  Currently
      this is the case at least for filesystems when deciding if a process can use
      the reserved 'root' blocks and for the case of things like the oom
      algorithm determining if processes are root processes and should be less
      likely to be killed.  These types of security system requests should not be
      audited or logged since they are not really security decisions.  It would be
      possible to solve this problem like the vm_enough_memory security check did
      by creating a new LSM interface and moving all of the policy into that
      interface but proves the needlessly bloat the LSM and provide complex
      indirection.
      
      This merely allows those decisions to be made where they belong and to not
      flood logs or printk with denials for thing that are not security decisions.
      Signed-off-by: default avatarEric Paris <eparis@redhat.com>
      Acked-by: default avatarStephen Smalley <sds@tycho.nsa.gov>
      Signed-off-by: default avatarJames Morris <jmorris@namei.org>
      06112163
    • Eric Paris's avatar
      Capabilities: BUG when an invalid capability is requested · 637d32dc
      Eric Paris authored
      If an invalid (large) capability is requested the capabilities system
      may panic as it is dereferencing an array of fixed (short) length.  Its
      possible (and actually often happens) that the capability system
      accidentally stumbled into a valid memory region but it also regularly
      happens that it hits invalid memory and BUGs.  If such an operation does
      get past cap_capable then the selinux system is sure to have problems as
      it already does a (simple) validity check and BUG.  This is known to
      happen by the broken and buggy firegl driver.
      
      This patch cleanly checks all capable calls and BUG if a call is for an
      invalid capability.  This will likely break the firegl driver for some
      situations, but it is the right thing to do.  Garbage into a security
      system gets you killed/bugged
      Signed-off-by: default avatarEric Paris <eparis@redhat.com>
      Acked-by: default avatarArjan van de Ven <arjan@linux.intel.com>
      Acked-by: default avatarSerge Hallyn <serue@us.ibm.com>
      Acked-by: default avatarAndrew G. Morgan <morgan@kernel.org>
      Signed-off-by: default avatarJames Morris <jmorris@namei.org>
      637d32dc
    • Eric Paris's avatar
      When the capset syscall is used it is not possible for audit to record the · e68b75a0
      Eric Paris authored
      actual capbilities being added/removed.  This patch adds a new record type
      which emits the target pid and the eff, inh, and perm cap sets.
      
      example output if you audit capset syscalls would be:
      
      type=SYSCALL msg=audit(1225743140.465:76): arch=c000003e syscall=126 success=yes exit=0 a0=17f2014 a1=17f201c a2=80000000 a3=7fff2ab7f060 items=0 ppid=2160 pid=2223 auid=0 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=pts0 ses=1 comm="setcap" exe="/usr/sbin/setcap" subj=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 key=(null)
      type=UNKNOWN[1322] msg=audit(1225743140.465:76): pid=0 cap_pi=ffffffffffffffff cap_pp=ffffffffffffffff cap_pe=ffffffffffffffff
      Signed-off-by: default avatarEric Paris <eparis@redhat.com>
      Acked-by: default avatarSerge Hallyn <serue@us.ibm.com>
      Signed-off-by: default avatarJames Morris <jmorris@namei.org>
      e68b75a0
    • Eric Paris's avatar
      Any time fcaps or a setuid app under SECURE_NOROOT is used to result in a · 3fc689e9
      Eric Paris authored
      non-zero pE we will crate a new audit record which contains the entire set
      of known information about the executable in question, fP, fI, fE, fversion
      and includes the process's pE, pI, pP.  Before and after the bprm capability
      are applied.  This record type will only be emitted from execve syscalls.
      
      an example of making ping use fcaps instead of setuid:
      
      setcap "cat_net_raw+pe" /bin/ping
      
      type=SYSCALL msg=audit(1225742021.015:236): arch=c000003e syscall=59 success=yes exit=0 a0=1457f30 a1=14606b0 a2=1463940 a3=321b770a70 items=2 ppid=2929 pid=2963 auid=0 uid=500 gid=500 euid=500 suid=500 fsuid=500 egid=500 sgid=500 fsgid=500 tty=pts0 ses=3 comm="ping" exe="/bin/ping" subj=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 key=(null)
      type=UNKNOWN[1321] msg=audit(1225742021.015:236): fver=2 fp=0000000000002000 fi=0000000000000000 fe=1 old_pp=0000000000000000 old_pi=0000000000000000 old_pe=0000000000000000 new_pp=0000000000002000 new_pi=0000000000000000 new_pe=0000000000002000
      type=EXECVE msg=audit(1225742021.015:236): argc=2 a0="ping" a1="127.0.0.1"
      type=CWD msg=audit(1225742021.015:236):  cwd="/home/test"
      type=PATH msg=audit(1225742021.015:236): item=0 name="/bin/ping" inode=49256 dev=fd:00 mode=0100755 ouid=0 ogid=0 rdev=00:00 obj=system_u:object_r:ping_exec_t:s0 cap_fp=0000000000002000 cap_fe=1 cap_fver=2
      type=PATH msg=audit(1225742021.015:236): item=1 name=(null) inode=507915 dev=fd:00 mode=0100755 ouid=0 ogid=0 rdev=00:00 obj=system_u:object_r:ld_so_t:s0
      Signed-off-by: default avatarEric Paris <eparis@redhat.com>
      Acked-by: default avatarSerge Hallyn <serue@us.ibm.com>
      Signed-off-by: default avatarJames Morris <jmorris@namei.org>
      3fc689e9
    • Eric Paris's avatar
      This patch will print cap_permitted and cap_inheritable data in the PATH · 851f7ff5
      Eric Paris authored
      records of any file that has file capabilities set.  Files which do not
      have fcaps set will not have different PATH records.
      
      An example audit record if you run:
      setcap "cap_net_admin+pie" /bin/bash
      /bin/bash
      
      type=SYSCALL msg=audit(1225741937.363:230): arch=c000003e syscall=59 success=yes exit=0 a0=2119230 a1=210da30 a2=20ee290 a3=8 items=2 ppid=2149 pid=2923 auid=0 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=pts0 ses=3 comm="ping" exe="/bin/ping" subj=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 key=(null)
      type=EXECVE msg=audit(1225741937.363:230): argc=2 a0="ping" a1="www.google.com"
      type=CWD msg=audit(1225741937.363:230):  cwd="/root"
      type=PATH msg=audit(1225741937.363:230): item=0 name="/bin/ping" inode=49256 dev=fd:00 mode=0104755 ouid=0 ogid=0 rdev=00:00 obj=system_u:object_r:ping_exec_t:s0 cap_fp=0000000000002000 cap_fi=0000000000002000 cap_fe=1 cap_fver=2
      type=PATH msg=audit(1225741937.363:230): item=1 name=(null) inode=507915 dev=fd:00 mode=0100755 ouid=0 ogid=0 rdev=00:00 obj=system_u:object_r:ld_so_t:s0
      Signed-off-by: default avatarEric Paris <eparis@redhat.com>
      Acked-by: default avatarSerge Hallyn <serue@us.ibm.com>
      Signed-off-by: default avatarJames Morris <jmorris@namei.org>
      851f7ff5
    • Eric Paris's avatar
      This patch add a generic cpu endian caps structure and externally available · c0b00441
      Eric Paris authored
      functions which retrieve fcaps information from disk.  This information is
      necessary so fcaps information can be collected and recorded by the audit
      system.
      Signed-off-by: default avatarEric Paris <eparis@redhat.com>
      Acked-by: default avatarSerge Hallyn <serue@us.ibm.com>
      Signed-off-by: default avatarJames Morris <jmorris@namei.org>
      c0b00441