在进行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. SDL源码阅读笔记(2) video dirver的初始化及选择

    write by 九天雁翎(JTianLing) -- blog.csdn.net/vagrxie 前一篇文章 讲了SDL的除video以外的大部分模块.本文主要关注SDL的video模块部分. SD ...

  2. 【SPOJ10628】Count on a tree

    题目大意:给定一棵 N 个节点的树,点有点权,要求回答 M 个询问,每次询问点 u 到点 v 的简单路径(链)上权值第 K 小是多少. 题解:学习到了树上主席树. 主席树维护序列时,每次将后一个点的树 ...

  3. hdu4549_M斐波那契数列 解题报告

    Solution: 1.快速幂:数/矩阵 2.以证明1000000007是素数. 费马小定理: 若p是素数,gcd(a,p)=1,则a^(p-1)1(mod p). 若a^b mod p 中b很大,则 ...

  4. 在Vue中如何使用axios跨域访问数据(转)

    最近在项目中需要用到axios,所以就恶补一下这个axios到底是什么东东.越来它是vue-resource的替代品,官网也说了,以后都用axios, vue-resource不在维护.那么这个axi ...

  5. java代码示例(6-3)

    创建AdministratorTest.java /** * 需求分析:创建管理员对象 * @author chenyanlong * 日期:2017/10/15 */ package com.hp. ...

  6. ubuntu14.04上java jdk & mvn安装

    这些常用工具的安装步骤还是自己记录下,以后再次用到时就会方便许多. 系统:ubuntu14.04 jdk安装. 1.从官网下载好jdk安装包 jdk-8u111-linux-x64.tar.gz 2. ...

  7. 20190311 Java处理JSON的常用类库

    1. Gson 1.1. 背景 谷歌 1.2. 简单使用 Gson gson = new Gson(); System.out.println(gson.toJson(1)); // ==> 1 ...

  8. Swift学习笔记7--访问控制

    在Swift语言中,访问修饰符有三种,分别为private,internal和public.同时,Swift对于访问权限的控制,不是基于类的,而是基于文件的.其区别如下: 1,private priv ...

  9. python---tornado初识(2)实现登录和发布文章

    # coding:utf8 # __author: Administrator # date: 2018/3/6 0006 # /usr/bin/env python import tornado.i ...

  10. go for range

    func main() { var str = "hellow worda" for _, val := range str { fmt.Printf("%q" ...