mirror of
https://github.com/swissmakers/fail2ban-ui.git
synced 2026-04-17 05:53:15 +02:00
Implement geoIP and whois lookups directly from fail2ban-UI
This commit is contained in:
@@ -180,9 +180,9 @@ mark {
|
||||
transition: background-color 0.2s ease;
|
||||
}
|
||||
|
||||
#backendStatus:hover {
|
||||
/*#backendStatus:hover {
|
||||
background-color: rgba(255, 255, 255, 0.15);
|
||||
}
|
||||
}*/
|
||||
|
||||
#statusDot {
|
||||
width: 0.5rem;
|
||||
|
||||
@@ -63,7 +63,7 @@ function showBanEventToast(event) {
|
||||
+ ' <div class="font-semibold text-sm">New Block Detected</div>'
|
||||
+ ' <div class="text-sm mt-1">'
|
||||
+ ' <span class="font-mono font-semibold">' + escapeHtml(ip) + '</span>'
|
||||
+ ' <span class="text-gray-500"> banned in </span>'
|
||||
+ ' <span> banned in </span>'
|
||||
+ ' <span class="font-semibold">' + escapeHtml(jail) + '</span>'
|
||||
+ ' </div>'
|
||||
+ ' <div class="text-xs text-gray-400 mt-1">'
|
||||
|
||||
@@ -1,6 +1,18 @@
|
||||
// Settings page functions for Fail2ban UI
|
||||
"use strict";
|
||||
|
||||
// Handle GeoIP provider change
|
||||
function onGeoIPProviderChange(provider) {
|
||||
const dbPathContainer = document.getElementById('geoipDatabasePathContainer');
|
||||
if (dbPathContainer) {
|
||||
if (provider === 'maxmind') {
|
||||
dbPathContainer.style.display = 'block';
|
||||
} else {
|
||||
dbPathContainer.style.display = 'none';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function loadSettings() {
|
||||
showLoading(true);
|
||||
fetch('/api/settings')
|
||||
@@ -83,6 +95,13 @@ function loadSettings() {
|
||||
|
||||
document.getElementById('bantimeIncrement').checked = data.bantimeIncrement || false;
|
||||
document.getElementById('defaultJailEnable').checked = data.defaultJailEnable || false;
|
||||
|
||||
// GeoIP settings
|
||||
const geoipProvider = data.geoipProvider || 'builtin';
|
||||
document.getElementById('geoipProvider').value = geoipProvider;
|
||||
onGeoIPProviderChange(geoipProvider);
|
||||
document.getElementById('geoipDatabasePath').value = data.geoipDatabasePath || '/usr/share/GeoIP/GeoLite2-Country.mmdb';
|
||||
document.getElementById('maxLogLines').value = data.maxLogLines || 50;
|
||||
document.getElementById('banTime').value = data.bantime || '';
|
||||
document.getElementById('findTime').value = data.findtime || '';
|
||||
document.getElementById('maxRetry').value = data.maxretry || '';
|
||||
@@ -149,6 +168,9 @@ function saveSettings(event) {
|
||||
ignoreips: getIgnoreIPsArray(),
|
||||
banaction: document.getElementById('banaction').value,
|
||||
banactionAllports: document.getElementById('banactionAllports').value,
|
||||
geoipProvider: document.getElementById('geoipProvider').value || 'builtin',
|
||||
geoipDatabasePath: document.getElementById('geoipDatabasePath').value || '/usr/share/GeoIP/GeoLite2-Country.mmdb',
|
||||
maxLogLines: parseInt(document.getElementById('maxLogLines').value, 10) || 50,
|
||||
smtp: smtpSettings,
|
||||
advancedActions: collectAdvancedActionsSettings()
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user