19 Apr, 2008

2 commits

  • …s/security-testing-2.6

    * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/security-testing-2.6:
    security: fix up documentation for security_module_enable
    Security: Introduce security= boot parameter
    Audit: Final renamings and cleanup
    SELinux: use new audit hooks, remove redundant exports
    Audit: internally use the new LSM audit hooks
    LSM/Audit: Introduce generic Audit LSM hooks
    SELinux: remove redundant exports
    Netlink: Use generic LSM hook
    Audit: use new LSM hooks instead of SELinux exports
    SELinux: setup new inode/ipc getsecid hooks
    LSM: Introduce inode_getsecid and ipc_getsecid hooks

    Linus Torvalds
     
  • Add the security= boot parameter. This is done to avoid LSM
    registration clashes in case of more than one bult-in module.

    User can choose a security module to enable at boot. If no
    security= boot parameter is specified, only the first LSM
    asking for registration will be loaded. An invalid security
    module name will be treated as if no module has been chosen.

    LSM modules must check now if they are allowed to register
    by calling security_module_enable(ops) first. Modify SELinux
    and SMACK to do so.

    Do not let SMACK register smackfs if it was not chosen on
    boot. Smackfs assumes that smack hooks are registered and
    the initial task security setup (swapper->security) is done.

    Signed-off-by: Ahmed S. Darwish
    Acked-by: James Morris

    Ahmed S. Darwish
     

13 Apr, 2008

1 commit

  • Smack doesn't have the need to create a private copy of the LSM "domain" when
    setting NetLabel security attributes like SELinux, however, the current
    NetLabel code requires a private copy of the LSM "domain". This patches fixes
    that by letting the LSM determine how it wants to pass the domain value.

    * NETLBL_SECATTR_DOMAIN_CPY
    The current behavior, NetLabel assumes that the domain value is a copy and
    frees it when done

    * NETLBL_SECATTR_DOMAIN
    New, Smack-friendly behavior, NetLabel assumes that the domain value is a
    reference to a string managed by the LSM and does not free it when done

    Signed-off-by: Paul Moore
    Acked-by: James Morris
    Signed-off-by: David S. Miller

    Paul Moore
     

21 Mar, 2008

1 commit

  • The original justification for cap_task_kill() was as follows:

    check_kill_permission() does appropriate uid equivalence checks.
    However with file capabilities it becomes possible for an
    unprivileged user to execute a file with file capabilities
    resulting in a more privileged task with the same uid.

    However now that cap_task_kill() always returns 0 (permission
    granted) when p->uid==current->uid, the whole hook is worthless,
    and only likely to create more subtle problems in the corner cases
    where it might still be called but return -EPERM. Those cases
    are basically when uids are different but euid/suid is equivalent
    as per the check in check_kill_permission().

    One example of a still-broken application is 'at' for non-root users.

    This patch removes cap_task_kill().

    Signed-off-by: Serge Hallyn
    Acked-by: Andrew G. Morgan
    Earlier-version-tested-by: Luiz Fernando N. Capitulino
    Acked-by: Casey Schaufler
    Signed-off-by: Linus Torvalds

    Serge Hallyn
     

20 Mar, 2008

1 commit

  • In the SYSV ipc msgctl(),semctl(),shmctl() family, if the user passed *_INFO
    as the desired operation, no specific object is meant to be controlled and
    only system-wide information is returned. This leads to a NULL IPC object in
    the LSM hooks if the _INFO flag is given.

    Avoid dereferencing this NULL pointer in Smack ipc *ctl() methods.

    Signed-off-by: Ahmed S. Darwish
    Acked-by: Casey Schaufler
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Ahmed S. Darwish
     

06 Mar, 2008

