espressif / ESP8266_NONOS_SDK

ESP8266 nonOS SDK
Other
926 stars 536 forks source link

wpa2 enterprise PEAP-MSChapv2 don't NAK the EAP authentification #263

Open dumarjo opened 5 years ago

dumarjo commented 5 years ago

Basic Infos

Platform

Settings in IDE

Problem Description

I cannot connect to a customer PEAP-mschapV2 WIFI setup. The setup is in a big school that use a microsoft redius server to do the authentification. I can connect with my pc without problem.

I did some packet sniffing to check the difference and it's look like the esp8266 don't refuse the eap authentification and respond to the server like it was on PEAP challenge.

here a screenshot of wireshark connection from the esp8266 and from my pc

image

MCVE Sketch

#include <ESP8266WiFi.h>

extern "C" {
#include "user_interface.h"
#include "wpa2_enterprise.h"
}

// SSID to connect to
static const char* ssid = "MySSID";
// Username for authentification
static const char* username = "myUserName";
// Password for authentication
static const char* password = "myPassword";

void setup() {
  // put your setup code here, to run once:
  Serial.begin(115200);

  // Setting ESP into STATION mode only (no AP mode or dual mode)
  wifi_set_opmode(STATION_MODE);

  struct station_config wifi_config;

  memset(&wifi_config, 0, sizeof(wifi_config));
  strcpy((char*)wifi_config.ssid, ssid);

  wifi_station_set_config(&wifi_config);

  wifi_station_clear_cert_key();
  wifi_station_clear_enterprise_ca_cert();
  wifi_station_clear_enterprise_identity();
  wifi_station_clear_enterprise_username();
  wifi_station_clear_enterprise_password();
  wifi_station_clear_enterprise_new_password();

  wifi_station_set_wpa2_enterprise_auth(1);
  wifi_station_set_enterprise_identity((uint8*)username, strlen(username));
  wifi_station_set_enterprise_username((uint8*)username, strlen(username));
  wifi_station_set_enterprise_password((uint8*)password, strlen(password));

  wifi_station_connect();

  Serial.print("Status: ");
  Serial.println(wifi_station_get_connect_status());

  // Wait for connection AND IP address from DHCP
  Serial.println();
  Serial.println("Waiting for connection and IP Address from DHCP");
  while (WiFi.status() != WL_CONNECTED) {
  Serial.println(WiFi.status());
  delay(2000);
  Serial.print(".");
  }
  Serial.println("");
  Serial.println("WiFi connected");
  Serial.println("IP address: ");
  Serial.println(WiFi.localIP());
}

void loop() {
}

Debug Messages

SDK:3.0.0-dev(c0f7b44)/Core:2.5.2-108-ge77f96c3=20502108/lwIP:STABLE-2_1_2_RELEASE/glue:1.1-8-g2314329/BearSSL:89454af
WPA2 ENTERPRISE VERSION: [v2.0] enable
Status: 1

Waiting for connection and IP Address from DHCP
6
wifi evt: 8
wifi evt: 2
.6
scandone
state: 0 -> 2 (b0)
state: 2 -> 3 (0)
state: 3 -> 5 (10)
add 0
aid 1
cnt 
EAP-MSCHAPV2: RX identifier 2 mschapv2_id 2
EAP-MSCHAPV2: Generate Challenge Response
.6
.6
.
pm open,type:2 0
.6

state: 5 -> 0 (2)
rm 0
pm close 7
reconnect
wifi evt: 1
STA disconnect: 204
.4
scandone
state: 0 -> 2 (b0)
state: 2 -> 3 (0)
state: 3 -> 5 (10)
add 0
aid 1
cnt 
EAP-MSCHAPV2: RX identifier 2 mschapv2_id 2
EAP-MSCHAPV2: Generate Challenge Response
.4
.4

Is there any settings that i can change to force the PEAP mode instead of EAP ?

Regards

Jonathan

danielbernalb commented 1 year ago

Almost 4 years later and I have the same problem with the same brand of Aruba Networks router. The ESP8266 not go beyond the point: EAP-MSCHAPV2: RX identifier 2 mschapv2_id 2 EAP-MSCHAPV2: Generate Challenge Response

The network is PEAP MSCHAP v2. I tested with all SDKs, version of core and everything that I found to a possible solution. Did you find any solution Jonathan? In my case I found that with the ESP32 works, but is not a easy solution to pass hardware and software to an ESP32.

Thank you