Globalrestart required
The attack this line protects against is simple: a person with the monitor open visits an unrelated page, and that page sends a request to the node from their browser. The browser sends it on its own, and to the monitor it looks like an action by a legitimate user.
The protection does two things. First, it forbids changing state with a GET request — and GET is exactly what any image or link on someone else’s page can send. Second, it requires a POST to carry either an API key or a session token obtained by a previous request to the monitor.
It is enabled by default (true) and does not get in the way in normal operation. It gets in the way of old applications that are used to changing the node’s state with a plain link.
A key does not pass the protection, it replaces it. A request with a valid http-api-key is accepted without a session token — by design: a program has no browser, and its request cannot be forged from outside.
There is almost never a need to disable it:
| Value | When |
|---|---|
| true (default) | always |
| false | an old application changes state via GET and cannot be rewritten |
Before disabling, it is worth trying a key: an application with a key works with protection enabled.
# disable it only for a specific application and with a recorded reason http-mgmt-port 1000 http-csrf-protection false # application X changes state via GET
what people get wrong and how it ends2 mistakes▶
our experience
§ 3.3.1.58.4
2 relations
curl -s -o /dev/null -w '%{http_code}\n' 'http://NODE:1000/command?command=show+version'
3 articles
◇Who is allowed to submit mail and for whom to accept itOut of the box, the node accepts submission only from the machine itself; two different questions — “who can send through us” and “for whose addresses we accept mail” — are answered by different directives.◇The group that grants management rightsMembership in the pmta group gives an unprivileged user the right to call the node’s commands and use submission.◇How the node selects a source and combines its settingsA connection falls under all source blocks whose addresses cover it, and they act merged — the narrow one overrides the wide one; named blocks are attached only by direct reference.