Skip to content

Operations ​

SQLite stores its database in state.db inside the data directory. The container configuration defaults to MySQL. For an external database, set database: postgres or database: mysql and supply its connection URL through TUNNEL_DATABASE_URL. The server creates the complete current schema in an empty database on first startup and rejects unsupported database formats. Server configuration

Certificate rotation ​

These rotation steps apply to deployments already using the current cryptographic suite. When switching to the current suite, start with an empty database and a new CA, then enroll clients again. Fresh installation

Gateway and client certificates rotate every 6 hours by default. Under Resources → Certificate Rotation (资源 → 证书轮换), the console shows certificate details, schedules, and operation history in Beijing time (UTC+8). Manual client rotation and policy changes require access to the client and permission to manage certificate rotation. The default policy runs on an interval. When saving a client policy, you can set how far ahead of expiry to renew.

Sign in as a system administrator. Under Gateway and Keys (网关与密钥), you can renew the gateway certificate, rotate its key pair, or change automatic rotation. The same tab provides Tunnel CA rotation, notification credential re-encryption, and transport token operations when the relevant materials are available. Platform rotation writes through the management API require a signed-in system administrator and X-Xigexb-Request: 1. Startup configuration

Under Resources → Domains and Certificates (资源 → 域名与证书), upload an ML-DSA-87 certificate chain and its matching private key for each domain where the gateway terminates HTTPS, WSS, or HTTP/3. The built-in Let's Encrypt DNS-01 issuer is disabled. Issue the gateway's business certificates separately and import them here. Renew publicly trusted browser certificates at the Nginx front end. Business certificates and port publishing

For a managed deployment with an offline root, prepare a successor Tunnel CA by running server issue-pki-successor --offline-root ./offline-root --output ./pki-successor in the signing environment. Deploy that directory to the gateway, point TUNNEL_PKI_SUCCESSOR_DIR to it, restart the gateway, and activate the successor under Gateway and Keys. To schedule automatic activation of a pre-issued successor under the same root, set TUNNEL_PKI_AUTO_ADVANCE_BEFORE_SECS in the startup environment. The lead time ranges from 1 hour to 30 days. Enter 3600 to 2592000 seconds. Root CA and Tunnel CA · Rotation scheduling

  • Keep the deployment root CA. Direct clients configured with root can obtain a new Tunnel CA under the same root over HTTP/3 as long as they can verify the gateway. Direct clients deployed from a certificate ZIP can set web_ca to the public root certificate for the same trust update.
  • Use the default Tunnel CA trust. Distribute the new Tunnel CA public certificate to deployed clients through a trusted channel. Replace the file configured as tunnel_ca, usually tunnel-ca.pem. Keep the device certificate, private key, and data directory.
  • Change the deployment root CA. Distribute administrator-verified trust material through a trusted channel. Update the configured root, web_ca, or tunnel_ca as applicable. For a managed transition, establish the new trust, activate the new signing chain, and verify devices before retiring the old trust.
  • MQTT clients. Replace tunnel-ca.pem in the deployment directory, then reload the configuration or restart. MQTT setup

Recover an expired device certificate ​

After a device remains offline past certificate expiry, client --config app.yml status can show recovering_identity while the client retries a trusted enrollment endpoint with backoff. If it shows identity_expired, verify the device and its access status, then issue a recovery ZIP from its certificate panel. Confirm each request with your current password or two-factor code as applicable. Certificate panel

Keep the original client data directory and access method. Update certificate, certificate_key, and tunnel_ca. Direct clients keep their client_key. Remove root when switching from root-based enrollment to the recovery ZIP. MQTT clients keep their existing relay and access settings. Run client --config app.yml reload. If the client is stopped, start it with the same configuration. The gateway activates the recovery certificate after mutual authentication, keeping the device and its mappings. Client identity settings

Notification channels, alerts, and templates ​

  1. Under Notifications → Notification Channels (通知 → 通知渠道), create a DingTalk, WeCom, Feishu, Webhook, or SMTP email channel. Select Test on the row of an enabled channel or in its details. The test uses the channel’s saved configuration. The console opens Delivery Records and highlights the test so you can check the acknowledgement, attempt count, and result. You can resend eligible records with a failed or uncertain result.
  2. Under Alert Rules (告警规则), select the event, resource scope, recipient channels, and severity. Set the trigger duration, recovery duration, and mute period as needed. For Daily Quiet Hours (每日静默), choose an IANA time zone from the searchable list, then set the start and end times. An end time earlier than the start spans midnight. Alert state is still recorded during quiet hours. Check Alert Instances for current state and Delivery Records for delivery results.
  3. Under Notifications → Notification Templates (通知 → 通知模板), select a channel and open its Trigger, Recovery, or Channel Test template. The drawer shows a message preview. Edit the title and body and preview your changes before saving. Channel Default shows the built-in content, and Restore Default removes the customization for that channel and scenario. Email uses HTML, the three bot channels use Markdown, and Webhook uses a JSON object.

