TTLS with client certificate request enabled

TianHong Zhao tzhao at wavesat.com
Thu Feb 26 15:25:43 EST 2009


Hi,

I'm looking at the possibility of enabling EAP-TTLSV0/MSCHAPV2 with
client certificate request, inspired by the following comments in
"eap_config.h":

/**
 * client_cert - File path to client certificate file (PEM/DER)
 *
 * This field is used with EAP method that use TLS authentication.
 * Usually, this is only configured for EAP-TLS, even though this could
 * in theory be used with EAP-TTLS and EAP-PEAP, too. Full path to the
 * file should be used since working directory may change when
 * wpa_supplicant is run in the background.
 *
 * Alternatively, a named configuration blob can be used by setting
 * this to blob://blob_name.
 */
 u8 *client_cert;


I use the peer/server code in the eap_example, and configure the
client_cert ,private_key and private_key_passwd in the
"eap_example_peer.c", but I do not get the "write certificate request A"
from the server, do I miss anything ? 

How to enable TTLS with client certificate request ? 

I am able to use EAP-TLS though, so nothing wrong with the certificates.

The attached is the test results by using EAP-TTLS/MSCHAPV2 (with client
certificate configured).

Regards

Tianhong Zhao
-------------- next part --------------
TLS: Trusted root certificate(s) loaded
EAP: Server state machine created
---[ server ]--------------------------------
EAP: EAP entering state INITIALIZE
EAP: EAP entering state SELECT_ACTION
EAP: getDecision: no identity known yet -> CONTINUE
EAP: EAP entering state PROPOSE_METHOD
EAP: getNextMethod: vendor 0 type 1
EAP: EAP entering state METHOD_REQUEST
EAP: building EAP-Request: Identifier 103
EAP: EAP entering state SEND_REQUEST
EAP: EAP entering state IDLE
EAP: retransmit timeout 3 seconds (from dynamic back off; retransCount=0)
==> Request
---[ peer ]----------------------------------
EAP: EAP entering state IDLE
EAP: EAP entering state RECEIVED
EAP: Received EAP-Request id=103 method=1 vendor=0 vendorMethod=0
EAP: EAP entering state IDENTITY
CTRL-EVENT-EAP-STARTED EAP authentication started
EAP: EAP-Request Identity data - hexdump_ascii(len=0):
EAP: using real identity - hexdump_ascii(len=4):
     75 73 65 72                                       user            
EAP: EAP entering state SEND_RESPONSE
EAP: EAP entering state IDLE
==> Response
---[ server ]--------------------------------
EAP: EAP entering state RECEIVED
EAP: parseEapResp: rxResp=1 respId=103 respMethod=1 respVendor=0 respVendorMethod=0
EAP: EAP entering state INTEGRITY_CHECK
EAP: EAP entering state METHOD_RESPONSE
EAP-Identity: Peer identity - hexdump_ascii(len=4):
     75 73 65 72                                       user            
