środa, 19 lutego 2014

Nginx TLS Proxy do backendu na HTTPD Apache

Przykładowa konfiguracja terminacji SSL/TLS po stronie Nginx.

Konfiguracja po stronie Nginx

    server {
            listen       443 default_server ssl;
            server_name  servername;
            ssl_certificate      /etc/pki/tls/custom/server.pem;
            ssl_certificate_key  /etc/pki/tls/custom/server.key;
            ssl_session_timeout  5m;
            ssl_prefer_server_ciphers   on;
            ssl_session_cache shared:SSL:10m;
            ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2;
            ssl_dhparam /etc/pki/tls/dh/dh.pem;
            ssl_ciphers "EECDH+ECDSA+AESGCM EECDH+aRSA+AESGCM EECDH+ECDSA+SHA384 EECDH+ECDSA+SHA256 EECDH+aRSA+SHA384 EECDH+aRSA+SHA256 EECDH+aRSA+RC4 EECDH EDH+aRSA RC4 !aNULL !eNULL !LOW !3DES !MD5 !EXP !PSK !SRP !DSS";
            ssl_stapling on;
            ssl_stapling_verify on;
            ssl_trusted_certificate /etc/pki/tls/certs/custom/oscp-bundle.pem;
            resolver 8.8.8.8 valid=300s;
            resolver_timeout 10s;
            location / {
                    proxy_pass http://127.0.0.1;
                    proxy_http_version 1.1;
                    proxy_set_header X-Forwarded-For $remote_addr;
                    proxy_set_header X-Forwarded-Proto $scheme;
                    proxy_set_header X-SSL-Protocol $ssl_protocol;
                    proxy_set_header X-SSL-Cipher $ssl_cipher;
                    proxy_set_header Host $host;
                    proxy_max_temp_file_size 0;
            }
    }
Konfiguracja po stronie Apache

    LogFormat "%V %h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" vcombined
    LogFormat "%V %{X-Forwarded-For}i %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %{X-SSL-Protocol}i %{X-SSL-Cipher}i" vproxy
    SetEnvIf X-Forwarded-For "^.*\..*\..*\..*" forwarded
    SetEnvIf X-Forwarded-Proto "^https$" HTTPS=on
    CustomLog "access.log" vcombined env=!forwarded
    CustomLog "access.log" vproxy env=forwarded

Brak komentarzy: