1 /* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */
2 /* plugins/preauth/pkinit/pkinit_trace.h - PKINIT tracing macros */
4 * Copyright (C) 2012 by the Massachusetts Institute of Technology.
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
11 * * Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
14 * * Redistributions in binary form must reproduce the above copyright
15 * notice, this list of conditions and the following disclaimer in
16 * the documentation and/or other materials provided with the
19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
22 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
23 * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
24 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
25 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
28 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
30 * OF THE POSSIBILITY OF SUCH DAMAGE.
33 #ifndef PKINIT_TRACE_H
34 #define PKINIT_TRACE_H
38 #define TRACE_PKINIT_CLIENT_EKU_ACCEPT(c) \
39 TRACE(c, "PKINIT client found acceptable EKU in KDC cert")
40 #define TRACE_PKINIT_CLIENT_EKU_REJECT(c) \
41 TRACE(c, "PKINIT client found no acceptable EKU in KDC cert")
42 #define TRACE_PKINIT_CLIENT_EKU_SKIP(c) \
43 TRACE(c, "PKINIT client skipping EKU check due to configuration")
44 #define TRACE_PKINIT_CLIENT_FRESHNESS_TOKEN(c) \
45 TRACE(c, "PKINIT client received freshness token from KDC")
46 #define TRACE_PKINIT_CLIENT_KDF_ALG(c, kdf, keyblock) \
47 TRACE(c, "PKINIT client used KDF {hexdata} to compute reply key " \
48 "{keyblock}", kdf, keyblock)
49 #define TRACE_PKINIT_CLIENT_KDF_OS2K(c, keyblock) \
50 TRACE(c, "PKINIT client used octetstring2key to compute reply key " \
51 "{keyblock}", keyblock)
52 #define TRACE_PKINIT_CLIENT_NO_IDENTITY(c) \
53 TRACE(c, "PKINIT client has no configured identity; giving up")
54 #define TRACE_PKINIT_CLIENT_REP_CHECKSUM_FAIL(c, expected, received) \
55 TRACE(c, "PKINIT client checksum mismatch: expected {cksum}, " \
56 "received {cksum}", expected, received)
57 #define TRACE_PKINIT_CLIENT_REP_DH(c) \
58 TRACE(c, "PKINIT client verified DH reply")
59 #define TRACE_PKINIT_CLIENT_REP_DH_FAIL(c) \
60 TRACE(c, "PKINIT client could not verify DH reply")
61 #define TRACE_PKINIT_CLIENT_REP_RSA(c) \
62 TRACE(c, "PKINIT client verified RSA reply")
63 #define TRACE_PKINIT_CLIENT_REP_RSA_KEY(c, keyblock, cksum) \
64 TRACE(c, "PKINIT client retrieved reply key {keyblock} from RSA " \
65 "reply (checksum {cksum})", keyblock, cksum)
66 #define TRACE_PKINIT_CLIENT_REP_RSA_FAIL(c) \
67 TRACE(c, "PKINIT client could not verify RSA reply")
68 #define TRACE_PKINIT_CLIENT_REQ_CHECKSUM(c, cksum) \
69 TRACE(c, "PKINIT client computed kdc-req-body checksum {cksum}", cksum)
70 #define TRACE_PKINIT_CLIENT_REQ_DH(c) \
71 TRACE(c, "PKINIT client making DH request")
72 #define TRACE_PKINIT_CLIENT_REQ_RSA(c) \
73 TRACE(c, "PKINIT client making RSA request")
74 #define TRACE_PKINIT_CLIENT_SAN_CONFIG_DNSNAME(c, host) \
75 TRACE(c, "PKINIT client config accepts KDC dNSName SAN {str}", host)
76 #define TRACE_PKINIT_CLIENT_SAN_MATCH_DNSNAME(c, host) \
77 TRACE(c, "PKINIT client matched KDC hostname {str} against " \
78 "dNSName SAN; EKU check still required", host)
79 #define TRACE_PKINIT_CLIENT_SAN_MATCH_NONE(c) \
80 TRACE(c, "PKINIT client found no acceptable SAN in KDC cert")
81 #define TRACE_PKINIT_CLIENT_SAN_MATCH_PRINC(c, princ) \
82 TRACE(c, "PKINIT client matched KDC principal {princ} against " \
83 "id-pkinit-san; no EKU check required", princ)
84 #define TRACE_PKINIT_CLIENT_SAN_ERR(c) \
85 TRACE(c, "PKINIT client failed to decode SANs in KDC cert")
86 #define TRACE_PKINIT_CLIENT_SAN_KDCCERT_DNSNAME(c, host) \
87 TRACE(c, "PKINIT client found dNSName SAN in KDC cert: {str}", host)
88 #define TRACE_PKINIT_CLIENT_SAN_KDCCERT_PRINC(c, princ) \
89 TRACE(c, "PKINIT client found id-pkinit-san in KDC cert: {princ}", princ)
90 #define TRACE_PKINIT_CLIENT_TRYAGAIN(c) \
91 TRACE(c, "PKINIT client trying again with KDC-provided parameters")
93 #define TRACE_PKINIT_OPENSSL_ERROR(c, msg) \
94 TRACE(c, "PKINIT OpenSSL error: {str}", msg)
96 #define TRACE_PKINIT_PKCS11_GETFLIST_FAILED(c, errstr) \
97 TRACE(c, "PKINIT PKCS11 C_GetFunctionList failed: {str}", errstr)
98 #define TRACE_PKINIT_PKCS11_GETSYM_FAILED(c, errstr) \
99 TRACE(c, "PKINIT unable to find PKCS11 plugin symbol " \
100 "C_GetFunctionList: {str}", errstr)
101 #define TRACE_PKINIT_PKCS11_LOGIN_FAILED(c, errstr) \
102 TRACE(c, "PKINIT PKCS11 C_Login failed: {str}", errstr)
103 #define TRACE_PKINIT_PKCS11_NO_MATCH_TOKEN(c) \
104 TRACE(c, "PKINIT PKCS#11 module has no matching tokens")
105 #define TRACE_PKINIT_PKCS11_NO_TOKEN(c) \
106 TRACE(c, "PKINIT PKCS#11 module shows no slots with tokens")
107 #define TRACE_PKINIT_PKCS11_OPEN(c, name) \
108 TRACE(c, "PKINIT opening PKCS#11 module \"{str}\"", name)
109 #define TRACE_PKINIT_PKCS11_OPEN_FAILED(c, errstr) \
110 TRACE(c, "PKINIT PKCS#11 module open failed: {str}", errstr)
111 #define TRACE_PKINIT_PKCS11_SLOT(c, slot, len, label) \
112 TRACE(c, "PKINIT PKCS#11 slotid {int} token {lenstr}", \
115 #define TRACE_PKINIT_SERVER_CERT_AUTH(c, modname) \
116 TRACE(c, "PKINIT server authorizing cert with module {str}", \
118 #define TRACE_PKINIT_SERVER_EKU_REJECT(c) \
119 TRACE(c, "PKINIT server found no acceptable EKU in client cert")
120 #define TRACE_PKINIT_SERVER_EKU_SKIP(c) \
121 TRACE(c, "PKINIT server skipping EKU check due to configuration")
122 #define TRACE_PKINIT_SERVER_INIT_REALM(c, realm) \
123 TRACE(c, "PKINIT server initializing realm {str}", realm)
124 #define TRACE_PKINIT_SERVER_INIT_FAIL(c, realm, retval) \
125 TRACE(c, "PKINIT server initialization failed for realm {str}: {kerr}", \
127 #define TRACE_PKINIT_SERVER_MATCHING_UPN_FOUND(c) \
128 TRACE(c, "PKINIT server found a matching UPN SAN in client cert")
129 #define TRACE_PKINIT_SERVER_MATCHING_SAN_FOUND(c) \
130 TRACE(c, "PKINIT server found a matching SAN in client cert")
131 #define TRACE_PKINIT_SERVER_NO_SAN(c) \
132 TRACE(c, "PKINIT server found no SAN in client cert")
133 #define TRACE_PKINIT_SERVER_PADATA_VERIFY(c) \
134 TRACE(c, "PKINIT server verifying KRB5_PADATA_PK_AS_REQ")
135 #define TRACE_PKINIT_SERVER_PADATA_VERIFY_FAIL(c) \
136 TRACE(c, "PKINIT server failed to verify PA data")
137 #define TRACE_PKINIT_SERVER_RETURN_PADATA(c) \
138 TRACE(c, "PKINIT server returning PA data")
139 #define TRACE_PKINIT_SERVER_SAN_REJECT(c) \
140 TRACE(c, "PKINIT server found no acceptable SAN in client cert")
141 #define TRACE_PKINIT_SERVER_UPN_PARSE_FAIL(c, upn, ret) \
142 TRACE(c, "PKINIT server could not parse UPN \"{str}\": {kerr}", \
145 #define TRACE_PKINIT_CERT_CHAIN_NAME(c, index, name) \
146 TRACE(c, "PKINIT chain cert #{int}: {str}", index, name)
147 #define TRACE_PKINIT_CERT_NUM_MATCHING(c, total, nummatch) \
148 TRACE(c, "PKINIT client checked {int} certs, found {int} matches", \
150 #define TRACE_PKINIT_CERT_RULE(c, rule) \
151 TRACE(c, "PKINIT client matching rule '{str}' against certificates", rule)
152 #define TRACE_PKINIT_CERT_RULE_INVALID(c, rule) \
153 TRACE(c, "PKINIT client ignoring invalid rule '{str}'", rule)
155 #define TRACE_PKINIT_EKU(c) \
156 TRACE(c, "PKINIT found acceptable EKU and digitalSignature KU")
157 #define TRACE_PKINIT_EKU_NO_KU(c) \
158 TRACE(c, "PKINIT found acceptable EKU but no digitalSignature KU")
159 #define TRACE_PKINIT_IDENTITY_OPTION(c, name) \
160 TRACE(c, "PKINIT loading identity {str}", name)
161 #define TRACE_PKINIT_LOADED_CERT(c, name) \
162 TRACE(c, "PKINIT loaded cert and key for {str}", name)
163 #define TRACE_PKINIT_LOAD_FROM_FILE(c, name) \
164 TRACE(c, "PKINIT loading CA certs and CRLs from FILE {str}", name)
165 #define TRACE_PKINIT_LOAD_FROM_DIR(c, name) \
166 TRACE(c, "PKINIT loading CA certs and CRLs from DIR {str}", name)
167 #define TRACE_PKINIT_NO_CA_ANCHOR(c, file) \
168 TRACE(c, "PKINIT no anchor CA in file {str}", file)
169 #define TRACE_PKINIT_NO_CA_INTERMEDIATE(c, file) \
170 TRACE(c, "PKINIT no intermediate CA in file {str}", file)
171 #define TRACE_PKINIT_NO_CERT(c) \
172 TRACE(c, "PKINIT no certificate provided")
173 #define TRACE_PKINIT_NO_CERT_AND_KEY(c, dirname) \
174 TRACE(c, "PKINIT no cert and key pair found in directory {str}", \
176 #define TRACE_PKINIT_NO_CRL(c, file) \
177 TRACE(c, "PKINIT no CRL in file {str}", file)
178 #define TRACE_PKINIT_NO_DEFAULT_CERT(c, count) \
179 TRACE(c, "PKINIT error: There are {int} certs, but there must " \
180 "be exactly one.", count)
181 #define TRACE_PKINIT_NO_MATCHING_CERT(c) \
182 TRACE(c, "PKINIT no matching certificate found")
183 #define TRACE_PKINIT_NO_PRIVKEY(c) \
184 TRACE(c, "PKINIT no private key provided")
185 #define TRACE_PKINIT_PKCS_DECODE_FAIL(c, name) \
186 TRACE(c, "PKINIT failed to decode PKCS12 file {str} contents", name)
187 #define TRACE_PKINIT_PKCS_OPEN_FAIL(c, name, err) \
188 TRACE(c, "PKINIT failed to open PKCS12 file {str}: err {errno}", \
190 #define TRACE_PKINIT_PKCS_PARSE_FAIL_FIRST(c) \
191 TRACE(c, "PKINIT initial PKCS12_parse with no password failed")
192 #define TRACE_PKINIT_PKCS_PARSE_FAIL_SECOND(c) \
193 TRACE(c, "PKINIT second PKCS12_parse with password failed")
194 #define TRACE_PKINIT_PKCS_PROMPT_FAIL(c) \
195 TRACE(c, "PKINIT failed to prompt for PKCS12 password")
196 #define TRACE_PKINIT_REGEXP_MATCH(c, keyword, comp, value, idx) \
197 TRACE(c, "PKINIT matched {str} rule '{str}' with " \
198 "value '{str}' in cert #{int}", keyword, comp, value, (idx) + 1)
199 #define TRACE_PKINIT_REGEXP_NOMATCH(c, keyword, comp, value, idx) \
200 TRACE(c, "PKINIT didn't match {str} rule '{str}' with " \
201 "value '{str}' in cert #{int}", keyword, comp, value, (idx) + 1)
202 #define TRACE_PKINIT_SAN_CERT_COUNT(c, count, princ, upns, dns, cert) \
203 TRACE(c, "PKINIT client found {int} SANs ({int} princs, {int} " \
204 "UPNs, {int} DNS names) in certificate {str}", count, princ, \
206 #define TRACE_PKINIT_SAN_CERT_NONE(c, cert) \
207 TRACE(c, "PKINIT client found no SANs in certificate {str}", cert)
209 #define TRACE_CERTAUTH_VTINIT_FAIL(c, ret) \
210 TRACE(c, "certauth module failed to init vtable: {kerr}", ret)
211 #define TRACE_CERTAUTH_INIT_FAIL(c, name, ret) \
212 TRACE(c, "certauth module {str} failed to init: {kerr}", name, ret)
214 #endif /* PKINIT_TRACE_H */