Update README.md

This commit is contained in:
Sefinek 2024-10-31 02:47:25 +01:00
parent 9c2f8f0a40
commit bc0289ffdd
2 changed files with 26 additions and 52 deletions

View file

@ -7,33 +7,20 @@
A tool that analyzes UFW firewall logs and reports malicious IP addresses to the [AbuseIPDB](https://www.abuseipdb.com) database.
If you like this repository or find it useful, I would greatly appreciate it if you could give it a star ⭐. Thanks a lot!
See also this: [sefinek24/Node-Cloudflare-WAF-AbuseIPDB](https://github.com/sefinek24/Node-Cloudflare-WAF-AbuseIPDB)
> [!IMPORTANT]
> If you'd like to make changes to any files in this repository, please start by creating a [public fork](https://github.com/sefinek/UFW-AbuseIPDB-Reporter/fork).
- [⚙️ How does it work in detail?](#how-it-works)
- [📋 Requirements](#requirements)
- [🛠️ Installing required packages](#installing-required-packages)
- [🌍 Perform repository and software updates](#perform-repository-and-software-updates)
- [🌌 Install required dependencies](#install-required-dependencies)
- [🧪 Tested operating systems](#tested-operating-systems)
- [📥 Installation](#installation)
- [🖥️ Usage](#usage)
- [🔍 Checking service status](#checking-service-status)
- [📄 Example report](#example-report)
- [🤝 Development](#development)
- [🔑 MIT License](#license)
See also this: [sefinek24/Node-Cloudflare-WAF-AbuseIPDB](https://github.com/sefinek24/Node-Cloudflare-WAF-AbuseIPDB)
## ⚙️ How does it work in detail?<div id="how-it-works"></div>
## ⚙️ How does it work in detail?
1. **Monitoring UFW logs:** The tool continuously monitors logs generated by the UFW firewall, looking for unauthorized access attempts or other suspicious activities.
2. **Analyzing the reported address:** After identifying a suspicious IP address, the script checks if the address has already been reported.
3. **Reporting IP to AbuseIPDB:** If the IP meets the criteria, the address is reported to the AbuseIPDB database with information about the protocol, source port, destination port, etc.
4. **Cache of reported IPs:** The tool stores a list of reported IPs in a temporary file to prevent multiple reports of the same IP address in a short period.
## 📋 Requirements<div id="requirements"></div>
## 📋 Requirements
- **Operating System:** Linux with UFW firewall installed and configured.
- **AbuseIPDB Account:** An account on the AbuseIPDB service [with a valid API token](https://www.abuseipdb.com/account/api). The API token is required.
- **Installed packages:**
@ -43,20 +30,20 @@ See also this: [sefinek24/Node-Cloudflare-WAF-AbuseIPDB](https://github.com/sefi
- `tail`, `awk`, `grep`, `sed`: Standard Unix tools used for text processing and log analysis.
## 🧪 Tested operating systems<div id="tested-operating-systems"></div>
## 🧪 Tested operating systems
- **Ubuntu Server:** 20.04 & 22.04
If the distribution you're using to run the tool isn't listed here and the script works correctly, please create a new [Issue](https://github.com/sefinek24/UFW-AbuseIPDB-Reporter/issues). I'll add its name to the list.
## 📥 How to install?<div id="installation"></div>
## 📥 How to install?
### 🌍 Perform repository and software updates (highly recommended)<div id="perform-repository-and-software-updates"></div>
### 🌍 Perform repository and software updates (highly recommended)
```bash
sudo apt update && sudo apt upgrade -y
```
### 🌌 Install required dependencies<div id="install-required-dependencies"></div>
### 🌌 Install required dependencies
```bash
sudo apt install -y ufw curl jq openssl
```
@ -70,14 +57,14 @@ sudo bash -c "$(curl -s https://raw.githubusercontent.com/sefinek24/UFW-AbuseIPD
The installation script will automatically download and configure the tool on your server. During installation, you will be asked to provide an [AbuseIPDB API token](https://www.abuseipdb.com/account/api).
## 🖥️ Usage<div id="usage"></div>
## 🖥️ Usage
After successful installation, the script will run continuously in the background, monitoring UFW logs and automatically reporting malicious IP addresses.
The tool requires no additional user action after installation. However, it's worth occasionally checking its operation and updating the script regularly (by running the installation command).
Servers open to the world are constantly scanned by bots, usually looking for vulnerabilities or other security gaps.
So don't be surprised if the next day, the number of reports to AbuseIPDB exceeds a thousand.
### 🔍 Checking service status<div id="checking-service-status"></div>
### 🔍 Checking service status
If the tool was installed as a system service, you can check its status using the following command:
```bash
sudo systemctl status abuseipdb-ufw.service
@ -88,7 +75,7 @@ To see the current logs generated by the process, use the command:
journalctl -u abuseipdb-ufw.service -f
```
### 📄 Example report<div id="example-report"></div>
### 📄 Example report
```
Blocked by UFW (TCP on port 80).
Source port: 28586
@ -101,8 +88,8 @@ https://github.com/sefinek24/UFW-AbuseIPDB-Reporter
```
## 🤝 Development<div id="development"></div>
## 🤝 Development
If you want to contribute to the development of this project, feel free to create a new [Pull request](https://github.com/sefinek24/UFW-AbuseIPDB-Reporter/pulls). I will definitely appreciate it!
## 🔑 GPL-3.0 License<div id="license"></div>
## 🔑 GPL-3.0 License
Copyright 2024 © by [Sefinek](https://sefinek.net). All rights reserved. See the [LICENSE](LICENSE) file for more information.

View file

@ -7,33 +7,20 @@
Narzędzie, które analizuje logi firewalla UFW i zgłasza złośliwe adresy IP do bazy danych [AbuseIPDB](https://www.abuseipdb.com).
Jeśli podoba Ci się to repozytorium lub uważasz je za przydatne, byłbym bardzo wdzięczny, gdybyś mógł dać mu gwiazdkę ⭐. Wielkie dzięki!
Zobacz również to: [sefinek24/Node-Cloudflare-WAF-AbuseIPDB](https://github.com/sefinek24/Node-Cloudflare-WAF-AbuseIPDB)
> [!IMPORTANT]
> Jeśli chcesz wprowadzić zmiany do jakichkolwiek plików w tym repozytorium, zacznij od utworzenia [publicznego forka](https://github.com/sefinek/UFW-AbuseIPDB-Reporter/fork).
- [⚙️ Jak to dokładniej działa?](#jak-to-dziala)
- [📋 Wymagania](#wymagania)
- [🛠️ Instalacja wymaganych pakietów](#instalacja-wymaganych-pakietow)
- [🌍 Wykonaj aktualizacje repozytoriów i oprogramowania](#wykonaj-aktualizacje-repozytoriow-i-oprogramowania)
- [🌌 Zainstaluj wymagane zależności](#zainstaluj-wymagane-zaleznosci)
- [🧪 Testowane systemy operacyjne](#testowane-systemy-operacyjne)
- [📥 Instalacja](#instalacja)
- [🖥️ Użycie](#uzycie)
- [🔍 Sprawdzenie statusu usługi](#sprawdzenie-statusu-uslugi)
- [📄 Przykładowe zgłoszenie](#przykladowe-zgloszenie)
- [🤝 Rozwój](#rozwoj)
- [🔑 Licencja MIT](#licencja)
Zobacz również to: [sefinek24/Node-Cloudflare-WAF-AbuseIPDB](https://github.com/sefinek24/Node-Cloudflare-WAF-AbuseIPDB)
## ⚙️ Jak to dokładniej działa?<div id="jak-to-dziala"></div>
## ⚙️ Jak to dokładniej działa?
1. **Monitorowanie logów UFW:** Narzędzie stale śledzi logi generowane przez firewall UFW, poszukując prób nieautoryzowanego dostępu lub innych podejrzanych działań.
2. **Analiza zgłoszonego adresu:** Po zidentyfikowaniu podejrzanego adresu IP, skrypt sprawdza, czy adres ten został już wcześniej zgłoszony.
3. **Zgłaszanie IP do AbuseIPDB:** Jeśli IP spełnia kryteria, adres jest zgłaszany do bazy danych AbuseIPDB wraz z informacjami o protokole, porcie źródłowym i docelowym itd.
4. **Cache zgłoszonych IP:** Narzędzie przechowuje listę zgłoszonych IP w pliku tymczasowym, aby zapobiec wielokrotnemu zgłaszaniu tego samego adresu IP w krótkim czasie.
## 📋 Wymagania<div id="wymagania"></div>
## 📋 Wymagania
- **System operacyjny:** Linux z zainstalowanym i skonfigurowanym firewallem UFW.
- **Konto AbuseIPDB:** Wymagane jest konto w serwisie AbuseIPDB [z ważnym tokenem API](https://www.abuseipdb.com/account/api). Token API jest niezbędny.
- **Zainstalowane pakiety:**
@ -43,20 +30,20 @@ Zobacz również to: [sefinek24/Node-Cloudflare-WAF-AbuseIPDB](https://github.co
- `tail`, `awk`, `grep`, `sed`: Standardowe narzędzia Unixowe wykorzystywane do przetwarzania tekstu i analizy logów.
## 🧪 Testowane systemy operacyjne<div id=„tested-operating-systems”></div>
## 🧪 Testowane systemy operacyjne
- **Ubuntu Server:** 20.04 i 22.04
Jeśli dystrybucja, której używasz do uruchomienia narzędzia, nie jest tutaj wymieniona, a skrypt działa poprawnie, utwórz nowy [Issue](https://github.com/sefinek24/UFW-AbuseIPDB-Reporter/issues). Dodam nazwę distra do listy.
## 📥 Jak zainstalować?<div id="installation"></div>
## 📥 Jak zainstalować?
### 🌍 Wykonaj aktualizacje repozytoriów i oprogramowania (wysoko zalecane)<div id="perform-repository-and-software-updates"></div>
### 🌍 Wykonaj aktualizacje repozytoriów i oprogramowania (wysoko zalecane)
```bash
sudo apt update && sudo apt upgrade -y
```
#### 🌌 Zainstaluj wymagane zależności<div id="zainstaluj-wymagane-zaleznosci"></div>
#### 🌌 Zainstaluj wymagane zależności
```bash
sudo apt install -y ufw curl jq openssl
```
@ -70,14 +57,14 @@ sudo bash -c "$(curl -s https://raw.githubusercontent.com/sefinek24/UFW-AbuseIPD
Skrypt instalacyjny automatycznie pobierze i skonfiguruje narzędzie na Twoim serwerze. Podczas instalacji zostaniesz poproszony o podanie [tokena API z AbuseIPDB](https://www.abuseipdb.com/account/api).
## 🖥️ Użycie<div id="uzycie"></div>
## 🖥️ Użycie
Po pomyślnej instalacji skrypt będzie działać cały czas w tle, monitorując logi UFW i automatycznie zgłaszając złośliwe adresy IP.
Narzędzie nie wymaga dodatkowych działań użytkownika po instalacji. Warto jednak od czasu do czasu sprawdzić jego działanie oraz aktualizować skrypt na bieżąco (wywołując polecenie instalacyjne).
Serwery otwarte na świat są nieustannie skanowane przez boty, które zazwyczaj szukają podatności lub jakichkolwiek innych luk w zabezpieczeniach.
Więc nie zdziw się, jeśli następnego dnia liczba zgłoszeń na AbuseIPDB przekroczy tysiąc.
### 🔍 Sprawdzenie statusu usługi<div id="sprawdzenie-statusu-uslugi"></div>
### 🔍 Sprawdzenie statusu usługi
Jeśli narzędzie zostało zainstalowane jako usługa systemowa, możesz sprawdzić jej status za pomocą poniższej komendy:
```bash
sudo systemctl status abuseipdb-ufw.service
@ -88,7 +75,7 @@ Aby zobaczyć bieżące logi generowane przez proces, użyj polecenia:
journalctl -u abuseipdb-ufw.service -f
```
### 📄 Przykładowe zgłoszenie<div id="przykladowe-zgloszenie"></div>
### 📄 Przykładowe zgłoszenie
```
Blocked by UFW (TCP on port 80).
Source port: 28586
@ -101,8 +88,8 @@ https://github.com/sefinek24/UFW-AbuseIPDB-Reporter
```
## 🤝 Rozwój<div id="rozwoj"></div>
## 🤝 Rozwój
Jeśli chcesz przyczynić się do rozwoju tego projektu, śmiało stwórz nowy [Pull request](https://github.com/sefinek24/UFW-AbuseIPDB-Reporter/pulls). Z pewnością to docenię!
## 🔑 Licencja GPL-3.0<div id="licencja"></div>
## 🔑 Licencja GPL-3.0
Copyright 2024 © by [Sefinek](https://sefinek.net). Wszelkie prawa zastrzeżone. Zobacz plik [LICENSE](LICENSE), aby dowiedzieć się więcej.