简体   繁体   English

像nginx这样的反向代理背后的客户端

[英]Client behind reverse proxy like nginx

As my tcpclient is behind nginx. 由于我的tcpclient在nginx之后。 My idea is to have backend tcpclient, authenticate the external server. 我的想法是让后端tcpclient验证外部服务器。

Finally, i had this configuration: 最后,我有以下配置:

#secured TCP part
stream {
log_format main '$remote_addr - - [$time_local] protocol $status $bytes_sent $bytes_received $session_time "$upstream_addr"';
server {
listen 127.0.0.1:10515 ;
proxy_pass REALIP:REALPORT;
proxy_ssl on;
#server side authentication (client verifying server's certificate)
proxy_ssl_protocols TLSv1.2;
proxy_ssl_certificate /f0/client.crt;
proxy_ssl_certificate_key /f0/client.key;
access_log /var/log/nginx.tcp1.access.log main;
error_log /var/log/nginx.tcp1.error.log debug;
#The trusted CA certificates in the file named by the proxy_ssl_trusted_certificate directive are used to verify the certificate on the ups
tream
proxy_ssl_verify on;
proxy_ssl_trusted_certificate /f0/client_ca.crt;
proxy_ssl_verify_depth 1;
proxy_ssl_session_reuse on;
proxy_ssl_name localhost;
ssl_session_timeout 4h;
ssl_handshake_timeout 30s;
ssl_prefer_server_ciphers on;
#proxy_ssl_ciphers "ECDHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-A
ES256-SHA384:ECDHE-RSA-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384";
proxy_ssl_ciphers "ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA256:EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH:EECDH+AESGCM:EDH
+AESGCM:ECDHE-RSA-AES128-GCM-SHA256:AES256+EECDH:DHE-RSA-AES128-GCM-SHA256:AES256+EDH:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES256-GCM-SHA384:ECDHE-R
SA-AES256-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA:ECDHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES128-SHA256:DHE-RSA-AES256-SHA:D
HE-RSA-AES128-SHA:ECDHE-RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES256-GCM-SHA384:AES128-GCM-SHA256:AES256-SHA256:AES128-SHA256:AES256-SHA";
#ssl_ecdh_curve prime256v1:secp384r1;
#ssl_session_tickets off;
resolver 8.8.8.8 8.8.4.4 valid=300s;
resolver_timeout 5s;
}

Can you please authenticate the above configuration and pls let me know, if I am doing right way of verifying the peer. 您能否对上述配置进行身份验证,如果我采用正确的方式验证对等方,请告诉我。 If yes, my other question: Is there a way, we can give peer certificate(public key) rather than its CA and verify. 如果是,我的另一个问题是:有没有办法,我们可以提供对等证书(公钥)而不是其CA进行验证。 Pls clarify 请澄清

Thanks, 谢谢,

The question looks obvious as it doesn't mention any specific aspects (apart from TLS). 这个问题很明显,因为它没有提到任何特定方面(除了TLS)。

Please visit the following to get a good start: 请访问以下网址以获得良好的开始:

https://docs.nginx.com/nginx/admin-guide/load-balancer/tcp-udp-load-balancer/ https://www.nginx.com/blog/tcp-load-balancing-udp-load-balancing-nginx-tips-tricks/ https://docs.nginx.com/nginx/admin-guide/load-balancer/tcp-udp-load-balancer/ https://www.nginx.com/blog/tcp-load-balancing-udp-load-平衡nginx技巧提示/

Quoting simple example configuration from the above sources: 从上述来源引用简单的示例配置:

stream {
    server {
        listen     12345;
        #TCP traffic will be forwarded to the "stream_backend" upstream group
        proxy_pass stream_backend;
    }
    server {
        listen     12346;
        #TCP traffic will be forwarded to the specified server
        proxy_pass backend.example.com:12346;
    }
}

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

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