kea-nginx.conf 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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 10 -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. # On some curl running on macOS the crypto library requires a PKCS#12
  45. # bundle with the private key and the certificate as the cert argument.
  46. # The PKCS#12 file can be generated by:
  47. #
  48. # openssl pkcs12 -export -in kea-client.crt -inkey kea-client.key \
  49. # -out kea-client.p12
  50. #
  51. # If the password is kea, curl command becomes:
  52. #
  53. # curl -k --cert kea-client.p12:kea -X POST \
  54. # -H Content-Type:application/json -d '{ "command": "list-commands" }' \
  55. # https://kea.example.org/kea
  56. #
  57. # nginx configuration starts here.
  58. events {
  59. }
  60. http {
  61. # HTTPS server
  62. server {
  63. # Use default HTTPS port.
  64. listen 443 ssl;
  65. # Set server name.
  66. server_name kea.example.org;
  67. # Server certificate and key.
  68. ssl_certificate /path/to/kea-proxy.crt;
  69. ssl_certificate_key /path/to/kea-proxy.key;
  70. # Certificate Authority. Client certificate must be signed by the CA.
  71. ssl_client_certificate /path/to/ca.crt;
  72. # Enable verification of the client certificate.
  73. ssl_verify_client on;
  74. # For URLs such as https://kea.example.org/kea, forward the
  75. # requests to http://127.0.0.1:8080.
  76. # Use the / location for URLs with no path.
  77. location /kea {
  78. proxy_pass http://127.0.0.1:8080;
  79. }
  80. }
  81. }