Skip to content

Commit aca8206

Browse files
committed
Fix IP access list control regression
IP access list control was implemented as default success for an empty access control list - but this had the effect of an empty list default allowing if "Satisfy Any" was set. Fortunately this was bugged, so empty lists default failed - but this broke empty lists for "Satisfy All". This patch is the correct fix: lists now always default fail, but an empty list removes the check from access control considerations. This restores the original implementations behavior and fixes the bug.
1 parent 0969cd7 commit aca8206

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

backend/templates/_access.conf

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,24 @@
22
set $auth_basic "Authorization required";
33
{% if access_list.satisfy_any == 1 %}
44
# Satisfy Any - any check can succeed - so look for success
5+
{% if access_list.clients.size != 0 %}
56
if ( $access_list_{{ access_list_id }} = 1) {
6-
set $auth_basic off;
7+
set $auth_basic off;
78
}
9+
{% endif %}
810
if ( $ssl_client_verify = "SUCCESS" ) {
9-
set $auth_basic off;
11+
set $auth_basic off;
1012
}
1113
{% else %}
1214
# Satisfy All - all checks must succeed (so handle fails)
15+
{% if access_list.clients.size != 0 %}
16+
# {{ access_list.clients.size }} IP rules
1317
if ( $access_list_{{ access_list_id }} = 0) {
1418
return {% if drop_unauthorized == 1 %}444{% else %}403{% endif %};
1519
}
20+
{% else %}
21+
# Empty IP rules list so no client IP check
22+
{% endif %}
1623
if ( $ssl_client_verify != "SUCCESS" ) {
1724
return {% if drop_unauthorized == 1 %}444{% else %}403{% endif %};
1825
}

backend/templates/access.conf

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
# Access List Clients for {{ access_list.id }} - {{ access_list.name }}
22
geo $realip_remote_addr $access_list_{{ access_list.id }} {
3-
{% if access_list.client.size == 0 %}
4-
default 1;
5-
{% else %}
63
default 0;
7-
{% endif %}
84
{% for client in access_list.clients %}
95
{% if client.directive == "allow" %}
106
{{client.address}} 1;

0 commit comments

Comments
 (0)