1
0
Fork 0
mirror of https://github.com/librenms/docker.git synced 2026-01-23 02:14:48 +00:00

Add REAL_IP_FROM and REAL_IP_HEADER environment variables

This commit is contained in:
CrazyMax 2019-04-07 18:04:31 +02:00
parent 8b9d2d1e59
commit 85c491fe32
No known key found for this signature in database
GPG key ID: 3248E46B6BB8C7F7
4 changed files with 11 additions and 3 deletions

View file

@ -48,6 +48,8 @@ It's a fork of [CrazyMax's LibreNMS Docker image repository](https://github.com/
* `MEMORY_LIMIT` : PHP memory limit (default `256M`)
* `UPLOAD_MAX_SIZE` : Upload max size (default `16M`)
* `OPCACHE_MEM_SIZE` : PHP OpCache memory consumption (default `128`)
* `REAL_IP_FROM` : Trusted addresses that are known to send correct replacement addresses (default `0.0.0.0/32`)
* `REAL_IP_HEADER` : Request header field whose value will be used to replace the client address (default `X-Forwarded-For`)
#### (Distributed) Poller

View file

@ -30,8 +30,8 @@ http {
tcp_nodelay on;
## Handling of IPs in proxied and load balancing situations
set_real_ip_from 0.0.0.0/32;
real_ip_header X-Forwarded-For;
set_real_ip_from @REAL_IP_FROM@;
real_ip_header @REAL_IP_HEADER@;
## Hide the Nginx version number
server_tokens off;

View file

@ -11,6 +11,8 @@ PGID=${PGID:-1000}
MEMORY_LIMIT=${MEMORY_LIMIT:-256M}
UPLOAD_MAX_SIZE=${UPLOAD_MAX_SIZE:-16M}
OPCACHE_MEM_SIZE=${OPCACHE_MEM_SIZE:-128}
REAL_IP_FROM=${REAL_IP_FROM:-"0.0.0.0/32"}
REAL_IP_HEADER=${REAL_IP_HEADER:-"X-Forwarded-For"}
MEMCACHED_PORT=${MEMCACHED_PORT:-11211}
RRDCACHED_PORT=${RRDCACHED_PORT:-42217}
@ -93,7 +95,9 @@ sed -e "s/@OPCACHE_MEM_SIZE@/$OPCACHE_MEM_SIZE/g" \
# Nginx
echo "Setting Nginx configuration..."
sed -e "s/@UPLOAD_MAX_SIZE@/$UPLOAD_MAX_SIZE/g" \
sed -e "s#@UPLOAD_MAX_SIZE@#$UPLOAD_MAX_SIZE#g" \
-e "s#@REAL_IP_FROM@#$REAL_IP_FROM#g" \
-e "s#@REAL_IP_HEADER@#$REAL_IP_HEADER#g" \
/tpls/etc/nginx/nginx.conf > /etc/nginx/nginx.conf
# SNMP

View file

@ -1,6 +1,8 @@
MEMORY_LIMIT=256M
UPLOAD_MAX_SIZE=16M
OPCACHE_MEM_SIZE=128
REAL_IP_FROM=0.0.0.0/32
REAL_IP_HEADER=X-Forwarded-For
LIBRENMS_POLLER_THREADS=16
LIBRENMS_POLLER_INTERVAL=5