Add whitelist #7
This commit is contained in:
1 parent
424f595531
commit
82e9c529d0
4 files changed
+22
-8
No files matched your search
@@ -1,3 +1,4 @@
|
|||||||
node_modules
|
node_modules
|
||||||
tmp
|
tmp
|
||||||
config.js
|
config.js
|
||||||
|
whitelist.txt
|
||||||
@@ -26,14 +26,17 @@ Also, check this out: [sefinek/Cloudflare-WAF-To-AbuseIPDB](https://github.com/s
|
|||||||
## ✅ Features
|
## ✅ Features
|
||||||
1. **Easy Configuration** – The [`config.js`](config.default.js) file allows for quick and simple configuration.
|
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.
|
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.
|
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. **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. **Local IP Filtering** – Local 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. **Discord Webhooks Integration**:
|
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
|
- Critical notifications
|
||||||
- Script error alerts
|
- Script error alerts
|
||||||
- Daily summaries of reported IPs
|
- 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)
|
## 📥 Installation (Ubuntu & Debian)
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ const ABUSE_STATE = require('./scripts/services/state.js');
|
|||||||
const { refreshServerIPs, getServerIPs } = require('./scripts/services/ipFetcher.js');
|
const { refreshServerIPs, getServerIPs } = require('./scripts/services/ipFetcher.js');
|
||||||
const { repoSlug, repoUrl } = require('./scripts/repo.js');
|
const { repoSlug, repoUrl } = require('./scripts/repo.js');
|
||||||
const isSpecialPurposeIP = require('./scripts/isSpecialPurposeIP.js');
|
const isSpecialPurposeIP = require('./scripts/isSpecialPurposeIP.js');
|
||||||
|
const { initWhitelist, isWhitelisted } = require('./scripts/services/whitelist.js');
|
||||||
const logger = require('./scripts/logger.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;
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isSpecialPurposeIP(srcIp)) {
|
if (isWhitelisted(srcIp)) {
|
||||||
if (EXTENDED_LOGS) logger.info(`Ignoring local IP address: PROTO=${proto?.toLowerCase()} SRC=${srcIp} DPT=${dpt} ID=${data.id}`);
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -174,6 +181,9 @@ const processLogLine = async (line, test = false) => {
|
|||||||
// Fetch IPs
|
// Fetch IPs
|
||||||
await refreshServerIPs();
|
await refreshServerIPs();
|
||||||
|
|
||||||
|
// Whitelist
|
||||||
|
initWhitelist();
|
||||||
|
|
||||||
// Load cache
|
// Load cache
|
||||||
await loadReportedIPs();
|
await loadReportedIPs();
|
||||||
|
|
||||||
|
|||||||
+1
-1
Submodule scripts updated: b84eaa02ce...046e9dd272.
Reference in new issue
Block a user