From 81c4d6315414aa4dc0670d61d65d01c6b73c7364 Mon Sep 17 00:00:00 2001 From: Matteo Di Lorenzi Date: Thu, 2 Apr 2026 14:23:30 +0200 Subject: [PATCH 1/4] chore(threat-shield): update UI for banIP version update --- .../dashboard/ThreatShieldIpCard.vue | 12 ++--- .../security/threat_shield/SettingsTab.vue | 49 ++++++------------- src/composables/useThreatShieldSettings.ts | 5 +- src/i18n/en.json | 1 - src/i18n/it.json | 1 - src/i18n/ta.json | 1 - 6 files changed, 24 insertions(+), 45 deletions(-) diff --git a/src/components/standalone/dashboard/ThreatShieldIpCard.vue b/src/components/standalone/dashboard/ThreatShieldIpCard.vue index 52bbcb05c..6249b8cef 100644 --- a/src/components/standalone/dashboard/ThreatShieldIpCard.vue +++ b/src/components/standalone/dashboard/ThreatShieldIpCard.vue @@ -45,13 +45,13 @@ const { const badge = computed(() => getStatusBadge(overview.value?.services.banip)) const serviceCounter = computed(() => overview.value?.counters.threat_shield_ip) -const isLoggingDisabled = computed( - () => - !tsSettings.value?.ban_logforwardlan && - !tsSettings.value?.ban_logforwardwan && - !tsSettings.value?.ban_loginput && +const isLoggingDisabled = computed(() => { + return ( + !tsSettings.value?.ban_logoutbound && + !tsSettings.value?.ban_loginbound && !tsSettings.value?.ban_logprerouting -) + ) +}) const isPending = computed(() => isOverviewPending.value || isSettingsPending.value) const isError = computed(() => isOverviewError.value || isSettingsError.value) diff --git a/src/components/standalone/security/threat_shield/SettingsTab.vue b/src/components/standalone/security/threat_shield/SettingsTab.vue index a7bcc1a29..6b3b20cf8 100644 --- a/src/components/standalone/security/threat_shield/SettingsTab.vue +++ b/src/components/standalone/security/threat_shield/SettingsTab.vue @@ -26,6 +26,8 @@ import { onMounted } from 'vue' import { useUciPendingChangesStore } from '@/stores/standalone/uciPendingChanges' import NeMultiTextInput from '../../NeMultiTextInput.vue' import { MessageBag } from '@/lib/validation' +import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome' +import { faFloppyDisk } from '@fortawesome/free-solid-svg-icons' const { t } = useI18n() const uciChangesStore = useUciPendingChangesStore() @@ -33,9 +35,8 @@ const queryClient = useQueryClient() const isThreatShieldEnabled = ref(false) const isLogPreroutingEnabled = ref(false) -const isLogInputEnabled = ref(false) -const isLogForwardEnabled = ref(false) -const isLogForwardLanEnabled = ref(false) +const isLoginBoundEnabled = ref(false) +const isLogoutBoundEnabled = ref(false) const isBlockBruteForceEnabled = ref(false) const banTime = ref('') const maxFailedAccesses = ref('') @@ -78,9 +79,8 @@ type ListSettingsResponse = { data: { ban_icmplimit: number ban_logcount: string - ban_logforwardlan: boolean - ban_logforwardwan: boolean - ban_loginput: boolean + ban_logoutbound: boolean + ban_loginbound: boolean ban_loglimit: boolean ban_logprerouting: boolean ban_logterm: string[] @@ -104,9 +104,8 @@ async function fetchSettings() { const threatShieldConfig = res.data.data isThreatShieldEnabled.value = threatShieldConfig.enabled isLogPreroutingEnabled.value = threatShieldConfig.ban_logprerouting - isLogInputEnabled.value = threatShieldConfig.ban_loginput - isLogForwardEnabled.value = threatShieldConfig.ban_logforwardwan - isLogForwardLanEnabled.value = threatShieldConfig.ban_logforwardlan + isLoginBoundEnabled.value = threatShieldConfig.ban_loginbound + isLogoutBoundEnabled.value = threatShieldConfig.ban_logoutbound isBlockBruteForceEnabled.value = threatShieldConfig.ban_loglimit banTime.value = threatShieldConfig.ban_nftexpiry maxFailedAccesses.value = threatShieldConfig.ban_logcount.toString() @@ -221,9 +220,8 @@ async function saveSettings() { await ubusCall('ns.threatshield', 'edit-settings', { enabled: isThreatShieldEnabled.value, ban_logprerouting: isLogPreroutingEnabled.value, - ban_loginput: isLogInputEnabled.value, - ban_logforwardwan: isLogForwardEnabled.value, - ban_logforwardlan: isLogForwardLanEnabled.value, + ban_loginbound: isLoginBoundEnabled.value, + ban_logoutbound: isLogoutBoundEnabled.value, ban_loglimit: isBlockBruteForceEnabled.value, ban_nftexpiry: banTime.value, ban_logcount: Number(maxFailedAccesses.value), @@ -288,12 +286,7 @@ onMounted(() => {
{ :disabled="loading.editSettings" /> -
@@ -496,11 +483,7 @@ onMounted(() => { @click="saveSettings()" > {{ t('common.save') }} diff --git a/src/composables/useThreatShieldSettings.ts b/src/composables/useThreatShieldSettings.ts index 53b0700ff..7019883f9 100644 --- a/src/composables/useThreatShieldSettings.ts +++ b/src/composables/useThreatShieldSettings.ts @@ -8,10 +8,9 @@ import { useQuery } from '@tanstack/vue-query' // list-settings payload, so all are optional here. export type ThreatShieldSettings = { enabled?: boolean - ban_logforwardlan?: boolean - ban_logforwardwan?: boolean - ban_loginput?: boolean ban_logprerouting?: boolean + ban_loginbound: boolean + ban_logoutbound: boolean } // api-server wraps the ubus result under `data`, and ns.threatshield wraps its diff --git a/src/i18n/en.json b/src/i18n/en.json index 5c74de9c4..4d1385460 100644 --- a/src/i18n/en.json +++ b/src/i18n/en.json @@ -1769,7 +1769,6 @@ "logging": "Logging", "logging_description": "Threats monitoring will take account and show only threats that have been logged.", "log_prerouting_chain": "Log packets blocked in pre-routing chain", - "log_input_chain": "Log packets blocked in input chain", "log_forward_chain": "Log packets blocked in forward chain", "log_forward_lan_chain": "Log packets blocked forwarded from LAN", "block_brute_force": "Block brute force attacks", diff --git a/src/i18n/it.json b/src/i18n/it.json index 8dfc30850..f1ad5f141 100644 --- a/src/i18n/it.json +++ b/src/i18n/it.json @@ -2111,7 +2111,6 @@ "local_blocklist_description": "Inserisci un indirizzo IPv4/IPv6 valido con notazione CIDR opzionale, un indirizzo MAC o un nome host che deve essere sempre bloccato da Threat Shield IP.", "logging_description": "Il monitoraggio delle minacce terrà conto e mostrerà solo le minacce che sono state salvate nel log.", "log_prerouting_chain": "Log dei pacchetti bloccati nella chain di pre-routing", - "log_input_chain": "Log dei pacchetti bloccati nella chain di input", "log_forward_chain": "Log dei pacchetti bloccati nella chain di forward", "log_forward_lan_chain": "Log dei pacchetti bloccati inoltrati dalla LAN", "ban_after_n_attempts_tooltip": "Il numero di volte che un IP deve apparire nel log prima di essere contrassegnato come sospetto e bloccato.", diff --git a/src/i18n/ta.json b/src/i18n/ta.json index 80ead1a95..01a7e91cd 100644 --- a/src/i18n/ta.json +++ b/src/i18n/ta.json @@ -1724,7 +1724,6 @@ "logging": "பதிவு செய்தல்", "logging_description": "அச்சுறுத்தல்கள் கண்காணிப்பு கணக்கில் எடுத்துக்கொள்ளப்படும் மற்றும் பதிவு செய்யப்பட்ட அச்சுறுத்தல்களை மட்டுமே காண்பிக்கும்.", "log_prerouting_chain": "ப்ரீ-ரூட்டிங் செயினில் பதிவு பாக்கெட்டுகள் தடுக்கப்பட்டுள்ளன", - "log_input_chain": "உள்ளீட்டுச் சங்கிலியில் பதிவுப் பொட்டலங்கள் தடுக்கப்பட்டுள்ளன", "log_forward_chain": "முன்னோக்கிச் சங்கிலியில் பதிவுப் பொட்டலங்கள் தடுக்கப்பட்டுள்ளன", "log_forward_lan_chain": "LAN இலிருந்து அனுப்பப்பட்ட பதிவு பாக்கெட்டுகள் தடுக்கப்பட்டன", "block_brute_force": "மிருகத்தனமான தாக்குதல்களைத் தடுக்கவும்", From 31c9b39d2ac5d9a67c38b32985cd042077eeb707 Mon Sep 17 00:00:00 2001 From: Matteo Di Lorenzi Date: Thu, 9 Jul 2026 10:40:02 +0200 Subject: [PATCH 2/4] fix(threat-shield): rename log variables and update translations for input chain --- .../security/threat_shield/SettingsTab.vue | 24 +++++++++---------- src/i18n/en.json | 2 +- src/i18n/it.json | 2 +- src/i18n/ta.json | 2 +- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/components/standalone/security/threat_shield/SettingsTab.vue b/src/components/standalone/security/threat_shield/SettingsTab.vue index 6b3b20cf8..4d7e4e0dc 100644 --- a/src/components/standalone/security/threat_shield/SettingsTab.vue +++ b/src/components/standalone/security/threat_shield/SettingsTab.vue @@ -35,8 +35,8 @@ const queryClient = useQueryClient() const isThreatShieldEnabled = ref(false) const isLogPreroutingEnabled = ref(false) -const isLoginBoundEnabled = ref(false) -const isLogoutBoundEnabled = ref(false) +const isLogInboundEnabled = ref(false) +const isLogOutboundEnabled = ref(false) const isBlockBruteForceEnabled = ref(false) const banTime = ref('') const maxFailedAccesses = ref('') @@ -104,8 +104,8 @@ async function fetchSettings() { const threatShieldConfig = res.data.data isThreatShieldEnabled.value = threatShieldConfig.enabled isLogPreroutingEnabled.value = threatShieldConfig.ban_logprerouting - isLoginBoundEnabled.value = threatShieldConfig.ban_loginbound - isLogoutBoundEnabled.value = threatShieldConfig.ban_logoutbound + isLogInboundEnabled.value = threatShieldConfig.ban_loginbound + isLogOutboundEnabled.value = threatShieldConfig.ban_logoutbound isBlockBruteForceEnabled.value = threatShieldConfig.ban_loglimit banTime.value = threatShieldConfig.ban_nftexpiry maxFailedAccesses.value = threatShieldConfig.ban_logcount.toString() @@ -220,8 +220,8 @@ async function saveSettings() { await ubusCall('ns.threatshield', 'edit-settings', { enabled: isThreatShieldEnabled.value, ban_logprerouting: isLogPreroutingEnabled.value, - ban_loginbound: isLoginBoundEnabled.value, - ban_logoutbound: isLogoutBoundEnabled.value, + ban_loginbound: isLogInboundEnabled.value, + ban_logoutbound: isLogOutboundEnabled.value, ban_loglimit: isBlockBruteForceEnabled.value, ban_nftexpiry: banTime.value, ban_logcount: Number(maxFailedAccesses.value), @@ -286,7 +286,7 @@ onMounted(() => {
{ :disabled="loading.editSettings" />
diff --git a/src/i18n/en.json b/src/i18n/en.json index 4d1385460..69904e9c6 100644 --- a/src/i18n/en.json +++ b/src/i18n/en.json @@ -1769,7 +1769,7 @@ "logging": "Logging", "logging_description": "Threats monitoring will take account and show only threats that have been logged.", "log_prerouting_chain": "Log packets blocked in pre-routing chain", - "log_forward_chain": "Log packets blocked in forward chain", + "log_input_chain": "Log packets blocked in input chain", "log_forward_lan_chain": "Log packets blocked forwarded from LAN", "block_brute_force": "Block brute force attacks", "block_brute_force_description": "Brute force attack protection safeguards against repeated unauthorized login attempts by blocking or limiting access after multiple failed attempts.", diff --git a/src/i18n/it.json b/src/i18n/it.json index f1ad5f141..121655868 100644 --- a/src/i18n/it.json +++ b/src/i18n/it.json @@ -2111,7 +2111,7 @@ "local_blocklist_description": "Inserisci un indirizzo IPv4/IPv6 valido con notazione CIDR opzionale, un indirizzo MAC o un nome host che deve essere sempre bloccato da Threat Shield IP.", "logging_description": "Il monitoraggio delle minacce terrà conto e mostrerà solo le minacce che sono state salvate nel log.", "log_prerouting_chain": "Log dei pacchetti bloccati nella chain di pre-routing", - "log_forward_chain": "Log dei pacchetti bloccati nella chain di forward", + "log_input_chain": "Log dei pacchetti bloccati nella chain di input", "log_forward_lan_chain": "Log dei pacchetti bloccati inoltrati dalla LAN", "ban_after_n_attempts_tooltip": "Il numero di volte che un IP deve apparire nel log prima di essere contrassegnato come sospetto e bloccato.", "block_dos_description": "Limita il traffico eccessivo relativo a protocolli specifici, bloccandolo fino a quando la situazione non torna alla normalità. Agisce su tutto il traffico in ingresso dalle interfacce WAN.", diff --git a/src/i18n/ta.json b/src/i18n/ta.json index 01a7e91cd..bbb0e8a73 100644 --- a/src/i18n/ta.json +++ b/src/i18n/ta.json @@ -1724,7 +1724,7 @@ "logging": "பதிவு செய்தல்", "logging_description": "அச்சுறுத்தல்கள் கண்காணிப்பு கணக்கில் எடுத்துக்கொள்ளப்படும் மற்றும் பதிவு செய்யப்பட்ட அச்சுறுத்தல்களை மட்டுமே காண்பிக்கும்.", "log_prerouting_chain": "ப்ரீ-ரூட்டிங் செயினில் பதிவு பாக்கெட்டுகள் தடுக்கப்பட்டுள்ளன", - "log_forward_chain": "முன்னோக்கிச் சங்கிலியில் பதிவுப் பொட்டலங்கள் தடுக்கப்பட்டுள்ளன", + "log_input_chain": "உள்ளீட்டுச் சங்கிலியில் பதிவுப் பொட்டலங்கள் தடுக்கப்பட்டுள்ளன", "log_forward_lan_chain": "LAN இலிருந்து அனுப்பப்பட்ட பதிவு பாக்கெட்டுகள் தடுக்கப்பட்டன", "block_brute_force": "மிருகத்தனமான தாக்குதல்களைத் தடுக்கவும்", "block_brute_force_description": "ப்ரூட் ஃபோர்ச் தாக்குதல் பாதுகாப்பு பல முறை தோல்வியுற்ற முயற்சிகளுக்குப் பிறகு அணுகலைத் தடுப்பதன் மூலம் அல்லது கட்டுப்படுத்துவதன் மூலம் மறுநிகழ்வு அங்கீகரிக்கப்படாத உள்நுழைவு முயற்சிகளுக்கு எதிராகப் பாதுகாக்கிறது.", From 6d0a2ad2be247b544cae4f22a8d2d0eee5ca5d81 Mon Sep 17 00:00:00 2001 From: Matteo Di Lorenzi Date: Wed, 22 Jul 2026 12:07:58 +0200 Subject: [PATCH 3/4] feat(threat-shield): integrate victoriametrics queries for service counter --- .../dashboard/ThreatShieldIpCard.vue | 198 ++++++++++++++---- src/lib/standalone/victoriaMetrics.ts | 62 ++++++ 2 files changed, 214 insertions(+), 46 deletions(-) create mode 100644 src/lib/standalone/victoriaMetrics.ts diff --git a/src/components/standalone/dashboard/ThreatShieldIpCard.vue b/src/components/standalone/dashboard/ThreatShieldIpCard.vue index 6249b8cef..65aa24554 100644 --- a/src/components/standalone/dashboard/ThreatShieldIpCard.vue +++ b/src/components/standalone/dashboard/ThreatShieldIpCard.vue @@ -4,61 +4,164 @@ -->