HTTPS setup
Both consoles serve HTTPS by default as soon as a certificate is bound to their ports. Binding one takes a single elevated step per machine, which covers both consoles. Until then each console still starts, on plain http on the local machine, with a warning.
What HTTPS protects
Section titled “What HTTPS protects”| Threat | Without HTTPS | With HTTPS |
|---|---|---|
| Reading the session cookie or vault answers off the wire | On the local machine this already needs administrator rights, so the gain is small. Beyond the local machine it would be exposed, so Harbor refuses -AllowRemote without HTTPS. |
The traffic is encrypted, and the session cookie becomes __Host-harbor_sid with the Secure flag, so the browser never sends it over plain http. |
| A page from another origin riding the session | Blocked either way by Harbor’s origin checks and CSRF token. | Same. |
Set it up
Section titled “Set it up”Choose one way. Each needs a Windows administrator once.
From an admin-only install (recommended)
Section titled “From an admin-only install (recommended)”In an elevated PowerShell, from a copy of Harbor that only administrators can change (see Install: all users):
Import-Module "$env:ProgramFiles\WindowsPowerShell\Modules\HarborOnboard"Initialize-HarborTls -TrustRootWith the -SetupTls switch
Section titled “With the -SetupTls switch”.\Install-Harbor.ps1 -SetupTls # or: .\Launch-Harbor.ps1 -SetupTlsThe switch first asks:
Trust Harbor's HTTPS certificate on this machine, so browsers show no warning? It is valid for localhost and 127.0.0.1 only. [Y/n]Then it opens an elevated PowerShell for you (one UAC prompt), but only
when no standard user can change the Harbor folder, or every script in it is
signed. A per-user copy is refused with the reasons and the way out, because
running user-writable code elevated would let anyone who can write the folder
run code as an administrator. Harbor Health’s Install-HarborHealth.ps1 and
Launch-Harbor-Health.ps1 have the same switch.
With the Windows service
Section titled “With the Windows service”Install-HarborService sets up HTTPS as part of the install. See
Run as a Windows service.
Start the consoles normally. They serve https://localhost:8787 and
https://localhost:8788.
What Initialize-HarborTls does
Section titled “What Initialize-HarborTls does”| Aspect | Behaviour |
|---|---|
| Certificate | Without -CertThumbprint, it reuses Harbor’s own certificate while it has more than 30 days left, or generates one: a self-signed leaf (never a CA), subject Harbor Web (localhost), valid for localhost and 127.0.0.1 (plus your -Hostnames with -AllowRemote), RSA 2048, server authentication only, valid 2 years (-ValidYears). |
| Private key | In LocalMachine\My, not exportable. Only SYSTEM and Administrators can use it. The consoles never touch it: Windows (http.sys) does the TLS handshake. |
| Trust | -TrustRoot adds the leaf, and only the leaf, to the machine’s trusted roots. A stolen key could impersonate only localhost and the listed names, and stealing it already takes administrator rights. |
| Ports | Binds 8787 and 8788 on 127.0.0.1 (all addresses with -AllowRemote). Both ports change, or neither: any failure restores what was there. |
| Other applications | It refuses to replace a binding that belongs to another application, unless you add -Force. |
| Re-running | Safe: each binding is swapped in place. |
Your own certificate (for example from your internal CA):
Initialize-HarborTls -CertThumbprint <thumbprint>It must be in LocalMachine\My, with its private key, and not expired.
Check it
Section titled “Check it”Get-HarborTlsStatus -Port 8787 # no elevation neededGet-HarborTlsStatus -Port 8788It returns Bound, the Thumbprint, NotAfter, ExpiresInDays, whether it is
Harbor’s own certificate, and Usable with a Problem when it is not.
How a console chooses its scheme
Section titled “How a console chooses its scheme”| Situation | Result |
|---|---|
| A usable certificate is bound to the port | https. |
-Https (or the service task) |
https, and the console refuses to start without a binding, with the exact fix in the message. |
-Http, or "https": false in the profile |
plain http, on purpose, without a warning. Loopback only. |
| No binding, or a binding that is not usable (certificate missing, no private key, expired) | Falls back to plain http on loopback, with an amber strip: “HTTPS is not set up on this machine: this console is serving plain http on loopback. One elevated step fixes it: Initialize-HarborTls -TrustRoot”. |
-AllowRemote never falls back: it refuses to start without HTTPS.
The two consoles must use the same scheme: an https Harbor Home cannot show an http Harbor Health. If only one port is bound, both consoles and the launchers say so (“Mixed schemes …”). Run the setup again: it binds both ports.
After switching to HTTPS
Section titled “After switching to HTTPS”- Bookmarks. The ports stay the same but the scheme changes, so
http://localhost:8787andhttp://localhost:8788stop working. Usehttps://. - Single sign-on. The redirect URIs change. Add
https://localhost:8787/auth/callbackandhttps://localhost:8788/auth/callbackto the CyberArk Identity app before you switch, and keep the http ones until every console has moved. Until then CyberArk sign-in fails; the emergency account still works. See SSO. - No HSTS. Harbor deliberately never sends
Strict-Transport-Security: it applies to a whole host name, so onlocalhostit would force https on every other local web server, on every port.
The console warns at start when its certificate expires within 30 days: “The TLS certificate expires in N day(s) – renew it: Initialize-HarborTls -Renew”.
Initialize-HarborTls -Renew -TrustRoot # elevated-Renew always generates a new certificate, swaps both bindings, and retires
Harbor’s older certificates, except one that another port still uses.
What can go wrong
Section titled “What can go wrong”| Symptom | Fix |
|---|---|
Initialize-HarborTls needs an elevated (Administrator) PowerShell |
Run it as administrator, from an admin-only copy. |
No TLS certificate is bound to port 8787 |
You started with -Https (or as a service) before setting up HTTPS. Run Initialize-HarborTls -TrustRoot. |
| The browser warns about the certificate | Trust it: run the setup again with -TrustRoot, or use a certificate your browsers already trust. A browser with its own certificate store may need it added there. |
| “Mixed schemes” strip | Only one port is bound. Run the setup again; it binds both. |
| CyberArk sign-in fails right after the switch | Register the https redirect URIs in the Identity app. |
Covers Harbor Onboard 0.59.0 / Harbor Health 0.22.0. On an older release? Upgrading and the release notes list what changed.