1 commit

  • Introduce new LSM interfaces to allow an FS to deal with their own mount
    options. This includes a new string parsing function exported from the
    LSM that an FS can use to get a security data blob and a new security
    data blob. This is particularly useful for an FS which uses binary
    mount data, like NFS, which does not pass strings into the vfs to be
    handled by the loaded LSM. Also fix a BUG() in both SELinux and SMACK
    when dealing with binary mount data. If the binary mount data is less
    than one page the copy_page() in security_sb_copy_data() can cause an
    illegal page fault and boom. Remove all NFSisms from the SELinux code
    since they were broken by past NFS changes.

    Signed-off-by: Eric Paris
    Acked-by: Stephen Smalley
    Acked-by: Casey Schaufler
    Signed-off-by: James Morris

    Eric Paris
     

24 Feb, 2008

1 commit

  • Update the Smack LSM to allow the registration of the capability "module"
    as a secondary LSM. Integrate the new hooks required for file based
    capabilities.

    Signed-off-by: Casey Schaufler
    Cc: Serge Hallyn
    Cc: Stephen Smalley
    Cc: Paul Moore
    Cc: James Morris
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Casey Schaufler
     

19 Feb, 2008

1 commit

  • Smack uses CIPSO labeling, but allows for unlabeled packets by
    specifying an "ambient" label that is applied to incoming unlabeled
    packets.

    Because the other end of the connection may dislike IP options, and ssh
    is one know application that behaves thus, it is prudent to respond in
    kind.

    This patch changes the network labeling behavior such that an outgoing
    packet that would be given a CIPSO label that matches the ambient label
    is left unlabeled. An "unlbl" domain is added and the netlabel
    defaulting mechanism invoked rather than assuming that everything is
    CIPSO. Locking has been added around changes to the ambient label as
    the mechanisms used to do so are more involved.

    Signed-off-by: Casey Schaufler
    Acked-by: Paul Moore
    Signed-off-by: Linus Torvalds

    Casey Schaufler
     

15 Feb, 2008

1 commit

  • This is the central patch of a cleanup series. In most cases there is no good
    reason why someone would want to use a dentry for itself. This series reflects
    that fact and embeds a struct path into nameidata.

    Together with the other patches of this series
    - it enforced the correct order of getting/releasing the reference count on
    pairs
    - it prepares the VFS for stacking support since it is essential to have a
    struct path in every place where the stack can be traversed
    - it reduces the overall code size:

    without patch series:
    text data bss dec hex filename
    5321639 858418 715768 6895825 6938d1 vmlinux

    with patch series:
    text data bss dec hex filename
    5320026 858418 715768 6894212 693284 vmlinux

    This patch:

    Switch from nd->{dentry,mnt} to nd->path.{dentry,mnt} everywhere.

    [akpm@linux-foundation.org: coding-style fixes]
    [akpm@linux-foundation.org: fix cifs]
    [akpm@linux-foundation.org: fix smack]
    Signed-off-by: Jan Blunck
    Signed-off-by: Andreas Gruenbacher
    Acked-by: Christoph Hellwig
    Cc: Al Viro
    Cc: Casey Schaufler
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jan Blunck
     

14 Feb, 2008

1 commit

  • There's a small problem with smack and NFS. A similar report was also
    sent here: http://lkml.org/lkml/2007/10/27/85

    I've also added similar checks in inode_{get/set}security(). Cheating from
    SELinux post_create_socket(), it does the same.

    [akpm@linux-foundation.org: remove uneeded BUG_ON()]
    Signed-off-by: Ahmed S. Darwish
    Acked-by: Casey Schaufler
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Ahmed S. Darwish
     

06 Feb, 2008

