Opened 5 years ago

Closed 5 years ago

#1948 closed defect (duplicate)

The directive 'ssl_protocols' is invalid ?

Reported by: vislee@… Owned by:
Priority: minor Milestone:
Component: nginx-module Version: 1.16.x
Keywords: ssl_protocols Cc:
uname -a: Linux centos-linux.shared 3.10.0-1062.4.1.el7.x86_64
nginx -V: nginx version: nginx/1.16.1
built by gcc 4.8.5 20150623 (Red Hat 4.8.5-39) (GCC)
built with OpenSSL 1.0.2k-fips 26 Jan 2017
TLS SNI support enabled
configure arguments: --prefix=/usr/share/nginx --sbin-path=/usr/sbin/nginx --modules-path=/usr/lib64/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/lib/nginx/tmp/client_body --http-proxy-temp-path=/var/lib/nginx/tmp/proxy --http-fastcgi-temp-path=/var/lib/nginx/tmp/fastcgi --http-uwsgi-temp-path=/var/lib/nginx/tmp/uwsgi --http-scgi-temp-path=/var/lib/nginx/tmp/scgi --pid-path=/run/nginx.pid --lock-path=/run/lock/subsys/nginx --user=nginx --group=nginx --with-file-aio --with-ipv6 --with-http_ssl_module --with-http_v2_module --with-http_realip_module --with-stream_ssl_preread_module --with-http_addition_module --with-http_xslt_module=dynamic --with-http_image_filter_module=dynamic --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_random_index_module --with-http_secure_link_module --with-http_degradation_module --with-http_slice_module --with-http_stub_status_module --with-http_perl_module=dynamic --with-http_auth_request_module --with-mail=dynamic --with-mail_ssl_module --with-pcre --with-pcre-jit --with-stream=dynamic --with-stream_ssl_module --with-google_perftools_module --with-debug --with-cc-opt='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtune=generic' --with-ld-opt='-Wl,-z,relro -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -Wl,-E'

Description (last modified by vislee@…)

nginx.conf

    server {
        listen 127.0.0.1:8093 ssl default;
        server_name t.com;

        # ssl_protocols SSLv2;
        ssl_certificate ./cert/default.crt;
        ssl_certificate_key ./cert/default.key;

        location / {
            return 200 "default";
        }
    }

    server {
        listen 127.0.0.1:8093 ssl;
        server_name x.com;

        ssl_protocols SSLv2;    # invalid???
        ssl_ciphers AES128-SHA;

        ssl_certificate ./cert/test.crt;
        ssl_certificate_key ./cert/test.key;

        location / {
            return 200 "ok";
        }
    }

CASE1:

# curl -k -v 'https://x.com:8093/' --resolve "x.com:8093:127.0.0.1" --tlsv1.1
* Added x.com:8093:127.0.0.1 to DNS cache
* About to connect() to x.com port 8093 (#0)
*   Trying 127.0.0.1...
* Connected to x.com (127.0.0.1) port 8093 (#0)
* Initializing NSS with certpath: sql:/etc/pki/nssdb
* skipping SSL peer certificate verification
* SSL connection using TLS_RSA_WITH_AES_128_CBC_SHA
* Server certificate:
* 	subject: CN=test.com,O=test,L=Beijing,ST=Beijing,C=CN
* 	start date: 2月 16 03:39:55 2020 GMT
* 	expire date: 1月 23 03:39:55 2120 GMT
* 	common name: test.com
* 	issuer: CN=test.com,O=test,L=Beijing,ST=Beijing,C=CN
> GET / HTTP/1.1
> User-Agent: curl/7.29.0
> Host: x.com:8093
> Accept: */*
>
< HTTP/1.1 200 OK
< Server: nginx/1.16.1
< Date: Mon, 09 Mar 2020 10:02:08 GMT
< Content-Type: application/octet-stream
< Content-Length: 2
< Connection: keep-alive
<
* Connection #0 to host x.com left intact
ok

error.log
2020/03/09 18:02:08 [debug] 29633#0: *6 SSL: TLSv1.1, cipher: "AES128-SHA SSLv3 Kx=RSA Au=RSA Enc=AES(128) Mac=SHA1"

CASE2:
add ssl_protocols SSLv2; for t.com server in the nginx.conf

# curl -k -v 'https://x.com:8093/' --resolve "x.com:8093:127.0.0.1" --tlsv1.1
* Added x.com:8093:127.0.0.1 to DNS cache
* About to connect() to x.com port 8093 (#0)
*   Trying 127.0.0.1...
* Connected to x.com (127.0.0.1) port 8093 (#0)
* Initializing NSS with certpath: sql:/etc/pki/nssdb
* NSS error -5961 (PR_CONNECT_RESET_ERROR)
* TCP connection reset by peer
* Closing connection 0
curl: (35) TCP connection reset by peer

error.log
2020/03/09 18:08:18 [info] 30228#0: *1 SSL_do_handshake() failed (SSL: error:140760FC:SSL routines:SSL23_GET_CLIENT_HELLO:unknown protocol) while SSL handshaking, client: 127.0.0.1, server: 127.0.0.1:8093

SO, the ssl_protocols only is effective in the default server?

Change History (2)

comment:1 by vislee@…, 5 years ago

Description: modified (diff)

comment:2 by Maxim Dounin, 5 years ago

Resolution: duplicate
Status: newclosed

Duplicate of #676.

Note: See TracTickets for help on using tickets.