19 Jul, 2007

1 commit

  • Create a new NetLabel KAPI interface, netlbl_enabled(), which reports on the
    current runtime status of NetLabel based on the existing configuration. LSMs
    that make use of NetLabel, i.e. SELinux, can use this new function to determine
    if they should perform NetLabel access checks. This patch changes the
    NetLabel/SELinux glue code such that SELinux only enforces NetLabel related
    access checks when netlbl_enabled() returns true.

    At present NetLabel is considered to be enabled when there is at least one
    labeled protocol configuration present. The result is that by default NetLabel
    is considered to be disabled, however, as soon as an administrator configured
    a CIPSO DOI definition NetLabel is enabled and SELinux starts enforcing
    NetLabel related access controls - including unlabeled packet controls.

    This patch also tries to consolidate the multiple "#ifdef CONFIG_NETLABEL"
    blocks into a single block to ease future review as recommended by Linus.

    Signed-off-by: Paul Moore
    Signed-off-by: James Morris

    Paul Moore
     

17 Jul, 2007

1 commit

  • Add TTY input auditing, used to audit system administrator's actions. This is
    required by various security standards such as DCID 6/3 and PCI to provide
    non-repudiation of administrator's actions and to allow a review of past
    actions if the administrator seems to overstep their duties or if the system
    becomes misconfigured for unknown reasons. These requirements do not make it
    necessary to audit TTY output as well.

    Compared to an user-space keylogger, this approach records TTY input using the
    audit subsystem, correlated with other audit events, and it is completely
    transparent to the user-space application (e.g. the console ioctls still
    work).

    TTY input auditing works on a higher level than auditing all system calls
    within the session, which would produce an overwhelming amount of mostly
    useless audit events.

    Add an "audit_tty" attribute, inherited across fork (). Data read from TTYs
    by process with the attribute is sent to the audit subsystem by the kernel.
    The audit netlink interface is extended to allow modifying the audit_tty
    attribute, and to allow sending explanatory audit events from user-space (for
    example, a shell might send an event containing the final command, after the
    interactive command-line editing and history expansion is performed, which
    might be difficult to decipher from the TTY input alone).

    Because the "audit_tty" attribute is inherited across fork (), it would be set
    e.g. for sshd restarted within an audited session. To prevent this, the
    audit_tty attribute is cleared when a process with no open TTY file
    descriptors (e.g. after daemon startup) opens a TTY.

    See https://www.redhat.com/archives/linux-audit/2007-June/msg00000.html for a
    more detailed rationale document for an older version of this patch.

    [akpm@linux-foundation.org: build fix]
    Signed-off-by: Miloslav Trmac
    Cc: Al Viro
    Cc: Alan Cox
    Cc: Paul Fulghum
    Cc: Casey Schaufler
    Cc: Steve Grubb
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Miloslav Trmac
     

09 Jun, 2007

1 commit

  • The current NetLabel code has some redundant APIs which allow both
    "struct socket" and "struct sock" types to be used; this may have made
    sense at some point but it is wasteful now. Remove the functions that
    operate on sockets and convert the callers. Not only does this make
    the code smaller and more consistent but it pushes the locking burden
    up to the caller which can be more intelligent about the locks. Also,
    perform the same conversion (socket to sock) on the SELinux/NetLabel
    glue code where it make sense.

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

    Paul Moore
     

08 Jun, 2007

1 commit


26 Apr, 2007

1 commit

  • Up until this patch the functions which have provided NetLabel support to
    SELinux have been integrated into the SELinux security server, which for
    various reasons is not really ideal. This patch makes an effort to extract as
    much of the NetLabel support from the security server as possibile and move it
    into it's own file within the SELinux directory structure.

    Signed-off-by: Paul Moore
    Signed-off-by: James Morris

    Paul Moore
     

01 Mar, 2007

1 commit


11 Feb, 2007

1 commit


09 Jan, 2007

