Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
envsetup
Manage
Activity
Members
Plan
Redmine
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mediaserver
envsetup
Commits
747cbd4a
Commit
747cbd4a
authored
3 years ago
by
Baptiste DE RENZO
Browse files
Options
Downloads
Patches
Plain Diff
Check sshd jail is active, refs
#34036
parent
062fe3af
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/scripts/test_fail2ban.py
+7
-7
7 additions, 7 deletions
tests/scripts/test_fail2ban.py
with
7 additions
and
7 deletions
tests/scripts/test_fail2ban.py
+
7
−
7
View file @
747cbd4a
...
...
@@ -83,7 +83,7 @@ def check_service_running(name: str) -> bool:
return
True
def
get_jails
()
->
list
:
def
get_
active_
jails
()
->
list
:
"""
Get the list of active jails.
:return: List of jails
...
...
@@ -150,14 +150,14 @@ def main():
lg
.
success
(
"
fail2ban is running
"
)
lg
.
log
(
"
Checking fail2ban jails:
"
)
jails
=
get_jails
()
jails
=
get_
active_
jails
()
for
jail
in
jails
:
lg
.
info
(
"
{} jail is running
"
.
format
(
jail
))
banned
=
check_jail_banned
(
jail
)
if
banned
>
0
:
lg
.
info
(
"
there is {} banned host in {} jail
"
.
format
(
banned
,
jail
))
else
:
lg
.
info
(
"
no banned host in {} jail
"
.
format
(
jail
))
lg
.
info
(
"
{} jail is running ({} banned host)
"
.
format
(
jail
,
banned
))
if
"
sshd
"
not
in
jails
:
lg
.
error
(
"
sshd jail is not running
"
)
exit
(
3
)
if
errors
:
exit
(
1
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment