feat: add IP whitelist support via CIDR networks#3549
Closed
masterbpro wants to merge 1 commit intoprometheus:masterfrom
Closed
feat: add IP whitelist support via CIDR networks#3549masterbpro wants to merge 1 commit intoprometheus:masterfrom
masterbpro wants to merge 1 commit intoprometheus:masterfrom
Conversation
Signed-off-by: masterbpro <iserver12345@gmail.com>
Member
|
Sorry, no, we don't want to support this here. This is what firewalls are for. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds optional IP whitelist support to the HTTP server
New flags:
--web.allowed-networks--web.whitelist-config--web.allowed-networksaccepts a comma-separated list of CIDR networks.Single IPs are accepted and treated as /32 (IPv4) or /128 (IPv6).
If configured, requests from non-matching IPs receive HTTP 403.
If not configured, behavior remains unchanged.
Whitelist applies to both:
Client IP resolution:
IP is resolved in the following order:
whitelist.ip_headers)X-Forwarded-For(first IP is used)X-Real-IPX-ForwardedRemoteAddrExamples:
Allow single network:
./node_exporter --web.allowed-networks=10.0.0.0/24Allow multiple networks:
./node_exporter --web.allowed-networks=10.0.0.0/24,192.168.1.0/24Allow single host:
./node_exporter --web.allowed-networks=10.0.0.10With IPv6:
./node_exporter --web.allowed-networks=2001:db8::/32Using YAML configuration:
./node_exporter --web.whitelist-config=/etc/node_exporter/whitelist.yamlExample YAML: