HomeFreeBSD

Fix the handling of IPv6 addresses for subject and process BSM audit
rS168688Unpublished

Unpublished Commit ยท Learn More

No further details are available.

Description

Fix the handling of IPv6 addresses for subject and process BSM audit
tokens. Currently, we do not support the set{get}audit_addr(2) system
calls which allows processes like sshd to set extended or ip6
information for subject tokens.

The approach that was taken was to change the process audit state
slightly to use an extended terminal ID in the kernel. This allows
us to store both IPv4 IPv6 addresses. In the case that an IPv4 address
is in use, we convert the terminal ID from an struct auditinfo_addr to
a struct auditinfo.

If getaudit(2) is called when the subject is bound to an ip6 address,
we return E2BIG.

  • Change the internal audit record to store an extended terminal ID
  • Introduce ARG_TERMID_ADDR
  • Change the kaudit <-> BSM conversion process so that we are using the appropriate subject token. If the address associated with the subject is IPv4, we use the standard subject32 token. If the subject has an IPv6 address associated with them, we use an extended subject32 token.
  • Fix a couple of endian issues where we do a couple of byte swaps when we shouldn't be. IP addresses are already in the correct byte order, so reading the ip6 address 4 bytes at a time and swapping them results in in-correct address data. It should be noted that the same issue was found in the openbsm library and it has been changed there too on the vendor branch
  • Change A_GETPINFO to use the appropriate structures
  • Implement A_GETPINFO_ADDR which basically does what A_GETPINFO does, but can also handle ip6 addresses
  • Adjust get{set}audit(2) syscalls to convert the data auditinfo <-> auditinfo_addr
  • Fully implement set{get}audit_addr(2)
NOTE: This adds the ability for processes to correctly set extended subject information. The appropriate userspace utilities still need to be updated.

MFC after: 1 month
Reviewed by: rwatson
Obtained from: TrustedBSD

Details

Provenance
csjpAuthored on
Parents
rS168687: Pav and marcus co-mentored me for a few weeks while adamw was busy in school
Branches
Unknown
Tags
Unknown