initial import
This commit is contained in:
parent
3ed58b0021
commit
4b70c0023c
48 changed files with 1540 additions and 0 deletions
26
bin/jailstat.sh
Executable file
26
bin/jailstat.sh
Executable file
|
|
@ -0,0 +1,26 @@
|
|||
#!/usr/bin/env bash
|
||||
#
|
||||
# Get list of fail2ban jails and print status of each
|
||||
#
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
# fail2ban-client requires root
|
||||
if [[ $(id -u) -ne 0 ]]; then
|
||||
echo "Must run as root user"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
## there's a tab after "list:"
|
||||
## fail2ban-client status ->
|
||||
# Status
|
||||
# |- Number of jail: 3
|
||||
# `- Jail list: nginx-4xx, nginx-limit-req, sshd
|
||||
|
||||
JAILS=$(fail2ban-client status | \
|
||||
awk -F: '/list/{gsub(/, /," ",$2);gsub(/^[ \t]+/,"",$2);print $2}'
|
||||
)
|
||||
|
||||
for jail in ${JAILS}; do
|
||||
fail2ban-client status "${jail}"
|
||||
done
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue