diff options
| author | Lexi Winter <lexi@le-fay.org> | 2025-07-12 07:52:42 +0100 |
|---|---|---|
| committer | Lexi Winter <lexi@le-fay.org> | 2025-07-12 07:52:42 +0100 |
| commit | 799dc834e0fe94ed62c0d6bb65e6d15a639ab668 (patch) | |
| tree | bb3b7a89764f768b6b1c4a4918e9eb37a88645b8 /apache24.sh | |
| download | lfldap-1.0.tar.gz lfldap-1.0.tar.bz2 | |
initial commitv1.0
Diffstat (limited to 'apache24.sh')
| -rw-r--r-- | apache24.sh | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/apache24.sh b/apache24.sh new file mode 100644 index 0000000..5fce133 --- /dev/null +++ b/apache24.sh @@ -0,0 +1,25 @@ +# This source code is released into the public domain. +# +# The Apache allow_internal.conf file is a list of "Require ip <prefix>", +# one per line. + +APACHE_FILE="/usr/local/etc/apache24/allow_internal.conf" +APACHE_TEMP="${APACHE_FILE}.ldaptmp" + +if [ ! -f "$APACHE_FILE" ]; then + exit 0 +fi + +awk <"$NETWORKS_FILE" >"$APACHE_TEMP" '{ print "Require ip " $1 }' + +if cmp -s "$APACHE_TEMP" "$APACHE_FILE"; then + rm "$APACHE_TEMP" + exit 0 +fi + +printf '%s updated:\n\n' "$APACHE_FILE" +diff "$APACHE_FILE" "$APACHE_TEMP" +printf '\n' + +mv "$APACHE_TEMP" "$APACHE_FILE" +/usr/local/sbin/apachectl graceful |
