Debian Codegraph @

doc/modules/guide/pages/https.adoc

raw
1 [[https]]
2 = SSL/TLS Usage
3
4 Cockpit usually requires that web browsers communicate with it using
5 HTTPS, for security reasons.
6
7 [[https-required]]
8 == HTTPS Requirement
9
10 Cockpit listens for both HTTP and HTTPS connections on the same port, by
11 default 9090. If an HTTP connection is made, Cockpit will redirect that
12 connection to HTTPS. There are some exceptions:
13
14 * If an HTTP connection comes from `+localhost+` (`+127.0.0.1+` or
15 `+::1+`, then Cockpit will allow communication without redirecting to
16 HTTPS.
17 * Certain URLs, like `+/ping+` are not required to use HTTPS.
18
19 This behavior can be overridden by setting the `+AllowUnencrypted+`
20 option in `+cockpit.conf+`.
21
22 [[https-certificates]]
23 == Certificates
24
25 Cockpit will load a certificate from the `+/etc/cockpit/ws-certs.d+`,
26 directory, or below `+$XDG_CONFIG_DIRS+` if set (see
27 link:./cockpit.conf.5.html[cockpit.conf]). It will use the last file
28 with a `+.cert+` or `+.crt+` extension in alphabetical order. The file
29 should contain one or more OpenSSL style `+BEGIN CERTIFICATE+` blocks
30 for the server certificate and the intermediate certificate authorities.
31
32 The private key must be contained in a separate file with the same name
33 as the certificate, but with a `+.key+` suffix instead. The key must not
34 be encrypted.
35
36 If no certificate is found, a self-signed certificate is created and
37 stored in the `+0-self-signed.cert+` file. On some platforms, Cockpit
38 will also generate a ca.crt in that directory, which may be safely
39 imported into client browsers.
40
41 Cockpit will read the files as root, so they can have tight permissions.
42
43 To check which certificate `+cockpit-ws+` will use run the following
44 command.
45
46 ....
47 $ sudo /usr/libexec/cockpit-certificate-ensure --check
48 ....
49
50 Or, on Debian-based systems:
51
52 ....
53 $ sudo /usr/lib/cockpit/cockpit-certificate-ensure --check
54 ....
55
56 If using `+certmonger+` to manage certificates, following command can be
57 used to automatically prepare a certificate/key file pair:
58
59 ....
60 getcert request -f /etc/cockpit/ws-certs.d/50-certmonger.cert \
61 -k /etc/cockpit/ws-certs.d/50-certmonger.key \
62 -D myhostname.example.com \
63 [--ca=...]
64 ....
65
66 This will not work on Red Hat Enterprise Linux 8 by default. Adjust the
67 SELinux type of the certificate directory to `+cert_t+` to allow
68 certmonger to write its certificates there:
69
70 ....
71 semanage fcontext -a -t cert_t '/etc/cockpit/ws-certs\.d(/.*)?'
72 restorecon -v /etc/cockpit/ws-certs.d
73 ....