Cockpit's web console is an administrative entry point to a Linux machine. A trusted certificate helps an administrator recognize the intended host, but it does not replace the host's authentication, firewall policy or a private access network. The practical goal is a predictable identity on port 9090, loaded from a controlled certificate pair and verified after every renewal.
Release assumption: a current distribution-supported Cockpit using cockpit-tls and systemd socket activation, with the modern separate certificate and key format described in the upstream HTTPS guide checked in November 2026. Older Cockpit documentation also describes combined PEM files, so consult the manual shipped with your package before adapting this recipe. The example uses a separate 90-admin.cert and 90-admin.key pair and does not modify the listening port.
The management name is admin.example.com. Use a publicly valid domain that you control even if the address resolves privately for administrators. A public certificate normally exposes its names through certificate transparency, so avoid treating a management hostname as a secret security control.
Step 1: Inspect socket activation and certificate selection
Start by identifying which service receives connections and where its configuration comes from. Cockpit is normally socket-activated; a running socket with an inactive service can be expected when no user is connected. Do not interpret that alone as a fault or launch cockpit-tls manually beside the packaged service.
sudo systemctl status cockpit.socket --no-pager
sudo systemctl cat cockpit.socket cockpit.service
sudo ls -la /etc/cockpit/ws-certs.dInspect existing .cert and .crt files without displaying any private keys. Cockpit chooses a certificate by filename ordering, so an old file with a later-sorting name can win over the one you just installed. Also check whether XDG_CONFIG_DIRS or a service override changes the configuration search path. Editing the default directory is not sufficient if the package was deliberately configured to use another location.
Create a protected backup of existing certificate files and relevant Cockpit configuration. Preserve ownership and mode bits. Record the current served fingerprint from an administrator workstation, and keep an SSH session or other approved console open for recovery. A browser console should not be your only way to repair its own TLS configuration.
sudo install -d -m 0700 /root/cockpit-tls-before
sudo cp -a /etc/cockpit /root/cockpit-tls-before/
openssl s_client -connect admin.example.com:9090 \
-servername admin.example.com </dev/null 2>/dev/null \
| openssl x509 -noout -dates -fingerprint -sha256If this is the first trusted certificate deployment, document that the previous identity is self-signed. Do not delete every old certificate immediately: a staged change with a known recovery option is easier to diagnose than replacing several unrelated settings at once.
Step 2: Prepare a narrow DNS challenge registration
Create admin.example.com in SimpleACME and activate paid update access. Add the exact CNAME supplied by the portal for _acme-challenge.admin.example.com. Leave the ordinary management hostname pointed at its intended address. The challenge registration does not route browser sessions, expose Linux accounts or authorize access to Cockpit.
Configure your issuing client using the Certbot how-to, retaining the existing registration credentials in a protected host-managed location. The developer documentation explains the delegated TXT update request. The ACME client still requests the certificate from the authority and retains its private key; SimpleACME supplies DNS challenge updates only.
For a private administration console, this avoids temporarily publishing HTTP solely to answer HTTP-01 challenges. It also avoids granting a renewal process a broad DNS-provider API key. Public challenge resolution, client egress and local scheduling still need to work. A demo registration allows DNS preparation but cannot update until the account has the required paid entitlement.
Give the certificate only the identifiers needed by this host's access plan. Sharing a wildcard key across many management consoles can simplify filenames while increasing the impact of a key exposure. An exact-name certificate is often the clearer default for a single administrative endpoint.
Step 3: Install a pair that Cockpit will actually select
Validate the issued certificate's SANs, validity and matching key before placing it in Cockpit's directory. Use the full intermediate chain in the certificate file. The private key must be in the unencrypted form supported for unattended loading and protected by filesystem permissions; do not expect a socket-activated service to ask an administrator for a passphrase.
The modern upstream guide describes separate same-basename certificate and key files and notes that Cockpit reads them as root. That supports tight permissions rather than a world-readable private key. Cockpit HTTPS guide source.
sudo install -d -o root -g root -m 0755 /etc/cockpit/ws-certs.d
sudo install -o root -g root -m 0644 \
/etc/letsencrypt/live/admin.example.com/fullchain.pem \
/etc/cockpit/ws-certs.d/90-admin.cert
sudo install -o root -g root -m 0600 \
/etc/letsencrypt/live/admin.example.com/privkey.pem \
/etc/cockpit/ws-certs.d/90-admin.keyConfirm that 90-admin.cert sorts after the certificate files you intend it to supersede. The number is a naming convention, not a guaranteed priority above every existing filename. A site may already use a later name or an identity supplied by domain enrollment; inspect before changing the winner.
On SELinux systems, preserve or restore the distribution's expected context for the certificate directory and inspect policy denials if loading fails. Do not disable SELinux globally to fix a certificate path. Likewise, avoid using symlinks into an inaccessible archive unless your package's service policy explicitly supports them.
The cockpit-tls manual explains the socket-activated TLS component and the certificate check utility. Its shipped version is also useful for confirming format differences from older combined-file examples. Cockpit TLS manual source.
Step 4: Check selection, restart the service and verify access
Run the certificate-selection utility provided by your distribution. The path differs between common packaging families, so use the one installed on your machine. The command checks which certificate Cockpit will use; it is more informative than assuming that a successful file copy selected the intended identity.
# Common Fedora/RHEL-family path:
sudo /usr/libexec/cockpit-certificate-ensure --check
# Common Debian-family path; use this instead when installed here:
sudo /usr/lib/cockpit/cockpit-certificate-ensure --checkDo not run both blindly if one does not exist. Inspect the output and correct a selection or parse error before restarting. Restart cockpit.service during an approved window to ensure the active TLS process uses the selected files, while preserving the existing socket definition and port.
sudo systemctl restart cockpit.service
sudo systemctl status cockpit.socket cockpit.service --no-pager
sudo journalctl -u cockpit.service -n 80 --no-pager
openssl s_client -connect admin.example.com:9090 \
-servername admin.example.com -verify_return_error </dev/nullA restart can disconnect administrative browser sessions, so notify other operators. Reconnect by the intended hostname and verify both the displayed certificate and a normal login. Test a harmless status view rather than making an unrelated host configuration change simply to prove the page works.
Cockpit normally redirects remote HTTP connections on its port to HTTPS, with documented exceptions such as localhost behavior and selected endpoints. Do not set AllowUnencrypted to work around certificate problems. A plain HTTP response from one exceptional path is not evidence that the certificate is missing, and a successful HTTPS handshake is not evidence that every access policy is correct.
Step 5: Turn renewal into a small audited maintenance action
After the ACME client reports successful renewal, validate and stage a complete certificate generation. Preserve the previous matching pair, deploy both files under a lock, run the selection check and restart the service. Avoid two independent renewal jobs replacing the same basename; concurrent writes can create a temporary mismatch and make troubleshooting misleading.
Verify a fresh connection from an actual administrator network after activation. Compare the served serial or fingerprint with the candidate, and record the result. Existing sessions and localhost checks do not necessarily exercise the same route or certificate that remote operators see. If a proxy or network gateway terminates HTTPS before Cockpit, that endpoint has a separate certificate owner and needs its own deployment procedure.
Rollback restores the previous unexpired pair under the same selected basename, checks it and restarts cockpit.service. If the prior state used a self-signed identity, returning to it may restore connectivity but also restores the previous trust warning; document that limitation. Do not remove the socket, change Linux authentication or reboot the whole host as the first response to a malformed certificate file.
Keep expiration monitoring independent of renewal logs. An issuing client can renew correctly while a deployment copy fails or an unexpected later-sorting file remains selected. SimpleACME TXT activity indicates challenge changes, not successful certificate issuance or Cockpit activation. Alert on the served certificate and the deployment result so an administrator has time to repair either stage before losing a trusted management channel.
Keep the management access policy unchanged
Review firewall and socket overrides after activation to confirm that this certificate change did not broaden the listener's exposure. A trusted public certificate can be used on a private address; it is not evidence that the service should accept connections from every network. Preserve the administrative source restrictions that existed before the work.
If your host is enrolled in a directory service, identify whether enrollment tooling also manages a certificate in ws-certs.d. An administrator-supplied filename that takes priority may intentionally override that identity. Document the ownership choice so a later domain enrollment or package upgrade does not appear to replace a certificate mysteriously. Do not remove enrollment material without understanding its other consumers.
Where operators connect using several aliases, choose the supported canonical name and communicate it clearly. Adding every informal alias to a certificate can postpone cleanup while expanding the identity inventory. A bookmark using an IP address can legitimately fail hostname verification even though the named endpoint is configured correctly.
For audit purposes, save the chosen certificate path, fingerprint, validity and the check utility's result alongside the restart timestamp. Exclude the key contents and Linux login credentials. These nonsecret details are sufficient to identify an unexpected selection change and help a future operator recover the correct certificate generation without searching through unlabelled private-key backups.
Frequently asked questions
Why is Cockpit still presenting its old certificate?
Inspect filename ordering, the effective configuration directory and the active service. The newly copied file may not be the selected candidate, or the running TLS process may need a controlled restart. Compare fingerprints rather than relying on filenames alone.
Should the certificate and key be combined?
This guide uses the modern separate-file format documented by the upstream HTTPS guide. Older package manuals describe combined PEM files. Follow the format supported by your installed Cockpit and confirm selection with its check utility before activation.
Does DNS validation require publishing the web console?
No. DNS-01 can validate the delegated challenge while Cockpit stays behind a VPN or firewall. The issuing client needs outbound access and the challenge DNS must be public, but the management listener need not accept public inbound traffic.
Does a trusted certificate replace Linux login security?
No. It authenticates the network endpoint and encrypts the connection. Linux account policy, multifactor authentication where supported, network restrictions and operator permissions remain separate controls and should stay intact during certificate work.