Skip to content

Commit 026d61e

Browse files
authored
PHRAS-4117 remove gateway /status and /ping page direct access (#4571)
* PHRAS-4117 remove gateway /status and /ping page direct access * PHRAS-4117 fix typo * PHRAS-4117 add ip management
1 parent f13a5d3 commit 026d61e

File tree

4 files changed

+17
-0
lines changed

4 files changed

+17
-0
lines changed

.env

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,10 @@ GATEWAY_DENIED_IPS=
313313
# @run
314314
GATEWAY_USERS=
315315

316+
# Status and ping access Allowed IPs: Comma-separated list of IP addresses that are allowed to access the /status or /ping pages.
317+
# Uncomment and specify IPs to enable. Example: GATEWAY_STATUS_ALLOWED_IPS=10.0.0.1,10.0.1.1
318+
# @run
319+
GATEWAY_STATUS_ALLOWED_IPS=
316320

317321
# HTTP requests quota management.
318322
# Manage http incoming request limits by verbs using the "ngx_http_limit_req_module" module.

docker-compose.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ services:
3535
- GATEWAY_ALLOWED_IPS
3636
- GATEWAY_DENIED_IPS
3737
- GATEWAY_USERS
38+
- GATEWAY_STATUS_ALLOWED_IPS
3839
- GATEWAY_CSP
3940
- HTTP_REQUEST_LIMITS
4041
- HTTP_READ_REQUEST_LIMIT_MEMORY

docker/nginx/root/entrypoint.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ fi
6565
#GATEWAY_DENIED_IPS="172.1.0.1,172.1.0.2"
6666
#GATEWAY_USERS="user1(password1),user2(password2)
6767
touch /etc/nginx/restrictions
68+
touch /etc/nginx/status_allowed_ip
6869
touch /etc/nginx/.htpasswd
6970

7071
if [[ ! -z $GATEWAY_ALLOWED_IPS ]] || [[ ! -z $GATEWAY_DENIED_IPS ]] || [[ ! -z $GATEWAY_USERS ]]; then
@@ -89,7 +90,16 @@ if [[ ! -z $GATEWAY_ALLOWED_IPS ]] || [[ ! -z $GATEWAY_DENIED_IPS ]] || [[ ! -z
8990
echo "deny all;" >> /etc/nginx/restrictions
9091
fi
9192
fi
93+
94+
if [[ ! -z $GATEWAY_STATUS_ALLOWED_IPS ]]; then
95+
for status_ip_allowed in $(echo $GATEWAY_STATUS_ALLOWED_IPS | sed "s/,/ /g")
96+
do
97+
echo "allow $status_ip_allowed;" >> /etc/nginx/status_allowed_ip
98+
done
99+
fi
100+
92101
unset GATEWAY_USERS
93102
unset GATEWAY_DENIED_IPS
94103
unset GATEWAY_ALLOWED_IPS
104+
unset GATEWAY_STATUS_ALLOWED_IPS
95105
exec "$@"

docker/nginx/root/nginx.conf.sample

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@ server {
6262
include fastcgi_params;
6363
include fastcgi_extended_params;
6464
fastcgi_pass backend;
65+
include status_allowed_ip;
66+
deny all;
6567
}
6668

6769
location /simplesaml/ {

0 commit comments

Comments
 (0)