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
c16c1fc6
Commit
c16c1fc6
authored
Jul 26, 2026
by
Vitaly Lipatov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
internal: handle broken config in unban requests
parent
329de0ed
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
5 deletions
+5
-5
int2.py
ban-internal-server/data/www/int2.py
+3
-5
static-checks.sh
tests/static-checks.sh
+2
-0
No files found.
ban-internal-server/data/www/int2.py
View file @
c16c1fc6
...
...
@@ -67,12 +67,10 @@ class OriginalDstHandler(BaseHTTPRequestHandler):
# Обработка запроса на разблокировку
if
self
.
path
.
startswith
(
"/unban"
):
# Читаем настройки из файла
settings_file
=
'/etc/eterban/settings.ini'
settings
=
read_settings
(
settings_file
)
# Подключаемся к Redis
try
:
# Read configuration and enqueue the command as one failure
# domain, so a broken config is reported as a controlled 503.
settings
=
read_settings
(
'/etc/eterban/settings.ini'
)
r
=
redis
.
Redis
(
**
redis_connection_options
(
settings
))
r
.
xadd
(
'eterban:commands'
,
{
'command'
:
'unban'
,
'ip'
:
ip
,
...
...
tests/static-checks.sh
View file @
c16c1fc6
...
...
@@ -54,3 +54,5 @@ if [ "$status" -ne 78 ]; then
fi
python3
-c
'import importlib.util; p = "gateway/usr/share/eterban/eterban_api.py"; s = importlib.util.spec_from_file_location("eterban_api", p); m = importlib.util.module_from_spec(s); s.loader.exec_module(m); m.ipset_test = lambda setname, ip: None; assert m.check_ip("192.0.2.1") == {"error": "ipset query failed"}'
python3
-c
'import importlib.util; p = "ban-internal-server/data/www/int2.py"; s = importlib.util.spec_from_file_location("eterban_internal", p); m = importlib.util.module_from_spec(s); s.loader.exec_module(m); m.get_original_dst = lambda request: ("192.0.2.1", 80); m.read_settings = lambda path: (_ for _ in ()).throw(KeyError("Settings")); f = type("F", (), {"path": "/unban", "request": object(), "client_address": ("198.51.100.1", 1), "send_error": lambda self, status, message: setattr(self, "response", (status, message))})(); m.OriginalDstHandler.do_GET(f); assert f.response[0] == 503'
>
/dev/null 2>&1
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