1 commit

  • Smack is the Simplified Mandatory Access Control Kernel.

    Smack implements mandatory access control (MAC) using labels
    attached to tasks and data containers, including files, SVIPC,
    and other tasks. Smack is a kernel based scheme that requires
    an absolute minimum of application support and a very small
    amount of configuration data.

    Smack uses extended attributes and
    provides a set of general mount options, borrowing technics used
    elsewhere. Smack uses netlabel for CIPSO labeling. Smack provides
    a pseudo-filesystem smackfs that is used for manipulation of
    system Smack attributes.

    The patch, patches for ls and sshd, a README, a startup script,
    and x86 binaries for ls and sshd are also available on

    http://www.schaufler-ca.com

    Development has been done using Fedora Core 7 in a virtual machine
    environment and on an old Sony laptop.

    Smack provides mandatory access controls based on the label attached
    to a task and the label attached to the object it is attempting to
    access. Smack labels are deliberately short (1-23 characters) text
    strings. Single character labels using special characters are reserved
    for system use. The only operation applied to Smack labels is equality
    comparison. No wildcards or expressions, regular or otherwise, are
    used. Smack labels are composed of printable characters and may not
    include "/".

    A file always gets the Smack label of the task that created it.

    Smack defines and uses these labels:

    "*" - pronounced "star"
    "_" - pronounced "floor"
    "^" - pronounced "hat"
    "?" - pronounced "huh"

    The access rules enforced by Smack are, in order:

    1. Any access requested by a task labeled "*" is denied.
    2. A read or execute access requested by a task labeled "^"
    is permitted.
    3. A read or execute access requested on an object labeled "_"
    is permitted.
    4. Any access requested on an object labeled "*" is permitted.
    5. Any access requested by a task on an object with the same
    label is permitted.
    6. Any access requested that is explicitly defined in the loaded
    rule set is permitted.
    7. Any other access is denied.

    Rules may be explicitly defined by writing subject,object,access
    triples to /smack/load.

    Smack rule sets can be easily defined that describe Bell&LaPadula
    sensitivity, Biba integrity, and a variety of interesting
    configurations. Smack rule sets can be modified on the fly to
    accommodate changes in the operating environment or even the time
    of day.

    Some practical use cases:

    Hierarchical levels. The less common of the two usual uses
    for MLS systems is to define hierarchical levels, often
    unclassified, confidential, secret, and so on. To set up smack
    to support this, these rules could be defined:

    C Unclass rx
    S C rx
    S Unclass rx
    TS S rx
    TS C rx
    TS Unclass rx

    A TS process can read S, C, and Unclass data, but cannot write it.
    An S process can read C and Unclass. Note that specifying that
    TS can read S and S can read C does not imply TS can read C, it
    has to be explicitly stated.

    Non-hierarchical categories. This is the more common of the
    usual uses for an MLS system. Since the default rule is that a
    subject cannot access an object with a different label no
    access rules are required to implement compartmentalization.

    A case that the Bell & LaPadula policy does not allow is demonstrated
    with this Smack access rule:

    A case that Bell&LaPadula does not allow that Smack does:

    ESPN ABC r
    ABC ESPN r

    On my portable video device I have two applications, one that
    shows ABC programming and the other ESPN programming. ESPN wants
    to show me sport stories that show up as news, and ABC will
    only provide minimal information about a sports story if ESPN
    is covering it. Each side can look at the other's info, neither
    can change the other. Neither can see what FOX is up to, which
    is just as well all things considered.

    Another case that I especially like:

    SatData Guard w
    Guard Publish w

    A program running with the Guard label opens a UDP socket and
    accepts messages sent by a program running with a SatData label.
    The Guard program inspects the message to ensure it is wholesome
    and if it is sends it to a program running with the Publish label.
    This program then puts the information passed in an appropriate
    place. Note that the Guard program cannot write to a Publish
    file system object because file system semanitic require read as
    well as write.

    The four cases (categories, levels, mutual read, guardbox) here
    are all quite real, and problems I've been asked to solve over
    the years. The first two are easy to do with traditonal MLS systems
    while the last two you can't without invoking privilege, at least
    for a while.

    Signed-off-by: Casey Schaufler
    Cc: Joshua Brindle
    Cc: Paul Moore
    Cc: Stephen Smalley
    Cc: Chris Wright
    Cc: James Morris
    Cc: "Ahmed S. Darwish"
    Cc: Andrew G. Morgan
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Casey Schaufler