Getting wrong version number in reverse proxy

Viewed 483

I have configuration for reverse proxy in nginx with self-signed CA. From start i was thinking it was problem with CA, soo recreate them but problem was still the same. Idea of this configuration is listen an ip >> First nginx which will be encrypting date >> Second nginx which will be dercypting and forward to target service. Without ssl configuration movement of date was normal but when i turn on ssl everything went to hell.

My configuration:

# user  nobody;
worker_processes auto;

events {
    worker_connections  1024;
}

stream {

    # DB connections
    ###########################################################
    upstream sql_backend {
        server 1.1.1.1:10000;
    }
    
    server    {
        listen 2.2.2.2:11000;    
        ssl_certificate     C:/nginx/ssl/server.pem;
        ssl_certificate_key C:/nginx/ssl/server.key;
        proxy_pass sql_backend;    
    }
    ###########################################################
    upstream sql_proxy {
        server 2.2.2.2:11000;
    }

    server {
        listen     2.2.2.2:10000;
        proxy_pass    sql_proxy;
        proxy_ssl on;
        proxy_ssl_certificate     C:/nginx/ssl/client.pem;
        proxy_ssl_certificate_key C:/nginx/ssl/client.key;
    }
    ###########################################################

    # serv connections

    upstream serv_backend {        
        server 1.1.1.1:1433;
    }
    
    server    {
        listen 2.2.2.2:14330;
        ssl_certificate     C:/nginx/ssl/server.pem;
        ssl_certificate_key C:/nginx/ssl/server.key;
        proxy_pass serv_backend;    
    }

    upstream serv_proxy {
        server 2.2.2.2:14330;   
    }

    server {
        listen     2.2.2.2:1433;
        proxy_pass    serv_proxy; 
        proxy_ssl on;
        proxy_ssl_certificate     C:/nginx/ssl/client.pem;
        proxy_ssl_certificate_key C:/nginx/ssl/client.key;
    }
}

And the problem that i'm gets in error.log

 SSL_do_handshake() failed (SSL: error:1408F10B:SSL routines:ssl3_get_record:wrong version number) while SSL handshaking to upstream, client: 10.60.12.237, server: 10.60.12.139:10000, upstream: "10.60.12.139:11000", bytes from/to client:0/0, bytes from/to upstream:0/0

I was trying with ssl_protocols TLSv1 TLSv1.1 TLSv1.2; and proxy_ssl_session_reuse on; but still the same problem.

I don't know if it will help, but the answers from curl to this machine

curl 2.2.2.2:10000
curl: (56) Recv failure: Connection reset by peer
curl 2.2.2.2:11000
curl: (1) Received HTTP/0.9 when not allowed
curl 2.2.2.2:14330
curl: (52) Empty reply from server
curl 2.2.2.2:1433
C^ Getting noting from this, timeout
0 Answers
Related