HTTPS & TLS Certificates¶
This page explains how to serve CosMO over HTTPS using its built-in TLS support, and how to install and manage the server certificate with the CosMO configuration tool.
Everything on this page is done from the configuration tool's Server tab — you do not need to run keytool, OpenSSL, or edit any files by hand. The tool stores the certificate and switches HTTPS on for you.
Do you need CosMO's own HTTPS?¶
There are two common ways to give users an https:// address:
- CosMO terminates TLS itself. CosMO listens directly on an HTTPS port with a certificate you install here. Best when CosMO faces clients (or the LAN) directly, with no proxy in front.
- A reverse proxy terminates TLS. Apache, Nginx, or IIS holds the certificate and forwards plain HTTP to CosMO. In that case you usually leave CosMO's own SSL disabled and follow the Reverse Proxy Setup guide instead.
Which should I use?
If you already run a reverse proxy (or plan to), terminate TLS there and skip CosMO's SSL. Use CosMO's built-in HTTPS when it is the front door — a single-server install, an appliance, or an internal deployment without a proxy tier.
The rest of this page covers CosMO's built-in HTTPS.
The Server tab at a glance¶
Open the configuration tool and go to the Server tab. The certificate controls are:
- Enable SSL — the master switch for HTTPS. When on, CosMO serves HTTPS on the configured Port; when off, it serves plain HTTP.
- SSL Certificate — a status line showing whether a valid certificate is installed. It is colour-coded:
- green — valid,
- orange — valid but expiring within 30 days,
- red — expired, or the keystore / password / alias is wrong.
- Manage Certificate — the actions used throughout this page:
- View… — inspect the installed certificate (subject, issuer, validity, SANs, fingerprints).
- Import… — install a certificate you already have.
- Generate CSR… — create a signing request to send to a Certificate Authority (CA).
- Import CA Reply… — install the signed certificate the CA returns.
Set the port before enabling SSL
HTTPS is served on the Port value on the Server tab. Set it to your intended HTTPS port (for example 8443) and restart the service after changing it.
After any change to the certificate or the Enable SSL switch, save and restart the CosMO service for it to take effect.
Certificate options¶
You have three ways to provide a certificate. Pick the one that matches how your organisation issues certificates:
| Situation | Use |
|---|---|
| Just testing / internal, trust warnings are acceptable | The self-signed certificate (created for you) |
| You already hold a certificate + key (or a keystore) | Import… |
| You need a certificate signed by a CA (public or internal) | Generate CSR… → Import CA Reply… |
1. The self-signed certificate (testing only)¶
A fresh installation creates a self-signed certificate automatically, so HTTPS works immediately. Because no trusted authority signed it, browsers show a security warning until the user accepts the certificate.
Not for production
A self-signed certificate is fine for a quick test or an isolated internal box, but users will see certificate warnings and Single Sign-On providers may refuse it. For anything user-facing, import a trusted certificate or obtain a CA-signed one (below).
2. Import an existing certificate¶
Use Manage Certificate → Import… when you already have the certificate and private key. The Source dropdown supports two shapes:
- Keystore (PKCS12 / JKS / BCFKS) — point at an existing keystore file, enter its password, click Load to list the key entries, and pick the alias to import. The key and its whole certificate chain are copied into CosMO's keystore.
- Certificate + key files (PEM / DER / PKCS#7) — supply the private-key file and one or more certificate files:
- the private key may be PEM or DER, PKCS#1 or PKCS#8, and may be encrypted (enter its passphrase);
- the certificate file(s) may be PEM, DER, or a PKCS#7 bundle (
.p7b/.p7c). Add the leaf certificate plus any intermediates — the tool assembles and orders the chain for you.
Preview before you commit
Click Preview certificate… in the Import dialog to check the subject, validity, and SANs of what you are about to install.
Whatever the source, CosMO always stores the result in a single keystore (cosmo.pfx) and switches HTTPS on for you.
3. Get a CA-signed certificate (CSR workflow)¶
When a Certificate Authority must sign your certificate — a public CA like Let's Encrypt or DigiCert, or your organisation's internal CA — use the request-and-reply workflow.
Step 1 — Generate the request. Open Manage Certificate → Generate CSR… and fill in:
- Subject CN — the primary host name users will type, e.g.
cosmo.example.com. - Subject alt names — additional host names or IP addresses the certificate should also cover. Add a row per entry, choosing Name (DNS) or IP as the type.
- Key size — RSA
2048(default) or4096. - Alias and Keystore password — where the new key is stored in
cosmo.pfx(defaults are filled in for you). - Save CSR to — the file to write the request to.
The tool generates a new key pair, stores it with a temporary self-signed placeholder (so HTTPS keeps working meanwhile), and writes the CSR file.
The CN is always added to the SANs
Modern browsers match the host name against the certificate's Subject Alternative Names, not the CN. CosMO therefore copies the CN into the SAN list automatically — you only need to add extra names.
Step 2 — Send the CSR to your CA. Submit the saved .csr file through your CA's process. They return a signed certificate, usually with one or more intermediate certificates.
Step 3 — Install the reply. Open Manage Certificate → Import CA Reply…, confirm the Alias and Keystore password match the key you generated the CSR from, then choose how the CA delivered the certificate:
- Single file — one file containing the signed certificate (optionally with the full chain).
- Separate files — the signed certificate plus intermediate(s) and root as individual files. Add them in any order; the tool assembles and orders the chain automatically.
Use Preview certificate… to check the reply, then import. CosMO verifies the signed certificate matches your stored private key and replaces the placeholder.
Renewing without changing the key
When your certificate is due for renewal and you want to keep the same key, tick “Reuse the current certificate's key and subject (CN/SAN)” in the Generate CSR dialog. It reuses the existing private key and pre-fills the CN and SANs from the installed certificate, so you only generate a fresh CSR and import the new reply.
Viewing certificates and expiry warnings¶
Click Manage Certificate → View… at any time to see the installed certificate's subject, issuer, validity period, Subject Alternative Names, key size, and SHA-256 / SHA-1 fingerprints. (The Authentication tab — see Authentication & Login — has the same View Certificate… action for the SAML signing certificate.)
CosMO warns you about expiry in two places, using a 30-day threshold:
- In the configuration tool — the SSL Certificate status turns orange (or red once expired) and shows how many days remain.
- In the server log — when the CosMO service starts, it writes a
WARNline if the TLS certificate (or a SAML signing certificate) is within 30 days of expiry or already expired. This catches expiry even when nobody has the configuration tool open.
Renew before it lapses
An expired TLS certificate makes browsers refuse to connect. Watch for the orange status / log warnings and renew in good time using the CSR workflow above.
Keeping the private key safe¶
The configuration tool keeps your certificate and its private key in a keystore file (cosmo.pfx) in CosMO's configuration folder. Because it holds the private key:
- restrict the file to the account that runs CosMO,
- keep the keystore password confidential, and
- include the file in your backups so you can restore HTTPS after a rebuild or migration.
Guard the keystore
Anyone with cosmo.pfx and its password holds your server's private key. Store it with the same care as any other credential.
Verifying the setup¶
- Restart the CosMO service after saving changes.
- On the Server tab, confirm the SSL Certificate status is green and shows a sensible expiry date.
- Browse to
https://<host>:<port>/and confirm the connection is secure. With a CA-signed certificate the browser shows no warning; with a self-signed one you must accept the certificate. - Inspect the served certificate in the browser (padlock → certificate details) and confirm the host name appears in the Subject Alternative Names.
- If you use a reverse proxy instead, verify TLS at the proxy and see Reverse Proxy Setup.
Common problems¶
| Symptom | Likely cause |
|---|---|
| Status shows “Invalid keystore or wrong password specified” | The keystore password is wrong, or the file is not a valid PKCS12 keystore |
| Status shows “Key alias does not exist in keystore” | The selected certificate entry (alias) isn't in the keystore — re-import and pick the correct alias |
| Browser warns the certificate is not trusted | A self-signed certificate is installed, or intermediate certificates are missing from the chain |
| Browser warns the name does not match | The host name is not in the certificate's Subject Alternative Names — reissue with the correct SANs |
| Import CA Reply reports the certificate doesn't match the key | The reply was signed for a different CSR/key — regenerate the CSR and resubmit, or reuse the original key |
| HTTPS doesn't start after enabling SSL | No valid certificate installed, or the HTTPS port conflicts with another service — check the CosMO log |
| Certificate stopped working overnight | It expired — watch the orange status / startup WARN and renew ahead of time |