CentOS 8 Http 2.4 에 mod_security 설치하기 (YUM)

리눅스/Security|2020. 11. 12. 10:30
반응형

CentOS 8, yum 으로 설치된 httpd 에 mod_security 를 추가로 설치하는 방법입니다.


1. 모듈 설치

# dnf -y install mod_security


2. OWASP 룰 설치 및 적용

# cd /etc/httpd

# git clone https://github.com/SpiderLabs/owasp-modsecurity-crs.git


# cd owasp-modsecurity-crs

# cp -arp crs-setup.conf.example /etc/httpd/modsecurity.d/crs-setup.conf

# vi /etc/httpd/modsecurity.d/crs-setup.conf

문서 하단부의 pass 를 deny 로 변경

SecAction \

 "id:900990,\

  phase:1,\

  nolog,\

  deny,\

  t:none,\

  setvar:tx.crs_setup_version=320" 


# cd rules

# cp -arp ./* /etc/httpd/modsecurity.d/activated_rules/


# cd /etc/httpd/modsecurity.d/activated_rules/

# cp -arp REQUEST-900-EXCLUSION-RULES-BEFORE-CRS.conf.example REQUEST-900-EXCLUSION-RULES-BEFORE-CRS.conf

# cp -arp RESPONSE-999-EXCLUSION-RULES-AFTER-CRS.conf.example RESPONSE-999-EXCLUSION-RULES-AFTER-CRS.conf


3. 적용

# systemctl restart httpd


4. 확인

웹브라우저에서 다음과 같이 웹페이지로 공격시도를 해봅니다.


http://도메인/index.html?cmd=rm



반응형

댓글()