한국IP외 막기
외국에서 Hacking 시도가 많아, 외국에서 들어오는 IP대역은 모두 막는 Script를 작성했습니다. 한국 IP 대역만 ACCEPT하고 나머지는 DROP시키는 방식입니다.
한국에서 사용하는 IP대역이 좀 많아.. 메모리 사용량 측면과 시스템 성능 측면에 대한 부분은 각자 판단하여 적용하시기 바랍니다.
[root@asterisk13 IPTABLE]# pwd
/root/IPTABLE
[root@asterisk13 IPTABLE]#
[root@asterisk13 IPTABLE]# cat SetKoreaIP.sh
#!/bin/bash
WGET=/usr/bin/wget
IPT=/sbin/iptables
UNZIP=/usr/bin/unzip
RM=/bin/rm
DATA=/root/IPTABLE/GeoIPCountryWhois.csv
URL=http://geolite.maxmind.com/download/geoip/database/GeoIPCountryCSV.zip
# 1. Get IP List
$RM -f $DATA
$RM -f GeoIPCountryCSV.zip
$WGET $URL
$UNZIP GeoIPCountryCSV.zip
# 2. Set IPTables
for IPRANGE in `egrep "Korea" $DATA | cut -d, -f1,2 | sed -e 's/"//g' | sed -e 's/,/-/g'`
do
$IPT -A INPUT -p all -m iprange --src-range $IPRANGE -j ACCEPT
done
/sbin/iptables -P INPUT DROP
[root@asterisk13 IPTABLE]#
감사합니다.
유현선 (http://blog.naver.com/hsunryou)
Asterisk Base Solution | IP-PBX, CTI, ARS, IVR, Recording, Conference
(mobile)+82-10-2669-4023 | (email )hsunryou@naver.com, hsunryou@gmail.com
Asterisk 기반 기술과 솔루션을 확인해보세요. 감사합니다!