init.sh
generates in config/tls/. That certificate is for getting started: browsers warn about it, and
API clients have to trust its ca.pem. Before you go live, use this page to replace it with a real
certificate for every name you serve, renewed without touching the machine again.


.env, and Envoy recreated after each renewal so it loads the new files. This page does them
with certbot and Let’s Encrypt. To use other tools, see
Other ways.
Before you begin
You need:- Fonoster installed with Docker Compose. See Install with Docker Compose.
- Every name you serve pointing at this machine, for example
app.example.comfor the dashboard andapi.example.comfor the SDKs. One name for both works too. - Ports
80and443free on this machine and open in any firewall in front of it.
Get a certificate
Install certbot
80 for the
first certificate. On Ubuntu and Debian:Get one certificate for every name
-d per name. The first name also names the folder the files land in:/etc/letsencrypt/live/app.example.com/ as fullchain.pem and
privkey.pem.Use your certificate
Set the three lines in .env
fonoster folder, set these lines in .env. PUBLIC_URL is the address people open
the dashboard at:Apply it
443 and redirects 80 to it. Browsers no longer warn,
and API clients don’t need --ca-file. With your certificate, Envoy also tells browsers to keep
to HTTPS for this host for a year (HSTS). It never does with the generated certificate, so
you can always click through its warning. Browser calls use wss://. Envoy passes them to
Routr, which also listens for them on port 5063 inside the stack. You don’t publish or open
that port.Check it
200:Renew automatically
The timer renews the certificate when it has 30 days left. Envoy holds port80 and reads the
certificate only when its container is created, so add two hooks: one stops Envoy before a renewal,
the other recreates it after.
Add the hooks
/opt/fonoster if your fonoster folder is elsewhere:Try a renewal
Congratulations, all simulated renewals succeeded. certbot reports the hooks’
progress lines as “error output”. They aren’t errors.Other ways
DNS challenge (no downtime)
DNS challenge (no downtime)
80, so Envoy
keeps running during renewals. Install your provider’s certbot plugin, issue the certificate
with it instead of --standalone, and keep only the post hook.A proxy in front
A proxy in front
docker compose up -d, then point the proxy at 127.0.0.1:8449. It must forward
gRPC (HTTP/2) and WebSocket upgrades on /sip.A certificate from another CA
A certificate from another CA
TLS_CERT and TLS_KEY at your PEM files: the certificate chain and the private key.
After you replace them, recreate Envoy with docker compose up -d --force-recreate envoy.SIP over TLS
Accept SIP over TLS on port 5061
Accept SIP over TLS on port 5061
5060. To also accept SIP over TLS on 5061, for carriers that require
it (WhatsApp does), you need a certificate that covers the names carriers connect to, a keystore
made from it, and a DNS name in Routr’s externalAddrs.Get a certificate that covers the SIP names
<label>.pstn.<domain> (one name per trunk; a linked WhatsApp
number gets its own), and they open a second connection to the name Routr writes in
Record-Route for mid-call requests such as the carrier’s hangup. The certificate’s names
must cover both: the wildcard *.pstn.<domain> and one fixed name under it, such as
sip.pstn.<domain>. Your HTTPS certificate covers only app. and api., so request one
more. Let’s Encrypt issues wildcards only through the DNS challenge, so use your DNS
provider’s certbot plugin (see Other ways) instead of --standalone:*.pstn.<domain> and sip.pstn.<domain> DNS records at this machine.Build the keystore
openssl line and docker compose up -d --force-recreate routr to that certificate’s
post hook.Name the host carriers call back
externalAddrs in Record-Route toward carriers. Over TLS the carrier verifies
that name against your certificate, so it must be the fixed DNS name from step 1, not the IP
address the file has by default (${HOST_IP}). Set it under spec.signaling in
config/routr-one.yaml:Turn the TLS listener on
routr lines in compose.tls.yaml, add it to COMPOSE_FILE
(COMPOSE_FILE=compose.yaml:compose.tls.yaml), uncomment the tls transport in
config/routr-edgeport.yaml, set its keyStorePassword to <password>, open
5061/tcp in your firewall, and run docker compose up -d --force-recreate routr. Carriers and
softphones then use transport=tls on port 5061.securityContext.trustStore and trustStorePassword in
config/routr-edgeport.yaml, then recreate Routr. Over a TLS trunk, call audio is encrypted with SRTP
(AES_CM_128_HMAC_SHA1_80, the one suite Routr offers); over 5060 it isn’t.Troubleshooting
The browser warns that the connection isn't private
The browser warns that the connection isn't private
init.sh generated for getting started. Open the details and continue to
the site; the browser remembers it. To make the warning go away, use your own certificate
(above).The browser warns and won't let you continue
The browser warns and won't let you continue
chrome://net-internals/#hsts, delete the host’s domain security policy, and
reload. Other browsers clear it with the site’s data.An API client fails with a certificate error
An API client fails with a certificate error
config/tls/ca.pem
from the server and pass it: --ca-file ca.pem for the CLI and the region
agent, the caFile option for the SDK, or FONOSTER_CA_FILE=ca.pem for any
of them.The dashboard links point at http://
The dashboard links point at http://
PUBLIC_URL in .env still starts with http://.
Set it to https:// and the certificate’s name, then run docker compose up -d.
To keep plain HTTP behind your own TLS proxy, use compose.http.yaml (above).Envoy doesn't start after you set TLS_CERT and TLS_KEY
Envoy doesn't start after you set TLS_CERT and TLS_KEY
.env exist on this machine, and read docker compose logs envoy.certbot can't bind to port 80
certbot can't bind to port 80
80, usually Envoy. Add the hooks above, or stop Envoy before you issue
the first certificate.