Is there an existing issue for this?
Is your feature request related to a problem? Please describe
Current behavior: LISTEN_ADDR only applies to nginx (UI, PORT). The API/GraphQL server (server/api_server/api_server_start.py) is started with a hard-coded app.run(host="0.0.0.0", port=graphql_port, …). With LISTEN_ADDR=127.0.0.1 (typical when running behind a reverse proxy, network_mode: host) the UI listens on loopback only, but GRAPHQL_PORT (20212) stays reachable on every interface:
$ ss -ltn | grep -E ':2021[12] '
LISTEN 0 511 127.0.0.1:20211 0.0.0.0:*
LISTEN 0 128 0.0.0.0:20212 0.0.0.0:*
Access is protected by API_TOKEN (a request without a valid token gets 403 Forbidden), so this is a hardening / defense-in-depth request, not a vulnerability report. It is still unexpected, and in this setup not needed: nginx already proxies to the API via http://127.0.0.1:${BACKEND_PORT} (netalertx.conf.template).
The docs also read as if LISTEN_ADDR covered the whole container ("Listen for connections on all interfaces" in the Docker Compose guide).
Verified on the 26.9.0 release image (app.run(host="0.0.0.0", …) at line 2132) and on netalertx-dev:latest (image f854bec8bc7c, revision cd1d0ed; same hard-coded value at line 2205).
Describe the solution you'd like
Proposal: make the API server bind address configurable. Either use LISTEN_ADDR for the API server as well, or add a separate variable (e.g. GRAPHQL_LISTEN_ADDR). It must stay opt-in / default to 0.0.0.0, because existing setups depend on the API being reachable from other hosts: for example Sync Hub nodes push to the hub's API port over the network (SYNC_hub_url='http://<hub>:20212', see #1698). A separate variable avoids changing behavior for anyone who already sets LISTEN_ADDR only for the UI.
Please also mention the scope of LISTEN_ADDR / the new variable in the docs.
Describe alternatives you've considered
- Workaround I use: mount a one-line patched copy of
api_server_start.py (host="127.0.0.1") read-only into the container. It works, but has to be regenerated on every image update, and the image is pinned by digest in my setup.
- Host firewall rule for the port: works, but needs a firewall on the host and is easy to forget.
Anything else?
Am I willing to test this? 🧪
Can I help implement this? 👩💻👨💻
Is there an existing issue for this?
Is your feature request related to a problem? Please describe
Current behavior:
LISTEN_ADDRonly applies to nginx (UI,PORT). The API/GraphQL server (server/api_server/api_server_start.py) is started with a hard-codedapp.run(host="0.0.0.0", port=graphql_port, …). WithLISTEN_ADDR=127.0.0.1(typical when running behind a reverse proxy,network_mode: host) the UI listens on loopback only, butGRAPHQL_PORT(20212) stays reachable on every interface:Access is protected by
API_TOKEN(a request without a valid token gets403 Forbidden), so this is a hardening / defense-in-depth request, not a vulnerability report. It is still unexpected, and in this setup not needed: nginx already proxies to the API viahttp://127.0.0.1:${BACKEND_PORT}(netalertx.conf.template).The docs also read as if
LISTEN_ADDRcovered the whole container ("Listen for connections on all interfaces" in the Docker Compose guide).Verified on the 26.9.0 release image (
app.run(host="0.0.0.0", …)at line 2132) and onnetalertx-dev:latest(image f854bec8bc7c, revision cd1d0ed; same hard-coded value at line 2205).Describe the solution you'd like
Proposal: make the API server bind address configurable. Either use
LISTEN_ADDRfor the API server as well, or add a separate variable (e.g.GRAPHQL_LISTEN_ADDR). It must stay opt-in / default to0.0.0.0, because existing setups depend on the API being reachable from other hosts: for example Sync Hub nodes push to the hub's API port over the network (SYNC_hub_url='http://<hub>:20212', see #1698). A separate variable avoids changing behavior for anyone who already setsLISTEN_ADDRonly for the UI.Please also mention the scope of
LISTEN_ADDR/ the new variable in the docs.Describe alternatives you've considered
api_server_start.py(host="127.0.0.1") read-only into the container. It works, but has to be regenerated on every image update, and the image is pinned by digest in my setup.Anything else?
http://<hub>:20212/sync, the reason the default has to remain0.0.0.0).GRAPHQL_PORTenvironment variable is not applied to theGRAPHQL_PORTsetting (container envGRAPHQL_PORT=20322, but the setting andapp.confstay at20212and nothing listens on 20322), so a second instance on a host network collides with the first one's API port.Am I willing to test this? 🧪
netlertx-devimage when requested within 48h and report bugs to help deliver a great user experience for everyone and not to break existing installations.Can I help implement this? 👩💻👨💻