nginx.conf 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. map $ssl_client_s_dn $ssl_client_s_dn_cn {
  2. default "no_client_cert";
  3. ~(^|,)CN=(?<CN>[^,]+) $CN;
  4. }
  5. server {
  6. listen 443 ssl;
  7. server_name localhost;
  8. root /dev/null;
  9. # TODO: once the JACE sends an official Kyrio cert, this can be set to
  10. # 'on' so the trust-chain is verified against the CA certs in ssl.crt.
  11. # Also may require tuning of ssl_verify_depth directive.
  12. # In its current state EPRI will validate that the client cert's CN
  13. # is correct, but in theory someone could spoof it with a self-signed
  14. # certificate containing the "correct" CN.
  15. # Also note that webui admin routes will likely be hit without a client
  16. # cert, so you will probably want to either:
  17. # a) have a seperate server/vhost for VEN traffic vs. admin traffic
  18. # b) leave ssl_verify_client at optional or optional_no_ca, and match
  19. # on $ssl_client_verify in a location block.
  20. ssl_verify_client optional_no_ca;
  21. # Don't advertise
  22. server_tokens off;
  23. # Don't merge slashes
  24. merge_slashes off;
  25. location / {
  26. proxy_set_header X-Real-IP $remote_addr;
  27. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  28. proxy_set_header Host $http_host;
  29. proxy_set_header X-Forwarded-Proto $scheme;
  30. proxy_set_header X-Forwarded-Ssl on;
  31. proxy_set_header X-Forwarded-Port $server_port;
  32. proxy_set_header X-Forwarded-Host $host;
  33. # these next two headers are consumed by EPRI to validate client cert
  34. # CN vs. EPRI VEN Common Name.
  35. proxy_set_header SSL_CLIENT_S_DN_CN $ssl_client_s_dn_cn;
  36. proxy_set_header HTTPS true;
  37. proxy_redirect off;
  38. proxy_pass http://vtn-rails:8080;
  39. }
  40. ssl_certificate /etc/ssl/ssl.crt;
  41. ssl_certificate_key /etc/ssl/ssl.key;
  42. }