[[https]]= SSL/TLS UsageCockpit usually requires that web browsers communicate with it usingHTTPS, for security reasons.[[https-required]]== HTTPS RequirementCockpit listens for both HTTP and HTTPS connections on the same port, bydefault 9090. If an HTTP connection is made, Cockpit will redirect thatconnection to HTTPS. There are some exceptions:* If an HTTP connection comes from `+localhost+` (`+127.0.0.1+` or`+::1+`, then Cockpit will allow communication without redirecting toHTTPS.* Certain URLs, like `+/ping+` are not required to use HTTPS.This behavior can be overridden by setting the `+AllowUnencrypted+`option in `+cockpit.conf+`.[[https-certificates]]== CertificatesCockpit will load a certificate from the `+/etc/cockpit/ws-certs.d+`,directory, or below `+$XDG_CONFIG_DIRS+` if set (seelink:./cockpit.conf.5.html[cockpit.conf]). It will use the last filewith a `+.cert+` or `+.crt+` extension in alphabetical order. The fileshould contain one or more OpenSSL style `+BEGIN CERTIFICATE+` blocksfor the server certificate and the intermediate certificate authorities.The private key must be contained in a separate file with the same nameas the certificate, but with a `+.key+` suffix instead. The key must notbe encrypted.If no certificate is found, a self-signed certificate is created andstored in the `+0-self-signed.cert+` file. On some platforms, Cockpitwill also generate a ca.crt in that directory, which may be safelyimported into client browsers.Cockpit will read the files as root, so they can have tight permissions.To check which certificate `+cockpit-ws+` will use run the followingcommand.....$ sudo /usr/libexec/cockpit-certificate-ensure --check....Or, on Debian-based systems:....$ sudo /usr/lib/cockpit/cockpit-certificate-ensure --check....If using `+certmonger+` to manage certificates, following command can beused to automatically prepare a certificate/key file pair:....getcert request -f /etc/cockpit/ws-certs.d/50-certmonger.cert \-k /etc/cockpit/ws-certs.d/50-certmonger.key \-D myhostname.example.com \[--ca=...]....This will not work on Red Hat Enterprise Linux 8 by default. Adjust theSELinux type of the certificate directory to `+cert_t+` to allowcertmonger to write its certificates there:....semanage fcontext -a -t cert_t '/etc/cockpit/ws-certs\.d(/.*)?'restorecon -v /etc/cockpit/ws-certs.d....