Skip to main content

Update HTTPS Certificates on a Self-Hosted Server

Generate, chain, and install custom CA or Let's Encrypt HTTPS certificates for nb-nginx on a self-hosted NetBeez NextGen server.

Written by Panickos Neophytou

On a self-hosted NetBeez NextGen (Version 20.0+) server, public HTTPS traffic terminates in the nb-nginx reverse-proxy container using the certificate and private key stored at /opt/netbeez/user_data/secrets/netbeez.crt and /opt/netbeez/user_data/secrets/netbeez.key. You can replace the default IMS-issued HTTPS certificate with a certificate signed by your organization's Certificate Authority (CA) or with Let's Encrypt.

In this article:

Step 1: Generate a Private Key and CSR

Generate an unencrypted 2048-bit (or 4096-bit) RSA private key and Certificate Signing Request (CSR) using OpenSSL on your workstation or the NetBeez server. Include your server's Fully Qualified Domain Name (FQDN) in both the Common Name (CN) and Subject Alternative Name (subjectAltName) so modern browsers trust the certificate:

openssl req -new -newkey rsa:2048 -nodes \
  -keyout netbeez.key \
  -out netbeez.csr \
  -subj "/C=US/ST=<State>/L=<City>/O=<Company_Name>/CN=<SERVER_FQDN>" \
  -addext "subjectAltName=DNS:<SERVER_FQDN>"

Keep netbeez.key confidential and submit netbeez.csr to your internal or public Certificate Authority.

Step 2: Obtain and Assemble the PEM Certificate Chain

When your CA returns the signed certificate, verify that it is PEM-encoded (Base64 ASCII blocks starting with -----BEGIN CERTIFICATE-----) and includes the full trust chain in exact leaf-first order:

  1. Your primary server certificate (for <SERVER_FQDN>) at the top.

  2. Any intermediate CA certificate(s) in order.

  3. Your root CA certificate (if required by internal clients) at the bottom.

If your CA provided separate files, concatenate them into a single netbeez.crt file:

cat server_certificate.pem intermediate_ca.pem root_ca.pem > netbeez.crt

Step 3: Install the Certificates on Your NextGen Server

Important: Only replace netbeez.crt and netbeez.key. Do not modify or overwrite server-agent.crt or server-agent.key in /opt/netbeez/user_data/secrets/—those IMS-issued files authenticate agent socket connections on nb-commsrv.

Option 1: Install Certificates Yourself (Root / Sudo Access)

  1. Back up the existing HTTPS certificate and private key:

    sudo mkdir -p /opt/netbeez/user_data/secrets/ims-original
    sudo cp -p /opt/netbeez/user_data/secrets/netbeez.crt /opt/netbeez/user_data/secrets/ims-original/netbeez.crt.bak
    sudo cp -p /opt/netbeez/user_data/secrets/netbeez.key /opt/netbeez/user_data/secrets/ims-original/netbeez.key.bak
  2. Copy your new netbeez.crt and unencrypted netbeez.key into /opt/netbeez/user_data/secrets/ and set read permissions for the read-only container mount:

    sudo install -m 444 netbeez.crt /opt/netbeez/user_data/secrets/netbeez.crt
    sudo install -m 444 netbeez.key /opt/netbeez/user_data/secrets/netbeez.key

    Note: Subsequent NetBeez Software Updates preserve existing non-empty netbeez.crt and netbeez.key files and will not overwrite your custom certificate.

  3. Restart the nb-nginx reverse-proxy service to load the new TLS certificate (agent TCP connections on port 20018 are unaffected):

    source /opt/netbeez/app_data/netbeez.rc
    nb-docker-compose restart nginx
  4. Verify that nb-nginx is healthy and serving your new certificate:

    nb-docker-compose ps nginx
    echo | openssl s_client -connect <SERVER_FQDN>:443 -servername <SERVER_FQDN> 2>/dev/null | openssl x509 -noout -subject -issuer -dates

Option 2: Cloud Instances Hosted by NetBeez

If NetBeez hosts and manages your cloud server and you use a custom vanity domain, open a support request via Help & Support or email support@netbeez.net to coordinate certificate installation.

Alternative: Let's Encrypt on Internet-Facing Servers

If your self-hosted server has a public DNS A record and allows inbound TCP 80 and TCP 443 from the internet, you can automate 90-day certificates with Certbot's standalone HTTP-01 mode:

  1. Install Certbot via snap (sudo snap install --classic certbot).

  2. Configure Certbot renewal hooks under /etc/letsencrypt/renewal-hooks/:

    • pre hook: Run docker stop nb-nginx so port 80 is free during the brief HTTP-01 challenge.

    • deploy hook: Copy ${RENEWED_LINEAGE}/fullchain.pem to /opt/netbeez/user_data/secrets/netbeez.crt and ${RENEWED_LINEAGE}/privkey.pem to /opt/netbeez/user_data/secrets/netbeez.key (mode 444), then run docker restart nb-nginx if running.

    • post hook: Run docker start nb-nginx if stopped.

  3. Issue the certificate with sudo certbot certonly --standalone --preferred-challenges http -d <SERVER_FQDN> and test automatic renewal with sudo certbot renew --dry-run.

Validation and Troubleshooting Notes

  • Remove Key Passphrases: If your private key is encrypted with a passphrase, nb-nginx cannot start unattended. Strip the passphrase before copying the key:

    openssl rsa -in netbeez-encrypted.key -out netbeez.key
  • Confirm Certificate and Private Key Match: Run both commands below and confirm they output identical SHA-256 hashes:

    openssl pkey -in netbeez.key -pubout -outform pem | sha256sum
    openssl x509 -in netbeez.crt -pubkey -noout -outform pem | sha256sum
Did this answer your question?