AB (Apache Bench) тест с взаимным TLS - PullRequest
0 голосов
/ 21 января 2019

Я использую сервер nginx с взаимной аутентификацией tls. Для скручивания Все нормально (я отвечаю, что мне нужно)

При испытательной нагрузке ab я получаю странные вещи Я использую эту команду ab -n 100000 -c 5000 -t 10000 -v 2 -E ../../containers/ngx-rosal/certs/client/rsa/clientB-key-crt.pem https://meteotravel.ru/

LOG: header received:
HTTP/1.1 200 OK
Server: nginx
Date: Mon, 21 Jan 2019 19:50:12 GMT
Content-Type: text/html
Content-Length: 872
Last-Modified: Wed, 16 Jan 2019 19:29:51 GMT
Connection: keep-alive
ETag: "5c3f862f-368"
Accept-Ranges: bytes

<!DOCTYPE html>
<html>
<head>
    <title>Welcome to nginx!</title>
    <style>
        body {
            width: 35em;
            margin: 0 auto;
            font-family: Tahoma, Verdana, Arial, sans-serif;
        }
    </style>
</head>
<body>
<h1>Welcome to nginx!</h1>
<h1>YAHOOOOOO</h1>
<h1>YAHOOOOOO</h1>
<h1>YAHOOOOOO</h1>
<h1>YAHOOOOOO</h1>
<h5>
   ohrwoqhro[whr[ohwqrohwro[ihwq[rhwqohrwrohwq
    werhowiehroqihro[wqhr[0ohwqohrwoqhro[whr[ohwqrohwro[ihwq[rhwqohrwrohwq
   </h5>
<p>If you see this page, the nginx web server is successfully installed and
    working. Further configuration is required.</p>

<p>For online documentation and support please refer to
    <a href="http://nginx.org/">nginx.org</a>.<br/>
    Commercial support is available at
    <a href="http://nginx.com/">nginx.com</a>.</p>

<p><em>Thank you for using nginx.</em></p>
</body>
</html>


Peer certificate
Certificate version: 1
Valid from: Dec 19 14:57:14 2018 GMT
Valid to  : Dec 19 14:57:14 2019 GMT
Public key is 2048 bits
The issuer name is /C=RU/ST=Some-State/O=Internet Widgits Pty Ltd/CN=abc.com/emailAddress=admin@abc.com
The subject name is /C=RU/ST=Some-State/O=Internet Widgits Pty Ltd/CN=meteotravel.ru/emailAddress=mail@devprofi.ru
Extension Count: 0
Transport Protocol      :TLSv1.2
Cipher Suite Protocol   :TLSv1.2
Cipher Suite Name       :ECDHE-RSA-AES256-GCM-SHA384
Cipher Suite Cipher Bits:256 (256)
SSL-Session:
    Protocol  : TLSv1.2
    Cipher    : ECDHE-RSA-AES256-GCM-SHA384
    Session-ID: FE75A19E671FD2873DD2BB2580716A3A5B3EDAC2959C3C6AE96E7BB0DD48CA03
    Session-ID-ctx: 
    Master-Key: 189FDF9E7E77DF276D0645EBAB49EC70322EB4A7D63D4D5E9CBBC6B33A82AA8EF6C84EF7922489EF1AA3C25361B95950
    PSK identity: None
    PSK identity hint: None
    SRP username: None
    Start Time: 1548089386
    Timeout   : 7200 (sec)
    Verify return code: 20 (unable to get local issuer certificate)
    Extended master secret: yes
LOG: header received:
HTTP/1.1 200 OK
Server: nginx
Date: Mon, 21 Jan 2019 19:47:24 GMT
Content-Type: text/html
Content-Length: 872
Last-Modified: Wed, 16 Jan 2019 19:29:51 GMT
Connection: keep-alive
ETag: "5c3f862f-368"
Accept-Ranges: bytes

<!DOCTYPE html>
<html>
<head>
    <title>Welcome to nginx!</title>
    <style>
        body {
            width: 35em;
            margin: 0 auto;
            font-family: Tahoma, Verdana, Arial, sans-serif;
        }
    </style>
</head>
<body>
<h1>Welcome to nginx!</h1>
<h1>YAHOOOOOO</h1>
<h1>YAHOOOOOO</h1>
<h1>YAHOOOOOO</h1>
<h1>YAHOOOOOO</h1>
<h5>
   ohrwoqhro[whr[ohwqrohwro[ihwq[rhwqohrwrohwq
    werhowiehroqihro[wqhr[0ohwqohrwoqhro[whr[ohwqrohwro[ihwq[rhwqohrwrohwq
   </h5>
<p>If you see this page, the nginx web server is successfully installed and
    working. Further configuration is required.</p>

<p>For online documentation and support please refer to
    <a href="http://nginx.org/">nginx.org</a>.<br/>
    Commercial support is available at
    <a href="http://nginx.com/">nginx.com</a>.</p>

<p><em>Thank you for using nginx.</em></p>
</body>
</html>

При опции -v 1 я получаю много сообщений об ошибке Ошибка чтения SSL (5) - закрытие соединения С опцией -k (keepalive) работает лучше. Количество неудачных запросов больше меньше.

По логу nginx (режим отладки) получаю 2019/01/21 20:04:32 [info] 16 # 16: * 216512 тайм-аут клиента (110: соединение
тайм-аут) во время установления соединения SSL, клиент: 10.244.5.0, сервер: 0.0.0.0:443 2019/01/21 20:04:32 [info] 25 # 25: * 216516 тайм-аут клиента (110: соединение
тайм-аут) во время установления соединения SSL, клиент: 10.244.5.0, сервер: 0.0.0.0:443

версия OpenSSl на клиенте OpenSSL 1.1.0h 27 марта 2018

версия OpenSSl на сервере OpenSSL 1.1.0h 27 марта 2018

nginx -V Версия nginx: nginx / 1.13.6 построен gcc 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1 ~ 16.04.11) построено с OpenSSL 1.1.0h 27 марта 2018 Поддержка TLS SNI включена настроить аргументы: --prefix = / etc / nginx --with-ld-opt = -Wl, -rpath, / usr / local / lib --add-module = / usr / app / ngx_devel_kit-0.3.0 --add -module = / usr / app / lua-nginx-module-0.10.13 --sbin-path = / usr / sbin / nginx --modules-path = / usr / lib / nginx / modules --conf-path = / etc / nginx / nginx.conf --error-log-path = / var / log / nginx / error.log --http-log-path = / var / log / nginx / access.log --http-client-body -temp-path = / var / cache / nginx / client_temp --http-proxy-temp-path = / var / cache / nginx / proxy_temp --http-fastcgi-temp-path = / var / cache / nginx / fastcgi_temp - -http-uwsgi-temp-path = / var / cache / nginx / uwsgi_temp --http-scgi-temp-path = / var / cache / nginx / scgi_temp --pid-path = / var / run / nginx.pid - -lock-path = / var / run / nginx.lock --user = root --group = www-data --user = www-data --group = www-data --with-compat --with-file- aio --with threads --with-http_addition_module --with-http_auth_request_module --with-http_dav_module --with-http_flv_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_mp_mo_mora тупой Поток -security -Wp, -D_FORTIFY_SOURCE = 2 -fPIC '--with-ld-opt =' - Wl, -символические функции -Wl, -z, relro -Wl, -z, теперь -Wl, - по мере необходимости -pie '

Как решить эту проблему?

Я переключаю журнал ошибок nginx на отладку и получаю эти журналы

[debug] 26#26: *27497 http check ssl handshake
 [debug] 26#26: *27497 http recv(): 1
 [debug] 26#26: *27497 https ssl handshake: 0x16
 [debug] 26#26: *27497 tcp_nodelay
 [debug] 26#26: *27497 SSL server name: "meteotravel.ru"
 [debug] 26#26: *27497 SSL_do_handshake: -1
2019/01/21 23:50:01 [debug] 26#26: *27497 SSL_get_error: 2
2019/01/21 23:50:01 [debug] 26#26: *27497 reusable connection: 0
2019/01/21 23:50:02 [debug] 26#26: *27497 SSL handshake handler: 0
2019/01/21 23:50:02 [debug] 26#26: *27497 SSL_do_handshake: -1
2019/01/21 23:50:02 [debug] 26#26: *27497 SSL_get_error: 5
...