# Global keys

| Key | Type | Default | Takes effect |
|---|---|---|---|
| [`prefs_version`](#prefs_version) | int | `2` | — |
| [`admin_bind_ip`](#admin_bind_ip) | ip | `0.0.0.0` | **restart** |
| [`admin_port`](#admin_port) | int | `8090` | **restart** |
| [`admin_keystore`](#admin_keystore) | path | empty | live |
| [`admin_keystore_password`](#admin_keystore_password) | secret | empty | live |
| [`admin_allowed_ips`](#admin_allowed_ips) | addrlist | empty | live |
| [`admin_password`](#admin_password) | verifier | empty | live |
| [`admin_session_timeout`](#admin_session_timeout) | int | `1800` | live |
| [`log_file`](#log_file) | path | `CrushBalanceServer.log` | live |
| [`log_max_size_mb`](#log_max_size_mb) | int | `50` | live |
| [`log_max_files`](#log_max_files) | int | `9` | live |
| [`log_level`](#log_level) | enum | `info` | live |
| [`log_categories`](#log_categories) | csv | empty | live |
| [`max_connections`](#max_connections) | int | `0` | live |
| [`geoip_key`](#geoip_key) | secret | empty | live |
| [`geoip_monthly_limit`](#geoip_monthly_limit) | int | `10000` | live |
| [`balancer_location`](#balancer_location) | latlon | empty | live |
| [`metrics_token`](#metrics_token) | verifier | empty | live |
| [`registration_name`](#registration_name) | string | empty | live |
| [`registration_email`](#registration_email) | string | empty | live |
| [`registration_code`](#registration_code) | string | empty | live |
| [`ip_rules`](#ip_rules) | list | empty list | live |
| [`listeners`](#listeners) | list | empty list | live |

### `prefs_version`

Format marker.

- **Where:** `prefs/prefs_version`
- **Type:** `int`, must be 2
- **Default:** `2` (written by the server)
- **Applies:** always
- **Takes effect:** — (not a setting that changes)
- **Flags:** none
- **UI:** not shown in the UI

### `admin_bind_ip`

Address of the HTTPS admin server.

- **Where:** `prefs/admin_bind_ip`
- **Type:** `ip`
- **Default:** `0.0.0.0` (all IPv4 and IPv6)
- **Applies:** always
- **Takes effect:** after a restart of CrushBalance (restart needed)
- **Flags:** none
- **UI:** Admin › Admin bind IP: Address the HTTPS admin server listens on. 0.0.0.0 accepts IPv4 and IPv6 on every interface.

### `admin_port`

Admin HTTPS port. An enabled listener whose port or port range includes `admin_port` on an overlapping address gets ERROR ADMIN_PORT_CONFLICT.

- **Where:** `prefs/admin_port`
- **Type:** `int`, 1–65,535
- **Default:** `8090`
- **Applies:** always
- **Takes effect:** after a restart of CrushBalance (restart needed)
- **Flags:** none
- **UI:** Admin › Admin port: HTTPS port of the admin server. An enabled listener on this port and an overlapping address is a conflict.

### `admin_keystore`

Admin TLS certificate. If the file is unusable: WARN KEYSTORE_UNUSABLE, the generated certificate is used, and a banner is shown.

- **Where:** `prefs/admin_keystore`
- **Type:** `path`
- **Default:** empty = per-install generated certificate `admin-selfsigned.p12`
- **Applies:** always
- **Takes effect:** live, when saved or loaded (no restart)
- **Flags:** none
- **UI:** Admin › Admin keystore: Keystore (JKS, PKCS12 or JCEKS) with the admin TLS certificate. Empty uses a certificate generated for this installation.

### `admin_keystore_password`

Keystore password. It is also the private-key password (constant: one password per keystore).

- **Where:** `prefs/admin_keystore_password`
- **Type:** `secret`
- **Default:** empty
- **Applies:** always
- **Takes effect:** live, when saved or loaded (no restart)
- **Flags:** secret: stored encrypted (`enc:`), never returned by the admin API
- **UI:** Admin › Admin keystore password: Password of the admin keystore, also used for its private key. Stored encrypted.

### `admin_allowed_ips`

Sources that may open admin connections, checked at the connection's first byte, before the TLS handshake; it does not protect the connection slots: a connection that never sends a byte is not checked (a known limitation of the JDK HTTP server; firewall the admin port to admin networks). Loopback is always allowed. A save or restore through the admin API that would exclude the requesting client is rejected (422 `would_lock_out`); loopback clients are exempt. On a disk load an invalid item is dropped with WARN ADDR_ITEM_DROPPED; if the list was non-empty and no valid item remains, that is ERROR BAD_VALUE and only loopback is allowed (fails closed; never `""` = any source).

- **Where:** `prefs/admin_allowed_ips`
- **Type:** `addrlist`
- **Default:** empty = any source
- **Applies:** always
- **Takes effect:** live, when saved or loaded (no restart)
- **Flags:** none
- **UI:** Admin › Allowed admin IPs: IP addresses and CIDR blocks that may open admin connections; empty allows any source. Loopback is always allowed.

### `admin_password`

Admin credential: PBKDF2-HMAC-SHA256, 600,000 iterations, 16-byte salt, 32-byte hash. Server-owned. Set by first-run setup, the password-change action or `-set-admin-password`. Blanking it by hand forces setup mode (setup token); this is the documented recovery path. Any change ends every admin session.

- **Where:** `prefs/admin_password`
- **Type:** `verifier`
- **Default:** empty = setup required
- **Applies:** always
- **Takes effect:** live, when saved or loaded (no restart)
- **Flags:** verifier: a one-way value written only by the server; server-owned: ignored by whole-configuration writes
- **UI:** Admin › Admin password: One-way verifier of the admin password, set by first-run setup or a password change. Any change ends every admin session.

### `admin_session_timeout`

Admin session idle timeout. Only user actions count; SSE never extends a session. The absolute session lifetime is a constant 12 h.

- **Where:** `prefs/admin_session_timeout`
- **Type:** `int`, in seconds, 300–43,200
- **Default:** `1800`
- **Applies:** always
- **Takes effect:** live, when saved or loaded (no restart)
- **Flags:** none
- **UI:** Admin › Session timeout: An admin session ends after this many seconds without a user action.

### `log_file`

Main log file. Archives are `<stem>1<ext>` … `<stem>N<ext>` (by default `CrushBalanceServer1.log` … `CrushBalanceServer9.log`). Audit lines go to this same file (category `audit`). The default is deliberately outside the CrushBalance 11 log family, and the file guard appends to or rotates an existing non-empty file only when it starts with a v2 line (`yyyy/MM/dd_HH:mm:ss:SSS|<CATEGORY>|<LEVEL>|`), so a CrushBalance 11 log is never continued or rotated.

- **Where:** `prefs/log_file`
- **Type:** `path`
- **Default:** `CrushBalanceServer.log`
- **Applies:** always
- **Takes effect:** live, when saved or loaded (no restart)
- **Flags:** none
- **UI:** Logging › Log file: Main log file; its name must end in .log. Audit lines go to the same file.

### `log_max_size_mb`

Size in MiB at which the log rotates.

- **Where:** `prefs/log_max_size_mb`
- **Type:** `int`, in MiB, 1–2048
- **Default:** `50`
- **Applies:** always
- **Takes effect:** live, when saved or loaded (no restart)
- **Flags:** none
- **UI:** Logging › Max log size: Size in MiB at which the log file rotates.

### `log_max_files`

Number of rotated archives kept.

- **Where:** `prefs/log_max_files`
- **Type:** `int`, 1–99
- **Default:** `9`
- **Applies:** always
- **Takes effect:** live, when saved or loaded (no restart)
- **Flags:** none
- **UI:** Logging › Archives kept: Number of rotated log archives kept.

### `log_level`

Default level for every category.

- **Where:** `prefs/log_level`
- **Type:** `enum`: `error`, `warn`, `info`, `debug` or `trace`
- **Default:** `info`
- **Applies:** always
- **Takes effect:** live, when saved or loaded (no restart)
- **Flags:** none
- **UI:** Logging › Default level: Log level of every category that has no override.

### `log_categories`

Per-category overrides for `server`, `config`, `conn`, `route`, `health`, `tls`, `http`, `proxy`, `security`, `admin`, `geoip`, `license`. `audit` is always on at `info`. An unknown category or level gives WARN CSV_ITEM_DROPPED and the item is dropped. An `audit=…` item is dropped with the same WARN; `audit` stays at `info`. Example: `conn=warn,health=debug`.

- **Where:** `prefs/log_categories`
- **Type:** `csv` of `category=level` items: category `server`, `config`, `conn`, `route`, `health`, `tls`, `http`, `proxy`, `security`, `admin`, `geoip` or `license`, level `error`, `warn`, `info`, `debug` or `trace`
- **Default:** empty
- **Applies:** always
- **Takes effect:** live, when saved or loaded (no restart)
- **Flags:** none
- **UI:** Logging › Category levels: Per-category level overrides, for example conn=warn,health=debug. The audit category always logs at info.

### `max_connections`

Process-wide cap on concurrent sessions. Auto = (open-file limit − 1024) ÷ 2, at least 1,000; 50,000 when the limit is unknown. At the cap, every listener pauses accepting until the count falls below 95 %.

- **Where:** `prefs/max_connections`
- **Type:** `int`, 0 (auto) or 100–10,000,000
- **Default:** `0` = auto
- **Applies:** always
- **Takes effect:** live, when saved or loaded (no restart)
- **Flags:** none
- **UI:** Server › Global connection cap: Concurrent sessions for the whole process; 0 = auto, from the open-file limit. At the cap every listener pauses accepting.

### `geoip_key`

ipstack (apilayer) access key, used exactly as CrushMFT uses it. GeoIP feeds the map only, never routing or admission.

- **Where:** `prefs/geoip_key`
- **Type:** `secret`
- **Default:** empty = GeoIP off
- **Applies:** always
- **Takes effect:** live, when saved or loaded (no restart)
- **Flags:** secret: stored encrypted (`enc:`), never returned by the admin API
- **UI:** GeoIP & map › GeoIP key: ipstack access key; empty turns GeoIP off. GeoIP only places addresses on the map and never affects routing.

### `geoip_monthly_limit`

Self-imposed cap on ipstack requests per calendar month (UTC). The count survives restarts (`geoip-cache.json`). 0 = no cap, and the UI warns. Set it to your plan's quota.

- **Where:** `prefs/geoip_monthly_limit`
- **Type:** `int`, 0–100,000,000 (0 = no cap)
- **Default:** `10000`
- **Applies:** always
- **Takes effect:** live, when saved or loaded (no restart)
- **Flags:** none
- **UI:** GeoIP & map › Monthly lookup limit: Most ipstack requests per calendar month (UTC); 0 = no cap. Set it to your plan's quota.

### `balancer_location`

Position of the balancer on the map.

- **Where:** `prefs/balancer_location`
- **Type:** `latlon`
- **Default:** empty = ipstack own-IP lookup once a day when GeoIP is on; otherwise no balancer marker
- **Applies:** always
- **Takes effect:** live, when saved or loaded (no restart)
- **Flags:** none
- **UI:** GeoIP & map › Balancer location: Position of the balancer on the map, as lat,lon. Empty looks it up once a day from the balancer's public address while GeoIP is on.

### `metrics_token`

Verifier of the bearer token for the Prometheus text endpoint `/metrics` on the admin port. Server-owned. The "Metrics token" action generates, rotates or clears it and shows the token once.

- **Where:** `prefs/metrics_token`
- **Type:** `verifier`
- **Default:** empty = `/metrics` off
- **Applies:** always
- **Takes effect:** live, when saved or loaded (no restart)
- **Flags:** verifier: a one-way value written only by the server; server-owned: ignored by whole-configuration writes
- **UI:** Server › Metrics token: Verifier of the bearer token for the Prometheus endpoint /metrics; empty turns /metrics off. The Metrics token action sets it and shows the token once.

### `registration_name`

CrushMFT Enterprise registration name, stored as entered (trimmed). A value made only of `%XX` escapes (CrushMFT's stored form) is accepted and decoded. Server-owned for config writes; a hand edit is re-validated.

- **Where:** `prefs/registration_name`
- **Type:** `string`, at most 512 characters
- **Default:** empty
- **Applies:** always
- **Takes effect:** live, when saved or loaded (no restart)
- **Flags:** server-owned: ignored by whole-configuration writes
- **UI:** Licence › Registration name: CrushMFT Enterprise registration name. Set through licence registration.

### `registration_email`

Registration email, stored as entered (trimmed).

- **Where:** `prefs/registration_email`
- **Type:** `string`, at most 512 characters
- **Default:** empty
- **Applies:** always
- **Takes effect:** live, when saved or loaded (no restart)
- **Flags:** server-owned: ignored by whole-configuration writes
- **UI:** Licence › Registration email: CrushMFT registration email. Set through licence registration.

### `registration_code`

CrushMFT registration code. Valid when it decrypts to a well-formed licence with V ≥ 11 and E ≥ 1 that has not expired. A CrushFTP 9 or 10 Enterprise registration is OLD_VERSION: "CrushBalance 27 needs a CrushFTP 11 or newer Enterprise registration". Not encrypted; masked everywhere. Invalid or missing: listeners stay stopped and a banner is shown. A valid code binds them immediately.

- **Where:** `prefs/registration_code`
- **Type:** `string`, at most 4096 characters
- **Default:** empty
- **Applies:** always
- **Takes effect:** live, when saved or loaded (no restart)
- **Flags:** server-owned: ignored by whole-configuration writes
- **UI:** Licence › Registration code: CrushFTP 11 or newer Enterprise registration code. Without a valid code the listeners stay stopped.

### `ip_rules`

Global IP rules, checked first for every new client connection.

- **Where:** `prefs/ip_rules`
- **Type:** `list` of at most 10,000 [IP rule](Keys-IP-Rules.md) maps
- **Default:** empty list = allow all
- **Applies:** always
- **Takes effect:** live, when saved or loaded (no restart)
- **Flags:** none
- **UI:** Security › Global IP rules: Rules checked first for every new client connection; the first match decides. An empty list allows everyone.

### `listeners`

The listeners, matched by `id`.

- **Where:** `prefs/listeners`
- **Type:** `list` of at most 1,000 [listener](Keys-Listener.md) maps
- **Default:** empty list
- **Applies:** always
- **Takes effect:** live, when saved or loaded (no restart)
- **Flags:** none
- **UI:** Listeners › Listeners: The listeners, each with its endpoints.
