Listen on `0.0.0.0` instead of `127.0.0.1` (#6755)

Binding `127.0.0.1` means that Zebra will accept inbound connections
coming only from the loopback network interface. This is desirable as
long as Zebra runs on a native machine.

When Zebra runs inside a Docker container, incoming connections coming
from the host machine don't come from the container's loopback
interface. In order to be able to connect to Zebra from the host
machine, we can listen on `0.0.0.0` so Zebra accepts inbound connections
coming from any interface. Users then can limit inbound connection to
the loopback of their host by

```bash
docker run -p 127.0.0.1:8232:8232 zfnd/zebra:1.0.0-rc.8
```
This commit is contained in:
Marek 2023-05-24 18:56:22 +02:00 committed by GitHub
parent 3706ff6e67
commit 5421447804
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 4 deletions

View File

@ -180,18 +180,18 @@ RUN set -ex; \
{ \ { \
echo "[network]"; \ echo "[network]"; \
echo "network = '${NETWORK}'"; \ echo "network = '${NETWORK}'"; \
echo "listen_addr = '127.0.0.1'"; \ echo "listen_addr = '0.0.0.0'"; \
echo "[consensus]"; \ echo "[consensus]"; \
echo "checkpoint_sync = ${CHECKPOINT_SYNC}"; \ echo "checkpoint_sync = ${CHECKPOINT_SYNC}"; \
echo "[state]"; \ echo "[state]"; \
echo "cache_dir = '/zebrad-cache'"; \ echo "cache_dir = '/zebrad-cache'"; \
echo "[rpc]"; \ echo "[rpc]"; \
[ -n "$RPC_PORT" ] && echo "listen_addr = '127.0.0.1:${RPC_PORT}'"; \ [ -n "$RPC_PORT" ] && echo "listen_addr = '0.0.0.0:${RPC_PORT}'"; \
echo "parallel_cpu_threads = 0"; \ echo "parallel_cpu_threads = 0"; \
echo "[metrics]"; \ echo "[metrics]"; \
echo "#endpoint_addr = '127.0.0.1:9999'"; \ echo "#endpoint_addr = '0.0.0.0:9999'"; \
echo "[tracing]"; \ echo "[tracing]"; \
echo "#endpoint_addr = '127.0.0.1:3000'"; \ echo "#endpoint_addr = '0.0.0.0:3000'"; \
} > "${ZEBRA_CONF_PATH}" } > "${ZEBRA_CONF_PATH}"