1 commit

  • The current netlbl_cipsov4_add_common() function has two problems which are
    fixed with this patch. The first is an off-by-one bug where it is possibile to
    overflow the doi_def->tags[] array. The second is a bug where the same
    doi_def->tags[] array was not always fully initialized, which caused sporadic
    failures.

    Signed-off-by: Paul Moore
    Signed-off-by: James Morris

    Paul Moore
     

23 Dec, 2006

2 commits

  • Back when the original NetLabel patches were being changed to use Netlink
    attributes correctly some code was accidentially dropped which set all of the
    undefined CIPSOv4 level and category mappings to a sentinel value. The result
    is the mappings data in the kernel contains bogus mappings which always map to
    zero. This patch restores the old/correct behavior by initializing the mapping
    data to the correct sentinel value.

    Signed-off-by: Paul Moore
    Signed-off-by: James Morris

    Paul Moore
     
  • There are a couple of cases where the user input for a CIPSOv4 DOI add
    operation was not being done soon enough; the result was unexpected behavior
    which was resulting in oops/panics/lockups on some platforms. This patch moves
    the existing input validation code earlier in the code path to protect against
    bogus user input.

    Signed-off-by: Paul Moore
    Signed-off-by: James Morris

    Paul Moore
     

03 Dec, 2006

8 commits

  • The original NetLabel category bitmap was a straight char bitmap which worked
    fine for the initial release as it only supported 240 bits due to limitations
    in the CIPSO restricted bitmap tag (tag type 0x01). This patch converts that
    straight char bitmap into an extensibile/sparse bitmap in order to lay the
    foundation for other CIPSO tag types and protocols.

    This patch also has a nice side effect in that all of the security attributes
    passed by NetLabel into the LSM are now in a format which is in the host's
    native byte/bit ordering which makes the LSM specific code much simpler; look
    at the changes in security/selinux/ss/ebitmap.c as an example.

    Signed-off-by: Paul Moore
    Signed-off-by: James Morris

    Paul Moore
     
  • The audit_enabled flag is used to signal when syscall auditing is to be
    performed. While NetLabel uses a Netlink interface instead of syscalls, it is
    reasonable to consider the NetLabel Netlink interface as a form of syscall so
    pay attention to the audit_enabled flag when generating audit messages in
    NetLabel.

    Signed-off-by: Paul Moore
    Signed-off-by: James Morris

    Paul Moore
     
  • Right now the NetLabel code always jumps into the CIPSOv4 layer to determine if
    a CIPSO IP option is present. However, we can do this check directly in the
    NetLabel code by making use of the CIPSO_V4_OPTEXIST() macro which should save
    us a function call in the common case of not having a CIPSOv4 option present.

    Signed-off-by: Paul Moore
    Signed-off-by: James Morris

    Paul Moore
     
  • The existing netlbl_lsm_secattr struct required the LSM to check all of the
    fields to determine if any security attributes were present resulting in a lot
    of work in the common case of no attributes. This patch adds a 'flags' field
    which is used to indicate which attributes are present in the structure; this
    should allow the LSM to do a quick comparison to determine if the structure
    holds any security attributes.

    Example:

    if (netlbl_lsm_secattr->flags)
    /* security attributes present */
    else
    /* NO security attributes present */

    Signed-off-by: Paul Moore
    Signed-off-by: James Morris

    Paul Moore
     
  • Currently the NetLabel unlabeled packet accept flag is an atomic type and it
    is checked for every non-NetLabel packet which comes into the system but rarely
    ever changed. This patch changes this flag to a normal integer and protects it
    with RCU locking.

    Signed-off-by: Paul Moore
    Signed-off-by: James Morris

    Paul Moore
     
  • By modyfing genlmsg_put() to take a genl_family and by adding
    genlmsg_put_reply() the process of constructing the netlink
    and generic netlink headers is simplified.

    Signed-off-by: Thomas Graf
    Acked-by: Paul Moore
    Signed-off-by: David S. Miller

    Thomas Graf
     
  • A generic netlink user has no interest in knowing how to
    address the source of the original request.

    Signed-off-by: Thomas Graf
    Acked-by: Paul Moore
    Signed-off-by: David S. Miller

    Thomas Graf
     
  • Account for the netlink message header size directly in nlmsg_new()
    instead of relying on the caller calculate it correctly.

    Replaces error handling of message construction functions when
    constructing notifications with bug traps since a failure implies
    a bug in calculating the size of the skb.

    Signed-off-by: Thomas Graf
    Acked-by: Paul Moore
    Signed-off-by: David S. Miller

    Thomas Graf
     

