Fixes for isLocalIP

This commit is contained in:
Sefinek committed 2025-03-18 21:38:05 +01:00
1 parent 27f0289845
commit 483029c75c
1 file changed
+7 -7
+7 -7
View File
@@ -1,9 +1,9 @@
exports.MAIN = { exports.MAIN = {
// This server // My Server
UFW_LOG_FILE: '/var/log/ufw.log', UFW_LOG_FILE: '/var/log/ufw.log',
CACHE_FILE: '/tmp/ufw-abuseipdb-reporter.cache', CACHE_FILE: '/tmp/ufw-abuseipdb-reporter.cache',
SERVER_ID: null, // The server name that will be visible in the reports (e.g., 'homeserver1'). If you don't want to define it, leave the value as null. SERVER_ID: null, // The server name that will be visible in the reports (e.g., 'homeserver1'). If you don't want to define it, leave the value as null.
IP_REFRESH_INTERVAL: 10 * 60 * 1000, // How often should (every 10 minutes) the script check the server's IP address to avoid accidental self-reports? IP_REFRESH_SCHEDULE: '*/20 * * * *', // Cron: How often should the script check the IP address assigned by the ISP to prevent accidental self-reporting? Default: every 20 minutes
// Reporting // Reporting
ABUSEIPDB_API_KEY: '', // Secret API key for AbuseIPDB. ABUSEIPDB_API_KEY: '', // Secret API key for AbuseIPDB.
@@ -11,11 +11,11 @@ exports.MAIN = {
// Automatic Updates // Automatic Updates
AUTO_UPDATE_ENABLED: true, // Do you want the script to automatically update to the latest version using 'git pull'? (true = enabled, false = disabled) AUTO_UPDATE_ENABLED: true, // Do you want the script to automatically update to the latest version using 'git pull'? (true = enabled, false = disabled)
AUTO_UPDATE_SCHEDULE: '0 18 * * *', // Schedule for automatic script updates (CRON format). Default: every day at 18:00 AUTO_UPDATE_SCHEDULE: '0 18 * * *', // Cron: Schedule for automatic script updates. Default: every day at 18:00
// Discord Webhooks // Discord Webhooks
DISCORD_WEBHOOKS_ENABLED: false, DISCORD_WEBHOOKS_ENABLED: false, // Should the script send webhooks? They will contain error reports, daily summaries related to reports, etc.
DISCORD_WEBHOOKS_URL: '', DISCORD_WEBHOOKS_URL: '', // Webhook URL.
}; };
@@ -45,14 +45,14 @@ exports.MAIN = {
* @returns {string} A formatted string report. * @returns {string} A formatted string report.
*/ */
exports.REPORT_COMMENT = ({ timestamp, In, Out, srcIp, dstIp, res, tos, prec, ttl, id, proto, spt, dpt, len, urgp, mac, window, syn }, fullLog, serverName) => exports.REPORT_COMMENT = ({ timestamp, In, Out, srcIp, dstIp, res, tos, prec, ttl, id, proto, spt, dpt, len, urgp, mac, window, syn }, fullLog, serverName) =>
`Blocked by UFW ${serverName ? `on ${serverName} ` : ''}[${dpt}/${proto?.toLowerCase()}] `Blocked by UFW ${serverName ? `on ${serverName} ` : ''}[${dpt || 'N/A'}/${proto?.toLowerCase() || 'N/A'}]
Source port: ${spt || 'N/A'} Source port: ${spt || 'N/A'}
TTL: ${ttl || 'N/A'} TTL: ${ttl || 'N/A'}
Packet length: ${len || 'N/A'} Packet length: ${len || 'N/A'}
TOS: ${tos || 'N/A'} TOS: ${tos || 'N/A'}
This report was generated by: This report was generated by:
https://github.com/sefinek/UFW-AbuseIPDB-Reporter`; // Please do not remove this URL; I would be very grateful! Thank you. 💙 https://github.com/sefinek/UFW-AbuseIPDB-Reporter`; // Please do not delete this URL. I would be very grateful, thank you! 💙
// Alternative version: // Alternative version:
// exports.REPORT_COMMENT = ({ timestamp, In, Out, srcIp, dstIp, res, tos, prec, ttl, id, proto, spt, dpt, len, urgp, mac, window, syn }, fullLog, serverName) => // exports.REPORT_COMMENT = ({ timestamp, In, Out, srcIp, dstIp, res, tos, prec, ttl, id, proto, spt, dpt, len, urgp, mac, window, syn }, fullLog, serverName) =>