Fix: harmonize Firewall and Fail2ban status, decouple strict mode and fix installer jail generation
This commit is contained in:
1 parent
8bbeb9caae
commit
8b57981b1b
6 files changed
+69
-121
No files matched your search
@@ -417,7 +417,7 @@ function renderDashboardMetrics() {
|
||||
const fwStatus = document.getElementById('dash-fw-status');
|
||||
const fwDetail = document.getElementById('dash-fw-detail');
|
||||
|
||||
const isFwActive = Boolean(sec.firewall_enabled || sec.strict_port80) && Boolean(sec.fail2ban_running);
|
||||
const isFwActive = Boolean(sec.firewall_enabled);
|
||||
if (isFwActive) {
|
||||
if (fwDot) fwDot.className = 'w-2 h-2 rounded-full bg-emerald-400 shadow-sm shadow-emerald-500/50';
|
||||
if (fwStatus) {
|
||||
@@ -431,7 +431,7 @@ function renderDashboardMetrics() {
|
||||
fwStatus.textContent = 'Inactif';
|
||||
fwStatus.className = 'text-sm font-extrabold text-slate-400 mt-1';
|
||||
}
|
||||
if (fwDetail) fwDetail.textContent = !sec.fail2ban_running ? 'Moteur Fail2ban arrêté' : 'Tout le trafic autorisé';
|
||||
if (fwDetail) fwDetail.textContent = 'Tout le trafic autorisé';
|
||||
}
|
||||
|
||||
const f2bDot = document.getElementById('dash-f2b-dot');
|
||||
@@ -445,7 +445,7 @@ function renderDashboardMetrics() {
|
||||
f2bStatus.className = 'text-sm font-extrabold text-emerald-400 mt-1';
|
||||
}
|
||||
const activeJailCount = Object.keys(sec.jails || {}).length;
|
||||
if (f2bDetail) f2bDetail.textContent = `${activeJailCount} prison(s) active(s)`;
|
||||
if (f2bDetail) f2bDetail.textContent = activeJailCount > 0 ? `${activeJailCount} prison(s) active(s)` : 'Surveillance active';
|
||||
} else {
|
||||
if (f2bDot) f2bDot.className = 'w-2 h-2 rounded-full bg-rose-500';
|
||||
if (f2bStatus) {
|
||||
@@ -3797,7 +3797,7 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
if (btn) btn.disabled = true;
|
||||
|
||||
const payload = {
|
||||
firewall_enabled: f.elements['firewall_enabled']?.checked ? 1 : (f.elements['certbot_strict_port80']?.checked ? 1 : 0),
|
||||
firewall_enabled: f.elements['firewall_enabled']?.checked ? 1 : 0,
|
||||
admin_https_port: Number(f.elements['admin_https_port']?.value || 8443),
|
||||
certbot_strict_port80: f.elements['certbot_strict_port80']?.checked ? 1 : 0,
|
||||
fail2ban_sip_maxretry: Number(f.elements['fail2ban_sip_maxretry']?.value || 3),
|
||||
@@ -4776,7 +4776,7 @@ function renderFirewall() {
|
||||
form.elements['certbot_strict_port80'].checked = Number(s.certbot_strict_port80) === 1;
|
||||
}
|
||||
if (form.elements['firewall_enabled']) {
|
||||
form.elements['firewall_enabled'].checked = (Number(s.firewall_enabled) === 1 || Number(s.certbot_strict_port80) === 1);
|
||||
form.elements['firewall_enabled'].checked = Number(s.firewall_enabled) === 1;
|
||||
}
|
||||
if (form.elements['fail2ban_sip_maxretry']) {
|
||||
form.elements['fail2ban_sip_maxretry'].value = s.fail2ban_sip_maxretry || 3;
|
||||
|
||||
Reference in new issue
Block a user