Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add docker commands to check if Fail2ban or CrowdSec containers are running #24

Merged
merged 3 commits into from
Feb 23, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions vps-audit.sh
Original file line number Diff line number Diff line change
@@ -213,11 +213,23 @@ if dpkg -l | grep -q "fail2ban"; then
systemctl is-active fail2ban >/dev/null 2>&1 && IPS_ACTIVE=1
fi

# Check docker container running fail2ban
if docker ps -a | awk '{print $2}' | grep "fail2ban"; then
IPS_INSTALLED=1
docker ps | grep -q "fail2ban" && IPS_ACTIVE=1
fi

if dpkg -l | grep -q "crowdsec"; then
IPS_INSTALLED=1
systemctl is-active crowdsec >/dev/null 2>&1 && IPS_ACTIVE=1
fi

# Check docker container running crowdsec
if docker ps -a | awk '{print $2}' | grep "crowdsec"; then
IPS_INSTALLED=1
docker ps | grep -q "crowdsec" && IPS_ACTIVE=1
fi

case "$IPS_INSTALLED$IPS_ACTIVE" in
"11") check_security "Intrusion Prevention" "PASS" "Fail2ban or CrowdSec is installed and running" ;;
"10") check_security "Intrusion Prevention" "WARN" "Fail2ban or CrowdSec is installed but not running" ;;