Update
This commit is contained in:
parent
4434fddf86
commit
bfa45ca0bd
2 changed files with 36 additions and 27 deletions
34
install.sh
34
install.sh
|
|
@ -1,7 +1,14 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
cat << "EOF"
|
###
|
||||||
|
# https://github.com/sefinek24/UFW-AbuseIPDB-Reporter
|
||||||
|
##
|
||||||
|
|
||||||
|
VERSION="1.0.2"
|
||||||
|
DATE="27.10.2024"
|
||||||
|
REPO="https://github.com/sefinek24/UFW-AbuseIPDB-Reporter"
|
||||||
|
|
||||||
|
cat << "EOF"
|
||||||
_ _ ___ ____ ____ ____
|
_ _ ___ ____ ____ ____
|
||||||
/ \ | |__ _ _ ___ ___ |_ _| | _ \ | _ \ | __ )
|
/ \ | |__ _ _ ___ ___ |_ _| | _ \ | _ \ | __ )
|
||||||
/ _ \ | '_ \ | | | | / __| / _ \ | | | |_) | | | | | | _ \
|
/ _ \ | '_ \ | | | | / __| / _ \ | | | |_) | | | | | | _ \
|
||||||
|
|
@ -14,20 +21,24 @@ cat << "EOF"
|
||||||
|_|_| |_|\__\___|\__, |_| \__,_|\__|_|\___/|_| |_|
|
|_|_| |_|\__\___|\__, |_| \__,_|\__|_|\___/|_| |_|
|
||||||
|___/
|
|___/
|
||||||
|
|
||||||
|
EOF
|
||||||
|
|
||||||
>> by https://sefinek.net <<
|
cat <<EOF
|
||||||
|
>> Made by sefinek.net || Version: $VERSION [$DATE] <<
|
||||||
|
|
||||||
This installer configures the UFW-AbuseIPDB-Reporter tool, which analyzes
|
This installer configures the UFW-AbuseIPDB-Reporter, a tool that analyzes UFW firewall logs
|
||||||
UFW firewall logs and reports malicious IP addresses to the AbuseIPDB database.
|
and reports malicious IP addresses to the AbuseIPDB database.
|
||||||
|
|
||||||
|
=======================================================================================================
|
||||||
|
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
|
|
||||||
# Function to download a file using either wget or curl
|
# Function to download a file using either wget or curl
|
||||||
download_file() {
|
download_file() {
|
||||||
local url="$1"
|
local url="$1"
|
||||||
local output="$2"
|
local output="$2"
|
||||||
local user_agent="UFW-AbuseIPDB-Reporter/1.0.1 (+https://github.com/sefinek24/UFW-AbuseIPDB-Reporter)"
|
local user_agent="UFW-AbuseIPDB-Reporter/$VERSION (+$REPO)"
|
||||||
|
|
||||||
if command -v wget >/dev/null 2>&1; then
|
if command -v wget >/dev/null 2>&1; then
|
||||||
echo "INFO: Using wget to download the file. Please wait..."
|
echo "INFO: Using wget to download the file. Please wait..."
|
||||||
|
|
@ -48,7 +59,7 @@ remove_service() {
|
||||||
sudo systemctl disable abuseipdb-ufw.service
|
sudo systemctl disable abuseipdb-ufw.service
|
||||||
sudo rm /etc/systemd/system/abuseipdb-ufw.service
|
sudo rm /etc/systemd/system/abuseipdb-ufw.service
|
||||||
sudo systemctl daemon-reload
|
sudo systemctl daemon-reload
|
||||||
sudo systemctl reset-failed
|
# sudo systemctl reset-failed
|
||||||
echo
|
echo
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -71,15 +82,14 @@ invoking_user=$(logname)
|
||||||
|
|
||||||
# Check if the service already exists
|
# Check if the service already exists
|
||||||
if systemctl list-unit-files | grep -q '^abuseipdb-ufw.service'; then
|
if systemctl list-unit-files | grep -q '^abuseipdb-ufw.service'; then
|
||||||
echo "WARNING: abuseipdb-ufw.service is already installed!"
|
echo "WARNING: abuseipdb-ufw.service is already installed! If you plan to update or reinstall, choose 'Yes'."
|
||||||
read -rp "> Do you want to remove the existing service? [Yes/no]: " remove_existing
|
read -rp "> Do you want to remove the existing service? [Yes/no]: " remove_existing
|
||||||
|
|
||||||
remove_existing=$(echo "$remove_existing" | tr '[:upper:]' '[:lower:]')
|
remove_existing=$(echo "$remove_existing" | tr '[:upper:]' '[:lower:]')
|
||||||
if [[ "$remove_existing" =~ ^(yes|y)$ ]]; then
|
if [[ "$remove_existing" =~ ^(yes|y)$ ]]; then
|
||||||
remove_service
|
remove_service
|
||||||
else
|
else
|
||||||
echo "INFO: Existing service will not be removed. Exiting..."
|
echo -e "INFO: Existing service will not be removed.\n"
|
||||||
exit 0
|
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
@ -156,11 +166,11 @@ add_service=$(echo "$add_service" | tr '[:upper:]' '[:lower:]')
|
||||||
if [[ "$add_service" =~ ^(yes|y)$ ]]; then
|
if [[ "$add_service" =~ ^(yes|y)$ ]]; then
|
||||||
service_file="/etc/systemd/system/abuseipdb-ufw.service"
|
service_file="/etc/systemd/system/abuseipdb-ufw.service"
|
||||||
echo "INFO: Setting up reporter.sh as a service"
|
echo "INFO: Setting up reporter.sh as a service"
|
||||||
if ! sudo bash -c "cat > $service_file" <<EOL
|
if ! sudo bash -c "cat > $service_file" <<-EOF
|
||||||
[Unit]
|
[Unit]
|
||||||
Description=UFW AbuseIPDB Reporter
|
Description=UFW AbuseIPDB Reporter
|
||||||
After=network.target
|
After=network.target
|
||||||
Documentation=https://github.com/sefinek24/UFW-AbuseIPDB-Reporter
|
Documentation=$REPO
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Environment="PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
|
Environment="PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
|
||||||
|
|
@ -173,7 +183,7 @@ StandardError=journal+console
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target
|
||||||
EOL
|
EOF
|
||||||
then
|
then
|
||||||
echo "ERROR: Failed to create service file. Please check your permissions!"
|
echo "ERROR: Failed to create service file. Please check your permissions!"
|
||||||
exit 1
|
exit 1
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
###
|
###
|
||||||
# https://github.com/sefinek24/UFW-AbuseIPDB-Reporter
|
# https://github.com/sefinek24/UFW-AbuseIPDB-Reporter
|
||||||
# Version v1.0.1 from 14.09.2024 [DD.MM.YYYY]
|
|
||||||
##
|
##
|
||||||
|
|
||||||
LOG_FILE="/var/log/ufw.log"
|
LOG_FILE="/var/log/ufw.log"
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue