[펌] 웹방화벽 mod_security 다운로드 및 설정
링크
http://www.modsecurity.org/download/direct.html (203) http://www.superuser.co.kr/home/lecture/index.php?cateNo=2&secNo=13&theNo=38&leccode=10958 (179)공개 웹방화벽 Mod_Security
mod_security란?
mod_security는 웹어플리케이션 방화벽 이다
현재 공격유형을 보면 70%이상이 웹 어플리케이션레벨에서 이루어지고 있으며 이러한
공격으로부터 보다 안전하게 시스템이 유지될 수 있도록 해주는 것이 mod_security이다.
이는 mod_security가 단순 URL 뿐 아니라 GET, POST 값 그리고 HTTP1.1의 스펙을
분석하고 검사할 수 있어 실제 웹상에서 명령어를 치고 들어오는 웹해킹 및 크래킹을
방어하는 모듈이다.
설치 방법
아파치에서 설치하기 위해 가장 간단한 방법은 소스를 컴파일 하는 방법이다.
먼저 컴파일하기에 앞서 소스를 다운받디위해서는 아래 URL의사이트에 방문하여
다운받으면 된다 .
다운 받은후 아래와 같이 컴파일을 하면 된다.
$ /path/to/apache/bin/apxs -cia mod_security.c
# /path/to/apache/bin/apachectl stop
# /path/to/apache/bin/apachectl start
단 윈도우즈에서 운영중이라면 미러 사이트에서 미리 컴파일된 dll을 다운 받으면 된다.
설정에 사용되는 지시어
SecFilterEngine (On|Off) : mod_security에 의한 필터를 시작할지에 대한 지시어
SecFilterScanPOST (On|Off) : POST로 정송되는 데이터에 대한 필터의 사용여부
SecFilterDefaultAction (pass|deny|status|redirect|exec|log|nolog)
이는 필터에 의해 검출이 된 경우 기본적으로 어떻게 처리할지에한 지시이다 .
pass : 검출되어도 필터링 하지 말고 통과
deny : 검출되면 요청 거부 (기본적으로 500에러 리턴)
status : 검출되거나 기타 이벤트발생시 반환할 에러
redirect : 검출되거나 기타 이벤트발생시 리다이렉트 시킴
exec : 검출되거나 기타 이벤트발생시 실행할 CGI
log : 로그를 남김
nolog : 로그를 남기지않음
SecFilterCheckURLEncoding (On|Off) 인코딩된 문자열을 기존의 문자열로 반환
SecFilterDebugLog logs <filename> : 해당 파일명으로 로그남김
SecFilterDebugLevel <log level (int)> :
0으로 설정하면 로그가 남지 않음
1. 치명적인 로그를 남기며
2~3 으로갈수록 자세한 정보를 남김
SecFilter KEYWORD : HTTP요청으로 들어오는 패킷에서 KEYWORD에 해당하는 요청이있으면 검출함
ex) SecFilter “../
SecFilterSelective [VARIABLES] (REGULAR|string)
웹헤더의 특정 필드나 특정아파치 변수의 값을 검출할 수 있음
SecFilterSignatureAction : 다음 해당 지시어가나올때까지 하나의 체인을 구성
해당체인에 대한 필터 액선을 지정할수 있음
실제 사용되는 예제
아래에서 크로스 사이트스크립트를 차단하는 룰을 차단해보겟다
1. <script> 라는 태그를 무력화시킨다.
2. javacript, vbscript의 지시어를 무력화시킨다.
3. 쿠키정보를 열람하는 것을 무력화시킨다.
4. 해당 페이지를 다른 페이지로 리다이렉트 하는 것을 무력화시키다
5. 해당페이지에 스크립트로 다른 소스를 삽입하는 것을 무력화시킨다.
# 해당 지시어가 다시 나올때까지 체인을 구성하며 필터링시 XSS attack이라는
# 로그를 남기며 필터링시 차단을 하라.
SecFilterSignatureAction "log,deny,msg:'XSS attack'"
# 넘어오는 값중에 “<script“라는 문자를 필터링하라
SecFilterSelective ARGS "<script"
# 넘어오는 값중에 "javascript:"문자를 필터링하라
SecFilterSelective ARGS "javascript:"
# 넘어오는 값중에 "vbscript:"문자를 필터링하라
SecFilterSelective ARGS "vbscript:"
# 넘어오는 값중에 "document\.cookie"문자를 필터링하라
SecFilterSelective ARGS "document\.cookie"
# 넘어오는 값중에 "document\.location"문자를 필터링하라
SecFilterSelective ARGS "document\.location"
# 넘어오는 값중에 "document\.write" 문자를 필터링하라
SecFilterSelective ARGS "document\.write"
댓글 6개
<IfModule mod_security.c>
# Enable ModSecurity
SecFilterEngine On
# Reject requests with status 403
SecFilterDefaultAction "deny,log,status:403"
# Some sane defaults
SecFilterScanPOST On
SecFilterCheckURLEncoding On
SecFilterCheckUnicodeEncoding Off
# Accept almost all byte values
SecFilterForceByteRange 1 255
# Server masking is optional
# SecServerSignature "Microsoft-IIS/5.0"
# Designate a directory for temporary files
# storage. It is a good idea to change the
# value below to a private directory, just as
# an additional measure against race conditions
SecUploadDir /tmp
SecUploadKeepFiles Off
# Only record the interesting stuff
SecAuditEngine RelevantOnly
# Uncomment below to record responses with unusual statuses
# SecAuditLogRelevantStatus ^5
SecAuditLog logs/modsec_audit.log
# You normally won't need debug logging
SecFilterDebugLevel 0
SecFilterDebugLog logs/modsec_debug.log
# Only accept request encodings we know how to handle
# we exclude GET requests from this because some (automated)
# clients supply "text/html" as Content-Type
SecFilterSelective REQUEST_METHOD "!^(GET|HEAD)$" chain
SecFilterSelective HTTP_Content-Type "!(^application/x-www-form-urlencoded$|^multipart/form-data;)"
# Do not accept GET or HEAD requests with bodies
SecFilterSelective REQUEST_METHOD "^(GET|HEAD)$" chain
SecFilterSelective HTTP_Content-Length "!^$"
# Require Content-Length to be provided with
# every POST request
SecFilterSelective REQUEST_METHOD "^POST$" chain
SecFilterSelective HTTP_Content-Length "^$"
# Don't accept transfer encodings we know we don't handle
SecFilterSelective HTTP_Transfer-Encoding "!^$"
</IfModule>
덕분에 추가 했습니다..^^
아무튼 화이팅 하시길 바랍니다.
게시판 목록
프로그램
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 1630 | 18년 전 | 2372 | ||
| 1629 | 18년 전 | 2842 | ||
| 1628 |
인스웨이브시스템즈
|
18년 전 | 4619 | |
| 1627 | 18년 전 | 2686 | ||
| 1626 |
silence
|
18년 전 | 1879 | |
| 1625 |
|
18년 전 | 3327 | |
| 1624 | 18년 전 | 3146 | ||
| 1623 | 18년 전 | 3871 | ||
| 1622 | 18년 전 | 2181 | ||
| 1621 | 18년 전 | 2362 | ||
| 1620 | 18년 전 | 10019 | ||
| 1619 | 18년 전 | 3515 | ||
| 1618 | 18년 전 | 3316 | ||
| 1617 | 18년 전 | 3195 | ||
| 1616 |
|
18년 전 | 2806 | |
| 1615 | 18년 전 | 4168 | ||
| 1614 |
에스카르고
|
18년 전 | 5513 | |
| 1613 | 18년 전 | 3751 | ||
| 1612 | 18년 전 | 3203 | ||
| 1611 | 18년 전 | 3613 | ||
| 1610 |
DHenny
|
18년 전 | 2269 | |
| 1609 | 18년 전 | 2697 | ||
| 1608 |
|
18년 전 | 3930 | |
| 1607 | 18년 전 | 2860 | ||
| 1606 |
|
18년 전 | 4374 | |
| 1605 | 18년 전 | 2091 | ||
| 1604 |
|
18년 전 | 2537 | |
| 1603 |
|
18년 전 | 2425 | |
| 1602 |
|
18년 전 | 3785 | |
| 1601 |
|
18년 전 | 3851 | |
| 1600 | 18년 전 | 2583 | ||
| 1599 | 18년 전 | 2655 | ||
| 1598 | 18년 전 | 2991 | ||
| 1597 |
|
18년 전 | 2812 | |
| 1596 |
|
18년 전 | 2020 | |
| 1595 |
|
18년 전 | 2186 | |
| 1594 | 18년 전 | 4837 | ||
| 1593 | 18년 전 | 4180 | ||
| 1592 | 18년 전 | 2807 | ||
| 1591 | 18년 전 | 2368 | ||
| 1590 | 18년 전 | 2879 | ||
| 1589 | 18년 전 | 2345 | ||
| 1588 |
|
18년 전 | 3515 | |
| 1587 | 18년 전 | 2176 | ||
| 1586 | 18년 전 | 1975 | ||
| 1585 | 18년 전 | 1828 | ||
| 1584 | 18년 전 | 1649 | ||
| 1583 | 18년 전 | 3244 | ||
| 1582 | 18년 전 | 4561 | ||
| 1581 | 18년 전 | 4842 | ||
| 1580 |
|
18년 전 | 2133 | |
| 1579 | 18년 전 | 3584 | ||
| 1578 | 18년 전 | 3313 | ||
| 1577 | 18년 전 | 4610 | ||
| 1576 | 18년 전 | 3241 | ||
| 1575 | 18년 전 | 4245 | ||
| 1574 |
개발전문가
|
18년 전 | 3939 | |
| 1573 |
mixdesign
|
18년 전 | 3646 | |
| 1572 |
mixdesign
|
18년 전 | 3025 | |
| 1571 |
mixdesign
|
18년 전 | 2910 | |
| 1570 | 18년 전 | 3489 | ||
| 1569 |
mixdesign
|
18년 전 | 2142 | |
| 1568 |
mixdesign
|
18년 전 | 2108 | |
| 1567 | 18년 전 | 5513 | ||
| 1566 |
mixdesign
|
18년 전 | 2690 | |
| 1565 |
mixdesign
|
18년 전 | 2446 | |
| 1564 | 18년 전 | 2749 | ||
| 1563 | 18년 전 | 2083 | ||
| 1562 | 18년 전 | 3086 | ||
| 1561 | 18년 전 | 10036 | ||
| 1560 |
행복속네잎크로버
|
18년 전 | 1928 | |
| 1559 | 18년 전 | 2838 | ||
| 1558 |
1111111
|
18년 전 | 2878 | |
| 1557 |
1111111
|
18년 전 | 2131 | |
| 1556 |
1111111
|
18년 전 | 2977 | |
| 1555 |
1111111
|
18년 전 | 3983 | |
| 1554 |
1111111
|
18년 전 | 2928 | |
| 1553 |
1111111
|
18년 전 | 2303 | |
| 1552 |
1111111
|
18년 전 | 6024 | |
| 1551 |
1111111
|
18년 전 | 3653 | |
| 1550 |
1111111
|
18년 전 | 6325 | |
| 1549 |
1111111
|
18년 전 | 2416 | |
| 1548 |
1111111
|
18년 전 | 2349 | |
| 1547 |
1111111
|
18년 전 | 2381 | |
| 1546 |
1111111
|
18년 전 | 3320 | |
| 1545 |
1111111
|
18년 전 | 3176 | |
| 1544 |
1111111
|
18년 전 | 1960 | |
| 1543 |
1111111
|
18년 전 | 3693 | |
| 1542 |
1111111
|
18년 전 | 1610 | |
| 1541 |
1111111
|
18년 전 | 1354 | |
| 1540 |
1111111
|
18년 전 | 1380 | |
| 1539 |
1111111
|
18년 전 | 1535 | |
| 1538 |
1111111
|
18년 전 | 1629 | |
| 1537 |
스카이부아
|
18년 전 | 3422 | |
| 1536 |
1111111
|
18년 전 | 2251 | |
| 1535 |
1111111
|
18년 전 | 1716 | |
| 1534 |
1111111
|
18년 전 | 2101 | |
| 1533 |
1111111
|
18년 전 | 4598 | |
| 1532 |
1111111
|
18년 전 | 2336 | |
| 1531 |
1111111
|
18년 전 | 2985 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기