Skip to content

조회 수 10345 추천 수 0 댓글 0
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄

Kernel 2.6.22 geoip, connlimit적용
SMILESERV
Jump to: navigation, 찾기
1. patch-o-matic-ng, iptables, 커널 소스, geoip-match-patch 다운로드

  patch-o-match-ng  --> ftp.netfilter.org/pub/patch-o-matic-ng/snapshot/
  IPTABLES  --> ftp.netfilter.org/pub/iptables
  KERNEL  --> ftp.kernel.org/pub/linux/kernel
  geoip-match.patch -->http://bjerkeset.com/patches/geoip-match-2.6.22.patch.gz
  * 되도록 /usr/src로 해당 파일들을 위치시키는 것이 오류가 나지 않음
     커널 make시에 용량이 커지므로 /usr 파티션 용량이 모자랄경우 다른 파티션에 커널 이미지를 풀고
     ln -s 커널이미지경로 /usr/src/linux로 심볼릭 링크를 걸어준다.

 

2. geoip, connlimit 커널에 패치

tar xfz patch-o-matic-ng-XXXXXX.tar.gz

cd patch-o-matic-ng

IPTABLES_DIR=/usr/src/iptables KERNEL_DIR=/usr/src/linux ./runme --download --> patch-o-matic에서 geoip 및 기타 다른 패키지를 자동으로 다운로드 하여 설치

IPTABLES_DIR=/usr/src/iptables KERNEL_DIR=/usr/src/linux ./runme geoip --> 커널에 geoip 패치

IPTABLES_DIR=/usr/src/iptables KERNEL_DIR=/usr/src/linux ./runme connlimit --> 커널에 connlimit 패치

cd /usr/src/linux/net/ipv4/netfilter/

cp /usr/src/geoip-match-2.6.22.patch /usr/src/linux/net/ipv4/netfilter/

patch -p1 < geoip-match.patch --> 위 명령 실행시 패치 할 원본 파일을 묻게되며 원본 파일은 ipt_geoip.c를 입력해야 하며 커널 2.6.22는 ipt_geoip.c를 패치해 주어야 make에서 오류가 발생하지 않음

 


3. 커널 컴파일 --> 커널 컴파일 관련 모든 명령은 커널소스 디렉토리 내에서 실행해야함

3-1 make memuconfig 아래 항목에서 geoip 및 connlimit선택, connlimit의 경우 해당 Netfilter Configuration 하위 메뉴에 있는 모든 메뉴를 선택해 주어야 make상에서 오류가 발생하지 않음 -> Device Drivers -> Networking support -> Networking support -> Networking options -> Network packet filtering (replaces ipchains) -> IP: Netfilter Configuration -> [*] geoip match support

3-2 make --> 커널 버전 변동없이 geoip만 추가 할 경우는 아래의 순서로 컴파일을 진행함

     make oldconfig
     make modules
     make modules_install
3-3 make modules

3-4 make modules_install

3-5 make install

 


4. 국가 DB 최신 정보로 업데이트

geoip 모듈은 /var/geoip 경로의 DB파일 참조함
- CSV 파일 변환 wget http://people.netfilter.org/peejix/geoip/tools/csv2bin-20041103.tar.gz tar zxfp csv2bin-20041103.tar.gz cd csv2bin make


- 국가별 DB 다운로드 wget http://www.maxmind.com/download/geoip/database/GeoIPCountryCSV.zip unzip GeoIPCountryCSV.zip ./csv2bin ../GeoIPCountryWhois.csv mkdir /var/geoip cp geoipdb.bin /var/geoip/ cp geoipdb.idx /var/geoip/

cp /usr/src/iptables/iptables /sbin -> iptables 소스파일의 iptables를 /sbin으로 복사


5. IPTABLES geoip 룰 적용

  예제)
  - 일본과 미국에서의 웹 접속을 차단하고 다른 곳에서의 접속은 허용할 때
  iptables -A INPUT -p tcp --dport 80 -m geoip --src-cc JP,US -j DROP
  iptables -A INPUT -p tcp --dport 80 -j ACCEPT
 
 
  - 한국에서의 ftp만 허용하고 나머지 국가에서의 접속은 차단하고자 할 때
  iptables -A INPUT -p tcp --dport 21 -m geoip --src-cc KR -j ACCEPT
  iptables -A INPUT -p tcp --dport 21 -j DROP
  또는 iptables -A INPUT -p tcp --dport 21 -m geoip ! --src-cc KR -j DROP


  1. lsof 활용 가이드

    Date2009.11.30 ByADMINPLAY Views8316
    Read More
  2. LINUX 해킹당했을 때 대처요령

    Date2010.03.08 Byl2zeo Views8734
    Read More
  3. Linux Security

    Date2009.07.18 ByADMINPLAY Views9755
    Read More
  4. Kernel 2.4.23 버전 이하에 나온 ptrace 버그에 관한 사항

    Date2009.12.13 ByADMINPLAY Views8800
    Read More
  5. iptables와 mod_security 연동을 통한 ip 차단

    Date2010.09.15 ByADMINPLAY Views19777
    Read More
  6. iptables를 이용한 SSH brute force 공격방어

    Date2010.05.29 Byl2zeo Views19701
    Read More
  7. iptables/sysctl을 이용하여 DDOS SYN 공격 방어하기

    Date2009.05.28 ByADMINPLAY Views9207
    Read More
  8. iptables-connlimit & geoip 설치설정

    Date2009.05.28 ByADMINPLAY Views10345
    Read More
  9. iptables 포트 포워딩

    Date2009.06.04 ByADMINPLAY Views12040
    Read More
  10. iptables 옵션 및 상태 추적 테이블 및 rule

    Date2009.11.30 ByADMINPLAY Views8854
    Read More
  11. iptables 설정, centos64 설치 간단셋팅

    Date2009.05.28 ByADMINPLAY Views8857
    Read More
  12. iptables 명령어로 ip 차단 법.

    Date2009.05.28 ByADMINPLAY Views9286
    Read More
  13. iptables 리눅스? NETFILTER관련

    Date2010.03.08 Byl2zeo Views10128
    Read More
  14. iptables 기본

    Date2009.05.22 ByADMINPLAY Views8389
    Read More
  15. iframe 이용한 악성코드 삽입, 홈페이지 변조 사고 대비 ...

    Date2009.10.15 ByADMINPLAY Views10809
    Read More
  16. find 명령어 활용(보안관련)

    Date2009.08.08 ByADMINPLAY Views9602
    Read More
  17. fcheck - 리눅스 시스템 무결성 검사 툴

    Date2008.12.14 ByADMIN Views11030
    Read More
  18. DOS Attack을 막기 위한 간단한 방법

    Date2009.05.22 ByADMINPLAY Views9572
    Read More
  19. denyhosts (ssh, ftp 등의 접근 차단)

    Date2010.05.03 ByADMINPLAY Views21373
    Read More
  20. DDOS - iptables 방화벽 초간단 문서

    Date2009.05.28 ByADMINPLAY Views12305
    Read More
Board Pagination Prev 1 2 3 4 5 Next
/ 5

Copyright ADMINPLAY corp. All rights reserved.

abcXYZ, 세종대왕,1234

abcXYZ, 세종대왕,1234