4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
22 * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
27 #include <sys/types.h>
29 #include <sys/fcntl.h>
30 #include <bsm/audit.h>
31 #include <bsm/audit_record.h>
32 #include <bsm/audit_uevents.h>
33 #include <bsm/libbsm.h>
37 #include <netinet/in.h>
42 #define dprintf(x) { (void) printf x; }
47 #define AUD_NULL_STR(s) ((s) ? (s) : "(null)")
52 dprintf(("audit_krb5kdc_setup()\n"));
58 au_event_t event
, /* audit event */
59 struct in_addr
*r_addr
, /* remote ipv4 addr */
60 in_port_t r_port
, /* remote port */
61 in_port_t l_port
, /* local port */
62 char *cname
, /* client principal name */
63 char *sname
, /* requested service name */
64 int sorf
) /* flag for success or failure */
71 dprintf(("common_audit() start\n"));
73 /* if auditing turned off, then don't do anything */
77 (void) aug_save_namask();
83 aug_save_auid(ai
.ai_auid
); /* Audit ID */
84 aug_save_uid(getuid()); /* User ID */
85 aug_save_euid(geteuid()); /* Effective User ID */
86 aug_save_gid(getgid()); /* Group ID */
87 aug_save_egid(getegid()); /* Effective Group ID */
88 aug_save_pid(getpid()); /* process ID */
89 aug_save_asid(getpid()); /* session ID */
91 aug_save_event(event
);
94 (void) snprintf(text_buf
, sizeof (text_buf
), "Client: %s",
96 aug_save_text1(text_buf
);
97 (void) snprintf(text_buf
, sizeof (text_buf
), "Service: %s",
99 aug_save_text2(text_buf
);
101 dprintf(("audit_krb5kdc: r_port=%d, l_port=%d\n", r_port
, l_port
));
102 port
= (htons(r_port
)<<16 | htons(l_port
));
104 machine
= r_addr
? (uint32_t)r_addr
->s_addr
: 0;
106 aug_save_tid_ex(port
, &machine
, AU_IPv4
);
112 audit_krb5kdc_as_req(
113 struct in_addr
*r_addr
, /* remote ipv4 addr */
114 in_port_t r_port
, /* remote port */
115 in_port_t l_port
, /* local port */
116 char *cname
, /* client principal name */
117 char *sname
, /* requested service name */
118 int sorf
) /* flag for success or failure */
120 common_audit(AUE_krb5kdc_as_req
, r_addr
, r_port
, l_port
, cname
,
125 audit_krb5kdc_tgs_req(
126 struct in_addr
*r_addr
, /* remote ipv4 addr */
127 in_port_t r_port
, /* remote port */
128 in_port_t l_port
, /* local port */
129 char *cname
, /* client principal name */
130 char *sname
, /* requested service name */
131 int sorf
) /* flag for success or failure */
133 common_audit(AUE_krb5kdc_tgs_req
, r_addr
, r_port
, l_port
, cname
,
138 audit_krb5kdc_tgs_req_2ndtktmm(
139 struct in_addr
*r_addr
, /* remote ipv4 addr */
140 in_port_t r_port
, /* remote port */
141 in_port_t l_port
, /* local port */
142 char *cname
, /* client principal name */
143 char *sname
) /* requested service name */
145 common_audit(AUE_krb5kdc_tgs_req_2ndtktmm
, r_addr
, r_port
, l_port
,
150 audit_krb5kdc_tgs_req_alt_tgt(
151 struct in_addr
*r_addr
, /* remote ipv4 addr */
152 in_port_t r_port
, /* remote port */
153 in_port_t l_port
, /* local port */
154 char *cname
, /* client principal name */
155 char *sname
, /* requested service name */
156 int sorf
) /* flag for success or failure */
158 common_audit(AUE_krb5kdc_tgs_req_alt_tgt
, r_addr
, r_port
, l_port
,