리눅스 mod_security 아파치용 웹방화벽 설치
페이지 정보
작성자
본문
#tar xvfz modsecurity-apache_1.9.4.tar.gz
#cd modsecurity-apache_1.9.4
#/usr/local/apache2/bin/apachectl stop
#/usr/local/apache2/bin/apxs -cia /usr/local/modsecurity-apache_1.9.4/apache2/mod_security.c
DSO 방식으로 설치
#/usr/local/apache2/bin/apachectl start
apxs를 이용하여 ModSecurity 모듈을 컴파일하고, 설치하고, 설정을 자동으로 변경한다.
위의 명령은 mod_security.c를 컴파일 하고(-c 옵션), 공유객체를 웹서버 modules 디렉토리에
설치하고(-i 옵션), 아파치 httpd.conf 설정파일에 적절한 LoadModule 줄을 추가(-a 옵션)한다.
참고로 apxs는 아파치 웹서버의 확장모듈을 컴파일하고 설치하는 도구로써, 여러 소스와 오브
젝트파일을 LoadModule 지시어로 실행 중인 아파치 서버로 읽어 들일 수 있는 동적공유객체
(DSO)를 만든다. 위의 결과로 modules 디렉토리에 mod_security.so가 생성되고 httpd.conf 파
일에 “LoadModule security_module modules/mod_security.so” 라인이 추가된다.
위의 명령은 mod_security.c를 컴파일 하고(-c 옵션), 공유객체를 웹서버 modules 디렉토리에
설치하고(-i 옵션), 아파치 httpd.conf 설정파일에 적절한 LoadModule 줄을 추가(-a 옵션)한다.
참고로 apxs는 아파치 웹서버의 확장모듈을 컴파일하고 설치하는 도구로써, 여러 소스와 오브
젝트파일을 LoadModule 지시어로 실행 중인 아파치 서버로 읽어 들일 수 있는 동적공유객체
(DSO)를 만든다. 위의 결과로 modules 디렉토리에 mod_security.so가 생성되고 httpd.conf 파
일에 “LoadModule security_module modules/mod_security.so” 라인이 추가된다.
************만약 설치중에!!!!!!!!
Warning! dlname not found in /usr/local/apache/modules/mod_security.la.
Assuming installing a .so rather than a libtool archive.
chmod 755 /usr/local/apache/modules/mod_security.so
chmod: cannot access `/usr/local/apache/modules/mod_security.so': 그런 파일이나 디렉토리가 없음
apxs:Error: Command failed with rc=65536
에러 출력되면
1) cd /usr/local/apache2/build
2) mv libtool libtool.back
3) ln -s /usr/bin/libtool libtool
이렇게 libtool 설정 후 다시 설치
ModSecurity 활성화 및 Rule 정의
① httpd.conf 파일 수정
# vi /usr/local/apache2/conf/httpd.conf
-----------------------------------------------------
-----------------------------------------------------
Include conf/modsecurity/*.conf <=== 라인 추가
-------------------------------------------------------
② #mkdir /usr/local/apache2/conf/modsecurity <=== modsecurity 룰 설정파일 디렉토리를 만들고
② #mkdir /usr/local/apache2/conf/modsecurity <=== modsecurity 룰 설정파일 디렉토리를 만들고
첨부파일을 다운받아서 업로드한다. 아래 설정파일은 정보보호진흥원에서 2007년 11월 20일자로 배포하는 설정파일이다.
* modsecurity_hosting_071120.conf ===> 웹호스팅용.
* modsecurity_SMB_071120.conf ====> 스몰비지니스용(중소기업용)
#vi /usr/local/apache2/conf/modsecurity/modsecurity_hosting_071120.conf
안에 내용을 읽어보고 주석(#)을 제거하고 설정을 완료한다. 정보보호진흥원에서 만든 자료라서 잘해놨음..설명...ㅎ
설정파일 자세한 설명은 첨부한 pdf 참고하시길...
그리고 나서 아파치 재시작...
작동 여부 확인
#curl --head http://127.0.0.1/
--------------------------------------------------
HTTP/1.1 403 Forbidden
Date: Tue, 14 Aug 2007 10:41:13 GMT
Server: Microsoft-IIS/5.0 <===정상작동중... 아닐때==>apache로나타남.
Content-Type: text/html; charset=iso-8859-1
---------------------------------------------------
HTTP/1.1 403 Forbidden
Date: Tue, 14 Aug 2007 10:41:13 GMT
Server: Microsoft-IIS/5.0 <===정상작동중... 아닐때==>apache로나타남.
Content-Type: text/html; charset=iso-8859-1
---------------------------------------------------
관련링크
- http://jnstory.net/1241 2870회 연결
댓글목록
등록된 댓글이 없습니다.