mirror of
https://github.com/swissmakers/fail2ban-ui.git
synced 2026-04-11 13:47:05 +02:00
Add missing banaction_allports setting to update settings function
This commit is contained in:
@@ -793,22 +793,23 @@ settings = {
|
||||
'banaction_allports': banaction_allports_val
|
||||
}
|
||||
|
||||
# Check if file already has our banner
|
||||
has_banner = False
|
||||
# Check if file already has our full banner (indicating it's already properly structured)
|
||||
has_full_banner = False
|
||||
has_action_mwlg = False
|
||||
has_action_override = False
|
||||
|
||||
try:
|
||||
with open(jail_file, 'r') as f:
|
||||
content = f.read()
|
||||
has_banner = 'Fail2Ban-UI' in content or 'fail2ban-ui' in content
|
||||
# Check for the complete banner pattern with hash line separators
|
||||
has_full_banner = '################################################################################' in content and 'Fail2Ban-UI Managed Configuration' in content and 'DO NOT EDIT THIS FILE MANUALLY' in content
|
||||
has_action_mwlg = 'action_mwlg' in content and 'ui-custom-action' in content
|
||||
has_action_override = 'action = %%(action_mwlg)s' in content
|
||||
except FileNotFoundError:
|
||||
pass
|
||||
|
||||
# If already properly structured, just update DEFAULT section
|
||||
if has_banner and has_action_mwlg and has_action_override:
|
||||
if has_full_banner and has_action_mwlg and has_action_override:
|
||||
try:
|
||||
with open(jail_file, 'r') as f:
|
||||
lines = f.readlines()
|
||||
@@ -862,6 +863,8 @@ if has_banner and has_action_mwlg and has_action_override:
|
||||
('findtime', 'findtime = ' + settings['findtime']),
|
||||
('maxretry', 'maxretry = ' + str(settings['maxretry'])),
|
||||
('destemail', 'destemail = ' + settings['destemail']),
|
||||
('banaction', 'banaction = ' + settings['banaction']),
|
||||
('banaction_allports', 'banaction_allports = ' + settings['banaction_allports']),
|
||||
]:
|
||||
if key not in keys_updated:
|
||||
for i, output_line in enumerate(output_lines):
|
||||
|
||||
Reference in New Issue
Block a user