EAP: EAP entering state SELECT_ACTION
EAP: getDecision: another method available -> CONTINUE
EAP: EAP entering state PROPOSE_METHOD
EAP: getNextMethod: vendor 0 type 21
EAP-TTLS: forcing version 0
EAP: EAP entering state METHOD_REQUEST
EAP: building EAP-Request: Identifier 104
EAP-TTLS: START -> PHASE1
EAP: EAP entering state SEND_REQUEST
EAP: EAP entering state IDLE
EAP: retransmit timeout 3 seconds (from dynamic back off; retransCount=0)
==> Request
---[ peer ]----------------------------------
EAP: EAP entering state RECEIVED
EAP: Received EAP-Request id=104 method=21 vendor=0 vendorMethod=0
EAP: EAP entering state GET_METHOD
EAP: Initialize selected EAP method: vendor 0 method 21 (TTLS)
EAP-TTLS: Phase2 type: MSCHAPV2
CTRL-EVENT-EAP-METHOD EAP vendor 0 method 21 (TTLS) selected
EAP: EAP entering state METHOD
SSL: Received packet(len=6) - Flags 0x20
EAP-TTLS: Start (server ver=0, own ver=0)
TLS: using phase1 config options
TLS: Trusted root certificate(s) loaded
OpenSSL: tls_connection_client_cert - SSL_use_certificate_file (DER) failed error:0D0680A8:asn1 encoding routines:ASN1_CHECK_TLEN:wrong tag
OpenSSL: pending error: error:0D07803A:asn1 encoding routines:ASN1_ITEM_EX_D2I:nested asn1 error
OpenSSL: pending error: error:140C800D:SSL routines:SSL_use_certificate_file:ASN1 lib
OpenSSL: SSL_use_certificate_file (PEM) --> OK
OpenSSL: SSL_use_PrivateKey_File (DER) --> OK
SSL: Private key loaded successfully
EAP-TTLS: Start
SSL: (where=0x10 ret=0x1)
SSL: (where=0x1001 ret=0x1)
SSL: SSL_connect:before/connect initialization
SSL: (where=0x1001 ret=0x1)
SSL: SSL_connect:SSLv3 write client hello A
SSL: (where=0x1002 ret=0xffffffff)
SSL: SSL_connect:error in SSLv3 read server hello A
SSL: SSL_connect - want more data
SSL: 87 bytes pending from ssl_out
SSL: 87 bytes left to be sent out (of total 87 bytes)
EAP: method process -> ignore=FALSE methodState=MAY_CONT decision=FAIL
EAP: EAP entering state SEND_RESPONSE
EAP: EAP entering state IDLE
==> Response
---[ server ]--------------------------------
EAP: EAP entering state RECEIVED
EAP: parseEapResp: rxResp=1 respId=104 respMethod=21 respVendor=0 respVendorMethod=0
EAP: EAP entering state INTEGRITY_CHECK
EAP: EAP entering state METHOD_RESPONSE
SSL: Received packet(len=93) - Flags 0x00
SSL: Received packet: Flags 0x0 Message Length 0
SSL: (where=0x10 ret=0x1)
SSL: (where=0x2001 ret=0x1)
SSL: SSL_accept:before/accept initialization
SSL: (where=0x2001 ret=0x1)
SSL: SSL_accept:SSLv3 read client hello A
SSL: (where=0x2001 ret=0x1)
SSL: SSL_accept:SSLv3 write server hello A
SSL: (where=0x2001 ret=0x1)
SSL: SSL_accept:SSLv3 write certificate A
SSL: (where=0x2001 ret=0x1)
SSL: SSL_accept:SSLv3 write server done A
SSL: (where=0x2001 ret=0x1)
SSL: SSL_accept:SSLv3 flush data
SSL: (where=0x2002 ret=0xffffffff)
SSL: SSL_accept:error in SSLv3 read client certificate A
SSL: SSL_accept - want more data
SSL: 1612 bytes pending from ssl_out
EAP: EAP entering state METHOD_REQUEST
EAP: building EAP-Request: Identifier 105
SSL: Generating Request
SSL: Sending out 1393 bytes (219 more to send)
EAP: EAP entering state SEND_REQUEST
EAP: EAP entering state IDLE
EAP: retransmit timeout 3 seconds (from dynamic back off; retransCount=0)
==> Request
---[ peer ]----------------------------------
EAP: EAP entering state RECEIVED
EAP: Received EAP-Request id=105 method=21 vendor=0 vendorMethod=0
EAP: EAP entering state METHOD
SSL: Received packet(len=1403) - Flags 0xc0
SSL: TLS Message Length: 1612
SSL: Need 219 bytes more input data
SSL: Building ACK (type=21 id=105 ver=0)
EAP: method process -> ignore=FALSE methodState=MAY_CONT decision=FAIL
EAP: EAP entering state SEND_RESPONSE
EAP: EAP entering state IDLE
==> Response
---[ server ]--------------------------------
EAP: EAP entering state RECEIVED
EAP: parseEapResp: rxResp=1 respId=105 respMethod=21 respVendor=0 respVendorMethod=0
EAP: EAP entering state INTEGRITY_CHECK
EAP: EAP entering state METHOD_RESPONSE
SSL: Received packet(len=6) - Flags 0x00
SSL: Received packet: Flags 0x0 Message Length 0
SSL: Fragment acknowledged
EAP: EAP entering state METHOD_REQUEST
EAP: building EAP-Request: Identifier 106
SSL: Generating Request
SSL: Sending out 219 bytes (message sent completely)
EAP: EAP entering state SEND_REQUEST
EAP: EAP entering state IDLE
EAP: retransmit timeout 3 seconds (from dynamic back off; retransCount=0)
==> Request
---[ peer ]----------------------------------
EAP: EAP entering state RECEIVED
EAP: Received EAP-Request id=106 method=21 vendor=0 vendorMethod=0
EAP: EAP entering state METHOD
SSL: Received packet(len=225) - Flags 0x00
SSL: (where=0x1001 ret=0x1)
SSL: SSL_connect:SSLv3 read server hello A
TLS: tls_verify_cb - preverify_ok=1 err=0 (ok) depth=1 buf='/C=US/ST=California/O=w1.fi/CN=Test CA/emailAddress=testca at w1.fi'
TLS: tls_verify_cb - preverify_ok=1 err=0 (ok) depth=0 buf='/C=US/ST=California/L=San Francisco/O=w1.fi/CN=Test AS/emailAddress=testas at w1.fi'
SSL: (where=0x1001 ret=0x1)
SSL: SSL_connect:SSLv3 read server certificate A
SSL: (where=0x1001 ret=0x1)
SSL: SSL_connect:SSLv3 read server done A
SSL: (where=0x1001 ret=0x1)
SSL: SSL_connect:SSLv3 write client key exchange A
SSL: (where=0x1001 ret=0x1)
SSL: SSL_connect:SSLv3 write change cipher spec A
SSL: (where=0x1001 ret=0x1)
SSL: SSL_connect:SSLv3 write finished A
SSL: (where=0x1001 ret=0x1)
SSL: SSL_connect:SSLv3 flush data
SSL: (where=0x1002 ret=0xffffffff)
SSL: SSL_connect:error in SSLv3 read finished A
SSL: SSL_connect - want more data
SSL: 198 bytes pending from ssl_out
SSL: 198 bytes left to be sent out (of total 198 bytes)
EAP: method process -> ignore=FALSE methodState=MAY_CONT decision=FAIL
EAP: EAP entering state SEND_RESPONSE
EAP: EAP entering state IDLE
==> Response
---[ server ]--------------------------------
EAP: EAP entering state RECEIVED
EAP: parseEapResp: rxResp=1 respId=106 respMethod=21 respVendor=0 respVendorMethod=0
EAP: EAP entering state INTEGRITY_CHECK
EAP: EAP entering state METHOD_RESPONSE
SSL: Received packet(len=204) - Flags 0x00
SSL: Received packet: Flags 0x0 Message Length 0
SSL: (where=0x2001 ret=0x1)
SSL: SSL_accept:SSLv3 read client key exchange A
SSL: (where=0x2001 ret=0x1)
SSL: SSL_accept:SSLv3 read finished A
SSL: (where=0x2001 ret=0x1)
SSL: SSL_accept:SSLv3 write change cipher spec A
SSL: (where=0x2001 ret=0x1)
SSL: SSL_accept:SSLv3 write finished A
SSL: (where=0x2001 ret=0x1)
SSL: SSL_accept:SSLv3 flush data
SSL: (where=0x20 ret=0x1)
SSL: (where=0x2002 ret=0x1)
SSL: 59 bytes pending from ssl_out
EAP: EAP entering state METHOD_REQUEST
EAP: building EAP-Request: Identifier 107
EAP-TTLS: Phase1 done, starting Phase2
EAP-TTLS: PHASE1 -> PHASE2_START
SSL: Generating Request
SSL: Sending out 59 bytes (message sent completely)
EAP: EAP entering state SEND_REQUEST
EAP: EAP entering state IDLE
EAP: retransmit timeout 3 seconds (from dynamic back off; retransCount=0)
==> Request
---[ peer ]----------------------------------
EAP: EAP entering state RECEIVED
EAP: Received EAP-Request id=107 method=21 vendor=0 vendorMethod=0
EAP: EAP entering state METHOD
SSL: Received packet(len=65) - Flags 0x00
SSL: (where=0x1001 ret=0x1)
SSL: SSL_connect:SSLv3 read finished A
SSL: (where=0x20 ret=0x1)
SSL: (where=0x1002 ret=0x1)
SSL: 0 bytes pending from ssl_out
OpenSSL: tls_connection_handshake - Failed to read possible Application Data error:00000000:lib(0):func(0):reason(0)
SSL: No data to be sent out
EAP-TTLS: TLS done, proceed to Phase 2
EAP-TTLS: Derived key - hexdump(len=64): [REMOVED]
EAP-TTLS: received 0 bytes encrypted data for Phase 2
EAP-TTLS: empty data in beginning of Phase 2 - use fake EAP-Request Identity
EAP-TTLS: Phase 2 MSCHAPV2 Request
MSCHAPV2: Identity - hexdump_ascii(len=4):
     75 73 65 72                                       user            
