Article 4XCWX Shell Script to Block the IP addresses

Shell Script to Block the IP addresses

by
krishnapa
from LinuxQuestions.org on (#4XCWX)
Hi All,

I have created shell script to block the IP addresses in 4 servers.
============================================================
#!/bin/sh
LOG=/home/logs/ip.log

. /home/server.conf

for n in ${HOSTS}
do
ssh -q -A -i /home/.ssh/id_home $n "/sbin/iptables -I INPUT -s $LOG -j DROP"
done
============================================================

Where
vi /home/server.conf (contain all the 4 host server IP addresses)
HOSTS="10.40.11.1 10.40.11.2 10.40.11.3 10.40.11.4"

LOG=/home/logs/ip.log contain all 2 IP addresses that I needs to block in iptables of above 4 servers
say-
11.22.33.44
11.22.33.55

Thanks,latest?d=yIl2AUoC8zA latest?i=KFXJctezLnI:g6UVIyd94pg:F7zBnMy latest?i=KFXJctezLnI:g6UVIyd94pg:V_sGLiP latest?d=qj6IDK7rITs latest?i=KFXJctezLnI:g6UVIyd94pg:gIN9vFwKFXJctezLnI
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments