You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

176 lines

  1. [[sysadmin_certificate_management]]
  2. Certificate Management
  3. ----------------------
  4. ifdef::wiki[]
  5. :pve-toplevel:
  6. endif::wiki[]
  7. Certificates for communication within the cluster
  8. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  9. Each {PVE} cluster creates its own (self-signed) Certificate Authority (CA) and
  10. generates a certificate for each node which gets signed by the aforementioned
  11. CA. These certificates are used for encrypted communication with the cluster's
  12. `pveproxy` service and the Shell/Console feature if SPICE is used.
  13. The CA certificate and key are stored in the xref:chapter_pmxcfs[Proxmox Cluster File System (pmxcfs)].
  14. Certificates for API and web GUI
  15. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  16. The REST API and web GUI are provided by the `pveproxy` service, which runs on
  17. each node.
  18. You have the following options for the certificate used by `pveproxy`:
  19. 1. By default the node-specific certificate in
  20. `/etc/pve/nodes/NODENAME/pve-ssl.pem` is used. This certificate is signed by
  21. the cluster CA and therefore not trusted by browsers and operating systems by
  22. default.
  23. 2. use an externally provided certificate (e.g. signed by a commercial CA).
  24. 3. use ACME (e.g., Let's Encrypt) to get a trusted certificate with automatic
  25. renewal, this is also integrated in the {pve} API and Webinterface.
  26. For options 2 and 3 the file `/etc/pve/local/pveproxy-ssl.pem` (and
  27. `/etc/pve/local/pveproxy-ssl.key`, which needs to be without password) is used.
  28. NOTE: Keep in mind that `/etc/pve/local` is a node specific symlink to
  29. `/etc/pve/nodes/NODENAME`.
  30. Certificates are managed with the {PVE} Node management command
  31. (see the `pvenode(1)` manpage).
  32. WARNING: Do not replace or manually modify the automatically generated node
  33. certificate files in `/etc/pve/local/pve-ssl.pem` and
  34. `/etc/pve/local/pve-ssl.key` or the cluster CA files in
  35. `/etc/pve/pve-root-ca.pem` and `/etc/pve/priv/pve-root-ca.key`.
  36. Getting trusted certificates via ACME
  37. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  38. {PVE} includes an implementation of the **A**utomatic **C**ertificate
  39. **M**anagement **E**nvironment **ACME** protocol, allowing {pve} admins to
  40. interface with Let's Encrypt for easy setup of trusted TLS certificates which
  41. are accepted out of the box on most modern operating systems and browsers.
  42. Currently the two ACME endpoints implemented are Let's Encrypt (LE) and its
  43. staging environment (see, both using the standalone
  44. HTTP challenge.
  45. Because of[rate-limits] you should use
  46. LE `staging` for experiments.
  47. There are a few prerequisites to use Let's Encrypt:
  48. 1. **Port 80** of the node needs to be reachable from the internet.
  49. 2. There **must** be no other listener on port 80.
  50. 3. The requested (sub)domain needs to resolve to a public IP of the Node.
  51. 4. You have to accept the ToS of Let's Encrypt.
  52. At the moment the GUI uses only the default ACME account.
  53. .Example: Sample `pvenode` invocation for using Let's Encrypt certificates
  54. ----
  55. root@proxmox:~# pvenode acme account register default mail@example.invalid
  56. Directory endpoints:
  57. 0) Let's Encrypt V2 (
  58. 1) Let's Encrypt V2 Staging (
  59. 2) Custom
  60. Enter selection:
  61. 1
  62. Attempting to fetch Terms of Service from ''..
  63. Terms of Service:
  64. Do you agree to the above terms? [y|N]y
  65. Attempting to register account with ''..
  66. Generating ACME account key..
  67. Registering ACME account..
  68. Registration successful, account URL: ''
  69. Task OK
  70. root@proxmox:~# pvenode acme account list
  71. default
  72. root@proxmox:~# pvenode config set --acme domains=example.invalid
  73. root@proxmox:~# pvenode acme cert order
  74. Loading ACME account details
  75. Placing ACME order
  76. Order URL:
  77. Getting authorization details from
  78. ''
  79. ... pending!
  80. Setting up webserver
  81. Triggering validation
  82. Sleeping for 5 seconds
  83. Status is 'valid'!
  84. All domains validated!
  85. Creating CSR
  86. Finalizing order
  87. Checking order status
  88. valid!
  89. Downloading certificate
  90. Setting pveproxy certificate and key
  91. Restarting pveproxy
  92. Task OK
  93. ----
  94. Switching from the `staging` to the regular ACME directory
  95. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  96. Changing the ACME directory for an account is unsupported. If you want to switch
  97. an account from the `staging` ACME directory to the regular, trusted, one you
  98. need to deactivate it and recreate it.
  99. This procedure is also needed to change the default ACME account used in the GUI.
  100. .Example: Changing the `default` ACME account from the `staging` to the regular directory
  101. ----
  102. root@proxmox:~# pvenode acme account info default
  103. Directory URL:
  104. Account URL:
  105. Terms Of Service:
  106. Account information:
  107. ID: xxxxxxx
  108. Contact:
  109. -
  110. Creation date: 2018-07-31T08:41:44.54196435Z
  111. Initial IP:
  112. Status: valid
  113. root@proxmox:~# pvenode acme account deactivate default
  114. Renaming account file from '/etc/pve/priv/acme/default' to '/etc/pve/priv/acme/_deactivated_default_4'
  115. Task OK
  116. root@proxmox:~# pvenode acme account register default
  117. Directory endpoints:
  118. 0) Let's Encrypt V2 (
  119. 1) Let's Encrypt V2 Staging (
  120. 2) Custom
  121. Enter selection:
  122. 0
  123. Attempting to fetch Terms of Service from ''..
  124. Terms of Service:
  125. Do you agree to the above terms? [y|N]y
  126. Attempting to register account with ''..
  127. Generating ACME account key..
  128. Registering ACME account..
  129. Registration successful, account URL: ''
  130. Task OK
  131. ----
  132. Automatic renewal of ACME certificates
  133. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  134. If a node has been successfully configured with an ACME-provided certificate
  135. (either via pvenode or via the GUI), the certificate will be automatically
  136. renewed by the pve-daily-update.service. Currently, renewal will be attempted
  137. if the certificate has expired already, or will expire in the next 30 days.