在进行802.1x 测试时遇到如下问题:

Waking up in 4.6 seconds.
(156) Received Access-Request Id 82 from 192.168.1.126:44896 to 192.168.1.122:1812 length 524
(156)   User-Name = "dddddd"
(156)   Called-Station-Id = "70-CC-CC-E3-00-91:myssid"
(156)   NAS-Port-Type = Wireless-802.11
(156)   NAS-Port = 1
(156)   Calling-Station-Id = "70-CC-CC-E1-22-35"
(156)   Connect-Info = "CONNECT 54Mbps 802.11g"
(156)   Acct-Session-Id = "59BD3E8C-000000DB"
(156)   Framed-MTU = 1400
(156)   EAP-Message = 0x025101580d0016030100070b00000300000016030101061000010201005334a243b0db1f6b723285cb5c7e721c0c14fde8164460fdf99b40e26ef1e98c4388577b61732cf224c668bd961722be74963d055c18293b95d9ed937e331d4ad0f0afaba131a9a3d1c8d1b44d201a9a26ff9ddf6b26deb7ee58
(156)   State = 0xf8598809fd08850a5fc36ea7518e8167
(156)   Message-Authenticator = 0x33eb613f3409a98c69ee6ab0e649785b
(156) session-state: No cached attributes
(156) # Executing section authorize from file /usr/local/etc/raddb/sites-enabled/default
(156)   authorize {
(156)     policy filter_username {
(156)       if (&User-Name) {
(156)       if (&User-Name)  -> TRUE
(156)       if (&User-Name)  {
(156)         if (&User-Name =~ / /) {
(156)         if (&User-Name =~ / /)  -> FALSE
(156)         if (&User-Name =~ /@[^@]*@/ ) {
(156)         if (&User-Name =~ /@[^@]*@/ )  -> FALSE
(156)         if (&User-Name =~ /\.\./ ) {
(156)         if (&User-Name =~ /\.\./ )  -> FALSE
(156)         if ((&User-Name =~ /@/) && (&User-Name !~ /@(.+)\.(.+)$/))  {
(156)         if ((&User-Name =~ /@/) && (&User-Name !~ /@(.+)\.(.+)$/))   -> FALSE
(156)         if (&User-Name =~ /\.$/)  {
(156)         if (&User-Name =~ /\.$/)   -> FALSE
(156)         if (&User-Name =~ /@\./)  {
(156)         if (&User-Name =~ /@\./)   -> FALSE
(156)       } # if (&User-Name)  = notfound
(156)     } # policy filter_username = notfound
(156)     [preprocess] = ok
(156)     [chap] = noop
(156)     [mschap] = noop
(156)     [digest] = noop
(156) suffix: Checking for suffix after "@"
(156) suffix: No '@' in User-Name = "dddddd", looking up realm NULL
(156) suffix: No such realm "NULL"
(156)     [suffix] = noop
(156) eap: Peer sent EAP Response (code 2) ID 81 length 344
(156) eap: No EAP Start, assuming it's an on-going EAP conversation
(156)     [eap] = updated
(156) files: users: Matched entry huwomo at line 221
(156)     [files] = ok
(156)     [expiration] = noop
(156)     [logintime] = noop
(156) pap: WARNING: Auth-Type already set.  Not setting to PAP
(156)     [pap] = noop
(156)   } # authorize = updated
(156) Found Auth-Type = eap
(156) # Executing group from file /usr/local/etc/raddb/sites-enabled/default
(156)   authenticate {
(156) eap: Expiring EAP session with state 0xf8598809fd08850a
(156) eap: Finished EAP session with state 0xf8598809fd08850a
(156) eap: Previous EAP request found for state 0xf8598809fd08850a, released from the list
(156) eap: Peer sent packet with method EAP TLS (13)
(156) eap: Calling submodule eap_tls to process data
(156) eap_tls: Continuing EAP-TLS
(156) eap_tls: [eaptls verify] = ok
(156) eap_tls: Done initial handshake
(156) eap_tls: <<< recv TLS 1.0 Handshake [length 0007], Certificate
(156) eap_tls: >>> send TLS 1.0 Alert [length 0002], fatal handshake_failure
(156) eap_tls: ERROR: TLS Alert write:fatal:handshake failure
tls: TLS_accept: Error in error
(156) eap_tls: ERROR: Failed in __FUNCTION__ (SSL_read): error:140890C7:SSL routines:ssl3_get_client_certificate:peer did not return a certificate
(156) eap_tls: ERROR: System call (I/O) error (-1)
(156) eap_tls: ERROR: TLS receive handshake failed during operation
(156) eap_tls: ERROR: [eaptls process] = fail
(156) eap: ERROR: Failed continuing EAP TLS (13) session.  EAP sub-module failed
(156) eap: Sending EAP Failure (code 4) ID 81 length 4
(156) eap: Failed in EAP select
(156)     [eap] = invalid
(156)   } # authenticate = invalid
(156) Failed to authenticate the user
(156) Using Post-Auth-Type Reject
(156) # Executing group from file /usr/local/etc/raddb/sites-enabled/default
(156)   Post-Auth-Type REJECT {
(156) attr_filter.access_reject: EXPAND %{User-Name}
(156) attr_filter.access_reject:    --> huwomo
(156) attr_filter.access_reject: Matched entry DEFAULT at line 11
(156)     [attr_filter.access_reject] = updated
(156)     [eap] = noop
(156)     policy remove_reply_message_if_eap {
(156)       if (&reply:EAP-Message && &reply:Reply-Message) {
(156)       if (&reply:EAP-Message && &reply:Reply-Message)  -> FALSE
(156)       else {
(156)         [noop] = noop
(156)       } # else = noop
(156)     } # policy remove_reply_message_if_eap = noop
(156)   } # Post-Auth-Type REJECT = updated
(156) Login incorrect (eap_tls: TLS Alert write:fatal:handshake failure): [huwomo] (from client hwm port 1 cli 78-C2-C0-E1-22-35)
(156) Delaying response for 1.000000 seconds

EAP-TLS  测试过程中, freeradius 服务器端报错如上,没有得到client端正确的证书。

而 client端 报出的错误是  密钥解析错误,跟踪 wpa_supplicant 代码,得到如下内容:

Thu Sep 21 17:35:18 2017 user.debug syslog: eap_peer_sm_step_received 697
Thu Sep 21 17:35:18 2017 user.debug syslog: EAP: Status notification: started (param=)
Thu Sep 21 17:35:19 2017 user.debug syslog: EAP: Status notification: refuse proposed method (param=PEAP)
Thu Sep 21 17:35:19 2017 user.debug syslog: EAP: Status notification: accept proposed method (param=TLS)
Thu Sep 21 17:35:19 2017 user.debug syslog: sm_EAP_GET_METHOD_Enter 290, selectedMethod : 0, reqMethod : 13
Thu Sep 21 17:35:19 2017 user.debug syslog: EAP: Initialize selected EAP method: vendor 0 method 13 (TLS)
Thu Sep 21 17:35:19 2017 user.debug syslog: asn1_parse_oid 95 
Thu Sep 21 17:35:19 2017 user.debug syslog: crypto_private_key_import 50
Thu Sep 21 17:35:19 2017 user.debug syslog: pkcs8_enc_key_import 156 class : 0, tag : d
Thu Sep 21 17:35:19 2017 user.debug syslog: Trying to parse PKCS #1 encoded RSA private key
Thu Sep 21 17:35:19 2017 user.debug syslog: crypto_rsa_import_private_key 199 class : 0, tag : d
Thu Sep 21 17:35:19 2017 user.debug syslog: crypto_private_key_import 44
Thu Sep 21 17:35:19 2017 user.debug syslog: pkcs8_key_import 27
Thu Sep 21 17:35:19 2017 user.debug syslog: pkcs8_key_import 45 class : 0, tag : 10
Thu Sep 21 17:35:19 2017 user.debug syslog: crypto_private_key_import 50
Thu Sep 21 17:35:19 2017 user.debug syslog: pkcs5_decrypt 187
Thu Sep 21 17:35:19 2017 user.debug syslog: pkcs5_get_params 54
Thu Sep 21 17:35:19 2017 user.debug syslog: asn1_parse_oid 95
Thu Sep 21 17:35:19 2017 user.debug syslog: PKCS #5: encryption algorithm 1.2.840.113549.1.5.13
Thu Sep 21 17:35:19 2017 user.debug syslog: PKCS #5: unsupported encryption algorithm 1.2.840.113549.1.5.13
Thu Sep 21 17:35:19 2017 user.debug syslog: Trying to parse PKCS #1 encoded RSA private key
Thu Sep 21 17:35:19 2017 user.debug syslog: crypto_rsa_parse_integer 41
Thu Sep 21 17:35:19 2017 user.debug syslog: crypto_rsa_import_private_key 213
Thu Sep 21 17:35:19 2017 user.debug syslog: TLSv1: Failed to parse private key
Thu Sep 21 17:35:19 2017 user.debug syslog: eap_tls_init_connection 194 res : -1
Thu Sep 21 17:35:19 2017 user.debug syslog: EAP-TLS: Start
Thu Sep 21 17:35:19 2017 user.debug syslog: SSL: Building ACK (type=13 id=217 ver=0)
Thu Sep 21 17:35:19 2017 user.debug syslog: SSL: Building ACK (type=13 id=218 ver=0)
Thu Sep 21 17:35:19 2017 user.debug syslog: SSL: Building ACK (type=13 id=219 ver=0)
Thu Sep 21 17:35:24 2017 user.debug syslog: EAP: Status notification: completion (param=failure)

在 tlsv1_set_key 中使用 PKCS#1 /  PKCS#5  / PKCS#8 方式解析密钥文件,均解析错误。

static int tlsv1_set_key(struct tlsv1_credentials *cred,
    const u8 *key, size_t len, const char *passwd)
{
 syslog(LOG_DEBUG, "%s %d", __func__, __LINE__);
 cred->key = crypto_private_key_import(key, len, passwd);
 if (cred->key == NULL)
  cred->key = tlsv1_set_key_pem(key, len);

if (cred->key == NULL)
  cred->key = tlsv1_set_key_enc_pem(key, len, passwd);
 
 if (cred->key == NULL) {
  syslog(LOG_DEBUG, "TLSv1: Failed to parse private key");
  wpa_printf(MSG_INFO, "TLSv1: Failed to parse private key");
  return -1;
 }
 return 0;
}

其中 使用PKCS#5 解析时,报错如下:

Thu Sep 21 17:35:19 2017 user.debug syslog: PKCS #5: encryption algorithm 1.2.840.113549.1.5.13
Thu Sep 21 17:35:19 2017 user.debug syslog: PKCS #5: unsupported encryption algorithm 1.2.840.113549.1.5.13

查找代码,在函数 pkcs5_get_params 中,解析params->alg = pkcs5_get_alg(&oid); 时,值应该为

static enum pkcs5_alg pkcs5_get_alg(struct asn1_oid *oid)
{
 if (oid->len == 7 &&
     oid->oid[0] == 1 /* iso */ &&
     oid->oid[1] == 2 /* member-body */ &&
     oid->oid[2] == 840 /* us */ &&
     oid->oid[3] == 113549 /* rsadsi */ &&
     oid->oid[4] == 1 /* pkcs */ &&
     oid->oid[5] == 5 /* pkcs-5 */ &&
     oid->oid[6] == 3 /* pbeWithMD5AndDES-CBC */)    
  return PKCS5_ALG_MD5_DES_CBC;

return PKCS5_ALG_UNKNOWN;
}

错在最后一位不相符。

通过查看  OID 节点 网页 http://oidref.com/   上相关内容得知:

1.2.840.113549.1.5.13    pkcs5 pebs2

1.2.840.113549.1.5.3        pbeWithMD5AndDES-CBC

两者加密的方式不同,  前者为 pebs2,  后者为 md5 des-cbc.

查看wpa-supplicant 修改日志, 得知  2016-10-2,V2.6  的修改日志中记录

	* TLS client
- do not verify CA certificates when ca_cert is not specified
- support validating server certificate hash
- support SHA384 and SHA512 hashes
- add signature_algorithms extension into ClientHello
- support TLS v1.2 signature algorithm with SHA384 and SHA512
- support server certificate probing
- allow specific TLS versions to be disabled with phase2 parameter
- support extKeyUsage
- support PKCS #5 v2.0 PBES2
- support PKCS #5 with PKCS #12 style key decryption
- minimal support for PKCS #12
- support OCSP stapling (including ocsp_multi)

了加入了对PEBS2的解析。

因此将代码升级到相应版本,问题解决。

此处留有疑问的是: 由于使用git使用的较少, 也懒的移植最新的wpa-supplicant的代码到openwrt  bb版本,从trunk版本上更新了hostapd代码为 2016-01-15  的版本也支持,不知道git跟 官网是怎样对应的。

freeradius 错误: error:140890C7:SSL routines:ssl3_get_client_certificate:peer did not return a certificate的更多相关文章

  1. delphi indy Idhttp error:1409442E:SSL routines:SSL3_READ_BYTES:tlsv1 alert protocol version

    在使用 indy 中的 idhttp 组件访问 https 网站时,出现如下错误: error:1409442E:SSL routines:SSL3_READ_BYTES:tlsv1 alert pr ...

  2. last error : SSL certificate problem, verify that the CA cert is OK. Details: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate veri

    今天在用搜狐提供的邮件群发系统的sdk,做发送邮件的测试时,提示: last error : SSL certificate problem, verify that the CA cert is O ...

  3. 重装@angular/cli reason: write EPROTO 139955972261696:error:1408F10B:SSL routines:ssl3_get_record:wrong version number:../deps/openssl/openssl/ssl/record/ssl3_record.c:252:

    前几天不小心卸载了 angular@cli,然后重装的时候发现,一直报错.如下: ××××××××@××××ln622653:/$ npm install -g @angular/clinpm ERR ...

  4. composer在update时提示file could not be downloaded: SSL operation failed with code 1. OpenSSL Error messages: error:1407742E:SSL routines:SSL23_GET_SERVER_HELLO

    在开发的时候,需要把依赖的服务更新到最新,然后 手动composer update一下,提示如下: failed) Update failed (The "e "https://a ...

  5. 【问题与解决】Github 上传代码报错(error:1407742E:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert protocol version)

    今天修改了GitHub 的代码,代码更新,想上传更新,却发现上传报错. 错误代码:error:1407742E:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 al ...

  6. centos8 curl: (35) error:141A318A:SSL routines:tls_process_ske_dhe:dh key too small

    centos8操作系统,curl -k https:/www.xxx.com 报错  curl: (35) error:141A318A:SSL routines:tls_process_ske_dh ...

  7. Loadrunner回放https脚本时出现错误Error -27780 Connection reset by peer解决办法

    录制好的https协议的web脚本,在脚本回放时会出现Error -27780: [GENERAL_MSG_CAT_SSL_ERROR]connect to host "......&quo ...

  8. nginx 报错:[crit] 12456#0: *5 SSL_do_handshake() failed (SSL: error:1408A0A0:SSL routines:SSL3_GET_CLIENT_HELLO

    解决方法: 将配置 listen ssl; 更换为: listen ; ssl on; 从版本1.15.0开始,ssl on; 指令被废弃,使用 listen 443 ssl; 代替. 具体查看官网: ...

  9. wget 报错 OpenSSL: error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failur

    解决办法 换成 curl -O -L xxxxxxxx

随机推荐

  1. CISCN2018-WP

    MISC: 验证码: 用token登录 输入好验证码就可以得到flag Picture: 图片隐写,一下就想到binwalk或者winhex打开试试 binwalk打开无果 将这段数据ctrl+shi ...

  2. 【洛谷P4054】计数问题

    题目大意:维护 N*M 个点,每个点有三个权值,支持单点修改,查询矩形区间内权值等于某个值的点的个数. 题解:矩阵可以看成两个维度,权值为第三个维度,为一个三维偏序维护问题.发现第三维仅仅为单点修改和 ...

  3. (转)Maven中的DependencyManagement和pluginmanagement

    背景:最近在学习maven的多模块构建过程中看到DependencyManagement选项,对这个选项的使用做个记录! 区别与联系 这里介绍一个在父项目中的根结点中声明dependencyManag ...

  4. 爬虫acm比赛成绩(多页成绩整合在一起、获取复制不了的数据)(hihocoder、计蒜客)

    https://github.com/congmingyige/web-crawler_rank-of-competition-in-JiSuanKe-and-hihocoder 1. 计蒜客(获取复 ...

  5. hdu 1097 A hard puzzle 快速幂取模

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1097 分析:简单题,快速幂取模, 由于只要求输出最后一位,所以开始就可以直接mod10. /*A ha ...

  6. Codeforces Round #523 (Div. 2) C. Multiplicity

    C. Multiplicity 题目链接:https://codeforc.es/contest/1061/problem/C 题意: 给出一串数,问它的“好序列“有多少.好序列的定义是,首先是一个子 ...

  7. poj 1904(强连通分量+完美匹配)

    传送门:Problem 1904 https://www.cnblogs.com/violet-acmer/p/9739990.html 参考资料: [1]:http://www.cnblogs.co ...

  8. 【bzoj5161】最长上升子序列 状压dp+打表

    题目描述 现在有一个长度为n的随机排列,求它的最长上升子序列长度的期望. 为了避免精度误差,你只需要输出答案模998244353的余数. 输入 输入只包含一个正整数n.N<=28 输出 输出只包 ...

  9. Ansible安装部署及常用模块详解

    Ansible命令使用 Ansible语法使用ansible <pattern_goes_here> -m <module_name> -a <arguments> ...

  10. Java_myBatis_xml代理写法

    这种开发方式只需要写好Mapper.xml和对应的Interface就可以了. 1.编写Mapper.xml <?xml version="1.0" encoding=&qu ...