-
Notifications
You must be signed in to change notification settings - Fork 7.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
无法连接wpa2企业加密ESP-TLS (IDFGH-3779) #5698
Comments
@kaedewang - Can you help us with the default EAP method set on Freeradius side, typically available in mods_available/eap file? Also what is the value of EAP_METHOD on esp32 in menuconfig? |
@kaedewang Thanks for reporting, would you please help share if any updates per the questions by @sagb2015 ? Thanks. |
@sagb2015 @Alvin1Zhang eap {
} |
I successed to connect wpa2-enterprise by EAP-TLS. |
@kaedewang
The latest 2 parameters is private_key_passwd and private_key_passwd_len. |
@AxelLin, sorry for this (maybe) noob question, but i'm struggling with the understanding of that function.
But what to pass to |
@dabbinavo In PKI, both parties (client and server in this case) generate <private, public> key pair and get certificates from trusted CA (which ties public key to the identity). Each side is supposed to know and keep their private keys private. The arg client_key_start refers to private key of the ESP32 device. Please refer to this article for more information on PKI and also contact your IT admin about generating the key pair and getting client-certificate signed by CA trusted by your organisation. |
@sagb2015 Thanks for the information! It wasn't clear to me, that the user certificate (client certificate) in .p12 format (PKCS#12) distributed by the IT admin contains both, the certificate and the private key. So to use the ESP-IDF API If so, does some ESP-IDF library running on the ESP32 already provide any functions to extract the certificate and private key from a .p12 file or do I have to include/use a separate library for this (e.g. openssl which can do that)? |
I take it back. While testing with v4.3-356-g48ae2309fd9c, I found the same issue as reported by #5698 (comment) I test again with v4.4-dev-2825-gb63ec47238fd, the same symptom: It does not work if the client key needs password. @sagb2015 @kapilkedawat (I think this issue should be re-open) |
Hi @dabbinavo , you can use openssl commands to extract certificate and key.
Hi @AxelLin , can you please share the certificates that you have used? If not possible, can you please share the cert type? |
@kapilkedawat ca.pem.txt |
I test again, this time it works. (No idea why it fails in my previous test). With CONFIG_WPA_DEBUG_PRINT=y, it works but it shows some error messages as below (FYI). I (3941) wifi:new:<11,2>, old:<1,0>, ap:<255,255>, sta:<11,2>, prof:1 I (17123) wpa: SSL: Need 1914 bytes more input data E (25240) wpa: RSN: PMKSA cache entry found - PMKID - hexdump(len=16): I (26259) wifi:connected with IGS-MESH, aid = 2, channel 11, 40D, bssid = 18:a6:f7:ab:ca:66 W (26265) wifi:Next TBTT incorrect! last beacon:1318892, offset:383, next beacon:11763692, beacon interval:102400, dtim period:0, dtim count:0, listen interval:3, now:23657636 |
@kapilkedawat Test again with v4.4-dev-2928-gd5f58ab13551 and v4.3.1 debug build, I got below error message on the device: |
Hi @kapilkedawat Then I can connect to the AP. |
I tried diffent -keypbe setting to generate the key via openssl, e.g. PBE-SHA1-RC2-128
But I still got below error if CONFIG_MBEDTLS_DES_C=n Is it necessary to set CONFIG_MBEDTLS_DES_C=y for password protected key? |
Hi @AxelLin , You can try with AES encryptions(128-192-256 bits). I would advise against enabling DES since it is vulnerable to sweet32 attacks. |
Could you show me the example to generate AES encryption key? Thanks. (I use freeRADIUS make client.pem) |
Hi @AxelLin , For more detailed steps,Pls refer this Doc. Link |
@AxelLin I replaced wpa2_ca.pem, wpa2_client.crt, wpa2_client.ket, and wpa2_client.pem in my routine with files in the RADIUS server. I don't use CA authentication, so I disabled it in the ConfigurAction Editor and selected TLS for the EAP Method. When I use a Huawei mobile phone to connect to RADIUS, a user certificate is selected. The user certificate is a client. p12 file provided by my colleagues who set up RADIUS. But I don't understand how ESP32 uses the client.p12 file. |
@weisen2021 Also see this post |
Hi @nishanth-radja Without "-traditional" , I got E (6105) wpa: mbedtls_pk_parse_keyfile returned -0x2e80.
Just wondering Is it possible to support PKCS#8 format? |
@dabbinavo |
Environment
git describe --tags
to find it):// v4.3-dev-771-gc77c4ccf6
xtensa-esp32-elf-gcc --version
to find it):// xtensa-esp32-elf-gcc (crosstool-NG esp-2020r2) 8.2.0
Problem Description
ESP32使用wpa2_enterprise例程,无法连接wpa2企业加密EAP-TLS,电脑和手机连接无问题
路由器使用ASUSwrt merlin,安装本地FreeRADIUS Version 3.0.21
根据其他issue
ESP32设置了
config EXAMPLE_VALIDATE_SERVER_CERT=n
config WPA_MBEDTLS_CRYPTO=n
FreeRADIUS设置了
disable_tlsv1_2 = no
disable_tlsv1_1 = yes
disable_tlsv1 = yes
tls_min_version = "1.2"
tls_max_version = "1.2"
FreeRADIUS Debug信息如下
(0) Received Access-Request Id 106 from 127.0.0.1:48424 to 127.0.0.1:1812 length 233
(0) User-Name = "[email protected]"
(0) NAS-IP-Address = 127.0.0.1
(0) Called-Station-Id = "D4-5D-64-4D-7B-C8:ASUS"
(0) NAS-Port-Type = Wireless-802.11
(0) Service-Type = Framed-User
(0) Calling-Station-Id = "C8-2B-96-B8-6A-DC"
(0) Connect-Info = "CONNECT 0Mbps 802.11g"
(0) Acct-Session-Id = "AA3CF7806C39EB64"
(0) Acct-Multi-Session-Id = "0ABFDC1446AD11C1"
(0) Attr-186 = 0x000fac04
(0) Attr-187 = 0x000fac04
(0) Attr-188 = 0x000fac01
(0) Framed-MTU = 1400
(0) EAP-Message = 0x02af001a016578616d706c65406573707265737369662e636f6d
(0) Message-Authenticator = 0x032d3ecaee12ccb4bfe5826034ada2bc
(0) # Executing section authorize from file /opt/etc/freeradius3/sites-enabled/default
(0) authorize {
(0) policy filter_username {
(0) if (&User-Name) {
(0) if (&User-Name) -> TRUE
(0) if (&User-Name) {
(0) if (&User-Name =~ / /) {
(0) if (&User-Name =~ / /) -> FALSE
(0) if (&User-Name =~ /@[^@]@/ ) {
(0) if (&User-Name =~ /@[^@]@/ ) -> FALSE
(0) if (&User-Name =~ /../ ) {
(0) if (&User-Name =~ /../ ) -> FALSE
(0) if ((&User-Name =~ /@/) && (&User-Name !~ /@(.+).(.+)$/)) {
(0) if ((&User-Name =~ /@/) && (&User-Name !~ /@(.+).(.+)$/)) -> FALSE
(0) if (&User-Name =~ /.$/) {
(0) if (&User-Name =~ /.$/) -> FALSE
(0) if (&User-Name =~ /@./) {
(0) if (&User-Name =~ /@./) -> FALSE
(0) } # if (&User-Name) = notfound
(0) } # policy filter_username = notfound
(0) [preprocess] = ok
(0) [chap] = noop
(0) [mschap] = noop
(0) [digest] = noop
(0) suffix: Checking for suffix after "@"
(0) suffix: Looking up realm "espressif.com" for User-Name = "[email protected]"
(0) suffix: No such realm "espressif.com"
(0) [suffix] = noop
(0) eap: Peer sent EAP Response (code 2) ID 175 length 26
(0) eap: EAP-Identity reply, returning 'ok' so we can short-circuit the rest of authorize
(0) [eap] = ok
(0) } # authorize = ok
(0) Found Auth-Type = eap
(0) # Executing group from file /opt/etc/freeradius3/sites-enabled/default
(0) authenticate {
(0) eap: Peer sent packet with method EAP Identity (1)
(0) eap: Calling submodule eap_tls to process data
(0) eap_tls: Initiating new TLS session
(0) eap_tls: Setting verify mode to require certificate from client
(0) eap_tls: [eaptls start] = request
(0) eap: Sending EAP Request (code 1) ID 176 length 6
(0) eap: EAP session adding &reply:State = 0xc607166ac6b71b6d
(0) [eap] = handled
(0) } # authenticate = handled
(0) Using Post-Auth-Type Challenge
(0) # Executing group from file /opt/etc/freeradius3/sites-enabled/default
(0) Challenge { ... } # empty sub-section is ignored
(0) Sent Access-Challenge Id 106 from 127.0.0.1:1812 to 127.0.0.1:48424 length 0
(0) EAP-Message = 0x01b000060d20
(0) Message-Authenticator = 0x00000000000000000000000000000000
(0) State = 0xc607166ac6b71b6dda08a4b72dd608fd
(0) Finished request
Waking up in 4.9 seconds.
(1) Received Access-Request Id 107 from 127.0.0.1:48424 to 127.0.0.1:1812 length 233
(1) User-Name = "[email protected]"
(1) NAS-IP-Address = 127.0.0.1
(1) Called-Station-Id = "D4-5D-64-4D-7B-C8:ASUS"
(1) NAS-Port-Type = Wireless-802.11
(1) Service-Type = Framed-User
(1) Calling-Station-Id = "C8-2B-96-B8-6A-DC"
(1) Connect-Info = "CONNECT 0Mbps 802.11g"
(1) Acct-Session-Id = "AA3CF7806C39EB64"
(1) Acct-Multi-Session-Id = "0ABFDC1446AD11C1"
(1) Attr-186 = 0x000fac04
(1) Attr-187 = 0x000fac04
(1) Attr-188 = 0x000fac01
(1) Framed-MTU = 1400
(1) EAP-Message = 0x02b00008030d1915
(1) State = 0xc607166ac6b71b6dda08a4b72dd608fd
(1) Message-Authenticator = 0x3ec65b164aa3513125bb08ad57020896
(1) session-state: No cached attributes
(1) # Executing section authorize from file /opt/etc/freeradius3/sites-enabled/default
(1) authorize {
(1) policy filter_username {
(1) if (&User-Name) {
(1) if (&User-Name) -> TRUE
(1) if (&User-Name) {
(1) if (&User-Name =~ / /) {
(1) if (&User-Name =~ / /) -> FALSE
(1) if (&User-Name =~ /@[^@]@/ ) {
(1) if (&User-Name =~ /@[^@]@/ ) -> FALSE
(1) if (&User-Name =~ /../ ) {
(1) if (&User-Name =~ /../ ) -> FALSE
(1) if ((&User-Name =~ /@/) && (&User-Name !~ /@(.+).(.+)$/)) {
(1) if ((&User-Name =~ /@/) && (&User-Name !~ /@(.+).(.+)$/)) -> FALSE
(1) if (&User-Name =~ /.$/) {
(1) if (&User-Name =~ /.$/) -> FALSE
(1) if (&User-Name =~ /@./) {
(1) if (&User-Name =~ /@./) -> FALSE
(1) } # if (&User-Name) = notfound
(1) } # policy filter_username = notfound
(1) [preprocess] = ok
(1) [chap] = noop
(1) [mschap] = noop
(1) [digest] = noop
(1) suffix: Checking for suffix after "@"
(1) suffix: Looking up realm "espressif.com" for User-Name = "[email protected]"
(1) suffix: No such realm "espressif.com"
(1) [suffix] = noop
(1) eap: Peer sent EAP Response (code 2) ID 176 length 8
(1) eap: No EAP Start, assuming it's an on-going EAP conversation
(1) [eap] = updated
(1) [files] = noop
(1) [expiration] = noop
(1) [logintime] = noop
Not doing PAP as Auth-Type is already set.
(1) [pap] = noop
(1) } # authorize = updated
(1) Found Auth-Type = eap
(1) # Executing group from file /opt/etc/freeradius3/sites-enabled/default
(1) authenticate {
(1) eap: Expiring EAP session with state 0xc607166ac6b71b6d
(1) eap: Finished EAP session with state 0xc607166ac6b71b6d
(1) eap: Previous EAP request found for state 0xc607166ac6b71b6d, released from the list
(1) eap: Peer sent packet with method EAP NAK (3)
(1) eap: Peer NAK'd our request for TLS (13) with a request for TLS (13), skipping...
(1) eap: WARNING: !!! We requested to use an EAP type as normal.
(1) eap: WARNING: !!! The supplicant rejected that, and requested to use the same EAP type.
(1) eap: WARNING: !!! i.e. the supplicant said 'I don't like X, please use X instead.
(1) eap: WARNING: !!! The supplicant software is broken and does not work properly.
(1) eap: WARNING: !!! Please upgrade it to software that works.
(1) eap: Found mutually acceptable type PEAP (25)
(1) eap: Calling submodule eap_peap to process data
(1) eap_peap: Initiating new TLS session
(1) eap_peap: [eaptls start] = request
(1) eap: Sending EAP Request (code 1) ID 177 length 6
(1) eap: EAP session adding &reply:State = 0xc607166ac7b60f6d
(1) [eap] = handled
(1) } # authenticate = handled
(1) Using Post-Auth-Type Challenge
(1) # Executing group from file /opt/etc/freeradius3/sites-enabled/default
(1) Challenge { ... } # empty sub-section is ignored
(1) Sent Access-Challenge Id 107 from 127.0.0.1:1812 to 127.0.0.1:48424 length 0
(1) EAP-Message = 0x01b100061920
(1) Message-Authenticator = 0x00000000000000000000000000000000
(1) State = 0xc607166ac7b60f6dda08a4b72dd608fd
(1) Finished request
Waking up in 4.9 seconds.
(2) Received Access-Request Id 108 from 127.0.0.1:48424 to 127.0.0.1:1812 length 233
(2) User-Name = "[email protected]"
(2) NAS-IP-Address = 127.0.0.1
(2) Called-Station-Id = "D4-5D-64-4D-7B-C8:ASUS"
(2) NAS-Port-Type = Wireless-802.11
(2) Service-Type = Framed-User
(2) Calling-Station-Id = "C8-2B-96-B8-6A-DC"
(2) Connect-Info = "CONNECT 0Mbps 802.11g"
(2) Acct-Session-Id = "AA3CF7806C39EB64"
(2) Acct-Multi-Session-Id = "0ABFDC1446AD11C1"
(2) Attr-186 = 0x000fac04
(2) Attr-187 = 0x000fac04
(2) Attr-188 = 0x000fac01
(2) Framed-MTU = 1400
(2) EAP-Message = 0x02b10008030d1915
(2) State = 0xc607166ac7b60f6dda08a4b72dd608fd
(2) Message-Authenticator = 0x18d0d4bce15988cc7a95cbb1cc1d7693
(2) session-state: No cached attributes
(2) # Executing section authorize from file /opt/etc/freeradius3/sites-enabled/default
(2) authorize {
(2) policy filter_username {
(2) if (&User-Name) {
(2) if (&User-Name) -> TRUE
(2) if (&User-Name) {
(2) if (&User-Name =~ / /) {
(2) if (&User-Name =~ / /) -> FALSE
(2) if (&User-Name =~ /@[^@]@/ ) {
(2) if (&User-Name =~ /@[^@]@/ ) -> FALSE
(2) if (&User-Name =~ /../ ) {
(2) if (&User-Name =~ /../ ) -> FALSE
(2) if ((&User-Name =~ /@/) && (&User-Name !~ /@(.+).(.+)$/)) {
(2) if ((&User-Name =~ /@/) && (&User-Name !~ /@(.+).(.+)$/)) -> FALSE
(2) if (&User-Name =~ /.$/) {
(2) if (&User-Name =~ /.$/) -> FALSE
(2) if (&User-Name =~ /@./) {
(2) if (&User-Name =~ /@./) -> FALSE
(2) } # if (&User-Name) = notfound
(2) } # policy filter_username = notfound
(2) [preprocess] = ok
(2) [chap] = noop
(2) [mschap] = noop
(2) [digest] = noop
(2) suffix: Checking for suffix after "@"
(2) suffix: Looking up realm "espressif.com" for User-Name = "[email protected]"
(2) suffix: No such realm "espressif.com"
(2) [suffix] = noop
(2) eap: Peer sent EAP Response (code 2) ID 177 length 8
(2) eap: No EAP Start, assuming it's an on-going EAP conversation
(2) [eap] = updated
(2) [files] = noop
(2) [expiration] = noop
(2) [logintime] = noop
Not doing PAP as Auth-Type is already set.
(2) [pap] = noop
(2) } # authorize = updated
(2) Found Auth-Type = eap
(2) # Executing group from file /opt/etc/freeradius3/sites-enabled/default
(2) authenticate {
(2) eap: Expiring EAP session with state 0xc607166ac7b60f6d
(2) eap: Finished EAP session with state 0xc607166ac7b60f6d
(2) eap: Previous EAP request found for state 0xc607166ac7b60f6d, released from the list
(2) eap: Peer sent packet with method EAP NAK (3)
(2) eap: Found mutually acceptable type TLS (13)
(2) eap: Calling submodule eap_tls to process data
(2) eap_tls: Initiating new TLS session
(2) eap_tls: Setting verify mode to require certificate from client
(2) eap_tls: [eaptls start] = request
(2) eap: Sending EAP Request (code 1) ID 178 length 6
(2) eap: EAP session adding &reply:State = 0xc607166ac4b51b6d
(2) [eap] = handled
(2) } # authenticate = handled
(2) Using Post-Auth-Type Challenge
(2) # Executing group from file /opt/etc/freeradius3/sites-enabled/default
(2) Challenge { ... } # empty sub-section is ignored
(2) Sent Access-Challenge Id 108 from 127.0.0.1:1812 to 127.0.0.1:48424 length 0
(2) EAP-Message = 0x01b200060d20
(2) Message-Authenticator = 0x00000000000000000000000000000000
(2) State = 0xc607166ac4b51b6dda08a4b72dd608fd
(2) Finished request
Waking up in 4.9 seconds.
(3) Received Access-Request Id 109 from 127.0.0.1:48424 to 127.0.0.1:1812 length 233
(3) User-Name = "[email protected]"
(3) NAS-IP-Address = 127.0.0.1
(3) Called-Station-Id = "D4-5D-64-4D-7B-C8:ASUS"
(3) NAS-Port-Type = Wireless-802.11
(3) Service-Type = Framed-User
(3) Calling-Station-Id = "C8-2B-96-B8-6A-DC"
(3) Connect-Info = "CONNECT 0Mbps 802.11g"
(3) Acct-Session-Id = "AA3CF7806C39EB64"
(3) Acct-Multi-Session-Id = "0ABFDC1446AD11C1"
(3) Attr-186 = 0x000fac04
(3) Attr-187 = 0x000fac04
(3) Attr-188 = 0x000fac01
(3) Framed-MTU = 1400
(3) EAP-Message = 0x02b20008030d1915
(3) State = 0xc607166ac4b51b6dda08a4b72dd608fd
(3) Message-Authenticator = 0xa9f191297d509a6b9534d9868bb936e0
(3) session-state: No cached attributes
(3) # Executing section authorize from file /opt/etc/freeradius3/sites-enabled/default
(3) authorize {
(3) policy filter_username {
(3) if (&User-Name) {
(3) if (&User-Name) -> TRUE
(3) if (&User-Name) {
(3) if (&User-Name =~ / /) {
(3) if (&User-Name =~ / /) -> FALSE
(3) if (&User-Name =~ /@[^@]@/ ) {
(3) if (&User-Name =~ /@[^@]@/ ) -> FALSE
(3) if (&User-Name =~ /../ ) {
(3) if (&User-Name =~ /../ ) -> FALSE
(3) if ((&User-Name =~ /@/) && (&User-Name !~ /@(.+).(.+)$/)) {
(3) if ((&User-Name =~ /@/) && (&User-Name !~ /@(.+).(.+)$/)) -> FALSE
(3) if (&User-Name =~ /.$/) {
(3) if (&User-Name =~ /.$/) -> FALSE
(3) if (&User-Name =~ /@./) {
(3) if (&User-Name =~ /@./) -> FALSE
(3) } # if (&User-Name) = notfound
(3) } # policy filter_username = notfound
(3) [preprocess] = ok
(3) [chap] = noop
(3) [mschap] = noop
(3) [digest] = noop
(3) suffix: Checking for suffix after "@"
(3) suffix: Looking up realm "espressif.com" for User-Name = "[email protected]"
(3) suffix: No such realm "espressif.com"
(3) [suffix] = noop
(3) eap: Peer sent EAP Response (code 2) ID 178 length 8
(3) eap: No EAP Start, assuming it's an on-going EAP conversation
(3) [eap] = updated
(3) [files] = noop
(3) [expiration] = noop
(3) [logintime] = noop
Not doing PAP as Auth-Type is already set.
(3) [pap] = noop
(3) } # authorize = updated
(3) Found Auth-Type = eap
(3) # Executing group from file /opt/etc/freeradius3/sites-enabled/default
(3) authenticate {
(3) eap: Expiring EAP session with state 0xc607166ac4b51b6d
(3) eap: Finished EAP session with state 0xc607166ac4b51b6d
(3) eap: Previous EAP request found for state 0xc607166ac4b51b6d, released from the list
(3) eap: Peer sent packet with method EAP NAK (3)
(3) eap: Peer NAK'd our request for TLS (13) with a request for TLS (13), skipping...
(3) eap: WARNING: !!! We requested to use an EAP type as normal.
(3) eap: WARNING: !!! The supplicant rejected that, and requested to use the same EAP type.
(3) eap: WARNING: !!! i.e. the supplicant said 'I don't like X, please use X instead.
(3) eap: WARNING: !!! The supplicant software is broken and does not work properly.
(3) eap: WARNING: !!! Please upgrade it to software that works.
(3) eap: Found mutually acceptable type PEAP (25)
(3) eap: Calling submodule eap_peap to process data
(3) eap_peap: Initiating new TLS session
The text was updated successfully, but these errors were encountered: