제가 사용하고 있는 Apache Geoip로 국가 접속차단에 대해 공유 드립니다.
윈도우 아파치 환경 입니다.

 

준비물 :

1. 윈도우 Apache 2.4 vc15 (vc16은 안해봤으나 아마 될거 같습니다?)
2. mod_geoip.so - 윈도우 아파치2.4 geoip 모듈

3. GeoIP.dat - 국가 ip가 좀 옛날거긴하나 왠만큼 차단됩니다.

 

2번과 3번은 압축하여 첨부파일로 올려 드립니다.

 

 

윈도우 아파치 설치된 폴더에 접근하여 mod_geoip.so는 아파치 modules 폴더에 파일을 넣으시고,

3번의 파일은 아파치 bin 폴더에 파일을 넣으세요.

 

conf 폴더의 사용중인 httpd.conf 파일을 수정합니다.

 

httpd.conf 파일 하단에 아래의 내용을 붙여넣을 붙여 넣으시면 됩니다.

대부분의 국가가 차단되며, KR 한국만 빠져 있어 접근이 가능합니다.

 

httpd.conf 내용추가후 아파치를 재시작 합니다.

 

 

아파치 에러 로그를 보시면  [access_compat:error] [pid 10608:tid 13092] [client xxx.xxx.xxx.xxx] AH01797: client denied by server configuration  이런식으로 차단되는게 보일겁니다.

직접 vpn으로 다른나라 선택하면 접근이 불가 합니다.

 

 

LoadModule geoip_module modules/mod_geoip.so
<IfModule geoip_module>
         GeoIPEnable On
     GeoIPOutput Env
         GeoIPDBFile bin/GeoIP.dat MemoryCache
</IfModule>
<Location />

SetEnvIf GEOIP_COUNTRY_CODE CN BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE CA BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE ES BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE DE BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE FR BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE GB BlockCountry

SetEnvIf GEOIP_COUNTRY_CODE AD BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE AE BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE AF BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE AG BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE AI BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE AL BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE AM BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE AO BlockCountry

SetEnvIf GEOIP_COUNTRY_CODE AP BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE AQ BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE AR BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE AS BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE AT BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE AU BlockCountry

SetEnvIf GEOIP_COUNTRY_CODE AW BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE AX BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE AZ BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE BA BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE BB BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE BD BlockCountry

SetEnvIf GEOIP_COUNTRY_CODE BE BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE BF BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE BG BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE BH BlockCountry

SetEnvIf GEOIP_COUNTRY_CODE BI BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE BJ BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE BL BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE BM BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE BN BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE BO BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE BQ BlockCountry

SetEnvIf GEOIP_COUNTRY_CODE BR BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE BS BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE BT BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE BV BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE BW BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE BY BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE BZ BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE BQ BlockCountry

SetEnvIf GEOIP_COUNTRY_CODE CC BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE CD BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE CF BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE CG BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE CH BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE CI BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE CK BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE CL BlockCountry

SetEnvIf GEOIP_COUNTRY_CODE CM BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE CO BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE CR BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE CU BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE CV BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE CW BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE CX BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE CY BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE CZ BlockCountry

SetEnvIf GEOIP_COUNTRY_CODE DJ BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE DK BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE DM BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE DO BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE DZ BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE EC BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE EE BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE EG BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE EH BlockCountry

SetEnvIf GEOIP_COUNTRY_CODE ER BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE ET BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE EU BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE FI BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE FJ BlockCountry

SetEnvIf GEOIP_COUNTRY_CODE FK BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE FM BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE FO BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE GA BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE GD BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE GE BlockCountry

SetEnvIf GEOIP_COUNTRY_CODE GF BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE GG BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE GH BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE GI BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE GL BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE GM BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE GN BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE GP BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE GQ BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE GR BlockCountry

SetEnvIf GEOIP_COUNTRY_CODE GS BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE GT BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE GU BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE GW BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE GY BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE HY BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE HM BlockCountry

SetEnvIf GEOIP_COUNTRY_CODE HN BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE HR BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE HT BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE HU BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE ID BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE IE BlockCountry

