From 7bb86e41189682d4c2fb502e672bd1dce99fb3c3 Mon Sep 17 00:00:00 2001 From: Adam Warner Date: Wed, 18 Jan 2023 22:12:29 +0000 Subject: [PATCH 1/3] Add a check for the version number of lighttpd. Only remove the server.modules += section of the new pihole-admin config if the version number is not greater than or equal to 1.4.56 Signed-off-by: Adam Warner --- advanced/lighttpd.conf.debian | 1 - automated install/basic-install.sh | 19 ++++++++++++++----- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/advanced/lighttpd.conf.debian b/advanced/lighttpd.conf.debian index 06c284fe..61d20821 100644 --- a/advanced/lighttpd.conf.debian +++ b/advanced/lighttpd.conf.debian @@ -17,7 +17,6 @@ server.modules = ( "mod_access", - "mod_accesslog", "mod_auth", "mod_expire", "mod_redirect", diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index 3b37bf28..44b4b313 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -1432,14 +1432,23 @@ installConfigs() { elif [[ -d "/etc/lighttpd/conf-available" ]]; then conf=/etc/lighttpd/conf-available/15-pihole-admin.conf install -D -m 644 -T ${PI_HOLE_LOCAL_REPO}/advanced/pihole-admin.conf $conf - # disable server.modules += ( ... ) in $conf to avoid module dups - # (needed until Debian 10 no longer supported by pi-hole) - # (server.modules duplication is ignored in lighttpd 1.4.56+) - if awk '!/^server\.modules/{print}' $conf > $conf.$$ && mv $conf.$$ $conf; then + + # Get the version number of lighttpd + version=$(lighttpd -v | grep -o -E '[0-9]+\.[0-9]+\.[0-9]+') + # Test if that version is greater than or euqal to 1.4.56 + if dpkg --compare-versions "$version" "ge" "1.4.56"; then + # If it is, then we don't need to disable the modules : else - rm $conf.$$ + # disable server.modules += ( ... ) in $conf to avoid module dups + # (server.modules duplication is ignored in lighttpd 1.4.56+) + if awk '!/^server\.modules/{print}' $conf > $conf.$$ && mv $conf.$$ $conf; then + : + else + rm $conf.$$ + fi fi + chmod 644 $conf if is_command lighty-enable-mod ; then lighty-enable-mod pihole-admin access accesslog redirect fastcgi setenv > /dev/null || true From d30a5f1b950a5a1b8efcf93ccc4f80bf90e1e706 Mon Sep 17 00:00:00 2001 From: Adam Warner Date: Thu, 19 Jan 2023 12:24:57 +0000 Subject: [PATCH 2/3] Get the lighttpd version from `dpkg-query` instead Signed-off-by: Adam Warner --- automated install/basic-install.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index 44b4b313..20fd997d 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -1434,14 +1434,14 @@ installConfigs() { install -D -m 644 -T ${PI_HOLE_LOCAL_REPO}/advanced/pihole-admin.conf $conf # Get the version number of lighttpd - version=$(lighttpd -v | grep -o -E '[0-9]+\.[0-9]+\.[0-9]+') + version=$(dpkg-query -f='${Version}\n' --show lighttpd) # Test if that version is greater than or euqal to 1.4.56 if dpkg --compare-versions "$version" "ge" "1.4.56"; then # If it is, then we don't need to disable the modules + # (server.modules duplication is ignored in lighttpd 1.4.56+) : else # disable server.modules += ( ... ) in $conf to avoid module dups - # (server.modules duplication is ignored in lighttpd 1.4.56+) if awk '!/^server\.modules/{print}' $conf > $conf.$$ && mv $conf.$$ $conf; then : else From 9331cbff4b186f91542a5981b54355076cb08a3b Mon Sep 17 00:00:00 2001 From: Adam Warner Date: Sat, 21 Jan 2023 14:25:06 +0000 Subject: [PATCH 3/3] remove the access log configuration from lighttpd.conf.debian and .conf.fedora to prevent issues on upgrades (this is defined in pihole-admin.conf) Signed-off-by: Adam Warner --- advanced/lighttpd.conf.debian | 2 -- advanced/lighttpd.conf.fedora | 2 -- 2 files changed, 4 deletions(-) diff --git a/advanced/lighttpd.conf.debian b/advanced/lighttpd.conf.debian index 61d20821..5a96c6cd 100644 --- a/advanced/lighttpd.conf.debian +++ b/advanced/lighttpd.conf.debian @@ -33,8 +33,6 @@ server.groupname = "www-data" # For lighttpd version 1.4.46 or above, the port can be overwritten in `/etc/lighttpd/external.conf` using the := operator # e.g. server.port := 8000 server.port = 80 -accesslog.filename = "/var/log/lighttpd/access-pihole.log" -accesslog.format = "%{%s}t|%V|%r|%s|%b" # Allow streaming response # reference: https://redmine.lighttpd.net/projects/lighttpd/wiki/Server_stream-response-bodyDetails diff --git a/advanced/lighttpd.conf.fedora b/advanced/lighttpd.conf.fedora index 04f3ee01..6276bfcb 100644 --- a/advanced/lighttpd.conf.fedora +++ b/advanced/lighttpd.conf.fedora @@ -35,8 +35,6 @@ server.groupname = "lighttpd" # For lighttpd version 1.4.46 or above, the port can be overwritten in `/etc/lighttpd/external.conf` using the := operator # e.g. server.port := 8000 server.port = 80 -accesslog.filename = "/var/log/lighttpd/access-pihole.log" -accesslog.format = "%{%s}t|%V|%r|%s|%b" # Allow streaming response # reference: https://redmine.lighttpd.net/projects/lighttpd/wiki/Server_stream-response-bodyDetails