我目前正在测试两个独立系统之间的连通性。当我尝试通过我们的软件进行web服务调用时,我注意到日志中反复出现401错误:
Caused by: org.apache.cxf.transport.http.HTTPException: HTTP response '401: Unauthorized' when communicating with https://testsystem.endpoint/webservice
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:1530)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:1490)从我所拥有的read on SO来看,401告诉您尚未成功登录或验证到您正在尝试连接的任何服务器。我已经通知了那些控制目标端点的人,并且我被告知我不需要登录,并且“一切都由证书进行身份验证”。据我所知,SSL/TLS证书当然可以作为一种身份验证方式,如果您在证书中声称是X,并且您的证书已由受信任的CA签名,那么您最有可能是X。但是,我相信这与输入有效或无效的登录凭据不同(我认为这更接近于401错误的原因)。
我尝试使用我的公钥对以及目标端点证书的根证书卷曲端点。我可以看到似乎有两个单独的SSL握手,我相信这是SSL renegotiation。我可以清楚地看到401错误再次发生:
$ curl -vv --cert cert.pem --cacert root.pem https://testsystem.endpoint/webservice
* About to connect() to testsystem.endpoint/webserivce port 443 (#0)
* Trying TEST.IP.ADDRESS.FAKE... connected
* Connected to testsystem.endpoint/webserivce (TEST.IP.ADDRESS.FAKE) port 443 (#0)
Enter PEM pass phrase:
* successfully set certificate verify locations:
* CAfile: root.pem
CApath: none
* SSLv2, Client hello (1):
* SSLv3, TLS handshake, Server hello (2):
* SSLv3, TLS handshake, CERT (11):
* SSLv3, TLS handshake, Server finished (14):
* SSLv3, TLS handshake, Client key exchange (16):
* SSLv3, TLS change cipher, Client hello (1):
* SSLv3, TLS handshake, Finished (20):
* SSLv3, TLS change cipher, Client hello (1):
* SSLv3, TLS handshake, Finished (20):
* SSL connection using AES128-SHA
* Server certificate:
* subject: /OU=Domain Control Validated/CN=TEST.CN.FAKE
* start date: 2015-07-07 22:44:38 GMT
* expire date: 2016-07-19 16:55:05 GMT
* subjectAltName: testsystem.endpoint/webserivce matched
* issuer: /C=US/ST=fake/L=fake/O=Company.com, Inc./OU=http://certs.company.com/repository//CN=Company Secure Certificate Authority
* SSL certificate verify ok.
> GET /webservice HTTP/1.1
> User-Agent: curl/7.16.2 (x86_64-unknown-linux-gnu) libcurl/7.16.2 OpenSSL/0.9.8b zlib/1.2.3
> Host: testsystem.endpoint/webserivce
> Accept: */*
>
* SSLv3, TLS handshake, Hello request (0):
* SSLv3, TLS handshake, Client hello (1):
* SSLv3, TLS handshake, Server hello (2):
* SSLv3, TLS handshake, CERT (11):
* SSLv3, TLS handshake, Request CERT (13):
* SSLv3, TLS handshake, Server finished (14):
* SSLv3, TLS handshake, CERT (11):
* SSLv3, TLS handshake, Client key exchange (16):
* SSLv3, TLS handshake, CERT verify (15):
* SSLv3, TLS change cipher, Client hello (1):
* SSLv3, TLS handshake, Finished (20):
* SSLv3, TLS change cipher, Client hello (1):
* SSLv3, TLS handshake, Finished (20):
< HTTP/1.1 401 Unauthorized
< Content-Type: text/html
< Server: Microsoft-IIS/7.5
< X-Powered-By: ASP.NET
< Date: Sat, 05 Sep 2015 00:16:21 GMT我不认为我的问题必然与SSL/TLS握手有关:我已经为另一端(在我这一端是受信任的)建立了完整的证书链,并且我可以看到第一次SSL/TLS握手似乎起作用了。我想我的问题是:当我使用我认为有效的密钥对时,为什么另一端401‘攻击我?
发布于 2018-11-17 05:38:37
可能您使用的OpenSSL版本太旧了。
TLS 1.2支持已于2012年引入,版本为1.0.1,而您使用的是0.98b
尝试升级cUrl和OpenSSL。
https://stackoverflow.com/questions/32466811
复制相似问题