Add whitelist #7

This commit is contained in:
Sefinek committed 2026-03-01 11:29:27 +01:00
1 parent 424f595531
commit 82e9c529d0
4 files changed
+23 -9

No files matched your search

+2 -1
View File
@@ -1,3 +1,4 @@
node_modules
tmp
config.js
config.js
whitelist.txt
+8 -5
View File
@@ -26,14 +26,17 @@ Also, check this out: [sefinek/Cloudflare-WAF-To-AbuseIPDB](https://github.com/s
## ✅ Features
1. **Easy Configuration** – The [`config.js`](config.default.js) file allows for quick and simple configuration.
2. **Simple Installer** – Enables fast and seamless integration deployment.
3. **Bulk Reporting Support** – If the script encounters a rate limit, it will start buffering collected IPs and send a bulk report.
4. **Self-IP Protection (IPv4 & IPv6)** – The script will never report IP addresses belonging to you or your server, even if you're using a dynamic IP address.
5. **Local IP Filtering** – Local IP addresses will never be reported.
6. **Discord Webhooks Integration**:
3. **Self-IP Protection (IPv4 & IPv6)** – The script will never report IP addresses belonging to you or your server, even if you're using a dynamic IP address.
4. **IP Filtering** – Local and special-purpose IP addresses will never be reported.
5. **IP Whitelist** – Maintain a `whitelist.txt` file with IP addresses that should never be reported (e.g., your home IP when running on a VPS).
6. **UDP Traffic Filtering** – UDP traffic is automatically skipped in accordance with [AbuseIPDB's policy](https://github.com/sefinek/UFW-AbuseIPDB-Reporter/discussions/2).
7. **Report Cooldown** – Prevents duplicate reports of the same IP within a configurable time window (default: 12 hours).
8. **Bulk Reporting Support** – If the script encounters a rate limit, it will start buffering collected IPs and send a bulk report.
9. **Discord Webhooks Integration**:
- Critical notifications
- Script error alerts
- Daily summaries of reported IPs
7. **Automatic Updates** – The script regularly fetches and applies the latest updates. You can disable this feature if you'd prefer.
10. **Automatic Updates** – The script regularly fetches and applies the latest updates. You can disable this feature if you'd prefer.
## 📥 Installation (Ubuntu & Debian)
+12 -2
View File
@@ -13,6 +13,7 @@ const ABUSE_STATE = require('./scripts/services/state.js');
const { refreshServerIPs, getServerIPs } = require('./scripts/services/ipFetcher.js');
const { repoSlug, repoUrl } = require('./scripts/repo.js');
const isSpecialPurposeIP = require('./scripts/isSpecialPurposeIP.js');
const { initWhitelist, isWhitelisted } = require('./scripts/services/whitelist.js');
const logger = require('./scripts/logger.js');
const { UFW_LOG_FILE, SERVER_ID, EXTENDED_LOGS, AUTO_UPDATE_ENABLED, AUTO_UPDATE_SCHEDULE, DISCORD_WEBHOOK_ENABLED, DISCORD_WEBHOOK_URL } = config.MAIN;
@@ -121,8 +122,14 @@ const processLogLine = async (line, test = false) => {
return;
}
if (isSpecialPurposeIP(srcIp)) {
if (EXTENDED_LOGS) logger.info(`Ignoring local IP address: PROTO=${proto?.toLowerCase()} SRC=${srcIp} DPT=${dpt} ID=${data.id}`);
if (isWhitelisted(srcIp)) {
if (EXTENDED_LOGS) logger.info(`Ignoring whitelisted IP address: PROTO=${proto?.toLowerCase()} SRC=${srcIp} DPT=${dpt} ID=${data.id}`);
return;
}
const specialIP = isSpecialPurposeIP(srcIp);
if (specialIP.is) {
if (EXTENDED_LOGS) logger.info(`Ignoring ${specialIP.range} IP address: PROTO=${proto?.toLowerCase()} SRC=${srcIp} DPT=${dpt} ID=${data.id}`);
return;
}
@@ -174,6 +181,9 @@ const processLogLine = async (line, test = false) => {
// Fetch IPs
await refreshServerIPs();
// Whitelist
initWhitelist();
// Load cache
await loadReportedIPs();
+1 -1
Submodule scripts updated: b84eaa02ce...046e9dd272.