script-user-unban 462 B

123456789101112131415161718192021222324
  1. #!/usr/bin/env bash
  2. # Unbans a fail2ban IP
  3. # Copyright 2021 Bryan C. Roessler
  4. parent="${BASH_SOURCE[0]}"
  5. parent=${parent%/*}
  6. [[ -f $parent/script-functions ]] && . "$parent"/script-functions || exit 1
  7. is_root
  8. echo "This script supports one optional argument, an IP address"
  9. if [[ $# -eq 1 ]]; then
  10. ip_address="$1"
  11. else
  12. prompt ip_address
  13. fi
  14. if fail2ban-client set sshd unbanip "$ip_address"; then
  15. echo "IP address $ip_address unbanned"
  16. fi
  17. exit $?