a6f6f4cfc67a23b02f2056a580f94be0de7cd230
[mech_eap.git] / src / eap_peer / eap_config.h
1 /*
2  * EAP peer configuration data
3  * Copyright (c) 2003-2008, Jouni Malinen <j@w1.fi>
4  *
5  * This software may be distributed under the terms of the BSD license.
6  * See README for more details.
7  */
8
9 #ifndef EAP_CONFIG_H
10 #define EAP_CONFIG_H
11
12 /**
13  * struct eap_peer_config - EAP peer configuration/credentials
14  */
15 struct eap_peer_config {
16         /**
17          * identity - EAP Identity
18          *
19          * This field is used to set the real user identity or NAI (for
20          * EAP-PSK/PAX/SAKE/GPSK).
21          */
22         u8 *identity;
23
24         /**
25          * identity_len - EAP Identity length
26          */
27         size_t identity_len;
28
29         /**
30          * anonymous_identity -  Anonymous EAP Identity
31          *
32          * This field is used for unencrypted use with EAP types that support
33          * different tunnelled identity, e.g., EAP-TTLS, in order to reveal the
34          * real identity (identity field) only to the authentication server.
35          *
36          * If not set, the identity field will be used for both unencrypted and
37          * protected fields.
38          */
39         u8 *anonymous_identity;
40
41         /**
42          * anonymous_identity_len - Length of anonymous_identity
43          */
44         size_t anonymous_identity_len;
45
46         /**
47          * password - Password string for EAP
48          *
49          * This field can include either the plaintext password (default
50          * option) or a NtPasswordHash (16-byte MD4 hash of the unicode
51          * presentation of the password) if flags field has
52          * EAP_CONFIG_FLAGS_PASSWORD_NTHASH bit set to 1. NtPasswordHash can
53          * only be used with authentication mechanism that use this hash as the
54          * starting point for operation: MSCHAP and MSCHAPv2 (EAP-MSCHAPv2,
55          * EAP-TTLS/MSCHAPv2, EAP-TTLS/MSCHAP, LEAP).
56          *
57          * In addition, this field is used to configure a pre-shared key for
58          * EAP-PSK/PAX/SAKE/GPSK. The length of the PSK must be 16 for EAP-PSK
59          * and EAP-PAX and 32 for EAP-SAKE. EAP-GPSK can use a variable length
60          * PSK.
61          */
62         u8 *password;
63
64         /**
65          * password_len - Length of password field
66          */
67         size_t password_len;
68
69         /**
70          * ca_cert - File path to CA certificate file (PEM/DER)
71          *
72          * This file can have one or more trusted CA certificates. If ca_cert
73          * and ca_path are not included, server certificate will not be
74          * verified. This is insecure and a trusted CA certificate should
75          * always be configured when using EAP-TLS/TTLS/PEAP. Full path to the
76          * file should be used since working directory may change when
77          * wpa_supplicant is run in the background.
78          *
79          * Alternatively, a named configuration blob can be used by setting
80          * this to blob://blob_name.
81          *
82          * Alternatively, this can be used to only perform matching of the
83          * server certificate (SHA-256 hash of the DER encoded X.509
84          * certificate). In this case, the possible CA certificates in the
85          * server certificate chain are ignored and only the server certificate
86          * is verified. This is configured with the following format:
87          * hash:://server/sha256/cert_hash_in_hex
88          * For example: "hash://server/sha256/
89          * 5a1bc1296205e6fdbe3979728efe3920798885c1c4590b5f90f43222d239ca6a"
90          *
91          * On Windows, trusted CA certificates can be loaded from the system
92          * certificate store by setting this to cert_store://name, e.g.,
93          * ca_cert="cert_store://CA" or ca_cert="cert_store://ROOT".
94          * Note that when running wpa_supplicant as an application, the user
95          * certificate store (My user account) is used, whereas computer store
96          * (Computer account) is used when running wpasvc as a service.
97          */
98         u8 *ca_cert;
99
100         /**
101          * ca_path - Directory path for CA certificate files (PEM)
102          *
103          * This path may contain multiple CA certificates in OpenSSL format.
104          * Common use for this is to point to system trusted CA list which is
105          * often installed into directory like /etc/ssl/certs. If configured,
106          * these certificates are added to the list of trusted CAs. ca_cert
107          * may also be included in that case, but it is not required.
108          */
109         u8 *ca_path;
110
111         /**
112          * client_cert - File path to client certificate file (PEM/DER)
113          *
114          * This field is used with EAP method that use TLS authentication.
115          * Usually, this is only configured for EAP-TLS, even though this could
116          * in theory be used with EAP-TTLS and EAP-PEAP, too. Full path to the
117          * file should be used since working directory may change when
118          * wpa_supplicant is run in the background.
119          *
120          * Alternatively, a named configuration blob can be used by setting
121          * this to blob://blob_name.
122          */
123         u8 *client_cert;
124
125         /**
126          * private_key - File path to client private key file (PEM/DER/PFX)
127          *
128          * When PKCS#12/PFX file (.p12/.pfx) is used, client_cert should be
129          * commented out. Both the private key and certificate will be read
130          * from the PKCS#12 file in this case. Full path to the file should be
131          * used since working directory may change when wpa_supplicant is run
132          * in the background.
133          *
134          * Windows certificate store can be used by leaving client_cert out and
135          * configuring private_key in one of the following formats:
136          *
137          * cert://substring_to_match
138          *
139          * hash://certificate_thumbprint_in_hex
140          *
141          * For example: private_key="hash://63093aa9c47f56ae88334c7b65a4"
142          *
143          * Note that when running wpa_supplicant as an application, the user
144          * certificate store (My user account) is used, whereas computer store
145          * (Computer account) is used when running wpasvc as a service.
146          *
147          * Alternatively, a named configuration blob can be used by setting
148          * this to blob://blob_name.
149          */
150         u8 *private_key;
151
152         /**
153          * private_key_passwd - Password for private key file
154          *
155          * If left out, this will be asked through control interface.
156          */
157         u8 *private_key_passwd;
158
159         /**
160          * dh_file - File path to DH/DSA parameters file (in PEM format)
161          *
162          * This is an optional configuration file for setting parameters for an
163          * ephemeral DH key exchange. In most cases, the default RSA
164          * authentication does not use this configuration. However, it is
165          * possible setup RSA to use ephemeral DH key exchange. In addition,
166          * ciphers with DSA keys always use ephemeral DH keys. This can be used
167          * to achieve forward secrecy. If the file is in DSA parameters format,
168          * it will be automatically converted into DH params. Full path to the
169          * file should be used since working directory may change when
170          * wpa_supplicant is run in the background.
171          *
172          * Alternatively, a named configuration blob can be used by setting
173          * this to blob://blob_name.
174          */
175         u8 *dh_file;
176
177         /**
178          * subject_match - Constraint for server certificate subject
179          *
180          * This substring is matched against the subject of the authentication
181          * server certificate. If this string is set, the server sertificate is
182          * only accepted if it contains this string in the subject. The subject
183          * string is in following format:
184          *
185          * /C=US/ST=CA/L=San Francisco/CN=Test AS/emailAddress=as@n.example.com
186          */
187         u8 *subject_match;
188
189         /**
190          * altsubject_match - Constraint for server certificate alt. subject
191          *
192          * Semicolon separated string of entries to be matched against the
193          * alternative subject name of the authentication server certificate.
194          * If this string is set, the server sertificate is only accepted if it
195          * contains one of the entries in an alternative subject name
196          * extension.
197          *
198          * altSubjectName string is in following format: TYPE:VALUE
199          *
200          * Example: EMAIL:server@example.com
201          * Example: DNS:server.example.com;DNS:server2.example.com
202          *
203          * Following types are supported: EMAIL, DNS, URI
204          */
205         u8 *altsubject_match;
206
207         /**
208          * ca_cert2 - File path to CA certificate file (PEM/DER) (Phase 2)
209          *
210          * This file can have one or more trusted CA certificates. If ca_cert2
211          * and ca_path2 are not included, server certificate will not be
212          * verified. This is insecure and a trusted CA certificate should
213          * always be configured. Full path to the file should be used since
214          * working directory may change when wpa_supplicant is run in the
215          * background.
216          *
217          * This field is like ca_cert, but used for phase 2 (inside
218          * EAP-TTLS/PEAP/FAST tunnel) authentication.
219          *
220          * Alternatively, a named configuration blob can be used by setting
221          * this to blob://blob_name.
222          */
223         u8 *ca_cert2;
224
225         /**
226          * ca_path2 - Directory path for CA certificate files (PEM) (Phase 2)
227          *
228          * This path may contain multiple CA certificates in OpenSSL format.
229          * Common use for this is to point to system trusted CA list which is
230          * often installed into directory like /etc/ssl/certs. If configured,
231          * these certificates are added to the list of trusted CAs. ca_cert
232          * may also be included in that case, but it is not required.
233          *
234          * This field is like ca_path, but used for phase 2 (inside
235          * EAP-TTLS/PEAP/FAST tunnel) authentication.
236          */
237         u8 *ca_path2;
238
239         /**
240          * client_cert2 - File path to client certificate file
241          *
242          * This field is like client_cert, but used for phase 2 (inside
243          * EAP-TTLS/PEAP/FAST tunnel) authentication. Full path to the
244          * file should be used since working directory may change when
245          * wpa_supplicant is run in the background.
246          *
247          * Alternatively, a named configuration blob can be used by setting
248          * this to blob://blob_name.
249          */
250         u8 *client_cert2;
251
252         /**
253          * private_key2 - File path to client private key file
254          *
255          * This field is like private_key, but used for phase 2 (inside
256          * EAP-TTLS/PEAP/FAST tunnel) authentication. Full path to the
257          * file should be used since working directory may change when
258          * wpa_supplicant is run in the background.
259          *
260          * Alternatively, a named configuration blob can be used by setting
261          * this to blob://blob_name.
262          */
263         u8 *private_key2;
264
265         /**
266          * private_key2_passwd -  Password for private key file
267          *
268          * This field is like private_key_passwd, but used for phase 2 (inside
269          * EAP-TTLS/PEAP/FAST tunnel) authentication.
270          */
271         u8 *private_key2_passwd;
272
273         /**
274          * dh_file2 - File path to DH/DSA parameters file (in PEM format)
275          *
276          * This field is like dh_file, but used for phase 2 (inside
277          * EAP-TTLS/PEAP/FAST tunnel) authentication. Full path to the
278          * file should be used since working directory may change when
279          * wpa_supplicant is run in the background.
280          *
281          * Alternatively, a named configuration blob can be used by setting
282          * this to blob://blob_name.
283          */
284         u8 *dh_file2;
285
286         /**
287          * subject_match2 - Constraint for server certificate subject
288          *
289          * This field is like subject_match, but used for phase 2 (inside
290          * EAP-TTLS/PEAP/FAST tunnel) authentication.
291          */
292         u8 *subject_match2;
293
294         /**
295          * altsubject_match2 - Constraint for server certificate alt. subject
296          *
297          * This field is like altsubject_match, but used for phase 2 (inside
298          * EAP-TTLS/PEAP/FAST tunnel) authentication.
299          */
300         u8 *altsubject_match2;
301
302         /**
303          * eap_methods - Allowed EAP methods
304          *
305          * (vendor=EAP_VENDOR_IETF,method=EAP_TYPE_NONE) terminated list of
306          * allowed EAP methods or %NULL if all methods are accepted.
307          */
308         struct eap_method_type *eap_methods;
309
310         /**
311          * phase1 - Phase 1 (outer authentication) parameters
312          *
313          * String with field-value pairs, e.g., "peapver=0" or
314          * "peapver=1 peaplabel=1".
315          *
316          * 'peapver' can be used to force which PEAP version (0 or 1) is used.
317          *
318          * 'peaplabel=1' can be used to force new label, "client PEAP
319          * encryption", to be used during key derivation when PEAPv1 or newer.
320          *
321          * Most existing PEAPv1 implementation seem to be using the old label,
322          * "client EAP encryption", and wpa_supplicant is now using that as the
323          * default value.
324          *
325          * Some servers, e.g., Radiator, may require peaplabel=1 configuration
326          * to interoperate with PEAPv1; see eap_testing.txt for more details.
327          *
328          * 'peap_outer_success=0' can be used to terminate PEAP authentication
329          * on tunneled EAP-Success. This is required with some RADIUS servers
330          * that implement draft-josefsson-pppext-eap-tls-eap-05.txt (e.g.,
331          * Lucent NavisRadius v4.4.0 with PEAP in "IETF Draft 5" mode).
332          *
333          * include_tls_length=1 can be used to force wpa_supplicant to include
334          * TLS Message Length field in all TLS messages even if they are not
335          * fragmented.
336          *
337          * sim_min_num_chal=3 can be used to configure EAP-SIM to require three
338          * challenges (by default, it accepts 2 or 3).
339          *
340          * result_ind=1 can be used to enable EAP-SIM and EAP-AKA to use
341          * protected result indication.
342          *
343          * fast_provisioning option can be used to enable in-line provisioning
344          * of EAP-FAST credentials (PAC):
345          * 0 = disabled,
346          * 1 = allow unauthenticated provisioning,
347          * 2 = allow authenticated provisioning,
348          * 3 = allow both unauthenticated and authenticated provisioning
349          *
350          * fast_max_pac_list_len=num option can be used to set the maximum
351          * number of PAC entries to store in a PAC list (default: 10).
352          *
353          * fast_pac_format=binary option can be used to select binary format
354          * for storing PAC entries in order to save some space (the default
355          * text format uses about 2.5 times the size of minimal binary format).
356          *
357          * crypto_binding option can be used to control PEAPv0 cryptobinding
358          * behavior:
359          * 0 = do not use cryptobinding (default)
360          * 1 = use cryptobinding if server supports it
361          * 2 = require cryptobinding
362          *
363          * EAP-WSC (WPS) uses following options: pin=Device_Password and
364          * uuid=Device_UUID
365          */
366         char *phase1;
367
368         /**
369          * phase2 - Phase2 (inner authentication with TLS tunnel) parameters
370          *
371          * String with field-value pairs, e.g., "auth=MSCHAPV2" for EAP-PEAP or
372          * "autheap=MSCHAPV2 autheap=MD5" for EAP-TTLS.
373          */
374         char *phase2;
375
376         /**
377          * pcsc - Parameters for PC/SC smartcard interface for USIM and GSM SIM
378          *
379          * This field is used to configure PC/SC smartcard interface.
380          * Currently, the only configuration is whether this field is %NULL (do
381          * not use PC/SC) or non-NULL (e.g., "") to enable PC/SC.
382          *
383          * This field is used for EAP-SIM and EAP-AKA.
384          */
385         char *pcsc;
386
387         /**
388          * pin - PIN for USIM, GSM SIM, and smartcards
389          *
390          * This field is used to configure PIN for SIM and smartcards for
391          * EAP-SIM and EAP-AKA. In addition, this is used with EAP-TLS if a
392          * smartcard is used for private key operations.
393          *
394          * If left out, this will be asked through control interface.
395          */
396         char *pin;
397
398         /**
399          * engine - Enable OpenSSL engine (e.g., for smartcard access)
400          *
401          * This is used if private key operations for EAP-TLS are performed
402          * using a smartcard.
403          */
404         int engine;
405
406         /**
407          * engine_id - Engine ID for OpenSSL engine
408          *
409          * "opensc" to select OpenSC engine or "pkcs11" to select PKCS#11
410          * engine.
411          *
412          * This is used if private key operations for EAP-TLS are performed
413          * using a smartcard.
414          */
415         char *engine_id;
416
417         /**
418          * engine2 - Enable OpenSSL engine (e.g., for smartcard) (Phase 2)
419          *
420          * This is used if private key operations for EAP-TLS are performed
421          * using a smartcard.
422          *
423          * This field is like engine, but used for phase 2 (inside
424          * EAP-TTLS/PEAP/FAST tunnel) authentication.
425          */
426         int engine2;
427
428
429         /**
430          * pin2 - PIN for USIM, GSM SIM, and smartcards (Phase 2)
431          *
432          * This field is used to configure PIN for SIM and smartcards for
433          * EAP-SIM and EAP-AKA. In addition, this is used with EAP-TLS if a
434          * smartcard is used for private key operations.
435          *
436          * This field is like pin2, but used for phase 2 (inside
437          * EAP-TTLS/PEAP/FAST tunnel) authentication.
438          *
439          * If left out, this will be asked through control interface.
440          */
441         char *pin2;
442
443         /**
444          * engine2_id - Engine ID for OpenSSL engine (Phase 2)
445          *
446          * "opensc" to select OpenSC engine or "pkcs11" to select PKCS#11
447          * engine.
448          *
449          * This is used if private key operations for EAP-TLS are performed
450          * using a smartcard.
451          *
452          * This field is like engine_id, but used for phase 2 (inside
453          * EAP-TTLS/PEAP/FAST tunnel) authentication.
454          */
455         char *engine2_id;
456
457
458         /**
459          * key_id - Key ID for OpenSSL engine
460          *
461          * This is used if private key operations for EAP-TLS are performed
462          * using a smartcard.
463          */
464         char *key_id;
465
466         /**
467          * cert_id - Cert ID for OpenSSL engine
468          *
469          * This is used if the certificate operations for EAP-TLS are performed
470          * using a smartcard.
471          */
472         char *cert_id;
473
474         /**
475          * ca_cert_id - CA Cert ID for OpenSSL engine
476          *
477          * This is used if the CA certificate for EAP-TLS is on a smartcard.
478          */
479         char *ca_cert_id;
480
481         /**
482          * key2_id - Key ID for OpenSSL engine (phase2)
483          *
484          * This is used if private key operations for EAP-TLS are performed
485          * using a smartcard.
486          */
487         char *key2_id;
488
489         /**
490          * cert2_id - Cert ID for OpenSSL engine (phase2)
491          *
492          * This is used if the certificate operations for EAP-TLS are performed
493          * using a smartcard.
494          */
495         char *cert2_id;
496
497         /**
498          * ca_cert2_id - CA Cert ID for OpenSSL engine (phase2)
499          *
500          * This is used if the CA certificate for EAP-TLS is on a smartcard.
501          */
502         char *ca_cert2_id;
503
504         /**
505          * otp - One-time-password
506          *
507          * This field should not be set in configuration step. It is only used
508          * internally when OTP is entered through the control interface.
509          */
510         u8 *otp;
511
512         /**
513          * otp_len - Length of the otp field
514          */
515         size_t otp_len;
516
517         /**
518          * pending_req_identity - Whether there is a pending identity request
519          *
520          * This field should not be set in configuration step. It is only used
521          * internally when control interface is used to request needed
522          * information.
523          */
524         int pending_req_identity;
525
526         /**
527          * pending_req_password - Whether there is a pending password request
528          *
529          * This field should not be set in configuration step. It is only used
530          * internally when control interface is used to request needed
531          * information.
532          */
533         int pending_req_password;
534
535         /**
536          * pending_req_pin - Whether there is a pending PIN request
537          *
538          * This field should not be set in configuration step. It is only used
539          * internally when control interface is used to request needed
540          * information.
541          */
542         int pending_req_pin;
543
544         /**
545          * pending_req_new_password - Pending password update request
546          *
547          * This field should not be set in configuration step. It is only used
548          * internally when control interface is used to request needed
549          * information.
550          */
551         int pending_req_new_password;
552
553         /**
554          * pending_req_passphrase - Pending passphrase request
555          *
556          * This field should not be set in configuration step. It is only used
557          * internally when control interface is used to request needed
558          * information.
559          */
560         int pending_req_passphrase;
561
562         /**
563          * pending_req_otp - Whether there is a pending OTP request
564          *
565          * This field should not be set in configuration step. It is only used
566          * internally when control interface is used to request needed
567          * information.
568          */
569         char *pending_req_otp;
570
571         /**
572          * pending_req_otp_len - Length of the pending OTP request
573          */
574         size_t pending_req_otp_len;
575
576         /**
577          * pac_file - File path or blob name for the PAC entries (EAP-FAST)
578          *
579          * wpa_supplicant will need to be able to create this file and write
580          * updates to it when PAC is being provisioned or refreshed. Full path
581          * to the file should be used since working directory may change when
582          * wpa_supplicant is run in the background.
583          * Alternatively, a named configuration blob can be used by setting
584          * this to blob://blob_name.
585          */
586         char *pac_file;
587
588         /**
589          * mschapv2_retry - MSCHAPv2 retry in progress
590          *
591          * This field is used internally by EAP-MSCHAPv2 and should not be set
592          * as part of configuration.
593          */
594         int mschapv2_retry;
595
596         /**
597          * new_password - New password for password update
598          *
599          * This field is used during MSCHAPv2 password update. This is normally
600          * requested from the user through the control interface and not set
601          * from configuration.
602          */
603         u8 *new_password;
604
605         /**
606          * new_password_len - Length of new_password field
607          */
608         size_t new_password_len;
609
610         /**
611          * fragment_size - Maximum EAP fragment size in bytes (default 1398)
612          *
613          * This value limits the fragment size for EAP methods that support
614          * fragmentation (e.g., EAP-TLS and EAP-PEAP). This value should be set
615          * small enough to make the EAP messages fit in MTU of the network
616          * interface used for EAPOL. The default value is suitable for most
617          * cases.
618          */
619         int fragment_size;
620
621 #define EAP_CONFIG_FLAGS_PASSWORD_NTHASH BIT(0)
622         /**
623          * flags - Network configuration flags (bitfield)
624          *
625          * This variable is used for internal flags to describe further details
626          * for the network parameters.
627          * bit 0 = password is represented as a 16-byte NtPasswordHash value
628          *         instead of plaintext password
629          */
630         u32 flags;
631 };
632
633
634 /**
635  * struct wpa_config_blob - Named configuration blob
636  *
637  * This data structure is used to provide storage for binary objects to store
638  * abstract information like certificates and private keys inlined with the
639  * configuration data.
640  */
641 struct wpa_config_blob {
642         /**
643          * name - Blob name
644          */
645         char *name;
646
647         /**
648          * data - Pointer to binary data
649          */
650         u8 *data;
651
652         /**
653          * len - Length of binary data
654          */
655         size_t len;
656
657         /**
658          * next - Pointer to next blob in the configuration
659          */
660         struct wpa_config_blob *next;
661 };
662
663 #endif /* EAP_CONFIG_H */