code.fastix.org

Dateiansicht:

Datei:Projekte -> Apache,mod_evasive,iptables:Helfer-Skripte zum (zeitweisen) Blockieren von IP-Adressen -> fwunblock
md5:89e5a6a24000b654fcdc8e95b290b9ac
sha1:2ec764eaceed93233234bc113a83eccf1dbe76e7
Download-Link:Download
  1. #!/usr/bin/sudo /bin/bash
  2.  
  3. ## safety instructions:   ##
  4. ##   chown root:root      ##
  5. ##   chmod 0755           ##
  6.  
  7. if [ -z "${1}" ]; then
  8.         echo "Keine IP angegeben.";
  9.         exit 1
  10. else
  11.         ip=$(echo -n "${1}" | tr -cd '0123456789./');
  12.         if iptables -D INPUT -s "${ip}" -j DROP; then
  13.                 fwlist | tee /tmp/fwlist.txt | grep "${ip}";
  14.                 echo "IP ${ip} is no longer blocked." | logger -t "fwunblock";
  15.                 exit 0;
  16.         else
  17.                 exit 2;
  18.         fi
  19. fi
  20.