Skip to content

Commit 8062fcb

Browse files
authored
Add Prometheus hostname to list of allowed hosts. (#724)
* Rename whitelist to allowlist. Signed-off-by: Byron Gravenorst <byron.gravenorst@consensys.net> * Additional updates. Signed-off-by: Byron Gravenorst <byron.gravenorst@consensys.net> * Whitelist renaming. Signed-off-by: Byron Gravenorst <byron.gravenorst@consensys.net> * Address reviewer feedback. Signed-off-by: Byron Gravenorst <byron.gravenorst@consensys.net> * Fix typos. Signed-off-by: Byron Gravenorst <byron.gravenorst@consensys.net> * Add Prometheus endpoint to list of allowed hosts. Signed-off-by: bgravenorst <byron.gravenorst@consensys.net> * Address reviewer feedback. Signed-off-by: bgravenorst <byron.gravenorst@consensys.net>
1 parent 69da9b8 commit 8062fcb

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

docs/HowTo/Monitor/Metrics.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,15 @@ To configure Prometheus and run with Besu:
8989
[`--metrics-enabled`](../../Reference/CLI/CLI-Syntax.md#metrics-enabled) option. To start a
9090
single node for testing with metrics enabled:
9191

92+
!!! important
93+
94+
To avoid DNS rebinding attacks, if running Prometheus on a different host to your Besu node
95+
(any host other than `localhost`), ensure you add the hostname that Prometheus uses to
96+
connect to Besu to [`--host-allowlist`](../../Reference/CLI/CLI-Syntax.md#host-allowlist).
97+
98+
For example, if Prometheus is configured to get metrics from `http://besu.local:8008/metrics`
99+
then `besu.local` has to be in `--host-allowlist`.
100+
92101
=== "Command syntax"
93102

94103
```bash
@@ -104,7 +113,7 @@ To configure Prometheus and run with Besu:
104113
To specify the host and port on which Prometheus accesses Besu, use the
105114
[`--metrics-host`](../../Reference/CLI/CLI-Syntax.md#metrics-host) and
106115
[`--metrics-port`](../../Reference/CLI/CLI-Syntax.md#metrics-port) options. The default host
107-
and port are 127.0.0.1 and 9545.
116+
and port are 127.0.0.1 (`localhost`) and 9545.
108117

109118
1. In another terminal, run Prometheus specifying the `prometheus.yml` file:
110119

docs/Reference/CLI/CLI-Syntax.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -613,8 +613,9 @@ Show the help message and exit.
613613
host-allowlist=["medomain.com", "meotherdomain.com"]
614614
```
615615

616-
A comma-separated list of hostnames to allow
617-
[access to the JSON-RPC API](../../HowTo/Interact/APIs/Using-JSON-RPC-API.md#host-allowlist). By
616+
A comma-separated list of hostnames to
617+
[access to the JSON-RPC API](../../HowTo/Interact/APIs/API.md#host-allowlist) and
618+
[pull Besu metrics](../../HowTo/Monitor/Metrics.md). By
618619
default, Besu accepts access from `localhost` and `127.0.0.1`.
619620

620621
!!!note

0 commit comments

Comments
 (0)