freebsd-skq/sys/security/audit
Christian S.J. Peron f0cbfcc468 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_arg.c Fix the handling of IPv6 addresses for subject and process BSM audit 2007-04-13 14:55:19 +00:00
audit_bsm_klib.c Replace custom file descriptor array sleep lock constructed using a mutex 2007-04-04 09:11:34 +00:00
audit_bsm_token.c Fix the handling of IPv6 addresses for subject and process BSM audit 2007-04-13 14:55:19 +00:00
audit_bsm.c Fix the handling of IPv6 addresses for subject and process BSM audit 2007-04-13 14:55:19 +00:00
audit_ioctl.h Allow the user process to query the kernel's notion of a maximum 2006-08-26 17:59:31 +00:00
audit_pipe.c Sweep kernel replacing suser(9) calls with priv(9) calls, assigning 2006-11-06 13:42:10 +00:00
audit_private.h Fix the handling of IPv6 addresses for subject and process BSM audit 2007-04-13 14:55:19 +00:00
audit_syscalls.c Fix the handling of IPv6 addresses for subject and process BSM audit 2007-04-13 14:55:19 +00:00
audit_trigger.c Update a number of comments: 2006-12-28 22:18:43 +00:00
audit_worker.c Update a number of comments: 2006-12-28 22:18:43 +00:00
audit.c Fix the handling of IPv6 addresses for subject and process BSM audit 2007-04-13 14:55:19 +00:00
audit.h Fix the handling of IPv6 addresses for subject and process BSM audit 2007-04-13 14:55:19 +00:00