【问题标题】:How do I fix "ssl handshake failed" with ApacheBench?如何使用 ApacheBench 修复“ssl 握手失败”?
【发布时间】:2010-09-16 10:36:12
【问题描述】:

当我使用ApacheBench测试https时,返回错误,“ssl handshake failed”。

如何使用 ApacheBench 测试 https?

【问题讨论】:

  • apachebench标签替换为apache-bench,以匹配相似标签。
  • 这似乎是由错误的证书引起的。 AB 自动使用 SSL。

标签: apache https apachebench


【解决方案1】:

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

它不如 AB 精确,但给出了想法。在比较测试中表现良好。

【讨论】:

  • 第二个日期会在wgets完成之前执行,所以没用。
  • 你是对的。我没有删除行尾的&amp;。解决了这个问题。
  • 比不上AB
【解决方案2】:

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.

【讨论】:

    【解决方案3】:

    我最近遇到了这个问题。作为一种解决方法,我使用了 loadtest npm 包,它具有与 ab 类似的选项:

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

    【讨论】:

      猜你喜欢
      • 2018-07-28
      • 2012-10-11
      • 2015-03-16
      • 2021-12-28
      • 2018-10-17
      • 2016-04-29
      • 2014-03-05
      • 1970-01-01
      相关资源
      最近更新 更多