MSCHAPV2: Username - hexdump_ascii(len=4):
     75 73 65 72                                       user            
MSCHAPV2: auth_challenge - hexdump(len=16): d5 8b 10 4f 08 7a 11 36 c9 32 f0 f5 36 5f 31 06
MSCHAPV2: peer_challenge - hexdump(len=16): 00 00 00 11 00 00 00 70 c1 0b 08 98 71 de b7 10
MSCHAPV2: username - hexdump_ascii(len=4):
     75 73 65 72                                       user            
MSCHAPV2: password - hexdump_ascii(len=8): [REMOVED]
MSCHAPV2: NT Response - hexdump(len=24): c4 2a b8 af 15 9f 99 36 29 69 79 7c fa 5e e4 53 9f cc 79 df cf d2 db 7c
MSCHAPV2: Auth Response - hexdump(len=20): 6c 9e f8 7e 1a 9f da c4 14 f1 96 db 96 3b 7e 0d fa bf 09 0c
MSCHAPV2: Master Key - hexdump(len=16): [REMOVED]
EAP-TTLS: Encrypting Phase 2 data - hexdump(len=104): [REMOVED]
SSL: 170 bytes left to be sent out (of total 170 bytes)
EAP: method process -> ignore=FALSE methodState=MAY_CONT decision=FAIL
EAP: EAP entering state SEND_RESPONSE
EAP: EAP entering state IDLE
==> Response
---[ server ]--------------------------------
EAP: EAP entering state RECEIVED
EAP: parseEapResp: rxResp=1 respId=107 respMethod=21 respVendor=0 respVendorMethod=0
EAP: EAP entering state INTEGRITY_CHECK
EAP: EAP entering state METHOD_RESPONSE
SSL: Received packet(len=176) - Flags 0x00
SSL: Received packet: Flags 0x0 Message Length 0
EAP-TTLS: received 170 bytes encrypted data for Phase 2
EAP-TTLS: Decrypted Phase 2 EAP - hexdump(len=104): [REMOVED]
EAP-TTLS: AVP: code=1 flags=0x40 length=12
EAP-TTLS: AVP data - hexdump(len=4): 75 73 65 72
EAP-TTLS: User-Name - hexdump_ascii(len=4):
     75 73 65 72                                       user            
