]> git.proxmox.com Git - pve-docs.git/blame_incremental - certificate-management.adoc
break long line
[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 renewal.
33
34For options 2 and 3 the file `/etc/pve/local/pveproxy-ssl.pem` (and
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
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`.
44
45Getting trusted certificates via ACME
46^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
47{PVE} includes an implementation of the **A**utomatic **C**ertificate
48**M**anagement **E**nvironment **ACME** protocol, allowing {pve} admins to
49interface with Let's Encrypt for easy setup of trusted TLS certificates which
50are accepted out of the box on most modern operating systems and browsers.
51
52Currently the two ACME endpoints implemented are Let's Encrypt (LE) and its
53staging environment (see https://letsencrypt.org), both using the standalone
54HTTP challenge.
55
56Because of https://letsencrypt.org/docs/rate-limits/[rate-limits] you should use
57LE `staging` for experiments.
58
59There are a few prerequisites to use Let's Encrypt:
60
611. **Port 80** of the node needs to be reachable from the internet.
622. There **must** be no other listener on port 80.
633. The requested (sub)domain needs to resolve to a public IP of the Node.
644. You have to accept the ToS of Let's Encrypt.
65
66At the moment the GUI uses only the default ACME account.
67
68.Example: Sample `pvenode` invocation for using Let's Encrypt certificates
69
70----
71root@proxmox:~# pvenode acme account register default mail@example.invalid
72Directory endpoints:
730) Let's Encrypt V2 (https://acme-v02.api.letsencrypt.org/directory)
741) Let's Encrypt V2 Staging (https://acme-staging-v02.api.letsencrypt.org/directory)
752) Custom
76Enter selection:
771
78
79Attempting to fetch Terms of Service from 'https://acme-staging-v02.api.letsencrypt.org/directory'..
80Terms of Service: https://letsencrypt.org/documents/LE-SA-v1.2-November-15-2017.pdf
81Do you agree to the above terms? [y|N]y
82
83Attempting to register account with 'https://acme-staging-v02.api.letsencrypt.org/directory'..
84Generating ACME account key..
85Registering ACME account..
86Registration successful, account URL: 'https://acme-staging-v02.api.letsencrypt.org/acme/acct/xxxxxxx'
87Task OK
88root@proxmox:~# pvenode acme account list
89default
90root@proxmox:~# pvenode config set --acme domains=example.invalid
91root@proxmox:~# pvenode acme cert order
92Loading ACME account details
93Placing ACME order
94Order URL: https://acme-staging-v02.api.letsencrypt.org/acme/order/xxxxxxxxxxxxxx
95
96Getting authorization details from
97'https://acme-staging-v02.api.letsencrypt.org/acme/authz/xxxxxxxxxxxxxxxxxxxxx-xxxxxxxxxxxxx-xxxxxxx'
98... pending!
99Setting up webserver
100Triggering validation
101Sleeping for 5 seconds
102Status is 'valid'!
103
104All domains validated!
105
106Creating CSR
107Finalizing order
108Checking order status
109valid!
110
111Downloading certificate
112Setting pveproxy certificate and key
113Restarting pveproxy
114Task OK
115----
116
117Switching from the `staging` to the regular ACME directory
118^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
119
120Changing the ACME directory for an account is unsupported. If you want to switch
121an account from the `staging` ACME directory to the regular, trusted, one you
122need to deactivate it and recreate it.
123
124This procedure is also needed to change the default ACME account used in the GUI.
125
126.Example: Changing the `default` ACME account from the `staging` to the regular directory
127
128----
129root@proxmox:~# pvenode acme account info default
130Directory URL: https://acme-staging-v02.api.letsencrypt.org/directory
131Account URL: https://acme-staging-v02.api.letsencrypt.org/acme/acct/6332194
132Terms Of Service: https://letsencrypt.org/documents/LE-SA-v1.2-November-15-2017.pdf
133
134Account information:
135ID: xxxxxxx
136Contact:
137 - mailto:example@proxmox.com
138Creation date: 2018-07-31T08:41:44.54196435Z
139Initial IP: 192.0.2.1
140Status: valid
141
142root@proxmox:~# pvenode acme account deactivate default
143Renaming account file from '/etc/pve/priv/acme/default' to '/etc/pve/priv/acme/_deactivated_default_4'
144Task OK
145
146root@proxmox:~# pvenode acme account register default example@proxmox.com
147Directory endpoints:
1480) Let's Encrypt V2 (https://acme-v02.api.letsencrypt.org/directory)
1491) Let's Encrypt V2 Staging (https://acme-staging-v02.api.letsencrypt.org/directory)
1502) Custom
151Enter selection:
1520
153
154Attempting to fetch Terms of Service from 'https://acme-v02.api.letsencrypt.org/directory'..
155Terms of Service: https://letsencrypt.org/documents/LE-SA-v1.2-November-15-2017.pdf
156Do you agree to the above terms? [y|N]y
157
158Attempting to register account with 'https://acme-v02.api.letsencrypt.org/directory'..
159Generating ACME account key..
160Registering ACME account..
161Registration successful, account URL: 'https://acme-v02.api.letsencrypt.org/acme/acct/39335247'
162Task OK
163----
164
165Automatic renewal of ACME certificates
166^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
167
168If a node has been successfully configured with an ACME-provided certificate
169(either via pvenode or via the GUI), the certificate will be automatically
170renewed by the pve-daily-update.service. Currently, renewal will be attempted
171if the certificate has expired or will expire in the next 30 days.