kea-nginx.conf 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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 certifiate authority (CA). The clients' certificates must
  7. # be signed by the CA.
  8. # The server certificate and key can be generated as follows:
  9. #
  10. # openssl genrsa -des3 -out kea-proxy.key 4096
  11. # openssl req -new -x509 -days 365 -key kea-proxy.key -out kea-proxy.crt
  12. #
  13. # The CA certificate and key can be generated as follows:
  14. #
  15. # openssl genrsa -des3 -out ca.key 4096
  16. # openssl req -new -x509 -days 365 -key ca.key -out ca.crt
  17. #
  18. #
  19. # The client certificate needs to be generated and signed:
  20. #
  21. # openssl genrsa -des3 -out kea-client.key 4096
  22. # openssl req -new -key kea-client.key -out kea-client.csr
  23. # openssl x509 -req -days 365 -in kea-client.csr -CA ca.crt \
  24. # -CAkey ca.key -set_serial 01 -out kea-client.crt
  25. #
  26. # Note that the 'common name' value used when generating the client
  27. # and the server certificates must differ from the value used
  28. # for the CA certificate.
  29. #
  30. # The client certificate must be deployed on the client system.
  31. # In order to test the proxy configuration with 'curl' run
  32. # command similar to the following:
  33. #
  34. # curl -k --key kea-client.key --cert kea-client.crt -X POST \
  35. # -H Content-Type:application/json -d '{ "command": "list-commands" }' \
  36. # https://kea.example.org/kea
  37. #
  38. #
  39. #
  40. # nginx configuration starts here.
  41. events {
  42. }
  43. http {
  44. # HTTPS server
  45. server {
  46. # Use default HTTPS port.
  47. listen 443 ssl;
  48. # Set server name.
  49. server_name kea.example.org;
  50. # Server certificate and key.
  51. ssl_certificate /path/to/kea-proxy.crt;
  52. ssl_certificate_key /path/to/kea-proxy.key;
  53. # Certificate Authority. Client certificate must be signed by the CA.
  54. ssl_client_certificate /path/to/ca.crt;
  55. # Enable verification of the client certificate.
  56. ssl_verify_client on;
  57. # For URLs such as https://kea.example.org/kea, forward the
  58. # requests to http://127.0.0.1:8080.
  59. location /kea {
  60. proxy_pass http://127.0.0.1:8080;
  61. }
  62. }
  63. }