Accounts with permission to view notification pages can read channel summaries, alert rules, instances, and delivery records for resources they own. Template access and previews, channel and rule changes, channel tests, and delivery retries require permission to manage notifications. Channel summaries and details omit SMTP passwords, Webhook URLs, and custom request headers. The console uses a one-time encryption challenge when creating or replacing connection settings. Automated clients can send requests over HTTPS using the formats documented at GET /api/v1/openapi.json.

When a database connection alert is enabled, the gateway caches eligible administrator rules and channels while the database is reachable. If the connection loss causes the gateway to exit, it checks database reachability again and makes one time-limited direct delivery attempt per eligible channel after the configured trigger time, subject to muting. During the outage, the gateway cannot save a delivery record. Check the server log and the receiving channel for the result. Database health notification implementation

Update GeoX data ​

Sign in as a system administrator and open Security → GeoX Data (安全 → GeoX 数据). GeoX and automatic updates are enabled by default. Updates run every 24 hours by default, with a minimum interval of 30 minutes. Save the settings, then select Update Now to check the update status and last successful update time. GeoIP, GeoSite, the country and territory MMDB, and the ASN MMDB default to MetaCubeX downloads. You can customize or reset each URL. Custom URLs use public HTTPS endpoints. GeoX settings

The gateway validates all four files before activating them together. If an update fails, it keeps using the last successful dataset. Before any valid dataset has loaded, country and ASN rules that depend on downloaded data do not match. Plain IP and CIDR rules continue to use their configured conditions. Troubleshoot updates

Leave the download proxy empty for direct downloads. To use a proxy, register an HTTP, HTTPS, SOCKS5, or SOCKS5H proxy under System → Proxy Configuration (系统 → 代理配置), then select it on the GeoX page. For each file, if a connection, download, or validation fails, the gateway follows the configured fallback chain, skipping disabled or expired proxies. Proxy configuration

Health probes ​

With the dedicated metrics listener enabled, use /healthz to confirm the listener is up and /readyz to check the gateway's database connection. If the database is unavailable, /readyz returns HTTP 503. Prometheus reads /metrics with a dedicated Bearer token. An in-place restore or other offline maintenance can temporarily close these listeners. Monitoring troubleshooting

With a standard Prometheus build, bind the metrics listener to loopback and scrape it over HTTP from the same network namespace. Direct remote HTTPS scraping requires an ML-DSA-87 metrics certificate and key on the gateway, a trusted root on the scraper, and a TLS 1.3 client that supports pure MLKEM1024 and TLS_AES_256_GCM_SHA384. Go 1.27 default TLS settings do not enable pure MLKEM1024. Metrics TLS settings

Backup metrics cover the last successful snapshot time, the result and duration of the last attempt, whether a backup is running, and whether the catalog is readable. The repository provides Prometheus alert rules and Blackbox Exporter examples for checking object storage backups and forwarding. Monitoring configuration and metrics

Console backup and restore ​

On a single gateway, use System → System Settings → Backup for routine backups and full restores. A full restore rewinds account passwords, two-factor enrollment, recovery codes, and role settings. When the gateway reopens, sign in with the credentials from the restored recovery point. After a security incident, verify devices and grants in isolation using the controlled recovery procedure below. Configure, download, and restore backups · System settings

Backup and controlled recovery ​

  1. Stop the gateway and its automatic restarts. Isolate its application endpoints. Prepare the database archive in object storage, the startup configuration, and explicitly referenced external inputs. Keep the root certificate and private key offline. Managed certificates, keys, and runtime state are in the database archive. Restore from object storage
  2. Restore the same recovery point in isolation using the original database engine. Put a SQLite snapshot at state.db in the restore directory and run server inspect-database --database sqlite --data-path ./restore to check its format and schema. For an external database, select its engine and point TUNNEL_DATABASE_URL to the isolated database.
  3. Run server secure-recovery --database sqlite --data-path ./restore status. Keep the same command prefix and database settings for the following subcommands. After isolating the old gateway and endpoints, run enter --confirm-isolation and record the returned recovery_id. For managed deployments, run verify --recovery-id <id> to check that data and keys came from the same backup.
  4. Run devices --recovery-id <id> to list clients that need verification. Run reset --recovery-id <id> --admin-password-file <new-password-file> to invalidate old credentials and grants, clear two-factor enrollments, and suspend mappings and notification channels.
  5. After the security reset, use issue-device-key --recovery-id <id> --device <device-id> --output <new-file> for reverified devices whose owners have permission. Deliver the new enrollment keys over a trusted channel. This command retains the original device ID and requires a new output file.
  6. Wait at least 30 seconds from the isolation time recorded by enter, then run finish --recovery-id <id> --confirm-isolation. Start Tunnel on the isolated network, restore account grants, and enroll devices with their new keys and certificates. Review and re-enable mappings and notification channels individually. Verify traffic before reopening the endpoints. Recovery commands

The database includes GeoX data and settings, console-managed download proxies and MQTT relays, and the matching managed keys. Keep separate backups of any startup MQTT configuration and the credentials, certificates, and private keys it explicitly references. MQTT relay settings