CentOS 7 firewalld+geoip
https://www.ehostidc.co.kr/cscenter/notice.php (365)https://www.ehostidc.co.kr/cscenter/consulting.php (338)
1) maxmind 회원 가1077; |
https://www.maxmind.com/en/geolite2/signup160;회원가1077; 가1077;.108; 계1221;1004;/196; /196;그1064; 후 라1060;선스Ȗ12; 0156;급
|
2) 필수 패Ȗ12;1648; 설치 |
[root@master ~]# yum install gcc gcc-c++ make automake unzip zip kernel-devel-`uname -r` iptables-devel perl-CPAN wget libmnl* perl-NetAddr-IP perl-Text-CSV_XS |
3) xtables-addons 다운/196;드 |
[root@master ~]# wget http://downloads.sourceforge.net/project/xtables-addons/Xtables-addons/xtables-addons-2.13.tar.xz160; [root@master ~]# tar xvf xtables-addons-2.13.tar.xz |
4) xtables-addons 설치 |
[root@master xtables-addons-2.13]# vi mconfig => build_TARPIT=m 1452;석 처리 [root@master xtables-addons-2.13]# ./configure [root@master xtables-addons-2.13]# make && make install |
5) GeoLite2xtables 160;라1060;브러리 다운 |
[root@master ~]# cd [root@master ~]# git clone160;https://github.com/mschmitt/GeoLite2xtables [root@master ~]# cd GeoLite2xtables/ [root@master GeoLite2xtables]# mv geolite2.license.example geolite2.license [root@master GeoLite2xtables]# vi geolite2.license => 0156;급0155;1008; 라1060;선스Ȗ12;/196; 수1221; |
6) geoip database를 다운/196;드 0143; CSV 파1068; 변환 |
[root@master GeoLite2xtables]# ./00_download_geolite2 [root@master GeoLite2xtables]# ./10_download_countryinfo [root@master GeoLite2xtables]# ll /tmp/ [root@master GeoLite2xtables]# mkdir /usr/share/xt_geoip [root@master GeoLite2xtables]# cat /tmp/GeoLite2-Country-Blocks-IPv{4,6}.csv |./20_convert_geolite2 /tmp/CountryInfo.txt > /usr/share/xt_geoip/GeoIP-legacy.csv |
7) geoip 모듈 csv 파1068; 1201;용 |
[root@master GeoLite2xtables]# cd [root@master ~]# ./xtables-addons-2.13/geoip/xt_geoip_build -D /usr/share/xt_geoip/ /usr/share/xt_geoip/GeoIP-legacy.csv |
8) geoip 모듈 csv 파1068; 1201;용 |
[root@master ~]# firewall-cmd --direct --add-rule ipv4 filter INPUT 0 -m geoip --src-cc [국가코드] -j DROP
[root@master ~]# firewall-cmd --direct --add-rule ipv4 filter INPUT 0 -m geoip ! --src-cc [국가코드] -j DROP |
160;