Skip to content
GitHubSupport

Domain and certificates

The panel gets a public certificate by itself and renews it:

  • with a domain: a regular certificate for the domain;
  • without a domain: a short-lived certificate for the IP address, about six days, renewed automatically.

Issuing needs port 80 open, and it is used for a few seconds. If the certificate cannot be obtained, the panel runs with a self-signed one: the browser warns you once, some apps will not accept the subscription, and Telegram will not open the Mini App. The status is shown in Settings → Security → Panel certificate. The “Get now” button (after a failure, “Retry”) waits up to 90 seconds and shows the result or the reason right in the card.

By default certificates are issued by Let’s Encrypt. You can pick another authority in Settings → Security → Panel certificate:

Authority What you need
Let’s Encrypt Nothing, it is the default.
ZeroSSL Only an e-mail: the panel gets the account key (EAB) from ZeroSSL by itself.
Google Trust Services An EAB key: keyId and HMAC. Create it in Google Cloud with gcloud publicca external-account-keys create. The HMAC is stored in the panel and never shown back.

The choice applies to the panel and to all nodes. When you change the authority, certificates are reissued, and the old ones keep working until the new ones arrive.

The “Check the certificate” button in Settings → Security looks at the panel from outside and shows:

  • what the panel port and the subscription port actually serve: who issued the certificate, for which names, until when, whether the chain is complete, and whether it is someone else’s certificate (for example nginx or certbot in front of the panel);
  • whether the domain’s A and AAAA records point to this server and whether the domain goes through the Cloudflare proxy (the orange cloud: turn it off, it must be grey);
  • whether port 80 reaches the panel for the authority’s check. The panel puts a test token on its port 80 and fetches it through the public address. It fetches it from the server itself, so a hoster firewall that blocks only outside traffic may not show up;
  • how the last certificate orders went;
  • for each node: its certificate and what the ports of its TLS-over-TCP protocols (AnyTLS, TrustTunnel, VLESS TLS) serve.

Each problem comes with a fix: a button (“Get now”, “Retry”, “Switch to ZeroSSL”, “Update the node”) or a command for the server that you can copy, for example ufw allow 80/tcp or ss -ltnp 'sport = :80'.

The panel explains errors in plain words. Here is what it can tell you:

  • port 80 is busy with another program (with its name, if it could be found out);
  • port 80 is closed in the hoster’s firewall or in ufw;
  • nothing answers on port 80;
  • another web server answers on port 80;
  • the domain is behind the Cloudflare proxy;
  • the domain points to another server;
  • the domain has no A or AAAA record;
  • a CAA record forbids this authority to issue certificates;
  • a rate limit, with the time after which the authority accepts orders again;
  • problems with the EAB key;
  • the server could not reach the certificate authority;
  • the node is too old.

An unknown error is shown as it is, in the authority’s own words, under “More”.

Settings → General → Server: the “Server address” and “Domain” fields. On save, the panel checks the domain through public DNS and tells you if there is no record or the domain points to another server. After a change, the panel requests a new certificate right away.

If port 80 is closed, or you need a wildcard, a Cloudflare Origin certificate or a certificate from your own CA, install your own: Settings → Security → Panel certificate → Own certificate. You need “Certificate with its chain” (fullchain.pem) and “Private key” (privkey.pem), as a file or as text. Port 80 is not needed then. To go back, use “Back to the automatic one”.

The same from the command line, handy for a certbot or acme.sh renewal hook:

arikan cert set --cert /etc/letsencrypt/live/DOMAIN/fullchain.pem \
--key /etc/letsencrypt/live/DOMAIN/privkey.pem
certbot renew --deploy-hook \
'arikan cert set --cert $RENEWED_LINEAGE/fullchain.pem --key $RENEWED_LINEAGE/privkey.pem'

The new file is picked up without a restart. arikan cert show shows what is installed now, and arikan cert clear goes back to the automatic public certificate.

The panel itself orders a public certificate for each remote node: for the node’s domain if it has one, otherwise for its IP (a six-day Let’s Encrypt certificate, renewed automatically). The authority checks the node on the node’s port 80 (HTTP-01). The node opens port 80 only for the few seconds of a check and releases it after.

So port 80/tcp must be open on the node’s server. The installer opens it in ufw, and mikan update opens it on nodes installed earlier. If port 80 on the node is held by another program (nginx, Caddy), the panel says so and names the program when the node can tell. Like on the panel, you can set a port for the check on the node with the line "MIKAN_ACME_LISTEN": "127.0.0.1:18080" in /opt/mikan/config.json on the node’s server (then mikan restart; on a server older than 0.5.2.0 it is the MIKAN_ACME_LISTEN=127.0.0.1:18080 line in .env, see The mikan command), and pass /.well-known/acme-challenge/ there from the web server.

The certificate used by the node’s protocols on TLS is chosen in this order:

  1. The node’s own uploaded certificate (Nodes → node → ⋯ → Certificate, or arikan cert set ... --node N). It wins over everything.
  2. The public certificate the panel got for this node.
  3. On the panel’s own node: the panel’s public certificate (for a domain, and now also for an IP).
  4. A self-signed certificate whose fingerprint (the pin) goes into links. Only as a fallback.

With a public certificate, subscription links carry no pin and no “insecure”. Then Hysteria2, TUIC, AnyTLS, TrustTunnel and VLESS TLS of this node also appear in sing-box apps (SFA, SFI, SFM, SFT), and TUIC checks the certificate. Links switch only after the node has actually taken the new certificate. Apps that have not refreshed the subscription keep the old pinned link until they do.

Nodes older than the panel cannot get a public certificate: the card says “update the node”. They keep working on the pinned self-signed certificate. With it, sing-box apps do not show the node’s TLS protocols, and TUIC goes without certificate verification.

The certificate status is shown on the node card, see Nodes.

If certbot or nginx is already installed on the server and holds port 80, it gets in the way of the authority’s check. “Check the certificate” names it. There are three ways out:

  • free port 80;
  • pass /.well-known/acme-challenge/ to the panel through MIKAN_ACME_LISTEN, as the installer does for nginx and Caddy;
  • upload your own certificate, which wins over the public one.

Settings → Subscription → Subscription port moves subscription links and the subscription page to a separate port, for example 2053 or 8443. It applies immediately, with no restart. The admin UI does not open on this port, and old links on the panel port keep working, so clients do not need to change anything.

A port of 443 is different: it goes through the node’s shared port. The panel’s own node holds 443 with its SNI router (see Shared port 443 (SNI router) in the node’s settings), which hands the panel’s domain and the subscription domain to the panel over loopback with the client’s real address in front. The links then carry no port at all — https://sub.example.com/… — and the admin panel opens on 443 too. It needs a domain: the router picks the panel out of the TLS name, so a link by address cannot use 443 this way.

The panel suggests the ports opened at install time and marks the ones used by protocols. Open any other port in the firewall yourself: ufw allow PORT/tcp.

Put files in /opt/mikan/data/panel/www: the panel serves them on all paths it does not use itself, and 404.html becomes the error page. This way an ordinary website opens at the panel’s address. If you have no site of your own, since 0.5.2.0 you can pick a ready page, see Front page.