freebsd-skq/sys/security
csjp 118c82a5e3 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
2007-04-13 14:55:19 +00:00
..
audit Fix the handling of IPv6 addresses for subject and process BSM audit 2007-04-13 14:55:19 +00:00
mac Remove 'MPSAFE' annotations from the comments above most system calls: all 2007-03-04 22:36:48 +00:00
mac_biba More unnecessary include reduction. 2007-02-23 14:39:04 +00:00
mac_bsdextended More unnecessary include reduction. 2007-02-23 14:39:04 +00:00
mac_ifoff More unnecessary include reduction. 2007-02-23 14:39:04 +00:00
mac_lomac Introduce accessor functions mac_label_get() and mac_label_set() to replace 2007-02-06 14:19:25 +00:00
mac_mls Introduce accessor functions mac_label_get() and mac_label_set() to replace 2007-02-06 14:19:25 +00:00
mac_none Remove many unneeded includes, update copyright. 2007-02-23 11:21:26 +00:00
mac_partition More unnecessary include reduction. 2007-02-23 14:39:04 +00:00
mac_portacl More unnecessary include reduction. 2007-02-23 14:39:04 +00:00
mac_seeotheruids More unnecessary include reduction. 2007-02-23 14:39:04 +00:00
mac_stub Continue 7-CURRENT MAC Framework rearrangement and cleanup: 2007-02-06 10:59:23 +00:00
mac_test More unnecessary include reduction. 2007-02-23 14:39:04 +00:00