Security
mod_security 설치
CHOMAN
2015. 6. 11. 16:31
Mod_security 설치
설치전 체크
mod_unique_id 인스톨되었는지 확인
libxml2 최신버전 인스톨되었는지 확인
lua ??
libxml2 최신버전 인스톨되었는지 확인
lua ??
설치전 필요한 패키지 설치
cd /usr/local/src/APM/httpd-2.2.9/modules/metadata
- /usr/local/apache/bin/apxs -cia mod_unique_id.c
vim /usr/local/apache/conf/httpd.conf
- LoadModule unique_id_module modules/mod_unique_id.so 이게 추가 되어 있다면
- LoadFile /usr/lib/libxml2.so 열 추가해준다
아래 패키지들이 필요하다던데?
libxml2
lua
pcre
pcre-devel
apr*
yum -y install libxml2 lua pcre pcre-devel apr*
pcre 소스 설치 (YUM 설치되면 소스 설치할 필요없음)
wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.02.zip
unzip pcre-8.02.zip
cd pcre-8.02
./configure --prefix=/usr/local/pcre
make
make install
/usr/local/src/APM/httpd-2.2.9/modules/metadata
wget http://www.modsecurity.org/download/modsecurity-apache_2.5.12.tar.gz
xvfz modsecurity-apache_2.5.12.tar.gz
cd modsecurity-apache_2.5.12
cd apache2/
./configure --with-apxs=/usr/local/apache/bin/apxs
- 2.5.12에서는 그냥 apxs 경로만 나열해주면 되는듯 함
op) ./configure --with-apr=/usr/local/apache --with-apu=/usr/local/apache --with-apxs=/usr/local/apache/
op1) ./configure --with-apxs=/usr/local/apache/bin/apxs --with-pcre=/usr/local/pcre --with-apr=/usr/local/apache/bin/apr-1-config --with-apu=/usr/local/apache/bin/apu-1-config
make
make install
룰설정? 모드시큐어리티 기본룰을 아파치 컨프에 복사해놓고 편리하게 쓰자...
cp -arpf rules /usr/local/apache/conf/modsecurity
xvfz modsecurity-apache_2.5.12.tar.gz
cd modsecurity-apache_2.5.12
cd apache2/
./configure --with-apxs=/usr/local/apache/bin/apxs
- 2.5.12에서는 그냥 apxs 경로만 나열해주면 되는듯 함
op) ./configure --with-apr=/usr/local/apache --with-apu=/usr/local/apache --with-apxs=/usr/local/apache/
op1) ./configure --with-apxs=/usr/local/apache/bin/apxs --with-pcre=/usr/local/pcre --with-apr=/usr/local/apache/bin/apr-1-config --with-apu=/usr/local/apache/bin/apu-1-config
make
make install
룰설정? 모드시큐어리티 기본룰을 아파치 컨프에 복사해놓고 편리하게 쓰자...
cp -arpf rules /usr/local/apache/conf/modsecurity
httpd.conf 추가
vim /usr/local/apache/conf/httpd.conf
LoadModule security2_module modules/mod_security2.so
<IfModule mod_security2.c>
Include conf/modsecurity/modsecurity_crs_10_config.conf
#Include conf/modsecurity_2x_SMB_090311.conf
#Include conf/modsecurity_2x_hosting_090311.conf
</IfModule>
LoadModule security2_module modules/mod_security2.so
<IfModule mod_security2.c>
Include conf/modsecurity/modsecurity_crs_10_config.conf
#Include conf/modsecurity_2x_SMB_090311.conf
#Include conf/modsecurity_2x_hosting_090311.conf
</IfModule>
위 라인은 이미 추가?되어 있음? modsecurity.conf 파일 찾아서 인쿨르드 해주는듯함)
include conf/modsecurity/modsecurity*conf 이 라인만 추가했음
Include conf/modsecurity/modsecurity_crs_10_config.conf ← 내 서버는 이렇게 설정되어 있음
Include conf/modsecurity/modsecurity_crs_10_config.conf ← 내 서버는 이렇게 설정되어 있음
퍼미션 조정 (/APACHE_SETUP_DIR/conf/modsecurity)
chmod 440 -R modsecurity/
아파치 재시작
로그 확인
tail -f /usr/local/apache/log/error_log;
tail -f /usr/local/apache/log/error_log;