EAP-TTLS: AVP: code=11 flags=0xc0 length=28
EAP-TTLS: AVP vendor_id 311
EAP-TTLS: AVP data - hexdump(len=16): d5 8b 10 4f 08 7a 11 36 c9 32 f0 f5 36 5f 31 06
EAP-TTLS: MS-CHAP-Challenge - hexdump(len=16): d5 8b 10 4f 08 7a 11 36 c9 32 f0 f5 36 5f 31 06
EAP-TTLS: AVP: code=25 flags=0xc0 length=62
EAP-TTLS: AVP vendor_id 311
EAP-TTLS: AVP data - hexdump(len=50): fb 00 00 00 00 11 00 00 00 70 c1 0b 08 98 71 de b7 10 00 00 00 00 00 00 00 00 c4 2a b8 af 15 9f 99 36 29 69 79 7c fa 5e e4 53 9f cc 79 df cf d2 db 7c
EAP-TTLS: MS-CHAP2-Response (MSCHAPV2) - hexdump(len=50): fb 00 00 00 00 11 00 00 00 70 c1 0b 08 98 71 de b7 10 00 00 00 00 00 00 00 00 c4 2a b8 af 15 9f 99 36 29 69 79 7c fa 5e e4 53 9f cc 79 df cf d2 db 7c
EAP-TTLS/MSCHAPV2: User - hexdump_ascii(len=4):
     75 73 65 72                                       user            