SetEnvIf GEOIP_COUNTRY_CODE IL BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE IM BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE IN BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE IO BlockCountry 
SetEnvIf GEOIP_COUNTRY_CODE IQ BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE IR BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE IS BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE IT BlockCountry

SetEnvIf GEOIP_COUNTRY_CODE JE BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE JM BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE JO BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE JP BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE KE BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE KG BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE KH BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE KI BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE KM BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE KN BlockCountry

SetEnvIf GEOIP_COUNTRY_CODE KP BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE KW BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE KY BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE KZ BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE LA BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE LB BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE LC BlockCountry

SetEnvIf GEOIP_COUNTRY_CODE LI BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE LK BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE LR BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE LS BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE LT BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE LU BlockCountry

SetEnvIf GEOIP_COUNTRY_CODE LV BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE LY BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE MA BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE MC BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE MD BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE ME BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE MF BlockCountry

SetEnvIf GEOIP_COUNTRY_CODE MG BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE MH BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE MK BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE ML BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE MM BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE MN BlockCountry

SetEnvIf GEOIP_COUNTRY_CODE MO BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE MO BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE MP BlockCountry 
SetEnvIf GEOIP_COUNTRY_CODE MQ BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE MR BlockCountry 
SetEnvIf GEOIP_COUNTRY_CODE MS BlockCountry 
SetEnvIf GEOIP_COUNTRY_CODE MT BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE MU BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE MV BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE MW BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE MX BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE MY BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE MZ BlockCountry 
SetEnvIf GEOIP_COUNTRY_CODE NA BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE NC BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE NE BlockCountry 
SetEnvIf GEOIP_COUNTRY_CODE NF BlockCountry 
SetEnvIf GEOIP_COUNTRY_CODE NG BlockCountry 
SetEnvIf GEOIP_COUNTRY_CODE NI BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE NL BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE NO BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE NP BlockCountry 
SetEnvIf GEOIP_COUNTRY_CODE NR BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE NU BlockCountry 
SetEnvIf GEOIP_COUNTRY_CODE NZ BlockCountry 
SetEnvIf GEOIP_COUNTRY_CODE OM BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE PA BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE PE BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE PF BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE PG BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE PH BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE PK BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE PL BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE PM BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE PN BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE PR BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE PS BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE PT BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE PW BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE PY BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE QA BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE RE BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE RO BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE RS BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE RU BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE RW BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE SA BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE SB BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE SC BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE SD BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE SE BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE SG BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE SH BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE SI BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE SJ BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE SK BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE SL BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE SM BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE SN BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE SO BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE SR BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE SS BlockCountry 
SetEnvIf GEOIP_COUNTRY_CODE ST BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE SV BlockCountry 
SetEnvIf GEOIP_COUNTRY_CODE SX BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE SY BlockCountry 
SetEnvIf GEOIP_COUNTRY_CODE SZ BlockCountry 
SetEnvIf GEOIP_COUNTRY_CODE TC BlockCountry 
SetEnvIf GEOIP_COUNTRY_CODE TD BlockCountry 
SetEnvIf GEOIP_COUNTRY_CODE TF BlockCountry 
SetEnvIf GEOIP_COUNTRY_CODE TG BlockCountry 
SetEnvIf GEOIP_COUNTRY_CODE TH BlockCountry 
SetEnvIf GEOIP_COUNTRY_CODE TJ BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE TK BlockCountry 
SetEnvIf GEOIP_COUNTRY_CODE TL BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE TM BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE TN BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE TO BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE TR BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE TT BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE TV BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE TW BlockCountry 
SetEnvIf GEOIP_COUNTRY_CODE TZ BlockCountry 
SetEnvIf GEOIP_COUNTRY_CODE UA BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE UG BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE UM BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE US BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE UY BlockCountry 
SetEnvIf GEOIP_COUNTRY_CODE UZ BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE VA BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE VC BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE VE BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE VG BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE VI BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE VN BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE VU BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE WF BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE WS BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE YE BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE YT BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE ZA BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE ZM BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE ZW BlockCountry
  Order allow,deny
  Deny from env=BlockCountry
  Allow from all
</Location>

 

 

 

Atachment
첨부