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