Skip to content
Snippets Groups Projects
Commit 747cbd4a authored by Baptiste DE RENZO's avatar Baptiste DE RENZO
Browse files

Check sshd jail is active, refs #34036

parent 062fe3af
No related branches found
No related tags found
No related merge requests found
......@@ -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)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment