From 79e5497f652a5e568bb8979aae0a0b5a58dd731a Mon Sep 17 00:00:00 2001
From: Jonas Leder <git@jonasled.de>
Date: Tue, 13 Apr 2021 11:50:33 +0200
Subject: [PATCH] fix apacheblocker install

---
 Dockerfile               |  2 +-
 install-apacheblocker.sh | 61 ++++++++++++++++++++++++++++++++++++++++
 2 files changed, 62 insertions(+), 1 deletion(-)
 create mode 100644 install-apacheblocker.sh

diff --git a/Dockerfile b/Dockerfile
index a37188d..c103a73 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -33,7 +33,7 @@ RUN a2enmod headers rewrite
 # |--------------------------------------------------------------------------
 # | install bad bot blocklist
 # |--------------------------------------------------------------------------
-ADD ["https://raw.githubusercontent.com/mitchellkrogza/apache-ultimate-bad-bot-blocker/master/install-apacheblocker.sh", "/tmp/"]
+COPY ./install-apacheblocker.sh /tmp/
 RUN apt update && apt install -y wget && chmod +x /tmp/install-apacheblocker.sh && /tmp/install-apacheblocker.sh
 
 # |--------------------------------------------------------------------------
diff --git a/install-apacheblocker.sh b/install-apacheblocker.sh
new file mode 100644
index 0000000..cc758ab
--- /dev/null
+++ b/install-apacheblocker.sh
@@ -0,0 +1,61 @@
+ash
+# Bash Script for Installing the Apache Bad Bot Blocker for Apache 2.2 > 2.4
+# Copyright - https://github.com/mitchellkrogza
+# Project Url: https://github.com/mitchellkrogza/apache-ultimate-bad-bot-blocker
+
+##############################################################################
+#        ___                 __                                              #
+#       / _ | ___  ___ _____/ /  ___                                         #
+#      / __ |/ _ \/ _ `/ __/ _ \/ -_)                                        #
+#     /_/ |_/ .__/\_,_/\__/_//_/\__/                                         #
+#        __/_/        __   ___       __     ___  __         __               #
+#       / _ )___ ____/ /  / _ )___  / /_   / _ )/ /__  ____/ /_____ ____     #
+#      / _  / _ `/ _  /  / _  / _ \/ __/  / _  / / _ \/ __/  '_/ -_) __/     #
+#     /____/\_,_/\_,_/  /____/\___/\__/  /____/_/\___/\__/_/\_\\__/_/        #
+#                                                                            #
+##############################################################################
+
+# Please Note:
+# ************
+# This script will install Apache 2.2 or 2.4 configurations.
+# If you attempt to use Apache 2.2 configs wiht Apache 2.4 you will need the mod_access_compat module to be loaded.
+# The new Apache 2.4 version uses the new Apache Access Control methods and does not require the mod_access_compat module to be loaded in order to work.
+
+# PLEASE READ CONFIGURATION INSTRUCTIONS BEFORE USING THIS - THIS IS ONLY A PARTIAL INSTALLER
+# https://github.com/mitchellkrogza/apache-ultimate-bad-bot-blocker/blob/master/CONFIGURATION.md
+
+# Use this script only once and thereafter use the Auto Update Bash Script update-apacheblocker.sh
+
+# THIS INSTALL SCRIPT ONLY COPIES THE NECESSARY FILES FOR APACHE DIRECT FROM THE REPO
+
+### You must manually edit any vhost files with the required include or it will not actually be protecting any sites.
+### READ: https://github.com/mitchellkrogza/apache-ultimate-bad-bot-blocker/blob/master/CONFIGURATION.md
+
+# Save this file as ~/install-apacheblocker.sh
+# sudo wget https://raw.githubusercontent.com/mitchellkrogza/apache-ultimate-bad-bot-blocker/master/install-apacheblocker.sh -O ~/install-apacheblocker.sh
+# Make it Executable chmod +x ~/install-apacheblocker.sh
+# Run it from the command line using sudo ~/install-apacheblocker.sh
+
+#Update all environment variables to suit your OS/Apache version.
+
+# LETS INSTALL NOW
+
+#Major Apache version e.g. 2.2, 2.4
+APACHE_VERSION='2.4'
+#Directory where bad bot configs are located.
+#Generally /etc/apache2 or /etc/httpd depending on OS
+APACHE_CONF='/etc/apache2'
+#location of Apache blocker files
+BLOCKER_URL="https://raw.githubusercontent.com/mitchellkrogza/apache-ultimate-bad-bot-blocker/master/Apache_${APACHE_VERSION}/custom.d"
+
+mkdir -p "${APACHE_CONF}/custom.d"
+wget ${BLOCKER_URL}/globalblacklist.conf -O "${APACHE_CONF}/custom.d/globalblacklist.conf"
+wget ${BLOCKER_URL}/whitelist-ips.conf -O "${APACHE_CONF}/custom.d/whitelist-ips.conf"
+wget ${BLOCKER_URL}/whitelist-domains.conf -O "${APACHE_CONF}/custom.d/whitelist-domains.conf"
+wget ${BLOCKER_URL}/blacklist-ips.conf -O "${APACHE_CONF}/custom.d/blacklist-ips.conf"
+wget ${BLOCKER_URL}/bad-referrer-words.conf -O "${APACHE_CONF}/custom.d/bad-referrer-words.conf"
+wget ${BLOCKER_URL}/blacklist-user-agents.conf -O "${APACHE_CONF}/custom.d/blacklist-user-agents.conf"
+echo "Manually edit vhost to include globalblacklist.conf"
+
+# PLEASE READ CONFIGURATION INSTRUCTIONS
+# https://github.com/mitchellkrogza/apache-ultimate-bad-bot-blocker/blob/master/CONFIGURATION.md
-- 
GitLab