mirror of
https://github.com/MacRimi/ProxMenux.git
synced 2026-04-25 08:56:21 +00:00
Update menus
This commit is contained in:
@@ -403,13 +403,30 @@ class JournalWatcher:
|
||||
|
||||
def _check_fail2ban(self, msg: str, syslog_id: str):
|
||||
"""Detect Fail2Ban IP bans."""
|
||||
if 'fail2ban' not in msg.lower() and syslog_id != 'fail2ban-server':
|
||||
return
|
||||
# Only process actual fail2ban action messages, not systemd service events
|
||||
if syslog_id not in ('fail2ban-server', 'fail2ban.actions', 'fail2ban'):
|
||||
if 'fail2ban' not in msg.lower():
|
||||
return
|
||||
# Skip systemd service lifecycle messages (start/stop/restart/reload)
|
||||
msg_lower = msg.lower()
|
||||
if any(x in msg_lower for x in ['service', 'started', 'stopped', 'starting',
|
||||
'stopping', 'reloading', 'reloaded', 'unit',
|
||||
'deactivated', 'activated']):
|
||||
return
|
||||
|
||||
# Ban detected
|
||||
ban_match = re.search(r'Ban\s+(\S+)', msg)
|
||||
# Ban detected - match only valid IPv4 or IPv6 addresses
|
||||
# IPv4: 192.168.1.100, IPv6: 2001:db8::1 or ::ffff:192.168.1.1
|
||||
ban_match = re.search(r'Ban\s+((?:\d{1,3}\.){3}\d{1,3}|[0-9a-fA-F:]{2,})', msg)
|
||||
if ban_match:
|
||||
ip = ban_match.group(1)
|
||||
# Validate it's a real IP address format
|
||||
# IPv4: must have 4 octets separated by dots
|
||||
# IPv6: must contain at least one colon
|
||||
is_ipv4 = re.match(r'^(\d{1,3}\.){3}\d{1,3}$', ip)
|
||||
is_ipv6 = ':' in ip and re.match(r'^[0-9a-fA-F:]+$', ip)
|
||||
if not is_ipv4 and not is_ipv6:
|
||||
return # Not a valid IP (e.g., "Service.", "Ban", etc.)
|
||||
|
||||
jail_match = re.search(r'\[(\w+)\]', msg)
|
||||
jail = jail_match.group(1) if jail_match else 'unknown'
|
||||
|
||||
|
||||
@@ -1384,7 +1384,7 @@ AI_DETAIL_TOKENS = {
|
||||
|
||||
# System prompt template - optimized hybrid version
|
||||
AI_SYSTEM_PROMPT = """You are a notification FORMATTER for ProxMenux Monitor (Proxmox VE).
|
||||
Your job: translate and reformat alerts into {language}. You are NOT an analyst <EFBFBD><EFBFBD><EFBFBD> do not interpret or diagnose.
|
||||
Your job: translate and reformat alerts into {language}. You are NOT an analyst — do not interpret or diagnose.
|
||||
|
||||
═══ WHAT TO TRANSLATE ═══
|
||||
Translate: labels, descriptions, status words, units (GB→Go in French, etc.)
|
||||
|
||||
@@ -21,7 +21,7 @@ import time
|
||||
import threading
|
||||
from typing import Set, List, Tuple, Optional
|
||||
|
||||
# ─── Configuration ──────────────────────────────────<EFBFBD><EFBFBD>────────────────────────
|
||||
# ─── Configuration ───────────────────────────────────────────────────────────
|
||||
|
||||
# Grace period durations (seconds)
|
||||
STARTUP_VM_GRACE_SECONDS = 180 # 3 minutes for VM/CT start aggregation
|
||||
|
||||
Reference in New Issue
Block a user