script-user-unban 483 B

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