# This source code is released into the public domain. # # The nginx allow_internal.conf file is a list of "allow ;", # 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