eap_config.h 20 KB

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