SSL for the panel hostname
This page is for you if the browser shows "Not secure" on https://panel.example.com:8443 after installing. The usual cause is that the panel hostname did not point to the server yet when the installer ran, so the installer used a temporary self-signed certificate.
Why it happens
The installer tries Let's Encrypt when it installs the panel (--tls auto, the default), with the built-in ACME client (moorcp-shared hostcert issue, no certbot). Let's Encrypt checks the hostname over HTTP on port 80. The check fails when:
- the panel hostname has no A record yet, or it points to another IP;
- port 80 is closed in the cloud provider's firewall.
When it fails, the installer still finishes with a self-signed certificate. The hostname stays recorded, so moorcp-hostcert.timer retries Let's Encrypt twice a day for 7 days and installs the certificate as soon as DNS points to the server. Running the installer again does not replace an existing certificate. Follow the steps below to issue it right away.
The same certificate is used by the admin panel (8443) and the client panel (2083).
Step 1: point DNS
- In your domain's DNS, create an A record for the panel hostname pointing to the server's public IP, for example
panel.example.com → 10.0.0.10. - If you use Cloudflare, set this record to DNS only (grey cloud), not Proxied.
- Wait until public DNS returns the server IP:
dig +short panel.example.com @1.1.1.1- Make sure port 80 is open from the internet (cloud firewall or security group). The installer already opened firewalld on the server.
TIP
Point DNS before you run the installer. The installer then sets up Let's Encrypt right away and you do not need this page.
Step 2: make sure the deploy hook knows the panel hostname
The deploy hook only copies the certificate to the panel for the hostname in /etc/moorcp-shared/certbot-domain:
cat /etc/moorcp-shared/certbot-domainIf it is empty or different, write the panel hostname:
echo panel.example.com > /etc/moorcp-shared/certbot-domainThe installer writes this file for every --tls mode, even when Let's Encrypt fails, so it usually holds the hostname already. Installers from earlier releases did not write it with --tls self-signed, and installers before rc.21 deleted it when they fell back to self-signed.
Step 3: issue the certificate
If the installer fell back to self-signed (--tls auto), the hostname is already recorded. Renew now:
moorcp-shared hostcert renewOtherwise (--tls self-signed, or retries stopped after 7 days), issue it:
moorcp-shared hostcert issue --domain panel.example.com --email admin@example.comThe same command works for panel only and for panel + hosting (all-in-one):
- if port 80 is free,
hostcertserves the HTTP-01 challenge itself; - if the hosting web server uses port 80 and serves the ACME webroot
/var/lib/moorcp/acmefor the panel hostname,hostcertuses the webroot; - otherwise it stops the active web server (OpenLiteSpeed, Nginx, or Apache) for a few seconds during validation and starts it again. Websites on this server are down for those seconds.
The certificate is stored in /etc/letsencrypt/live/panel.example.com/, and the deploy hook copies it to the panel.
Installs that already use certbot
If the panel certificate was issued with certbot (there is a /etc/letsencrypt/renewal/panel.example.com.conf file), hostcert refuses with panel.example.com is managed by certbot; renew it with certbot, and certbot keeps renewing it. See Certbot (older installs).
Step 4: check the result
The panel loads the new certificate within a minute, without a restart. Check:
echo | openssl s_client -connect panel.example.com:8443 -servername panel.example.com 2>/dev/null | openssl x509 -noout -issuer -enddateThe issuer must be Let's Encrypt. Then reload the panel in the browser.
Agents keep their connection
Hosting servers installed with --panel-ca (and the agent on all-in-one) stay connected after the switch: agents from v0.9.0-rc.45 trust the public certificate authorities as well as the panel certificate they were installed with. Upgrade older agents before you switch the certificate. See Upgrading.
Automatic renewal
moorcp-hostcert.timer runs moorcp-shared hostcert renew twice a day (03:00 and 15:00, with up to 1 hour of random delay). It renews when less than 30 days remain, then runs the deploy hook, so the panel switches to the new certificate without a restart. Check the expiry date:
moorcp-shared hostcert statusTo stop renewing a hostname you no longer use (the certificate files are kept):
moorcp-shared hostcert remove --domain panel.example.comCertbot (older installs)
On installs where the panel certificate was issued with certbot, certbot renews it about every 60 days through certbot-renew.timer, with the same method (and hooks) used to issue it. Test without replacing the certificate:
certbot renew --dry-runIf the certificate was issued while port 80 was free and the server later became all-in-one, renewal can fail with Could not bind TCP port 80 because it is already in use. Add hooks that stop the web server briefly to the existing certificate. Example for OpenLiteSpeed:
certbot reconfigure --cert-name panel.example.com --pre-hook 'systemctl stop lshttpd; for i in $(seq 1 60); do ss -Hltn "sport = :80" | grep -q . || break; sleep 0.5; done' --post-hook 'systemctl start lshttpd'Replace lshttpd with your server's web server: nginx (nginx-proxy and nginx) or httpd (Apache). Check which one is running with systemctl is-active lshttpd nginx httpd.
Common problems
| Message | Cause | Fix |
|---|---|---|
port 80 is in use and the web server does not serve /var/lib/moorcp/acme for panel.example.com: ... | Port 80 is held by a web server that hostcert does not recognize | Stop that service briefly, then run hostcert issue again |
panel.example.com is managed by certbot; renew it with certbot | The certificate was issued with certbot | Keep using certbot; see Certbot (older installs) |
NXDOMAIN looking up A for panel.example.com | No A record yet, or not propagated | Create the A record, wait, check with dig |
Timeout during connect (likely firewall problem) | Port 80 closed from outside, or DNS points to another IP | Open port 80 in the cloud firewall; check the IP with dig |
Invalid response ... 403/404 | The record is proxied by Cloudflare or points to another server | Set DNS only; check the IP |
too many failed authorizations recently / too many certificates | Let's Encrypt rate limits | Wait about an hour; fix DNS or port 80 before trying again |
CAA record ... prevents issuance | The domain's CAA record does not allow Let's Encrypt | Add CAA 0 issue "letsencrypt.org" |
Certificate issued but the panel is still self-signed? Usually /etc/moorcp-shared/certbot-domain did not contain the panel hostname when the certificate was issued. Fill in that file (step 2), then run the hook by hand:
RENEWED_LINEAGE=/etc/letsencrypt/live/panel.example.com RENEWED_DOMAINS=panel.example.com /etc/letsencrypt/renewal-hooks/deploy/moorcp-shared-deploy-hook.shINFO
On all-in-one, the panel hostname must also resolve so this server can enroll as a hosting server. If the installer stops because the hostname does not resolve yet, point DNS and run the same installer command again. See Panel + hosting (all-in-one).