EAP-TTLS/MSCHAPV2: auth_challenge - hexdump(len=16): d5 8b 10 4f 08 7a 11 36 c9 32 f0 f5 36 5f 31 06
EAP-TTLS/MSCHAPV2: peer_challenge - hexdump(len=16): 00 00 00 11 00 00 00 70 c1 0b 08 98 71 de b7 10
EAP-TTLS/MSCHAPV2: Correct NT-Response
EAP-TTLS: PHASE2_START -> PHASE2_MSCHAPV2_RESP
EAP: EAP entering state METHOD_REQUEST
EAP: building EAP-Request: Identifier 108
EAP-TTLS/MSCHAPV2: Encrypting Phase 2 data - hexdump(len=55): [REMOVED]
SSL: Generating Request
SSL: Sending out 138 bytes (message sent completely)
EAP: EAP entering state SEND_REQUEST
EAP: EAP entering state IDLE
EAP: retransmit timeout 3 seconds (from dynamic back off; retransCount=0)
==> Request
---[ peer ]----------------------------------
EAP: EAP entering state RECEIVED
EAP: Received EAP-Request id=108 method=21 vendor=0 vendorMethod=0
EAP: EAP entering state METHOD
SSL: Received packet(len=144) - Flags 0x00
EAP-TTLS: received 138 bytes encrypted data for Phase 2
EAP-TTLS: Decrypted Phase 2 AVPs - hexdump(len=55): 00 00 00 1a c0 00 00 37 00 00 01 37 fb 53 3d 36 43 39 45 46 38 37 45 31 41 39 46 44 41 43 34 31 34 46 31 39 36 44 42 39 36 33 42 37 45 30 44 46 41 42 46 30 39 30 43
EAP-TTLS: AVP: code=26 flags=0xc0 length=55
EAP-TTLS: AVP vendor_id 311
EAP-TTLS: AVP data - hexdump(len=43): fb 53 3d 36 43 39 45 46 38 37 45 31 41 39 46 44 41 43 34 31 34 46 31 39 36 44 42 39 36 33 42 37 45 30 44 46 41 42 46 30 39 30 43
EAP-TTLS: MS-CHAP2-Success - hexdump_ascii(len=43):
     fb 53 3d 36 43 39 45 46 38 37 45 31 41 39 46 44   _S=6C9EF87E1A9FD
     41 43 34 31 34 46 31 39 36 44 42 39 36 33 42 37   AC414F196DB963B7
     45 30 44 46 41 42 46 30 39 30 43                  E0DFABF090C     
EAP-TTLS: Phase 2 MSCHAPV2 authentication succeeded
EAP-TTLS: Authentication completed successfully
SSL: Building ACK (type=21 id=108 ver=0)
EAP: method process -> ignore=FALSE methodState=DONE decision=UNCOND_SUCC
EAP: EAP entering state SEND_RESPONSE
EAP: EAP entering state IDLE
==> Response
---[ server ]--------------------------------
EAP: EAP entering state RECEIVED
EAP: parseEapResp: rxResp=1 respId=108 respMethod=21 respVendor=0 respVendorMethod=0
EAP: EAP entering state INTEGRITY_CHECK
EAP: EAP entering state METHOD_RESPONSE
SSL: Received packet(len=6) - Flags 0x00
SSL: Received packet: Flags 0x0 Message Length 0
EAP-TTLS/MSCHAPV2: Peer acknowledged response
EAP-TTLS: PHASE2_MSCHAPV2_RESP -> SUCCESS
EAP-TTLS: Derived key - hexdump(len=64): [REMOVED]
EAP: EAP entering state SELECT_ACTION
EAP: getDecision: method succeeded -> SUCCESS
EAP: EAP entering state SUCCESS
EAP: Building EAP-Success (id=108)
==> Success
EAP keying material - hexdump(len=64): eb ca 92 2f b2 7c 32 73 31 54 4e 44 18 3b 75 f0 04 29 a3 87 92 f9 7a 7f 0a 71 de 49 63 c3 a6 be 76 3e cc 4e 16 04 50 30 e5 bc bf 10 9b c0 60 ab ae e4 43 27 e7 74 18 51 08 54 ef d7 78 b0 ad 68
---[ peer ]----------------------------------
EAP: EAP entering state RECEIVED
EAP: Received EAP-Success
EAP: EAP entering state SUCCESS
CTRL-EVENT-EAP-SUCCESS EAP authentication completed successfully
EAP keying material - hexdump(len=64): eb ca 92 2f b2 7c 32 73 31 54 4e 44 18 3b 75 f0 04 29 a3 87 92 f9 7a 7f 0a 71 de 49 63 c3 a6 be 76 3e cc 4e 16 04 50 30 e5 bc bf 10 9b c0 60 ab ae e4 43 27 e7 74 18 51 08 54 ef d7 78 b0 ad 68
EAP: deinitialize previously used EAP method (21, TTLS) at EAP deinit
EAP: Server state machine removed


More information about the HostAP mailing list