简体   繁体   English

如何使用 ApacheBench 修复“ssl 握手失败”?

[英]How do I fix “ssl handshake failed” with ApacheBench?

When I use ApacheBench to test https, the error is returned, "ssl handshake failed".当我使用 ApacheBench 测试 https 时,返回错误,“ssl 握手失败”。

How can I use ApacheBench to test https?如何使用 ApacheBench 测试 https?

ApacheBench doesn't seem to be capable of ignoring certificate problems (at least some of them) so I wrote this script: ApacheBench 似乎无法忽略证书问题(至少其中一些),所以我写了这个脚本:

#!/bin/bash
K=200;    
HTTPSA='https://192.168.1.103:443/'    
date +%M-%S-%N>wgetres.txt
for (( c=1; c<=$K; c++ ))
do
    wget --no-check-certificate --secure-protocol=SSLv3 --spider $HTTPSA
done
date +%M-%S-%N>>wgetres.txt

It's not as precise as AB, but gives the idea.它不像AB那样精确,但给出了想法。 Does well in comparison tests.在对比测试中表现良好。

httperf is also single threaded, but as of today (Aug 31, 2012), it correctly handles SSL and even has a some useful additional features surrounding SSL: httperf也是单线程的,但截至今天(2012 年 8 月 31 日),它可以正确处理 SSL,甚至还有一些围绕 SSL 的有用附加功能:

 --ssl Specifies that all communication between httperf and the server should utilize the Secure Sockets Layer (SSL) protocol. This option is available only if httperf was compiled with SSL sup†port enabled. --ssl-ciphers=L This option is only meaningful if SSL is in use (see --ssl option). This option specifies the list L of cipher suites that httperf may use in negotiating a secure connection with the server. If the list contains more than one cipher suite, the ciphers must be separated by a colon. If the server does not accept any of the listed cipher suites, the connection estab†lishment will fail and httperf will exit immediately. If this option is not specified when the --ssl option is present then httperf will use all of the SSLv3 cipher suites provided by the underlying SSL library. --ssl-no-reuse This option is only meaningful if SSL and sessions are in use (see --ssl, --wsess, --wsesslog). When an SSL connection is established the client receives a session identifier (session id) from the server. On subsequent SSL connections, the client normally reuses this session id in order to avoid the expense of repeating the (slow) SSL handshake to establish a new SSL ses†sion and obtain another session id (even if the client attempts to re-use a session id, the server may force the client to rene†gotiate a session). By default httperf reuses the session id across all connections in a session. If the --ssl-no-reuse option is in effect, then httperf will not reuse the session id, and the entire SSL handshake will be performed for each new con†nection in a session.

I ran into this problem recently.我最近遇到了这个问题。 As a work around I used the loadtest npm package, which has similar options as ab:作为一种解决方法,我使用了 loadtest npm 包,它具有与 ab 类似的选项:

https://www.npmjs.com/package/loadtest https://www.npmjs.com/package/loadtest

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM