]> git.proxmox.com Git - pve-docs.git/blame - certificate-managment.adoc
Precise certificate generation
[pve-docs.git] / certificate-managment.adoc
CommitLineData
aeecd9ea
SI
1[[sysadmin_certificate_management]]
2Certificate Management
3----------------------
4ifdef::wiki[]
5:pve-toplevel:
6endif::wiki[]
7
8
9Certificates for communication within the cluster
10~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
11
94958b8b
FR
12Each {PVE} cluster creates its own (self-signed) Certificate Authority (CA) and
13generates a certificate for each node and signs it by the previously created CA.
14These certificates are used
0e9c6c13
FG
15for encrypted communication with the cluster's pveproxy service and the
16Shell/Console feature if SPICE is used.
aeecd9ea 17
2971c735 18The CA certificate and key are stored in the xref:chapter_pmxcfs[Proxmox Cluster File System (pmxcfs)].
aeecd9ea
SI
19
20Certificates for API and web GUI
21~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
22
0e9c6c13
FG
23The REST API and web GUI are provided by the `pveproxy` service, which runs on
24each node.
aeecd9ea
SI
25
26You have the following options for the certificate used by `pveproxy`:
27
0e9c6c13
FG
281. By default the node-specific certificate in
29`/etc/pve/nodes/NODENAME/pve-ssl.pem` is used. This certificate is signed by
30the cluster CA and therefore not trusted by browsers and operating systems by
31default.
322. use an externally provided certificate (e.g. signed by a commercial CA).
333. use ACME (e.g., Let's Encrypt) to get a trusted certificate with automatic renewal.
aeecd9ea 34
0e9c6c13 35For options 2 and 3 the file `/etc/pve/local/pveproxy-ssl.pem` (and
aeecd9ea
SI
36`/etc/pve/local/pveproxy-ssl.key`, which needs to be without password) is used.
37
38Certificates are managed with the {PVE} Node management command
39(see the `pvenode(1)` manpage).
40
0e9c6c13
FG
41WARNING: Do not replace or manually modify the automatically generated node
42certificate files in `/etc/pve/local/pve-ssl.pem` and
43`/etc/pve/local/pve-ssl.key` or the cluster CA files in
44`/etc/pve/pve-root-ca.pem` and `/etc/pve/priv/pve-root-ca.key`.
aeecd9ea
SI
45
46Getting trusted certificates via ACME
47^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
48{PVE} includes an implementation of the **A**utomatic **C**ertificate
49**M**anagement **E**nvironment **ACME** protocol, allowing {pve} admins to
0e9c6c13
FG
50interface with Let's Encrypt for easy setup of trusted TLS certificates which
51are accepted out of the box on most modern operating systems and browsers.
aeecd9ea
SI
52
53Currently the two ACME endpoints implemented are Let's Encrypt (LE) and its
54staging environment (see https://letsencrypt.org), both using the standalone
55HTTP challenge.
56
57Because of https://letsencrypt.org/docs/rate-limits/[rate-limits] you should use
58LE `staging` for experiments.
59
60There are a few prerequisites to use Let's Encrypt:
61
621. **Port 80** of the node needs to be reachable from the internet.
632. There **must** be no other listener on port 80.
0e9c6c13 643. The requested (sub)domain needs to resolve to a public IP of the Node.
aeecd9ea
SI
654. You have to accept the ToS of Let's Encrypt.
66
67At the moment the GUI uses only the default ACME account.
68
69.Example: Sample `pvenode` invocation for using Let's Encrypt certificates
70
b0014034 71----
aeecd9ea
SI
72root@proxmox:~# pvenode acme account register default mail@example.invalid
73Directory endpoints:
740) Let's Encrypt V2 (https://acme-v02.api.letsencrypt.org/directory)
751) Let's Encrypt V2 Staging (https://acme-staging-v02.api.letsencrypt.org/directory)
762) Custom
77Enter selection:
781
79
80Attempting to fetch Terms of Service from 'https://acme-staging-v02.api.letsencrypt.org/directory'..
81Terms of Service: https://letsencrypt.org/documents/LE-SA-v1.2-November-15-2017.pdf
82Do you agree to the above terms? [y|N]y
83
84Attempting to register account with 'https://acme-staging-v02.api.letsencrypt.org/directory'..
85Generating ACME account key..
86Registering ACME account..
87Registration successful, account URL: 'https://acme-staging-v02.api.letsencrypt.org/acme/acct/xxxxxxx'
88Task OK
89root@proxmox:~# pvenode acme account list
90default
91root@proxmox:~# pvenode config set --acme domains=example.invalid
92root@proxmox:~# pvenode acme cert order
93Loading ACME account details
94Placing ACME order
95Order URL: https://acme-staging-v02.api.letsencrypt.org/acme/order/xxxxxxxxxxxxxx
96
97Getting authorization details from
98'https://acme-staging-v02.api.letsencrypt.org/acme/authz/xxxxxxxxxxxxxxxxxxxxx-xxxxxxxxxxxxx-xxxxxxx'
99... pending!
100Setting up webserver
101Triggering validation
102Sleeping for 5 seconds
103Status is 'valid'!
104
105All domains validated!
106
107Creating CSR
108Finalizing order
109Checking order status
110valid!
111
112Downloading certificate
113Setting pveproxy certificate and key
114Restarting pveproxy
115Task OK
d75e644b 116----
0e9c6c13 117
19b04e77 118Switching from the `staging` to the regular ACME directory
b0014034 119^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
19b04e77
SI
120
121Changing the ACME directory for an account is unsupported. If you want to switch
122an account from the `staging` ACME directory to the regular, trusted, one you
123need to deactivate it and recreate it.
124
125This procedure is also needed to change the default ACME account used in the GUI.
126
127.Example: Changing the `default` ACME account from the `staging` to the regular directory
128
d75e644b 129----
19b04e77
SI
130root@proxmox:~# pvenode acme account info default
131Directory URL: https://acme-staging-v02.api.letsencrypt.org/directory
132Account URL: https://acme-staging-v02.api.letsencrypt.org/acme/acct/6332194
133Terms Of Service: https://letsencrypt.org/documents/LE-SA-v1.2-November-15-2017.pdf
134
135Account information:
136ID: xxxxxxx
137Contact:
138 - mailto:example@proxmox.com
139Creation date: 2018-07-31T08:41:44.54196435Z
140Initial IP: 192.0.2.1
141Status: valid
142
143root@proxmox:~# pvenode acme account deactivate default
144Renaming account file from '/etc/pve/priv/acme/default' to '/etc/pve/priv/acme/_deactivated_default_4'
145Task OK
d75e644b 146
19b04e77
SI
147root@proxmox:~# pvenode acme account register default example@proxmox.com
148Directory endpoints:
1490) Let's Encrypt V2 (https://acme-v02.api.letsencrypt.org/directory)
1501) Let's Encrypt V2 Staging (https://acme-staging-v02.api.letsencrypt.org/directory)
1512) Custom
152Enter selection:
1530
154
155Attempting to fetch Terms of Service from 'https://acme-v02.api.letsencrypt.org/directory'..
156Terms of Service: https://letsencrypt.org/documents/LE-SA-v1.2-November-15-2017.pdf
157Do you agree to the above terms? [y|N]y
158
159Attempting to register account with 'https://acme-v02.api.letsencrypt.org/directory'..
160Generating ACME account key..
161Registering ACME account..
162Registration successful, account URL: 'https://acme-v02.api.letsencrypt.org/acme/acct/39335247'
163Task OK
d75e644b 164----
19b04e77 165
0e9c6c13
FG
166Automatic renewal of ACME certificates
167^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
168
169If a node has been successfully configured with an ACME-provided certificate
170(either via pvenode or via the GUI), the certificate will be automatically
171renewed by the pve-daily-update.service. Currently, renewal will be attempted
172if the certificate has expired or will expire in the next 30 days.