blob: cb080e98f1d9b9673a88f5336cd23bf199d89803 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
# This source code is released into the public domain.
#
# The nginx allow_internal.conf file is a list of "allow <prefix>;",
# one per line, followed by "deny all;".
NGINX_FILE="/usr/local/etc/nginx/allow_internal.conf"
NGINX_TEMP="${NGINX_FILE}.ldaptmp"
if [ ! -f "$NGINX_FILE" ]; then
exit 0
fi
awk <"$NETWORKS_FILE" >"$NGINX_TEMP" '{ print "allow " $1 ";" }'
printf >>"$NGINX_TEMP" 'deny all;\n'
if cmp -s "$NGINX_TEMP" "$NGINX_FILE"; then
rm "$NGINX_TEMP"
exit 0
fi
printf '%s updated:\n\n' "$NGINX_FILE"
diff "$NGINX_FILE" "$NGINX_TEMP"
printf '\n'
mv "$NGINX_TEMP" "$NGINX_FILE"
/usr/local/sbin/nginx -s reload
|