Improved handling of fetching IPv4 and IPv6 addresses

This commit is contained in:
Sefinek 2025-03-20 03:57:31 +01:00
parent 47850dd646
commit d9b53447f1
3 changed files with 5 additions and 5 deletions

View file

@ -3,7 +3,8 @@ exports.MAIN = {
UFW_LOG_FILE: '/var/log/ufw.log',
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.
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
IP_REFRESH_SCHEDULE: '0 */6 * * *', // Cron: How often should the script check the IP address assigned by the ISP to prevent accidental self-reporting? Default: every 6 hours
IPv6_SUPPORT: true, // Specifies whether the device has been assigned an IPv6 address.
// Reporting
ABUSEIPDB_API_KEY: '', // Secret API key for AbuseIPDB.

View file

@ -121,8 +121,9 @@ const processLogLine = async (line, test = false) => {
loadReportedIPs();
log(0, 'Fetching your IP addresses...');
log(0, 'Trying to fetch your IPv4 and IPv6 address from api.sefinek.net...');
await refreshServerIPs();
log(0, `Fetched ${getServerIPs()?.length} of your IP addresses. If any of them accidentally appear in the UFW logs, they will be ignored.`);
if (!fs.existsSync(UFW_LOG_FILE)) {
log(2, `Log file ${UFW_LOG_FILE} does not exist`);
@ -156,8 +157,6 @@ const processLogLine = async (line, test = false) => {
}
log(0, `Ready! Now monitoring: ${UFW_LOG_FILE}`);
log(0, '=====================================================================');
process.send && process.send('ready');
})();

@ -1 +1 @@
Subproject commit 150fb53fbdd0ff6429c298f7d697488854328a5f
Subproject commit 4582f3ce9de4f852ba17bdbe516e319ec6d75686