Notice
Recent Posts
Recent Comments
Link
| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 1 | 2 | 3 | 4 | 5 | 6 | |
| 7 | 8 | 9 | 10 | 11 | 12 | 13 |
| 14 | 15 | 16 | 17 | 18 | 19 | 20 |
| 21 | 22 | 23 | 24 | 25 | 26 | 27 |
| 28 | 29 | 30 | 31 |
Tags
- 윈도우 mod_security2
- 윈도우 환경 아파치 mod_security2 설치
- 숫자 3자리(천단위) 마다 콤마 찍기
- mariadb upgrade
- php 이미지 url 검증 함수
- html pdf 변환
- mod_security2 설치
- bootstrap
- bootstrap modal
- VS Code 서버설치
- (using password: YES)" when trying to connect
- 비밀번호정규식
- httpd.conf 보안 설정
- usb efi 시스템 파티션 삭제
- 유튜브 플레이 리스트 저장
- PHP 정규식 예제
- 파라미터 & 오류
- group_concat 구분자
- javascript
- modsecurity 설치
- thumbnail 클래스
- wsl2 우분투에 docker 설치
- 아파치 웹 서버의 정보 숨기기
- 비밀번호검증정규식
- php 배열제거
- usb 삭제
- apple push notification service (apns) is changing
- postfix 설치
- 자바스크립트비밀번호검증
- sha-2 root
Archives
- Today
- Total
투덜이 개발자
CentOS Linux 7 modsecurity-crs 적용 본문
반응형
CentOS Linux 7 modsecurity-crs 적용
sudo wget https://github.com/coreruleset/coreruleset/archive/v3.3.4.tar.gz
tar xvfzp v3.3.4.tar.gz
mkdir /etc/httpd/modsecurity-crs
mv coreruleset-3.3.4 /etc/httpd/modsecurity-crs/.
cd /etc/httpd/modsecurity-crs/coreruleset-3.3.4
mv crs-setup.conf.example crs-setup.conf
# OWASP CRS (Core Rule Set) 3.3.4 을 사용하므로
# &MULTIPART_PART_HEADERS는 ModSecurity v2에서 인식 불가능
# 파일 이름을 바꿔 비활성화
mv /etc/httpd/modsecurity-crs/coreruleset-3.3.4/rules/REQUEST-922-MULTIPART-ATTACK.conf \
/etc/httpd/modsecurity-crs/coreruleset-3.3.4/rules/REQUEST-922-MULTIPART-ATTACK.conf.disabled
vi /etc/httpd/modsecurity-crs/coreruleset-3.3.4/rules/REQUEST-949-BLOCKING-EVALUATION.conf
#SecRule TX:ANOMALY_SCORE "@ge %{tx.inbound_anomaly_score_threshold}" \
# "id:949110,\
# phase:2,\
# deny,\
# t:none,\
# log,\
# msg:'Inbound Anomaly Score Exceeded (Total Score: %{TX.ANOMALY_SCORE})',\
# tag:'application-multi',\
# tag:'language-multi',\
# tag:'platform-multi',\
# tag:'attack-generic',\
# ver:'OWASP_CRS/3.3.4',\
# severity:'CRITICAL',\
# setvar:'tx.inbound_anomaly_score=%{tx.anomaly_score}'"
# Anomaly Score를 증가시키는 규칙 (setvar 사용)
SecAction "id:949110, phase:2, t:none, pass, nolog, setvar:tx.anomaly_score=+0.5"
# Anomaly Score가 임계값을 초과하면 차단하는 규칙
SecRule TX:ANOMALY_SCORE "@ge 30" \
"id:949111,\
phase:2,\
deny,\
t:none,\
log,\
msg:'Inbound Anomaly Score Exceeded (Total Score: %{TX.ANOMALY_SCORE})',\
tag:'application-multi',\
tag:'language-multi',\
tag:'platform-multi',\
tag:'attack-generic',\
ver:'OWASP_CRS/3.3.4',\
severity:'CRITICAL',\
setvar:'tx.inbound_anomaly_score=%{tx.anomaly_score}'"
vi /etc/httpd/conf.d/mod_security.conf
<IfModule mod_security2.c>
# ModSecurity Core Rules Set configuration
IncludeOptional modsecurity.d/*.conf
IncludeOptional modsecurity.d/activated_rules/*.conf
# coreruleset-3.3.4 예외 설정 추가
IncludeOptional /etc/httpd/modsecurity-crs/custom_exceptions.conf
# coreruleset-3.3.4 설정 추가
IncludeOptional /etc/httpd/modsecurity-crs/coreruleset-3.3.4/crs-setup.conf
IncludeOptional /etc/httpd/modsecurity-crs/coreruleset-3.3.4/rules/*.conf
</IfModule>
# 예외 설청 추가
vi /etc/httpd/modsecurity-crs/custom_exceptions.conf
SecRule ARGS_NAMES "@rx ^(contents|cf_footer|irs_info|address_email_info|ksc_time|staff_info)$" \
"id:110001,phase:1,pass,nolog,\
ctl:ruleRemoveTargetById=941310;ARGS:contents,\
ctl:ruleRemoveTargetById=941310;ARGS:cf_footer,\
ctl:ruleRemoveTargetById=941310;ARGS:irs_info,\
ctl:ruleRemoveTargetById=941310;ARGS:address_email_info,\
ctl:ruleRemoveTargetById=932130;ARGS:cf_footer"
SecRule ARGS_NAMES "@rx ^(contents|cf_footer|irs_info|address_email_info|ksc_time|staff_info)$" \
"id:110002,phase:2,pass,nolog,\
ctl:ruleRemoveTargetById=941310;ARGS:contents,\
ctl:ruleRemoveTargetById=941310;ARGS:cf_footer,\
ctl:ruleRemoveTargetById=941310;ARGS:irs_info,\
ctl:ruleRemoveTargetById=941310;ARGS:address_email_info,\
ctl:ruleRemoveTargetById=932130;ARGS:cf_footer,\
ctl:ruleRemoveTargetById=932130;ARGS:address_email_info,\
ctl:ruleRemoveTargetById=932130;ARGS:contents,\
ctl:ruleRemoveTargetById=932115;ARGS:contents,\
ctl:ruleRemoveTargetById=941180;ARGS:contents,\
ctl:ruleRemoveTargetById=941310;ARGS:ksc_time,\
ctl:ruleRemoveTargetById=941310;ARGS:staff_info"
vi /etc/httpd/modsecurity-crs/coreruleset-3.3.4/rules/999-whitelist-summernote.conf
# 웹 에디터 콘텐츠 업로드 시 예외 처리
SecRule REQUEST_URI "@beginsWith /" "id:1001,phase:1,nolog,pass,ctl:ruleRemoveById=941100"
SecRule REQUEST_URI "@beginsWith /" "id:1002,phase:1,nolog,pass,ctl:ruleRemoveById=941130"
SecRule REQUEST_URI "@beginsWith /" "id:1003,phase:1,nolog,pass,ctl:ruleRemoveById=941140"
SecRule REQUEST_URI "@beginsWith /" "id:1004,phase:1,nolog,pass,ctl:ruleRemoveById=941160"
SecRule REQUEST_URI "@beginsWith /" "id:1005,phase:1,nolog,pass,ctl:ruleRemoveById=941170"
SecRule REQUEST_URI "@beginsWith /" "id:1006,phase:1,nolog,pass,ctl:ruleRemoveById=941200"반응형
'OS > Linux' 카테고리의 다른 글
| cronolog 설치 (0) | 2025.05.09 |
|---|---|
| 우분투 Postfix 설치 (0) | 2025.05.08 |
| Apache 보안 설정 (0) | 2025.04.23 |
| [apache] 아파치 설정 보안 mod rewrite 설치 (1) | 2025.04.07 |
| Ubuntu ssh 접속시 root 권한 문제 해결 (0) | 2025.03.12 |