| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 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 |
- thumbnail 클래스
- PHP 정규식 예제
- 숫자 3자리(천단위) 마다 콤마 찍기
- mod_security2 설치
- 비밀번호검증정규식
- 윈도우 환경 아파치 mod_security2 설치
- wsl2 우분투에 docker 설치
- html pdf 변환
- group_concat 구분자
- 비밀번호정규식
- javascript
- usb 삭제
- sha-2 root
- apple push notification service (apns) is changing
- usb efi 시스템 파티션 삭제
- 자바스크립트비밀번호검증
- bootstrap modal
- (using password: YES)" when trying to connect
- modsecurity 설치
- postfix 설치
- VS Code 서버설치
- php 이미지 url 검증 함수
- 유튜브 플레이 리스트 저장
- 윈도우 mod_security2
- 파라미터 & 오류
- httpd.conf 보안 설정
- bootstrap
- 아파치 웹 서버의 정보 숨기기
- php 배열제거
- mariadb upgrade
- Today
- Total
투덜이 개발자
우분투 모드시큐리트 modsecurity 설치 본문
우분투 모드시큐리트 설치 에러 발생

모드시큐리트 modsecurity 모듈 설치
sudo apt install libapache2-mod-security2

설치 확인
apachectl -M | grep security

모듈 활성화
a2enmod security2
ModSecurity 설정
cd /etc/modsecurity

cp /etc/modsecurity/modsecurity.conf-recommended /etc/modsecurity/modsecurity.conf

vi modsecurity.conf 파일을 열고 아래 추가
#SecRuleEngine DetectionOnly
SecRuleEngine On
[구축] Ubuntu/Apache WAF(Modsecurity) 설치
1. ModSecurity 설치 관리자 권한으로 명령어 수행했으며 관리자 로그인 불가시 sudo 사용 - ModSecurity 모듈 설치 - security2 모듈 활성화 * a2enmod 명령으로 모듈을 활성화하면 /etc/apache2/mods-enabled 디렉터
cyong.tistory.com
룰셋다운받기 + 압축 풀기
sudo wget https://github.com/coreruleset/coreruleset/archive/v3.3.0.tar.gz
sudo wget https://github.com/coreruleset/coreruleset/archive/v3.3.4.tar.gz
tar xvfzp v3.3.4.tar.gz

규칙 세트를 저장한 디렉터리를 생성하고 규칙 세트 이동 + 경로 이동
mkdir /etc/apache2/modsecurity-crs
mv coreruleset-3.3.4 /etc/apache2/modsecurity-crs/.
cd /etc/apache2/modsecurity-crs/coreruleset-3.3.4
mv crs-setup.conf.example crs-setup.conf
규칙 룰셋 적용하기
vi /etc/apache2/mods-enabled/security2.conf
<IfModule security2_module>
# Default Debian dir for modsecurity's persistent data
SecDataDir /var/cache/modsecurity
# Include all the *.conf files in /etc/modsecurity.
# Keeping your local configuration in that directory
# will allow for an easy upgrade of THIS file and
# make your life easier
IncludeOptional /etc/modsecurity/*.conf
# Include OWASP ModSecurity CRS rules if installed
#IncludeOptional /usr/share/modsecurity-crs/*.load
IncludeOptional /etc/apache2/modsecurity-crs/coreruleset-3.3.4/crs-setup.conf
IncludeOptional /etc/apache2/modsecurity-crs/coreruleset-3.3.4/rules/*.conf
</IfModule>
아파치 재시작
웹에디터에서 이미지 첨부가 안된다.
로그 확인하여 보면 블럭 당했다.

그래서 해당 파일은 삭제 함
rm -f /etc/apache2/modsecurity-crs/coreruleset-3.3.4/rules/REQUEST-949-BLOCKING-EVALUATION.conf
삭제를 하면 다른 규칙이 적용이 안되기 때문에 예외처리 한다.
/etc/apache2/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"
만들어준다.
첨부파일 업로드가 안된다
그래서
vi /etc/modsecurity/modsecurity.conf
주석 처리 함
SecRule MULTIPART_UNMATCHED_BOUNDARY "!@eq 0" \
"id:'200004',phase:2,t:none,log,deny,msg:'Multipart parser detected a possible unmatched boundary.'"
#SecRule MULTIPART_UNMATCHED_BOUNDARY "!@eq 0" \
#"id:'200004',phase:2,t:none,log,deny,msg:'Multipart parser detected a possible unmatched boundary.'"
https://liveyourit.tistory.com/171
웹방화벽(WAF) ModSecurity 설치 및 sql인젝션 룰 설정
우분투(Ubuntu)에 리눅스 무료 웹방화벽(WAF)인 ModSecurity를 설치 및 설정해본다. 그리고 sql인젝션이 되는 취약한 웹페이지에서 ModSecurity에 sql인젝션 룰설정을 통해 인젝션을 방지할 수 있음을 보인
liveyourit.tistory.com
https://blog.boxcorea.com/wp/archives/3236
ubuntu 18.04, apache2 mod-security2 설치 및 설정.
ubuntu 18.04, apache2 mod-security2 설치 및 설정. 1. 설치. $ sudo apt install libapache2-mod-security2 2. 아파치 웹서버를 다시 실행하고 security2 모듈이 작동중인지 확인한다. 재실행. $ sudo systemctl restart apache2 모듈
blog.boxcorea.com
# ModSecurity 삭제
sudo apt remove libapache2-mod-security2

웹 서버의 정보 숨기기 (apache)
웹서버보안 : hide apache webserver information & mod_security curl, nc, httprint 등으로 서버의 정보를 수집하는 방법은 다양하다. 도메인이나 ip주소를 입력하면 해당 서버의 OS, 웹서버, 네임서버 등의 정보를
aegypius.tistory.com