06 Nov, 2006

1 commit

  • > the build with the attached .config failed, make ends with:
    > ...
    > : undefined reference to `cipso_v4_sock_getattr'
    > net/built-in.o: In function `netlbl_socket_getattr':

    ...

    It looks like I was stupid and made NetLabel depend on CONFIG_NET and not
    CONFIG_INET, the patch below should fix this by making NetLabel depend on
    CONFIG_INET and CONFIG_SECURITY. Please review and apply for 2.6.19.

    Signed-off-by: Paul Moore
    Signed-off-by: David S. Miller

    Paul Moore
     

12 Oct, 2006

1 commit

  • Testing revealed a problem with the NetLabel cache where a cached entry could
    be freed while in use by the LSM layer causing an oops and other problems.
    This patch fixes that problem by introducing a reference counter to the cache
    entry so that it is only freed when it is no longer in use.

    Signed-off-by: Paul Moore
    Signed-off-by: James Morris

    paul.moore@hp.com
     

30 Sep, 2006

1 commit

  • Fix some issues Steve Grubb had with the way NetLabel was using the audit
    subsystem. This should make NetLabel more consistent with other kernel
    generated audit messages specifying configuration changes.

    Signed-off-by: Paul Moore
    Acked-by: Steve Grubb
    Signed-off-by: David S. Miller

    Paul Moore
     

29 Sep, 2006

1 commit

  • This patch adds audit support to NetLabel, including six new audit message
    types shown below.

    #define AUDIT_MAC_UNLBL_ACCEPT 1406
    #define AUDIT_MAC_UNLBL_DENY 1407
    #define AUDIT_MAC_CIPSOV4_ADD 1408
    #define AUDIT_MAC_CIPSOV4_DEL 1409
    #define AUDIT_MAC_MAP_ADD 1410
    #define AUDIT_MAC_MAP_DEL 1411

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

    Paul Moore
     

26 Sep, 2006

4 commits


23 Sep, 2006

5 commits

  • Add some missing include files to the NetLabel related header files.

    Signed-off-by: Paul Moore
    Signed-off-by: David S. Miller

    Paul Moore
     
  • Adds nlmsg_notify() implementing proper notification logic. The
    message is multicasted to all listeners in the group. The
    applications the requests orignates from can request a unicast
    back report in which case said socket will be excluded from the
    multicast to avoid duplicated notifications.

    nlmsg_multicast() is extended to take allocation flags to
    allow notification in atomic contexts.

    Signed-off-by: Thomas Graf
    Signed-off-by: David S. Miller

    Thomas Graf
     
  • This patch makes needlessly global code static.

    Signed-off-by: Adrian Bunk
    Signed-off-by: David S. Miller

    Adrian Bunk
     
  • Add CIPSO/IPv4 and unlabeled packet management to the NetLabel
    subsystem. The CIPSO/IPv4 changes allow the configuration of
    CIPSO/IPv4 within the overall NetLabel framework. The unlabeled
    packet changes allows NetLabel to pass unlabeled packets without
    error.

    Signed-off-by: Paul Moore
    Signed-off-by: David S. Miller

    Paul Moore
     
  • Add a new kernel subsystem, NetLabel, to provide explicit packet
    labeling services (CIPSO, RIPSO, etc.) to LSM developers. NetLabel is
    designed to work in conjunction with a LSM to intercept and decode
    security labels on incoming network packets as well as ensure that
    outgoing network packets are labeled according to the security
    mechanism employed by the LSM. The NetLabel subsystem is configured
    through a Generic NETLINK interface described in the header files
    included in this patch.

    Signed-off-by: Paul Moore
    Signed-off-by: David S. Miller

    Paul Moore