kea-nginx.conf 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. # This file contains an example nginx HTTP server configuration which
  2. # enables reverse proxy service for Kea RESTful API. An access to
  3. # the service is protected by client's certificate verification
  4. # mechanism. Before using this configuration a server administrator
  5. # must generate server certificate and private key as well as
  6. # the certificate authority (CA). The clients' certificates must
  7. # be signed by the CA.
  8. #
  9. # Note that the steps provided below to generate and setup certificates
  10. # are provided as an example for testing purposes only. Always
  11. # consider best known security measures to protect your production
  12. # environment.
  13. #
  14. # The server certificate and key can be generated as follows:
  15. #
  16. # openssl genrsa -des3 -out kea-proxy.key 4096
  17. # openssl req -new -x509 -days 365 -key kea-proxy.key -out kea-proxy.crt
  18. #
  19. # The CA certificate and key can be generated as follows:
  20. #
  21. # openssl genrsa -des3 -out ca.key 4096
  22. # openssl req -new -x509 -days 365 -key ca.key -out ca.crt
  23. #
  24. #
  25. # The client certificate needs to be generated and signed:
  26. #
  27. # openssl genrsa -des3 -out kea-client.key 4096
  28. # openssl req -new -key kea-client.key -out kea-client.csr
  29. # openssl x509 -req -days 365 -in kea-client.csr -CA ca.crt \
  30. # -CAkey ca.key -set_serial 01 -out kea-client.crt
  31. #
  32. # Note that the 'common name' value used when generating the client
  33. # and the server certificates must differ from the value used
  34. # for the CA certificate.
  35. #
  36. # The client certificate must be deployed on the client system.
  37. # In order to test the proxy configuration with 'curl' run
  38. # command similar to the following:
  39. #
  40. # curl -k --key kea-client.key --cert kea-client.crt -X POST \
  41. # -H Content-Type:application/json -d '{ "command": "list-commands" }' \
  42. # https://kea.example.org/kea
  43. #
  44. #
  45. #
  46. # nginx configuration starts here.
  47. events {
  48. }
  49. http {
  50. # HTTPS server
  51. server {
  52. # Use default HTTPS port.
  53. listen 443 ssl;
  54. # Set server name.
  55. server_name kea.example.org;
  56. # Server certificate and key.
  57. ssl_certificate /path/to/kea-proxy.crt;
  58. ssl_certificate_key /path/to/kea-proxy.key;
  59. # Certificate Authority. Client certificate must be signed by the CA.
  60. ssl_client_certificate /path/to/ca.crt;
  61. # Enable verification of the client certificate.
  62. ssl_verify_client on;
  63. # For URLs such as https://kea.example.org/kea, forward the
  64. # requests to http://127.0.0.1:8080.
  65. location /kea {
  66. proxy_pass http://127.0.0.1:8080;
  67. }
  68. }
  69. }