Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
eterban
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
etersoft
eterban
Commits
1eecd565
Commit
1eecd565
authored
Jul 24, 2026
by
Vitaly Lipatov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gateway: clear bans through durable unban queue
parent
ab82341f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
2 deletions
+26
-2
eterban.sh
gateway/usr/bin/eterban.sh
+1
-2
autoban_cli.py
gateway/usr/share/eterban/autoban_cli.py
+25
-0
No files found.
gateway/usr/bin/eterban.sh
View file @
1eecd565
...
...
@@ -84,8 +84,7 @@ if [ "$command" = "clear" ] ; then
echo
"Usage: eterban clear --force"
>
&2
exit
2
fi
ipset flush
$setname
ipset flush
$setname_ipv6
/usr/share/eterban/autoban_cli.py clear
exit
fi
...
...
gateway/usr/share/eterban/autoban_cli.py
View file @
1eecd565
...
...
@@ -21,6 +21,7 @@ CONFIG_PATH = '/etc/eterban/settings.ini'
META_PREFIX
=
'eterban:meta:'
SCHEDULE_KEY
=
'eterban:unban_schedule'
PERMANENT_KEY
=
'eterban:permanent'
ACTIVE_BANS_KEY
=
'eterban:active_bans'
def
format_duration
(
seconds
):
...
...
@@ -173,6 +174,26 @@ def cmd_permanent():
print
(
f
" {ip}"
)
def
cmd_clear
():
"""Queue durable unban commands for every authoritative active ban."""
r
=
get_redis
()
pipeline
=
r
.
pipeline
(
transaction
=
False
)
queued
=
0
for
member
in
r
.
sscan_iter
(
ACTIVE_BANS_KEY
):
ip
=
member
.
decode
()
if
isinstance
(
member
,
bytes
)
else
member
pipeline
.
xadd
(
'eterban:commands'
,
{
'command'
:
'unban'
,
'ip'
:
ip
,
'by'
:
'all bans cleared by administrator'
,
})
queued
+=
1
if
queued
%
1000
==
0
:
pipeline
.
execute
()
if
queued
%
1000
:
pipeline
.
execute
()
print
(
f
"Queued {queued} unban commands"
)
def
usage
():
print
(
"""Usage: autoban_cli.py <command> [args]
...
...
@@ -181,6 +202,7 @@ Commands:
reset <ip> - reset offense counter for IP
pending - list pending auto-unbans
permanent - list permanent bans
clear - queue unban for every active ban
"""
)
sys
.
exit
(
1
)
...
...
@@ -209,6 +231,9 @@ def main():
elif
cmd
==
'permanent'
:
cmd_permanent
()
elif
cmd
==
'clear'
:
cmd_clear
()
else
:
print
(
f
"Unknown command: {cmd}"
)
usage
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment