Make the health and metrics listen addresses configurable (they are hardcoded to 0.0.0.0)
Context
I'm packaging the Buzz relay for YunoHost, where apps run natively under systemd, next to other apps on the same machine, behind nginx. The main listener is configurable (BUZZ_BIND_ADDR), so the relay can stay on 127.0.0.1 and nginx exposes it. Two other listeners cannot be restricted:
- the health probe:
crates/buzz-relay/src/main.rs,TcpListener::bind(("0.0.0.0", config.health_port)); - the Prometheus exporter:
crates/buzz-relay/src/metrics.rs,.with_http_listener(([0, 0, 0, 0], port)).
Only the ports can be set (BUZZ_HEALTH_PORT, BUZZ_METRICS_PORT), not the addresses.
Why it matters outside Kubernetes
In a pod, binding to all interfaces is what you want. On a bare-metal or VPS host, both endpoints end up listening on the public interface, and only a firewall stands between them and the Internet. The metrics endpoint in particular publishes per-community figures (buzz_community_users, buzz_community_messages, buzz_community_users_online_pod, buzz_community_git_repos…) and authentication failure counts, which an operator would not expect to be public. A firewall misconfiguration, or a host without one, is enough to leak it.
Proposal
Add two optional variables, keeping today's behaviour as the default:
BUZZ_HEALTH_BIND_ADDR(default0.0.0.0)BUZZ_METRICS_BIND_ADDR(default0.0.0.0)
This mirrors what BUZZ_BIND_ADDR and BUZZ_MESH_BIND_ADDR already do. Accepting a full ip:port (like BUZZ_BIND_ADDR) and keeping the *_PORT variables for compatibility would work too.
I'd be glad to open a PR for this if the approach suits you.
Source: block/buzz