Skip to content
  • Venkat Yekkirala's avatar
    SELinux: Various xfrm labeling fixes · c1a856c9
    Venkat Yekkirala authored
    
    
    Since the upstreaming of the mlsxfrm modification a few months back,
    testing has resulted in the identification of the following issues/bugs that
    are resolved in this patch set.
    
    1. Fix the security context used in the IKE negotiation to be the context
       of the socket as opposed to the context of the SPD rule.
    
    2. Fix SO_PEERSEC for tcp sockets to return the security context of
       the peer as opposed to the source.
    
    3. Fix the selection of an SA for an outgoing packet to be at the same
       context as the originating socket/flow.
    
    The following would be the result of applying this patchset:
    
    - SO_PEERSEC will now correctly return the peer's context.
    
    - IKE deamons will receive the context of the source socket/flow
      as opposed to the SPD rule's context so that the negotiated SA
      will be at the same context as the source socket/flow.
    
    - The SELinux policy will require one or more of the
      following for a socket to be able to communicate with/without SAs:
    
      1. To enable a socket to communicate without using labeled-IPSec SAs:
    
         allow socket_t unlabeled_t:association { sendto recvfrom }
    
      2. To enable a socket to communicate with labeled-IPSec SAs:
    
         allow socket_t self:association { sendto };
         allow socket_t peer_sa_t:association { recvfrom };
    
    This Patch: Pass correct security context to IKE for use in negotiation
    
    Fix the security context passed to IKE for use in negotiation to be the
    context of the socket as opposed to the context of the SPD rule so that
    the SA carries the label of the originating socket/flow.
    
    Signed-off-by: default avatarVenkat Yekkirala <vyekkirala@TrustedCS.com>
    Signed-off-by: default avatarJames Morris <jmorris@namei.org>
    c1a856c9