Globalcriticalrestart requiredset by the Hub
The line declares a key that the client passes in the X-API-Key header. Length from 32 to 128 characters, letters, digits and underscore, case-sensitive. The line is repeatable — there can be several keys, for example one per application.
The key opens not just the monitor but four things at once: the web monitor itself with administrator rights; the configuration files API (§ 8.2) — reading, writing and listing the node’s configuration files; the configuration API (§ 8.3) — editing address lists and sending addresses; the command API (§ 8.4) — almost all console commands over HTTP.
The key is stronger than the address restriction. The manual says this twice and word for word: a valid key overrides everything set in http-access, and requests are accepted from any address. This is not a second factor but a bypass of the first.
So the key equals access to the node — and to its configuration. Whoever has it can rewrite the configuration file through the API and reload the engine.
🔴 But the key goes over the wire in plain text. Polling runs over plain http:// — NodePoller, PmtaMonitor and PmtaCommander put it into the header unencrypted, and our base configuration has http-redirect-to-https set to false. A key that can rewrite the node’s configuration and run any command crosses the network in the clear on every poll. Storage is encrypted, transmission is not.
The key is long and random, otherwise it is not a key:
| What | How |
|---|---|
| length | from 32 to 128 characters |
| character set | Latin letters, digits, underscore |
| case | matters |
| how many | as many as needed; the line is repeatable |
Different applications get different keys. Then revoking one does not break the others: one line is removed.
# different applications get different keys: revoking one does not break the others http-api-key abcd_0123_abcd_0123_abcd_0123_ab # Hub telemetryhttp-api-key 5f6e7e426949e3a5e4ec38e747e71963 # report export
what people get wrong and how it ends3 mistakes▶
§ 8.2
our experience
our experience
4 relations
http-mgmt-portGlobalAll three HTTP interfaces that the key opens listen on this port. § 8.4
http-csrf-protectionGlobalA request with a valid key does not pass the protection but bypasses it: the key takes the place of the session token. § 3.3.1.58.4http-enable-api-configGlobalReading may pass by access level, but editing always requires a key. § 8.3api-key<transmissions-api>The key for a different entry point — the web monitor and the management HTTP API; the names are similar, the rights are different. § 3.3.20.1How the node decides whether to let an HTTP request inThe key is the second way to identify yourself, and it is stronger than the first. § 8.2
curl -s -H 'X-API-Key: KEY' -o /dev/null -w '%{http_code}\n' http://NODE:1000/status
3 articles
◇The vendor's analytics — and what leaves the node for itA paid service that receives the node’s accounting data and returns analytics, a health score and a spam trap report; it is enabled by scope and stays off until its block exists.◇Exposing metrics over SNMPThe node can expose its metrics over SNMP — a second way of monitoring besides the web monitor.◇What the node tells about itself and through which channelsSeven observation surfaces: the web monitor, the console in four formats, the log, accounting, accounting search, metrics and export to external analytics.