The FreeRADIUS server $Id: a4e7f8c94e8038b7627bcf52356b7ed15955c1d7 $
Loading...
Searching...
No Matches
rlm_eap_peap.c
Go to the documentation of this file.
1/*
2 * rlm_eap_peap.c contains the interfaces that are called from eap
3 *
4 * Version: $Id: a5e68047ab74ae408d5992a2a36d3e383c5f6176 $
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 *
20 * @copyright 2003 Alan DeKok (aland@freeradius.org)
21 * @copyright 2006 The FreeRADIUS server project
22 */
23RCSID("$Id: a5e68047ab74ae408d5992a2a36d3e383c5f6176 $")
24
25#include <freeradius-devel/eap/tls.h>
26
27typedef struct {
28 SSL_CTX *ssl_ctx; //!< Thread local SSL_CTX.
30
31typedef struct {
32 fr_tls_conf_t *tls_conf;
33
34 bool use_tunneled_reply; //!< Use the reply attributes from the tunneled session in
35 //!< the non-tunneled reply to the client.
36
37 bool copy_request_to_tunnel; //!< Use SOME of the request attributes from outside of the
38 //!< tunneled session in the tunneled request.
39
40 virtual_server_t *virtual_server; //!< Virtual server for inner tunnel session.
41 virtual_server_t *resume_virtual_server; //!< Virtual server to send resumed sessions through.
42
43 bool req_client_cert; //!< Do we do require a client cert?
45
55
61
69
70#define EAP_TLV_SUCCESS (1)
71#define EAP_TLV_FAILURE (2)
72#define EAP_TLV_ACK_RESULT (3)
73
74#define FR_PEAP_EXTENSIONS_TYPE 33U
75
77 { FR_CONF_SUBSECTION_ALLOC("tls", CONF_FLAG_REQUIRED, rlm_eap_peap_t, tls_conf, fr_tls_server_config),
78 .subcs_type = "fr_tls_conf_t" },
79
80 { FR_CONF_V3_DEPRECATED("copy_request_to_tunnel", rlm_eap_peap_t, NULL), .dflt = "no" },
81
82 { FR_CONF_V3_DEPRECATED("use_tunneled_reply", rlm_eap_peap_t, NULL), .dflt = "no" },
83
86 .uctx = &(virtual_server_cf_parse_uctx_t){ .process_module_name = "radius"} },
87 { FR_CONF_OFFSET_TYPE_FLAGS("resume_virtual_server", FR_TYPE_VOID, CONF_FLAG_NOT_EMPTY, rlm_eap_peap_t, resume_virtual_server),
89 .uctx = &(virtual_server_cf_parse_uctx_t){ .process_module_name = "radius"} },
90 { FR_CONF_OFFSET("require_client_cert", rlm_eap_peap_t, req_client_cert), .dflt = "no" },
91
93};
94
96static fr_dict_t const *dict_radius;
97
100 { .out = &dict_freeradius, .proto = "freeradius" },
101 { .out = &dict_radius, .proto = "radius" },
103};
104
107
110
113 { .out = &attr_auth_type, .name = "Auth-Type", .type = FR_TYPE_UINT32, .dict = &dict_freeradius },
114 { .out = &attr_eap_tls_require_client_cert, .name = "EAP-TLS-Require-Client-Cert", .type = FR_TYPE_UINT32, .dict = &dict_freeradius },
115
116 { .out = &attr_eap_message, .name = "EAP-Message", .type = FR_TYPE_OCTETS, .dict = &dict_radius },
117 { .out = &attr_user_name, .name = "User-Name", .type = FR_TYPE_STRING, .dict = &dict_radius },
119};
120
121
122/*
123 * Send protected EAP-Failure
124 *
125 * Result-TLV = Failure
126 */
127static int eap_peap_failure(request_t *request, eap_session_t *eap_session, fr_tls_session_t *tls_session)
128{
129 uint8_t tlv_packet[11];
130
131 RDEBUG2("FAILURE");
132
133 tlv_packet[0] = FR_EAP_CODE_REQUEST;
134 tlv_packet[1] = eap_session->this_round->response->id +1;
135 tlv_packet[2] = 0;
136 tlv_packet[3] = 11; /* length of this packet */
137 tlv_packet[4] = FR_PEAP_EXTENSIONS_TYPE;
138 tlv_packet[5] = 0x80;
139 tlv_packet[6] = EAP_TLV_ACK_RESULT;
140 tlv_packet[7] = 0;
141 tlv_packet[8] = 2; /* length of the data portion */
142 tlv_packet[9] = 0;
143 tlv_packet[10] = EAP_TLV_FAILURE;
144
145 (void) fr_dbuff_in_memcpy_partial(&tls_session->clean_in, tlv_packet, 11);
146
147 return fr_tls_session_send(request, tls_session);
148}
149
150/*
151 * Send protected EAP-Success
152 *
153 * Result-TLV = Success
154 */
155static int eap_peap_success(request_t *request, eap_session_t *eap_session, fr_tls_session_t *tls_session)
156{
157 uint8_t tlv_packet[11];
158
159 RDEBUG2("SUCCESS");
160
161 tlv_packet[0] = FR_EAP_CODE_REQUEST;
162 tlv_packet[1] = eap_session->this_round->response->id +1;
163 tlv_packet[2] = 0;
164 tlv_packet[3] = 11; /* length of this packet */
165 tlv_packet[4] = FR_PEAP_EXTENSIONS_TYPE;
166 tlv_packet[5] = 0x80; /* mandatory AVP */
167 tlv_packet[6] = EAP_TLV_ACK_RESULT;
168 tlv_packet[7] = 0;
169 tlv_packet[8] = 2; /* length of the data portion */
170 tlv_packet[9] = 0;
171 tlv_packet[10] = EAP_TLV_SUCCESS;
172
173 (void) fr_dbuff_in_memcpy_partial(&tls_session->clean_in, tlv_packet, 11);
174
175 return fr_tls_session_send(request, tls_session);
176}
177
178
179static int eap_peap_identity(request_t *request, eap_session_t *eap_session, fr_tls_session_t *tls_session)
180{
181 eap_packet_hdr_t eap_packet;
182
183 eap_packet.code = FR_EAP_CODE_REQUEST;
184 eap_packet.id = eap_session->this_round->response->id + 1;
185 eap_packet.length[0] = 0;
186 eap_packet.length[1] = EAP_HEADER_LEN + 1;
187 eap_packet.data[0] = FR_EAP_METHOD_IDENTITY;
188
189 (void) fr_dbuff_in_memcpy_partial(&tls_session->clean_in, (uint8_t const *) &eap_packet, sizeof(eap_packet));
190 return fr_tls_session_send(request, tls_session);
191}
192
193/*
194 * Verify the tunneled EAP message.
195 */
197 uint8_t const *data, size_t data_len)
198{
199 eap_packet_raw_t const *eap_packet = (eap_packet_raw_t const *) data;
200 eap_type_t eap_method;
201
202 /*
203 * No data, OR only 1 byte of EAP type.
204 */
205 if (!data || !data_len || (data[0] != FR_EAP_METHOD_IDENTITY)) return 0;
206
207 /*
208 * Since the full EAP header is sent for the EAP Extensions type (Type 33),
209 * but not for other Types, it is difficult for the implementation to distinguish
210 * an Extensions Request (Code 1) from an EAP Type 1 (Identity) Request packet.
211 *
212 * i.e. The only way to validate PEAP inner method packets properly is to know
213 * we just send a protected success/failure.
214 */
215 switch (peap_tunnel->status) {
218 if (data_len < 5) {
219 REDEBUG("Peer sent too-short EAP packet in PEAP Extensions exchange (%zu < 5)", data_len);
220 return -1;
221 }
222
223 if (eap_packet->data[0] != FR_PEAP_EXTENSIONS_TYPE) {
224 REDEBUG("Invalid inner tunnel data, expected method (%u), got (%u)",
225 FR_PEAP_EXTENSIONS_TYPE, eap_packet->data[0]);
226 return -1;
227 }
228 return 0;
229
230 default:
231 break;
232 }
233
234 eap_method = (eap_type_t)data[0]; /* Inner EAP header misses off code and identifier */
235 switch (eap_method) {
237 RDEBUG2("Received EAP-Identity-Response");
238 return 0;
239
240 /*
241 * We normally do Microsoft MS-CHAPv2 (26), versus
242 * Cisco MS-CHAPv2 (29).
243 */
245 default:
246 RDEBUG2("EAP method %s (%u)", eap_type2name(eap_method), eap_method);
247 return 0;
248 }
249
250}
251
252/*
253 * Convert a pseudo-EAP packet to a list of fr_pair_t's.
254 */
255static void eap_peap_inner_to_pairs(TALLOC_CTX *ctx, fr_pair_list_t *pairs,
256 eap_round_t *eap_round,
257 uint8_t const *data, size_t data_len)
258{
259 uint8_t *p;
260 fr_pair_t *vp = NULL;
261
262 if (data_len > (65535 - EAP_HEADER_LEN)) return; /* paranoia */
263
264 /*
265 * Hand-build an EAP packet from the crap in PEAP version 0.
266 *
267 * The whole packet goes in one EAP-Message attribute. eap_packet_from_vp() compares
268 * the length in the EAP header with the length of the first EAP-Message attribute,
269 * so a packet split across attributes fails that check.
270 */
272 MEM(fr_pair_value_mem_alloc(vp, &p, EAP_HEADER_LEN + data_len, false) == 0);
274 p[1] = eap_round->response->id;
275 p[2] = (data_len + EAP_HEADER_LEN) >> 8;
276 p[3] = (data_len + EAP_HEADER_LEN) & 0xff;
277 memcpy(p + EAP_HEADER_LEN, data, data_len);
278
279 fr_pair_append(pairs, vp);
280}
281
282
283/*
284 * Convert a list of fr_pair_t's to an EAP packet, through the
285 * simple expedient of dumping the EAP message
286 */
287static int eap_peap_inner_from_pairs(request_t *request, fr_tls_session_t *tls_session, fr_pair_list_t *vps)
288{
289 fr_pair_t *this;
290
292 /*
293 * Send the EAP data in the first attribute, WITHOUT the
294 * header.
295 */
296 this = fr_pair_list_head(vps);
297 if (this->vp_length <= EAP_HEADER_LEN) return 1;
298
299 (void) fr_dbuff_in_memcpy_partial(&tls_session->clean_in, this->vp_octets + EAP_HEADER_LEN,
300 this->vp_length - EAP_HEADER_LEN);
301
302 /*
303 * Send the rest of the EAP data, but skipping the first VP.
304 */
305 for (this = fr_pair_list_next(vps, this);
306 this;
307 this = fr_pair_list_next(vps, this)) {
308 (void) fr_dbuff_in_memcpy_partial(&tls_session->clean_in, this->vp_octets, this->vp_length);
309 }
310
311 fr_tls_session_send(request, tls_session);
312
313 return 1;
314}
315
316
317/*
318 * See if there's a TLV in the response.
319 */
320static int eap_peap_check_tlv(request_t *request, uint8_t const *data, size_t data_len)
321{
322 eap_packet_raw_t const *eap_packet = (eap_packet_raw_t const *) data;
323
324 if (data_len < 11) return 0;
325
326 /*
327 * Look for success or failure.
328 */
329 if ((eap_packet->code == FR_EAP_CODE_RESPONSE) &&
330 (eap_packet->data[0] == FR_PEAP_EXTENSIONS_TYPE)) {
331 if (data[10] == EAP_TLV_SUCCESS) {
332 return 1;
333 }
334
335 if (data[10] == EAP_TLV_FAILURE) {
336 RDEBUG2("Client sent a Result TLV = Failure in reply to our Success TLV");
337 RDEBUG2("This means that the client rejected our response. The password is probably incorrect");
338 return 0;
339 }
340 }
341
342 RDEBUG2("Unknown TLV %02x", data[10]);
343
344 return 0;
345}
346
347
348/*
349 * Send the success TLV, once any session ticket has been written.
350 */
352{
353 eap_session_t *eap_session = talloc_get_type_abort(uctx, eap_session_t);
354 eap_tls_session_t *eap_tls_session = talloc_get_type_abort(eap_session->opaque, eap_tls_session_t);
355 fr_tls_session_t *tls_session = eap_tls_session->tls_session;
356 peap_tunnel_t *t = tls_session->opaque;
357
359 if (eap_peap_success(request, eap_session, tls_session) < 0) RETURN_UNLANG_FAIL;
360
361 p_result->priority = MOD_PRIORITY_MAX;
363}
364
365/*
366 * Use a reply packet to determine what to do.
367 */
369{
370 eap_session_t *eap_session = talloc_get_type_abort(uctx, eap_session_t);
371 eap_tls_session_t *eap_tls_session = talloc_get_type_abort(eap_session->opaque, eap_tls_session_t);
372 fr_tls_session_t *tls_session = eap_tls_session->tls_session;
373 fr_pair_list_t vps;
374 peap_tunnel_t *t = tls_session->opaque;
375 request_t *parent = request->parent;
376 fr_packet_t *reply = request->reply;
377
378 p_result->priority = MOD_PRIORITY_MAX;
379
380 if (RDEBUG_ENABLED2) {
381
382 /*
383 * Note that we don't do *anything* with the reply
384 * attributes.
385 */
387 RDEBUG2("Got tunneled reply %s", fr_radius_packet_name[reply->code]);
388 } else {
389 RDEBUG2("Got tunneled reply code %u", reply->code);
390 }
391 log_request_pair_list(L_DBG_LVL_2, request, NULL, &request->reply_pairs, NULL);
392 }
393
394 switch (reply->code) {
396 /*
397 * Create the stateless session ticket before the success TLV is written. PEAP ends with
398 * a message from the server, so the ticket and the TLV leave in the same EAP request.
399 */
400 return fr_tls_ticket_stateless_issue(p_result, request, tls_session, process_reply_success, eap_session);
401
404 if (eap_peap_failure(request, eap_session, tls_session) < 0) RETURN_UNLANG_FAIL;
406
408 /*
409 * PEAP takes only EAP-Message attributes inside
410 * of the tunnel. Any Reply-Message in the
411 * Access-Challenge is ignored.
412 */
413 fr_pair_list_init(&vps);
414 MEM(fr_pair_list_copy_by_da(t, &vps, &request->reply_pairs, attr_eap_message) >= 0);
415
416 /*
417 * Handle the ACK, by tunneling any necessary reply
418 * VP's back to the client.
419 */
420 if (!fr_pair_list_empty(&vps)) {
421 eap_peap_inner_from_pairs(parent, tls_session, &vps);
422 fr_pair_list_free(&vps);
423 }
425
426 default:
427 REDEBUG2("Unknown RADIUS packet type %u: rejecting tunneled user", reply->code);
429 }
430}
431
432
433static char const *peap_state(peap_tunnel_t *t)
434{
435 switch (t->status) {
437 return "TUNNEL ESTABLISHED";
438
440 return "WAITING FOR INNER IDENTITY";
441
443 return "send tlv success";
444
446 return "send tlv failure";
447
449 return "phase2_init";
450
452 return "phase2";
453
454 default:
455 break;
456 }
457 return "?";
458}
459
461
463{
464 eap_session_t *eap_session = talloc_get_type_abort(uctx, eap_session_t);
465 eap_tls_session_t *eap_tls_session = talloc_get_type_abort(eap_session->opaque, eap_tls_session_t);
466 fr_tls_session_t *tls_session = eap_tls_session->tls_session;
467 peap_tunnel_t *t = tls_session->opaque;
468#ifndef NDEBUG
469 request_t *parent = request->parent;
470#endif
471
472 fr_assert(eap_session->request == parent->parent);
473
474 p_result->priority = MOD_PRIORITY_MAX;
475
476 switch (request->reply->code) {
479 /* we're good, send success TLV */
481 if (eap_peap_success(request, eap_session, tls_session) < 0) {
483 }
485
486 default:
488 }
489}
490
491/*
492 * Process the pseudo-EAP contents of the tunneled data.
493 */
495 eap_session_t *eap_session, fr_tls_session_t *tls_session)
496{
497 peap_tunnel_t *t = tls_session->opaque;
498 request_t *child = NULL;
499 fr_pair_t *vp;
501 uint8_t const *data;
502 size_t data_len;
503 eap_round_t *eap_round = eap_session->this_round;
504 rlm_eap_peap_t *inst = talloc_get_type_abort(mctx->mi->data, rlm_eap_peap_t);
505
506 /*
507 * Read the buffer directly, rather than copying the octets
508 * out of it. That avoids another data copy.
509 */
510 data_len = fr_dbuff_used(&tls_session->clean_out);
511 data = fr_dbuff_start(&tls_session->clean_out);
512 fr_tls_record_init(&tls_session->clean_out);
513
514 RDEBUG2("PEAP state %s", peap_state(t));
515
516 if ((t->status != PEAP_STATUS_TUNNEL_ESTABLISHED) && (eap_peap_verify(request, t, data, data_len) < 0)) {
517 REDEBUG("Tunneled data is invalid");
519 }
520
521 switch (t->status) {
523 /* FIXME: should be no data in the buffer here, check & assert? */
524
525 if (SSL_session_reused(tls_session->ssl)) {
526 RDEBUG2("Skipping Phase2 because of session resumption");
527
528 /*
529 * A simplified version of the code used to process tunnelled TTLS data.
530 *
531 * In this case, the request is populated with pairs restored from
532 * the cached session-state.
533 */
534 (void) unlang_module_yield(request, process_rcode, NULL, FR_SIGNAL_NONE, eap_session);
535
536 MEM(child = unlang_subrequest_alloc(request, request->proto_dict));
537
538 if (unlikely(fr_pair_list_copy(child->request_ctx, &child->request_pairs,
539 &request->session_state_pairs) < 0)) {
540 error:
541 rcode = RLM_MODULE_FAIL;
542 goto finish;
543 }
544
545 RDEBUG2("Resumed session-state:");
546 log_request_pair_list(L_DBG_LVL_2, request, NULL, &child->request_pairs, NULL);
547
548 if (unlang_subrequest_child_push(&eap_session->submodule_result, child, child,
549 false, UNLANG_SUB_FRAME) < 0) goto error;
550
551 if (unlang_function_push_with_result(NULL, child, NULL, process_resume_reply, NULL,
553 eap_session) != UNLANG_ACTION_PUSHED_CHILD) goto error;
554
555 if (unlikely(eap_virtual_server(child, eap_session,
556 inst->resume_virtual_server) == UNLANG_ACTION_FAIL)) goto error;
557
559
560 } else {
561 /* send an identity request */
564 if (eap_peap_identity(request, eap_session, tls_session) < 0) {
565 rcode = RLM_MODULE_FAIL;
566 goto finish;
567 }
568 }
569 rcode = RLM_MODULE_HANDLED;
570 goto finish;
571
573 /* we're expecting an identity response */
574 if (!data_len || (data[0] != FR_EAP_METHOD_IDENTITY)) {
575 REDEBUG("Expected EAP-Identity, got something else");
576 rcode = RLM_MODULE_REJECT;
577 goto finish;
578 }
579
580 /*
581 * Save it for later.
582 */
584 t->username->vp_tainted = true;
585
586 fr_pair_value_bstrndup(t->username, (char const *)data + 1, data_len - 1, true);
587
588 RDEBUG2("Got inner identity \"%pV\"", &t->username->data);
590 break;
591
592 /*
593 * If we authenticated the user, then it's OK.
594 */
596 if (eap_peap_check_tlv(request, data, data_len)) {
597 RDEBUG2("Success");
598 rcode = RLM_MODULE_OK;
599 goto finish;
600 }
601
602 /*
603 * Otherwise, the client rejected the session
604 * resumption. If the session is being re-used,
605 * we need to do a full authentication.
606 *
607 * We do this by sending an EAP-Identity request
608 * inside of the PEAP tunnel.
609 */
611 RDEBUG2("Client rejected session resumption. Re-starting full authentication");
612
613 /*
614 * Mark session resumption status.
615 */
618
619 if (eap_peap_identity(request, eap_session, tls_session) < 0) {
620 rcode = RLM_MODULE_FAIL;
621 goto finish;
622 }
623 rcode = RLM_MODULE_HANDLED;
624 goto finish;
625 }
626
627 REDEBUG("Sent a success, but received something weird in return");
628 rcode = RLM_MODULE_REJECT;
629 goto finish;
630
631 /*
632 * Supplicant ACKs our failure.
633 */
635 RINDENT();
636 REDEBUG("The users session was previously rejected: returning reject (again.)");
637 RIDEBUG("This means you need to read the PREVIOUS messages in the debug output");
638 RIDEBUG("to find out the reason why the user was rejected");
639 RIDEBUG("Look for \"reject\" or \"fail\". Those earlier messages will tell you");
640 RIDEBUG("what went wrong, and how to fix the problem");
641 REXDENT();
642
644
646 RDEBUG2("In state machine in phase2 init?");
647 break;
648
650 break;
651
652 default:
653 REDEBUG("Unhandled state in peap");
654 rcode = RLM_MODULE_REJECT;
655 goto finish;
656 }
657
658 MEM(child = unlang_subrequest_alloc(request, request->proto_dict));
659 fr_assert(fr_pair_list_empty(&child->request_pairs));
660
661 switch (t->status) {
662 /*
663 * If we're in PHASE2_INIT, the phase2 method hasn't been
664 * sent an Identity packet yet; do so from the stored
665 * username and this will kick off the phase2 eap method
666 */
668 {
669 size_t len;
670 uint8_t *q;
671
673
674 len = t->username->vp_length + EAP_HEADER_LEN + 1;
676
677 MEM(vp = fr_pair_afrom_da(child->request_ctx, attr_eap_message));
678 MEM(fr_pair_value_mem_alloc(vp, &q, len, false) == 0);
680 q[1] = eap_round->response->id;
681 q[2] = (len >> 8) & 0xff;
682 q[3] = len & 0xff;
684 memcpy(q + EAP_HEADER_LEN + 1,
685 t->username->vp_strvalue, t->username->vp_length);
686 fr_pair_append(&child->request_pairs, vp);
687 }
688 break;
689
691 eap_peap_inner_to_pairs(child->request_ctx, &child->request_pairs,
692 eap_round, data, data_len);
693 if (fr_pair_list_empty(&child->request_pairs)) {
694 TALLOC_FREE(child);
695 RDEBUG2("Unable to convert tunneled EAP packet to internal server data structures");
696 rcode = RLM_MODULE_REJECT;
697 goto finish;
698 }
699 break;
700
701 default:
702 REDEBUG("Invalid state change in PEAP");
703 rcode = RLM_MODULE_REJECT;
704 goto finish;
705 }
706
707 RDEBUG2("Got tunneled request");
708 log_request_pair_list(L_DBG_LVL_2, request, NULL, &child->request_pairs, NULL);
709
710 /*
711 * Update other items in the request_t data structure.
712 */
713 if (!t->username) {
714 /*
715 * There's no User-Name in the tunneled session,
716 * so we add one here, by pulling it out of the
717 * EAP-Identity packet.
718 */
719 if ((data[0] == FR_EAP_METHOD_IDENTITY) && (data_len > 1)) {
721 fr_assert(t->username != NULL);
722 t->username->vp_tainted = true;
723
724 fr_pair_value_bstrndup(t->username, (char const *)data + 1, data_len - 1, true);
725
726 RDEBUG2("Got tunneled identity of %pV", &t->username->data);
727 }
728 } /* else there WAS a t->username */
729
730 if (t->username) {
731 MEM(vp = fr_pair_copy(child->request_ctx, t->username));
732 fr_pair_append(&child->request_pairs, vp);
733 RDEBUG2("Setting request.User-Name from tunneled (inner) identity \"%s\"",
734 vp->vp_strvalue);
735 } else {
736 RDEBUG2("No tunnel username (SSL resumption?)");
737 }
738
739 /*
740 * Set the child up for execution. This represents
741 * a pseudo protocol inside of PEAPs inner EAP method.
742 */
743 if (unlang_subrequest_child_push(&eap_session->submodule_result, child,
744 child,
745 false, UNLANG_SUB_FRAME) < 0) goto finish;
746
747 /*
748 * Setup a function in thie child to process the
749 * result of the subrequest.
750 */
752 child,
753 NULL,
754 /*
755 * Run in the child after the virtual sever executes.
756 * This sets the rcode for the subrequest, which is
757 * written to eap_session->submodule_result.
758 */
760 NULL, FR_SIGNAL_NONE,
761 UNLANG_SUB_FRAME, eap_session) != UNLANG_ACTION_PUSHED_CHILD) goto finish;
762
763 /*
764 * Run inner tunnel in the context of the child
765 */
766 if (unlikely(eap_virtual_server(child, eap_session, inst->virtual_server) == UNLANG_ACTION_FAIL)) {
767 rcode = RLM_MODULE_FAIL;
768 goto finish;
769 }
770
771 /*
772 * We now yield to the subrequest. unlang_subrequest_child_push
773 * pushed a new frame in the context of the parent which'll start
774 * the subrequest.
775 */
777
778finish:
779 if (child) {
780 /*
781 * We can't just free the child, we need to detach it
782 * and then let the interpreter to unwind and eventually
783 * free the request.
784 */
785 request_detach(child);
787 }
788
789 RETURN_UNLANG_RCODE(rcode);
790}
791
792/*
793 * Allocate the PEAP per-session data
794 */
795static peap_tunnel_t *peap_alloc(TALLOC_CTX *ctx)
796{
797 peap_tunnel_t *t;
798
799 t = talloc_zero(ctx, peap_tunnel_t);
801
802 return t;
803}
804
805/*
806 * Construct the reply appropriately based on the rcode from PEAP processing.
807 */
809{
810 eap_session_t *eap_session = talloc_get_type_abort(mctx->rctx, eap_session_t);
811
812 RDEBUG3("Tunneled request complete");
813
814 switch (eap_session->submodule_result.rcode) {
816 p_result->rcode = eap_session->submodule_result.rcode;
817 return eap_tls_fail(request, eap_session);
818
820 eap_tls_request(request, eap_session);
821 break;
822
823 case RLM_MODULE_OK:
824 {
825 eap_tls_prf_label_t prf_label;
826
827 eap_crypto_prf_label_init(&prf_label, eap_session,
828 "client EAP encryption",
829 sizeof("client EAP encryption") - 1);
830
831 p_result->rcode = RLM_MODULE_OK;
832 return eap_tls_success(request, eap_session, &prf_label);
833 }
834
835 /*
836 * No response packet, MUST be proxying it.
837 * The main EAP module will take care of discovering
838 * that the request now has a "proxy" packet, and
839 * will proxy it, rather than returning an EAP packet.
840 */
842 break;
843
844 default:
845 p_result->rcode = eap_session->submodule_result.rcode;
846 return eap_tls_fail(request, eap_session);
847 }
848
850}
851
853{
854 eap_session_t *eap_session = talloc_get_type_abort(mctx->rctx, eap_session_t);
855 eap_tls_session_t *eap_tls_session = talloc_get_type_abort(eap_session->opaque, eap_tls_session_t);
856 fr_tls_session_t *tls_session = eap_tls_session->tls_session;
857 peap_tunnel_t *peap = talloc_get_type_abort(tls_session->opaque, peap_tunnel_t);
858
859 if ((eap_tls_session->state == EAP_TLS_INVALID) || (eap_tls_session->state == EAP_TLS_FAIL)) {
860 REDEBUG("[eap-tls process] = %s", fr_table_str_by_value(eap_tls_status_table, eap_tls_session->state, "<INVALID>"));
861 } else {
862 RDEBUG2("[eap-tls process] = %s", fr_table_str_by_value(eap_tls_status_table, eap_tls_session->state, "<INVALID>"));
863 }
864
865 switch (eap_tls_session->state) {
866 /*
867 * EAP-TLS handshake was successful, tell the
868 * client to keep talking.
869 *
870 * If this was EAP-TLS, we would just return
871 * an EAP-TLS-Success packet here.
872 */
875 break;
876
877 /*
878 * The TLS code is still working on the TLS
879 * exchange, and it's a valid TLS request.
880 * do nothing.
881 */
882 case EAP_TLS_HANDLED:
883 /*
884 * FIXME: If the SSL session is established, grab the state
885 * and EAP id from the inner tunnel, and update it with
886 * the expected EAP id!
887 */
889
890 /*
891 * Handshake is done, proceed with decoding tunneled
892 * data.
893 */
895 /*
896 * TLSv1.3 makes application data immediately
897 * available when the handshake is finished.
898 */
899 if (fr_tls_session_is_init_finished(tls_session) && (peap->status == PEAP_STATUS_INVALID)) {
901 }
902 break;
903
904 /*
905 * Anything else: fail.
906 */
907 default:
908 p_result->rcode = RLM_MODULE_FAIL;
909 return eap_tls_fail(request, eap_session);
910 }
911
912 /*
913 * Session is established, proceed with decoding
914 * tunneled data.
915 */
916 RDEBUG2("Session established. Decoding tunneled data");
917
918 /*
919 * We may need PEAP data associated with the session, so
920 * allocate it here, if it wasn't already alloacted.
921 */
922 if (!tls_session->opaque) tls_session->opaque = peap_alloc(tls_session);
923
924 /*
925 * Setup the resume point to prepare the correct reply based on
926 * the rcode coming back from PEAP processing.
927 */
928 (void) unlang_module_yield(request, process_rcode, NULL, FR_SIGNAL_NONE, eap_session);
929
930 /*
931 * Process the PEAP portion of the request.
932 */
933 return eap_peap_process(&eap_session->submodule_result, mctx, request, eap_session, tls_session);
934}
935
936/*
937 * Do authentication, by letting EAP-TLS do most of the work.
938 */
941{
942 eap_session_t *eap_session = eap_session_get(request->parent);
943
944 /*
945 * Setup the resumption frame to process the result
946 */
948
949 /*
950 * Process TLS layer until done.
951 */
952 return eap_tls_process(request, eap_session);
953}
954
956{
957 rlm_eap_peap_t *inst = talloc_get_type_abort(mctx->mi->data, rlm_eap_peap_t);
958 rlm_eap_peap_thread_t *t = talloc_get_type_abort(mctx->thread, rlm_eap_peap_thread_t);
959 eap_session_t *eap_session = eap_session_get(request->parent);
960 eap_tls_session_t *eap_tls_session;
961 fr_tls_session_t *tls_session;
962
963 fr_pair_t *vp;
964 bool client_cert;
965
966 /*
967 * EAP-TLS-Require-Client-Cert attribute will override
968 * the require_client_cert configuration option.
969 */
971 if (vp) {
972 client_cert = vp->vp_uint32 ? true : false;
973 } else {
974 client_cert = inst->req_client_cert;
975 }
976
977 eap_session->opaque = eap_tls_session = eap_tls_session_init(request, eap_session, t->ssl_ctx, client_cert);
978 if (!eap_tls_session) RETURN_UNLANG_FAIL;
979
980 tls_session = eap_tls_session->tls_session;
981
982 /*
983 * As it is a poorly designed protocol, PEAP uses
984 * bits in the TLS header to indicate PEAP
985 * version numbers. For now, we only support
986 * PEAP version 0, so it doesn't matter too much.
987 * However, if we support later versions of PEAP,
988 * we will need this flag to indicate which
989 * version we're currently dealing with.
990 */
991 eap_tls_session->base_flags = 0x00;
992
993 /*
994 * PEAP version 0 requires 'include_length = no',
995 * so rather than hoping the user figures it out,
996 * we force it here.
997 */
998 eap_tls_session->include_length = false;
999
1000 /*
1001 * TLS session initialization is over. Now handle TLS
1002 * related handshaking or application data.
1003 */
1004 if (eap_tls_start(request, eap_session) < 0) {
1005 talloc_free(eap_tls_session);
1007 }
1008
1009 /*
1010 * Session resumption requires the storage of data, so
1011 * allocate it if it doesn't already exist.
1012 */
1013 tls_session->opaque = peap_alloc(tls_session);
1014
1015 eap_session->process = mod_handshake_process;
1016
1018}
1019
1020/*
1021 * Send an initial eap-tls request to the peer, using the libeap functions.
1022 */
1024{
1025 rlm_eap_peap_t *inst = talloc_get_type_abort(mctx->mi->data, rlm_eap_peap_t);
1026 eap_session_t *eap_session = eap_session_get(request->parent);
1027
1028 eap_session->tls = true;
1029
1031
1032 if (inst->tls_conf->new_session) return fr_tls_new_session_push(request, inst->tls_conf);
1033
1035}
1036
1038{
1039 rlm_eap_peap_t *inst = talloc_get_type_abort(mctx->mi->data, rlm_eap_peap_t);
1040 rlm_eap_peap_thread_t *t = talloc_get_type_abort(mctx->thread, rlm_eap_peap_thread_t);
1041
1042 t->ssl_ctx = fr_tls_ctx_alloc(inst->tls_conf, false);
1043 if (!t->ssl_ctx) return -1;
1044
1045 return 0;
1046}
1047
1049{
1050 rlm_eap_peap_thread_t *t = talloc_get_type_abort(mctx->thread, rlm_eap_peap_thread_t);
1051
1052 if (likely(t->ssl_ctx != NULL)) SSL_CTX_free(t->ssl_ctx);
1053 t->ssl_ctx = NULL;
1054
1055 return 0;
1056}
1057
1058/*
1059 * Attach the module.
1060 */
1061static int mod_instantiate(module_inst_ctx_t const *mctx)
1062{
1063 rlm_eap_peap_t *inst = talloc_get_type_abort(mctx->mi->data, rlm_eap_peap_t);
1064 CONF_SECTION *conf = mctx->mi->conf;
1065
1066 fr_assert(inst->virtual_server);
1067
1068 eap_tls_conf_check(conf, inst->tls_conf, true);
1069
1070 if (!inst->resume_virtual_server) inst->resume_virtual_server = inst->virtual_server;
1071
1072 return 0;
1073}
1074
1075/*
1076 * The module name should be the only globally exported symbol.
1077 * That is, everything else should be 'static'.
1078 */
1081 .common = {
1082 .magic = MODULE_MAGIC_INIT,
1083 .name = "eap_peap",
1084 .inst_size = sizeof(rlm_eap_peap_t),
1086 .instantiate = mod_instantiate,
1087
1088 .thread_inst_size = sizeof(rlm_eap_peap_thread_t),
1089 .thread_instantiate = mod_thread_instantiate,
1090 .thread_detach = mod_thread_detach,
1091 },
1092 .provides = { FR_EAP_METHOD_PEAP },
1093 .session_init = mod_session_init, /* Initialise a new EAP session */
1094 .tunnel = true
1095};
unlang_action_t
Returned by unlang_op_t calls, determine the next action of the interpreter.
Definition action.h:35
@ UNLANG_ACTION_PUSHED_CHILD
unlang_t pushed a new child onto the stack, execute it instead of continuing.
Definition action.h:40
@ UNLANG_ACTION_FAIL
Encountered an unexpected error.
Definition action.h:36
@ UNLANG_ACTION_CALCULATE_RESULT
Calculate a new section rlm_rcode_t value.
Definition action.h:38
static uint8_t request[4]
static uint8_t reply[4]
#define RCSID(id)
Definition build.h:609
#define unlikely(_x)
Definition build.h:492
#define UNUSED
Definition build.h:415
#define CONF_PARSER_TERMINATOR
Definition cf_parse.h:722
cf_parse_t func
Override default parsing behaviour for the specified type with a custom parsing function.
Definition cf_parse.h:666
#define FR_CONF_V3_DEPRECATED(_name, _struct, _field)
conf_parser_t entry which raises an error if a deprecated v3 item is found
Definition cf_parse.h:446
#define FR_CONF_OFFSET(_name, _struct, _field)
conf_parser_t which parses a single CONF_PAIR, writing the result to a field in a struct
Definition cf_parse.h:280
@ CONF_FLAG_REQUIRED
Error out if no matching CONF_PAIR is found, and no dflt value is set.
Definition cf_parse.h:466
@ CONF_FLAG_NOT_EMPTY
CONF_PAIR is required to have a non zero length value.
Definition cf_parse.h:484
#define FR_CONF_SUBSECTION_ALLOC(_name, _flags, _struct, _field, _subcs)
conf_parser_t which allocates a struct and populates it from a subsection
Definition cf_parse.h:384
#define FR_CONF_OFFSET_TYPE_FLAGS(_name, _type, _flags, _struct, _field)
conf_parser_t which parses a single CONF_PAIR, writing the result to a field in a struct
Definition cf_parse.h:238
Defines a CONF_PAIR to C data type mapping.
Definition cf_parse.h:649
A section grouping multiple CONF_PAIR.
Definition cf_priv.h:106
eap_packet_t * response
Packet we received from the peer.
Definition compose.h:48
uint8_t id
Definition compose.h:36
Contains a pair of request and response packets.
Definition compose.h:47
#define fr_dbuff_used(_dbuff_or_marker)
Return the number of bytes remaining between the start of the dbuff or marker and the current positio...
Definition dbuff.h:819
#define fr_dbuff_start(_dbuff_or_marker)
Return the 'start' position of a dbuff or marker.
Definition dbuff.h:950
#define fr_dbuff_in_memcpy_partial(_out, _in, _inlen)
Copy at most _inlen bytes into the dbuff.
Definition dbuff.h:1491
#define MEM(x)
Definition debug.h:38
@ FR_RADIUS_CODE_ACCESS_CHALLENGE
RFC2865 - Access-Challenge.
Definition defs.h:43
@ FR_RADIUS_CODE_ACCESS_ACCEPT
RFC2865 - Access-Accept.
Definition defs.h:34
@ FR_RADIUS_CODE_ACCESS_REJECT
RFC2865 - Access-Reject.
Definition defs.h:35
fr_dict_attr_t const ** out
Where to write a pointer to the resolved fr_dict_attr_t.
Definition dict.h:316
fr_dict_t const ** out
Where to write a pointer to the loaded/resolved fr_dict_t.
Definition dict.h:329
#define DICT_AUTOLOAD_TERMINATOR
Definition dict.h:335
Specifies an attribute which must be present for the module to function.
Definition dict.h:315
Specifies a dictionary which must be loaded/loadable for the module to function.
Definition dict.h:328
#define MODULE_MAGIC_INIT
Stop people using different module/library/server versions together.
Definition dl_module.h:63
char const * eap_type2name(eap_type_t method)
Return an EAP-name for a particular type.
Definition types.c:54
uint8_t data[]
Definition types.h:125
@ FR_EAP_METHOD_MSCHAPV2
Definition types.h:71
@ FR_EAP_METHOD_IDENTITY
Definition types.h:46
@ FR_EAP_METHOD_PEAP
Definition types.h:70
uint8_t id
Definition types.h:133
uint8_t code
Definition types.h:132
uint8_t length[2]
Definition types.h:134
enum eap_type eap_type_t
uint8_t code
Definition types.h:122
#define EAP_HEADER_LEN
Definition types.h:34
@ FR_EAP_CODE_RESPONSE
Definition types.h:38
@ FR_EAP_CODE_REQUEST
Definition types.h:37
uint8_t data[1]
Definition types.h:135
When we need to create a base EAP packet.
Definition types.h:131
Structure to represent packet format of eap on wire
Definition types.h:121
#define unlang_function_push_with_result(_result_p, _request, _func, _repeat, _signal, _sigmask, _top_frame, _uctx)
Push a generic function onto the unlang stack that produces a result.
Definition function.h:146
talloc_free(hp)
void unlang_interpret_signal(request_t *request, fr_signal_t action)
Send a signal (usually stop) to a request.
Definition interpret.c:1806
unlang_mod_action_t priority
The priority or action for that rcode.
Definition interpret.h:142
#define UNLANG_SUB_FRAME
Definition interpret.h:37
rlm_rcode_t rcode
The current rcode, from executing the instruction or merging the result from a frame.
Definition interpret.h:140
unlang_action_t eap_virtual_server(request_t *request, eap_session_t *eap_session, virtual_server_t *virtual_server)
Run a subrequest through a virtual server.
Definition base.c:385
void eap_crypto_prf_label_init(eap_tls_prf_label_t *prf_label, eap_session_t *eap_session, char const *keying_prf_label, size_t keying_prf_label_len)
Initialize the PRF label fields.
Definition crypto.c:48
static eap_session_t * eap_session_get(request_t *request)
Definition session.h:97
void * opaque
Opaque data used by EAP methods.
Definition session.h:69
bool tls
Whether EAP method uses TLS.
Definition session.h:78
module_method_t process
Callback that should be used to process the next round.
Definition session.h:71
unlang_result_t submodule_result
Result of last submodule call.
Definition session.h:53
request_t * request
Current request.
Definition session.h:58
eap_round_t * this_round
The EAP response we're processing, and the EAP request we're building.
Definition session.h:66
Tracks the progress of a single session of any EAP method.
Definition session.h:47
unlang_action_t eap_tls_success(request_t *request, eap_session_t *eap_session, eap_tls_prf_label_t *prf_label)
Send an EAP-TLS success.
Definition tls.c:308
eap_tls_session_t * eap_tls_session_init(request_t *request, eap_session_t *eap_session, SSL_CTX *ssl_ctx, bool client_cert)
Create a new fr_tls_session_t associated with an eap_session_t.
Definition tls.c:1377
void eap_tls_conf_check(CONF_SECTION *cs, fr_tls_conf_t *tls_conf, bool delayed_tickets)
Apply the limits that EAP puts on a parsed tls { ... } section.
Definition tls.c:1606
int eap_tls_start(request_t *request, eap_session_t *eap_session)
Send an initial EAP-TLS request to the peer.
Definition tls.c:272
int eap_tls_request(request_t *request, eap_session_t *eap_session)
Frames the OpenSSL data that needs to be sent to the client in an EAP-Request.
Definition tls.c:422
unlang_action_t eap_tls_fail(request_t *request, eap_session_t *eap_session)
Send an EAP-TLS failure.
Definition tls.c:369
USES_APPLE_DEPRECATED_API fr_table_num_ordered_t const eap_tls_status_table[]
Definition tls.c:82
unlang_action_t eap_tls_process(request_t *request, eap_session_t *eap_session)
Process an EAP TLS request.
Definition tls.c:1178
int base_flags
Some protocols use the reserved bits of the EAP-TLS flags (such as PEAP).
Definition tls.h:162
@ EAP_TLS_INVALID
Invalid, don't reply.
Definition tls.h:121
@ EAP_TLS_HANDLED
TLS code has handled it.
Definition tls.h:124
@ EAP_TLS_RECORD_RECV_COMPLETE
Received final fragment of a record.
Definition tls.h:141
@ EAP_TLS_FAIL
Fail, send fail.
Definition tls.h:123
@ EAP_TLS_ESTABLISHED
Session established, send success (or start phase2).
Definition tls.h:122
eap_tls_status_t state
The state of the EAP-TLS session.
Definition tls.h:157
fr_tls_session_t * tls_session
TLS session used to authenticate peer or tunnel sensitive data.
Definition tls.h:159
bool include_length
A flag to include length in every TLS Data/Alert packet.
Definition tls.h:168
Tracks the state of an EAP-TLS session.
Definition tls.h:156
void log_request_pair_list(fr_log_lvl_t lvl, request_t *request, fr_pair_t const *parent, fr_pair_list_t const *vps, char const *prefix)
Print a fr_pair_list_t.
Definition log.c:831
#define REXDENT()
Exdent (unindent) R* messages by one level.
Definition log.h:460
#define RDEBUG3(fmt,...)
Definition log.h:360
#define REDEBUG2(fmt,...)
Definition log.h:389
#define RINDENT()
Indent R* messages by one level.
Definition log.h:447
@ L_DBG_LVL_2
2nd highest priority debug messages (-xx | -X).
Definition log.h:68
@ FR_TYPE_STRING
String of printable characters.
@ FR_TYPE_UINT32
32 Bit unsigned integer.
@ FR_TYPE_VOID
User data.
@ FR_TYPE_OCTETS
Raw octets.
unsigned char uint8_t
@ MOD_PRIORITY_MAX
Definition mod_action.h:61
module_instance_t const * mi
Instance of the module being instantiated.
Definition module_ctx.h:42
void * thread
Thread specific instance data.
Definition module_ctx.h:43
void * rctx
Resume ctx that a module previously set.
Definition module_ctx.h:45
void * thread
Thread instance data.
Definition module_ctx.h:67
module_instance_t const * mi
Instance of the module being instantiated.
Definition module_ctx.h:64
module_instance_t * mi
Instance of the module being instantiated.
Definition module_ctx.h:51
Temporary structure to hold arguments for module calls.
Definition module_ctx.h:41
Temporary structure to hold arguments for instantiation calls.
Definition module_ctx.h:50
Temporary structure to hold arguments for thread_instantiation calls.
Definition module_ctx.h:63
int fr_pair_list_copy(TALLOC_CTX *ctx, fr_pair_list_t *to, fr_pair_list_t const *from)
Duplicate a list of pairs.
Definition pair.c:2312
fr_pair_t * fr_pair_find_by_da(fr_pair_list_t const *list, fr_pair_t const *prev, fr_dict_attr_t const *da)
Find the first pair with a matching da.
Definition pair.c:716
int fr_pair_append(fr_pair_list_t *list, fr_pair_t *to_add)
Add a VP to the end of the list.
Definition pair.c:1306
fr_pair_t * fr_pair_afrom_da(TALLOC_CTX *ctx, fr_dict_attr_t const *da)
Dynamically allocate a new attribute and assign a fr_dict_attr_t.
Definition pair.c:284
void fr_pair_list_init(fr_pair_list_t *list)
Initialise a pair list header.
Definition pair.c:47
int fr_pair_value_bstrndup(fr_pair_t *vp, char const *src, size_t len, bool tainted)
Copy data into a "string" type value pair.
Definition pair.c:2756
fr_pair_t * fr_pair_copy(TALLOC_CTX *ctx, fr_pair_t const *vp)
Copy a single valuepair.
Definition pair.c:509
int fr_pair_value_mem_alloc(fr_pair_t *vp, uint8_t **out, size_t size, bool tainted)
Pre-allocate a memory buffer for a "octets" type value pair.
Definition pair.c:2855
int fr_pair_list_copy_by_da(TALLOC_CTX *ctx, fr_pair_list_t *to, fr_pair_list_t const *from, fr_dict_attr_t const *da)
Duplicate pairs in a list matching the specified da.
Definition pair.c:2400
static const conf_parser_t config[]
Definition base.c:164
char const * fr_radius_packet_name[FR_RADIUS_CODE_MAX]
Definition base.c:119
#define fr_assert(_expr)
Definition rad_assert.h:37
#define REDEBUG(fmt,...)
Definition radclient.h:52
#define RDEBUG_ENABLED2()
Definition radclient.h:50
#define RDEBUG2(fmt,...)
Definition radclient.h:54
#define FR_RADIUS_PACKET_CODE_VALID(_x)
Definition radius.h:51
static rs_t * conf
Definition radsniff.c:52
#define RIDEBUG(fmt,...)
Definition radsniff.h:65
rlm_rcode_t
Return codes indicating the result of the module call.
Definition rcode.h:44
@ RLM_MODULE_OK
The module is OK, continue.
Definition rcode.h:49
@ RLM_MODULE_FAIL
Module failed, don't reply.
Definition rcode.h:48
@ RLM_MODULE_REJECT
Immediately reject the request.
Definition rcode.h:47
@ RLM_MODULE_UPDATED
OK (pairs modified).
Definition rcode.h:55
@ RLM_MODULE_HANDLED
The module handled the request, so stop.
Definition rcode.h:50
#define RETURN_UNLANG_HANDLED
Definition rcode.h:71
#define RETURN_UNLANG_RCODE(_rcode)
Definition rcode.h:67
#define RETURN_UNLANG_FAIL
Definition rcode.h:69
#define RETURN_UNLANG_REJECT
Definition rcode.h:68
int request_detach(request_t *child)
Unlink a subrequest from its parent.
Definition request.c:560
static unlang_action_t mod_handshake_process(UNUSED unlang_result_t *p_result, UNUSED module_ctx_t const *mctx, request_t *request)
static unlang_action_t mod_handshake_resume(unlang_result_t *p_result, module_ctx_t const *mctx, request_t *request)
bool copy_request_to_tunnel
Use SOME of the request attributes from outside of the tunneled session in the tunneled request.
#define EAP_TLV_FAILURE
static fr_dict_attr_t const * attr_eap_message
static peap_tunnel_t * peap_alloc(TALLOC_CTX *ctx)
virtual_server_t * virtual_server
Virtual server for inner tunnel session.
static fr_dict_t const * dict_freeradius
static fr_dict_attr_t const * attr_eap_tls_require_client_cert
static int eap_peap_success(request_t *request, eap_session_t *eap_session, fr_tls_session_t *tls_session)
peap_status
@ PEAP_STATUS_PHASE2_INIT
@ PEAP_STATUS_TUNNEL_ESTABLISHED
@ PEAP_STATUS_PHASE2
@ PEAP_STATUS_INNER_IDENTITY_REQ_SENT
@ PEAP_STATUS_SENT_TLV_SUCCESS
@ PEAP_STATUS_SENT_TLV_FAILURE
@ PEAP_STATUS_INVALID
SSL_CTX * ssl_ctx
Thread local SSL_CTX.
fr_dict_attr_autoload_t rlm_eap_peap_dict_attr[]
fr_dict_autoload_t rlm_eap_peap_dict[]
static unlang_action_t process_reply(unlang_result_t *p_result, request_t *request, void *uctx)
static unlang_action_t mod_session_init_resume(unlang_result_t *p_result, module_ctx_t const *mctx, request_t *request)
virtual_server_t * resume_virtual_server
Virtual server to send resumed sessions through.
static fr_dict_t const * dict_radius
static int eap_peap_identity(request_t *request, eap_session_t *eap_session, fr_tls_session_t *tls_session)
#define FR_PEAP_EXTENSIONS_TYPE
static fr_dict_attr_t const * attr_auth_type
static unlang_action_t eap_peap_process(unlang_result_t *p_result, module_ctx_t const *mctx, request_t *request, eap_session_t *eap_session, fr_tls_session_t *tls_session)
fr_tls_conf_t * tls_conf
static int eap_peap_check_tlv(request_t *request, uint8_t const *data, size_t data_len)
static unlang_action_t process_reply_success(unlang_result_t *p_result, request_t *request, void *uctx)
static void eap_peap_inner_to_pairs(TALLOC_CTX *ctx, fr_pair_list_t *pairs, eap_round_t *eap_round, uint8_t const *data, size_t data_len)
peap_status status
bool home_access_accept
peap_resumption session_resumption_state
bool req_client_cert
Do we do require a client cert?
rlm_eap_submodule_t rlm_eap_peap
bool use_tunneled_reply
Use the reply attributes from the tunneled session in the non-tunneled reply to the client.
static int mod_thread_instantiate(module_thread_inst_ctx_t const *mctx)
static int eap_peap_inner_from_pairs(request_t *request, fr_tls_session_t *tls_session, fr_pair_list_t *vps)
static unlang_action_t process_rcode(unlang_result_t *p_result, module_ctx_t const *mctx, request_t *request)
static char const * peap_state(peap_tunnel_t *t)
#define EAP_TLV_SUCCESS
static fr_dict_attr_t const * attr_user_name
static unlang_action_t process_resume_reply(unlang_result_t *p_result, request_t *request, void *uctx)
static conf_parser_t submodule_config[]
static int eap_peap_failure(request_t *request, eap_session_t *eap_session, fr_tls_session_t *tls_session)
static unlang_action_t mod_session_init(UNUSED unlang_result_t *p_result, module_ctx_t const *mctx, request_t *request)
static int eap_peap_verify(request_t *request, peap_tunnel_t *peap_tunnel, uint8_t const *data, size_t data_len)
static int mod_thread_detach(module_thread_inst_ctx_t const *mctx)
static int mod_instantiate(module_inst_ctx_t const *mctx)
peap_resumption
@ PEAP_RESUMPTION_YES
@ PEAP_RESUMPTION_NO
@ PEAP_RESUMPTION_MAYBE
fr_pair_t * username
#define EAP_TLV_ACK_RESULT
CONF_SECTION * conf
Module's instance configuration.
Definition module.h:356
size_t inst_size
Size of the module's instance data.
Definition module.h:214
void * data
Module's instance data.
Definition module.h:298
@ FR_SIGNAL_NONE
No signals.
Definition signal.h:39
@ FR_SIGNAL_CANCEL
Request has been cancelled.
Definition signal.h:40
unlang_action_t unlang_module_yield(request_t *request, module_method_t resume, unlang_module_signal_t signal, fr_signal_t sigmask, void *rctx)
Yield a request back to the interpreter from within a module.
Definition module.c:431
eap_aka_sim_process_conf_t * inst
fr_pair_t * vp
Stores an attribute, a value and various bits of other data.
Definition pair.h:68
module_t common
Common fields provided by all modules.
Definition submodule.h:50
Interface exported by EAP submodules.
Definition submodule.h:49
request_t * unlang_subrequest_alloc(request_t *parent, fr_dict_t const *namespace)
Allocate a subrequest to run through a virtual server at some point in the future.
Definition subrequest.c:316
int unlang_subrequest_child_push(unlang_result_t *p_result, request_t *child, void const *unique_session_ptr, bool free_child, bool top_frame)
Push a pre-existing child back onto the stack as a subrequest.
Definition subrequest.c:440
#define fr_table_str_by_value(_table, _number, _def)
Convert an integer to a string.
Definition table.h:804
bool fr_pair_list_empty(fr_pair_list_t const *list)
Is a valuepair list empty.
fr_pair_t * fr_pair_list_next(fr_pair_list_t const *list, fr_pair_t const *item))
Get the next item in a valuepair list after a specific entry.
Definition pair_inline.c:69
void fr_pair_list_free(fr_pair_list_t *list)
Free memory used by a valuepair list.
#define vp_length
Definition pair.h:116
fr_pair_t * fr_pair_list_head(fr_pair_list_t const *list)
Get the head of a valuepair list.
Definition pair_inline.c:42
static fr_slen_t parent
Definition pair.h:864
static fr_slen_t data
Definition value.h:1366
static fr_sbuff_err_t char size_t * len
Definition value.h:1061
int virtual_server_cf_parse(UNUSED TALLOC_CTX *ctx, void *out, UNUSED void *parent, CONF_ITEM *ci, conf_parser_t const *rule)
Wrapper for the config parser to allow pass1 resolution of virtual servers.
Additional validation rules for virtual server lookup.