24 RCSID(
"$Id: e5f6ed03242fd2239a4e62d98e7226757f98b3c3 $")
27 #include <freeradius-devel/radius/radius.h>
28 #include <freeradius-devel/radius/defs.h>
55 (tls_session->record_from_buff)(&tls_session->clean_in, tlv_packet, 11);
60 fr_tls_session_send(request, tls_session);
89 (tls_session->record_from_buff)(&tls_session->clean_in, tlv_packet, 11);
94 fr_tls_session_send(request, tls_session);
110 (tls_session->record_from_buff)(&tls_session->clean_in, &eap_packet,
sizeof(eap_packet));
111 fr_tls_session_send(request, tls_session);
112 (tls_session->record_init)(&tls_session->clean_in);
139 switch (peap_tunnel->
status) {
143 REDEBUG(
"Invalid inner tunnel data, expected method (%u), got (%u)",
153 eap_method =
data[0];
154 switch (eap_method) {
156 RDEBUG2(
"Received EAP-Identity-Response");
182 if (data_len > 65535)
return;
186 if (total > 249) total = 249;
199 while (total < data_len) {
203 total +=
vp->vp_length;
225 (tls_session->record_from_buff)(&tls_session->clean_in, this->vp_octets +
EAP_HEADER_LEN,
234 (tls_session->record_from_buff)(&tls_session->clean_in, this->vp_octets, this->vp_length);
237 fr_tls_session_send(request, tls_session);
250 if (data_len < 11)
return 0;
262 RDEBUG2(
"Client rejected our response. The password is probably incorrect");
280 fr_tls_session_t *tls_session = eap_tls_session->
tls_session;
295 RDEBUG2(
"Got tunneled reply code %i", reply->
code);
300 switch (reply->
code) {
302 RDEBUG2(
"Tunneled authentication was successful");
308 RDEBUG2(
"Tunneled authentication was rejected");
314 RDEBUG2(
"Got tunneled Access-Challenge");
336 RDEBUG2(
"Unknown RADIUS packet type %d: rejecting tunneled user", reply->
code);
346 return "TUNNEL ESTABLISHED";
349 return "WAITING FOR INNER IDENTITY";
352 return "send tlv success";
355 return "send tlv failure";
358 return "phase2_init";
387 data_len = tls_session->clean_out.used;
388 tls_session->clean_out.used = 0;
389 data = tls_session->clean_out.data;
394 REDEBUG(
"Tunneled data is invalid");
402 if (SSL_session_reused(tls_session->ssl)) {
403 RDEBUG2(
"Skipping Phase2 because of session resumption");
421 REDEBUG(
"Expected EAP-Identity, got something else");
457 RDEBUG2(
"Client rejected session resumption. Re-starting full authentication");
470 REDEBUG(
"Sent a success, but received something weird in return");
479 REDEBUG(
"The users session was previously rejected: returning reject (again.)");
480 RIDEBUG(
"This means you need to read the PREVIOUS messages in the debug output");
481 RIDEBUG(
"to find out the reason why the user was rejected");
482 RIDEBUG(
"Look for \"reject\" or \"fail\". Those earlier messages will tell you");
483 RIDEBUG(
"what went wrong, and how to fix the problem");
489 RDEBUG2(
"In state machine in phase2 init?");
496 REDEBUG(
"Unhandled state in peap");
524 q[2] = (len >> 8) & 0xff;
535 eap_round,
data, data_len);
538 RDEBUG2(
"Unable to convert tunneled EAP packet to internal server data structures");
545 REDEBUG(
"Invalid state change in PEAP");
550 RDEBUG2(
"Got tunneled request");
576 RDEBUG2(
"Setting &request.User-Name from tunneled (inner) identity \"%s\"",
579 RDEBUG2(
"No tunnel username (SSL resumption?)");
unlang_action_t
Returned by unlang_op_t calls, determine the next action of the interpreter.
@ UNLANG_ACTION_PUSHED_CHILD
unlang_t pushed a new child onto the stack, execute it instead of continuing.
#define USES_APPLE_DEPRECATED_API
eap_packet_t * response
Packet we received from the peer.
Contains a pair of request and response packets.
fr_dcursor_eval_t void const * uctx
@ FR_RADIUS_CODE_ACCESS_CHALLENGE
RFC2865 - Access-Challenge.
@ FR_RADIUS_CODE_ACCESS_ACCEPT
RFC2865 - Access-Accept.
@ FR_RADIUS_CODE_ACCESS_REJECT
RFC2865 - Access-Reject.
char const * eap_type2name(eap_type_t method)
Return an EAP-name for a particular type.
Structure to represent packet format of eap on wire
@ PEAP_STATUS_PHASE2_INIT
@ PEAP_STATUS_TUNNEL_ESTABLISHED
@ PEAP_STATUS_INNER_IDENTITY_REQ_SENT
@ PEAP_STATUS_SENT_TLV_SUCCESS
@ PEAP_STATUS_SENT_TLV_FAILURE
#define FR_PEAP_EXTENSIONS_TYPE
peap_resumption session_resumption_state
#define EAP_TLV_ACK_RESULT
#define unlang_function_push(_request, _func, _repeat, _signal, _sigmask, _top_frame, _uctx)
Push a generic function onto the unlang stack.
HIDDEN fr_dict_attr_t const * attr_eap_message
unlang_action_t eap_virtual_server(request_t *request, eap_session_t *eap_session, CONF_SECTION *server_cs)
Run a subrequest through a virtual server.
void * opaque
Opaque data used by EAP methods.
rlm_rcode_t submodule_rcode
Result of last submodule call.
eap_round_t * this_round
The EAP response we're processing, and the EAP request we're building.
Tracks the progress of a single session of any EAP method.
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.
#define REXDENT()
Exdent (unindent) R* messages by one level.
#define RINDENT()
Indent R* messages by one level.
@ L_DBG_LVL_2
2nd highest priority debug messages (-xx | -X).
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, unsigned int count)
Duplicate pairs in a list matching the specified da.
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.
int fr_pair_value_memdup(fr_pair_t *vp, uint8_t const *src, size_t len, bool tainted)
Copy data into an "octets" data type.
int fr_pair_append(fr_pair_list_t *list, fr_pair_t *to_add)
Add a VP to the end of the list.
void fr_pair_list_init(fr_pair_list_t *list)
Initialise a pair list header.
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.
fr_pair_t * fr_pair_copy(TALLOC_CTX *ctx, fr_pair_t const *vp)
Copy a single valuepair.
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.
static USES_APPLE_DEPRECATED_API int eap_peap_failure(request_t *request, eap_session_t *eap_session, fr_tls_session_t *tls_session)
static unlang_action_t process_reply(rlm_rcode_t *p_result, UNUSED int *priority, request_t *request, void *uctx)
static int eap_peap_success(request_t *request, eap_session_t *eap_session, fr_tls_session_t *tls_session)
static int eap_peap_identity(request_t *request, eap_session_t *eap_session, fr_tls_session_t *tls_session)
static int eap_peap_check_tlv(request_t *request, uint8_t const *data, size_t data_len)
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)
static int eap_peap_inner_from_pairs(request_t *request, fr_tls_session_t *tls_session, fr_pair_list_t *vps)
unlang_action_t eap_peap_process(rlm_rcode_t *p_result, request_t *request, eap_session_t *eap_session, fr_tls_session_t *tls_session)
static char const * peap_state(peap_tunnel_t *t)
static int eap_peap_verify(request_t *request, peap_tunnel_t *peap_tunnel, uint8_t const *data, size_t data_len)
char const * fr_radius_packet_name[FR_RADIUS_CODE_MAX]
static fr_dict_attr_t const * attr_user_name
#define RDEBUG_ENABLED2()
#define FR_RADIUS_PACKET_CODE_VALID(_x)
#define RETURN_MODULE_REJECT
#define RETURN_MODULE_RCODE(_rcode)
#define RETURN_MODULE_HANDLED
rlm_rcode_t
Return codes indicating the result of the module call.
@ RLM_MODULE_OK
The module is OK, continue.
@ RLM_MODULE_REJECT
Immediately reject the request.
@ RLM_MODULE_HANDLED
The module handled the request, so stop.
int request_detach(request_t *child)
Unlink a subrequest from its parent.
MEM(pair_append_request(&vp, attr_eap_aka_sim_identity) >=0)
Stores an attribute, a value and various bits of other data.
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.
int unlang_subrequest_child_push(rlm_rcode_t *out, request_t *child, unlang_subrequest_session_t const *session, bool free_child, bool top_frame)
Push a pre-existing child back onto the stack as a subrequest.
fr_tls_session_t * tls_session
TLS session used to authenticate peer or tunnel sensitive data.
Tracks the state of an EAP-TLS session.
unsigned int code
Packet code (type).
fr_pair_t * fr_pair_list_head(fr_pair_list_t const *list)
Get the head of a valuepair list.
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.
void fr_pair_list_free(fr_pair_list_t *list)
Free memory used by a valuepair list.