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