[펌] 웹방화벽 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>
덕분에 추가 했습니다..^^
아무튼 화이팅 하시길 바랍니다.
게시판 목록
프로그램
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 2230 | 16년 전 | 1290 | ||
| 2229 | 16년 전 | 2161 | ||
| 2228 | 16년 전 | 3225 | ||
| 2227 | 16년 전 | 2166 | ||
| 2226 | 16년 전 | 1753 | ||
| 2225 | 16년 전 | 1512 | ||
| 2224 |
|
16년 전 | 2045 | |
| 2223 | 16년 전 | 4730 | ||
| 2222 | 16년 전 | 1410 | ||
| 2221 |
|
16년 전 | 2146 | |
| 2220 |
|
16년 전 | 2135 | |
| 2219 |
|
16년 전 | 2406 | |
| 2218 |
|
16년 전 | 2147 | |
| 2217 |
|
16년 전 | 4440 | |
| 2216 |
|
16년 전 | 2927 | |
| 2215 | 16년 전 | 2866 | ||
| 2214 | 16년 전 | 1602 | ||
| 2213 | 16년 전 | 1250 | ||
| 2212 |
|
16년 전 | 3948 | |
| 2211 |
|
16년 전 | 1621 | |
| 2210 |
|
16년 전 | 1617 | |
| 2209 | 16년 전 | 2114 | ||
| 2208 | 16년 전 | 1886 | ||
| 2207 |
letsgolee
|
16년 전 | 1491 | |
| 2206 |
|
16년 전 | 3920 | |
| 2205 | 16년 전 | 1759 | ||
| 2204 | 16년 전 | 3136 | ||
| 2203 | 16년 전 | 3023 | ||
| 2202 | 16년 전 | 1047 | ||
| 2201 | 16년 전 | 1844 | ||
| 2200 | 16년 전 | 1595 | ||
| 2199 |
|
16년 전 | 1854 | |
| 2198 |
태양의서쪽
|
16년 전 | 2644 | |
| 2197 |
태양의서쪽
|
16년 전 | 3025 | |
| 2196 |
태양의서쪽
|
16년 전 | 3227 | |
| 2195 | 16년 전 | 3328 | ||
| 2194 | 16년 전 | 1465 | ||
| 2193 |
letsgolee
|
16년 전 | 1423 | |
| 2192 | 16년 전 | 2258 | ||
| 2191 | 16년 전 | 1976 | ||
| 2190 |
|
17년 전 | 2290 | |
| 2189 | 17년 전 | 2810 | ||
| 2188 |
Sizkein
|
17년 전 | 3261 | |
| 2187 |
letsgolee
|
17년 전 | 2358 | |
| 2186 |
Sizkein
|
17년 전 | 1636 | |
| 2185 |
Sizkein
|
17년 전 | 3208 | |
| 2184 |
Sizkein
|
17년 전 | 3062 | |
| 2183 | 17년 전 | 3041 | ||
| 2182 | 17년 전 | 3918 | ||
| 2181 | 17년 전 | 2584 | ||
| 2180 |
|
17년 전 | 2406 | |
| 2179 | 17년 전 | 2654 | ||
| 2178 | 17년 전 | 2898 | ||
| 2177 | 17년 전 | 2616 | ||
| 2176 | 17년 전 | 1453 | ||
| 2175 | 17년 전 | 1897 | ||
| 2174 | 17년 전 | 1495 | ||
| 2173 |
|
17년 전 | 1923 | |
| 2172 | 17년 전 | 2524 | ||
| 2171 | 17년 전 | 8708 | ||
| 2170 | 17년 전 | 3158 | ||
| 2169 | 17년 전 | 4249 | ||
| 2168 |
|
17년 전 | 1987 | |
| 2167 | 17년 전 | 3659 | ||
| 2166 |
|
17년 전 | 1552 | |
| 2165 | 17년 전 | 1386 | ||
| 2164 | 17년 전 | 2324 | ||
| 2163 | 17년 전 | 1317 | ||
| 2162 | 17년 전 | 1641 | ||
| 2161 | 17년 전 | 1460 | ||
| 2160 | 17년 전 | 2530 | ||
| 2159 |
inxps
|
17년 전 | 1499 | |
| 2158 |
inxps
|
17년 전 | 1093 | |
| 2157 | 17년 전 | 1225 | ||
| 2156 | 17년 전 | 3104 | ||
| 2155 | 17년 전 | 2175 | ||
| 2154 | 17년 전 | 1976 | ||
| 2153 |
|
17년 전 | 1223 | |
| 2152 |
letsgolee
|
17년 전 | 2455 | |
| 2151 | 17년 전 | 1170 | ||
| 2150 |
아름다운세상
|
17년 전 | 1130 | |
| 2149 |
아름다운세상
|
17년 전 | 1378 | |
| 2148 |
아름다운세상
|
17년 전 | 2737 | |
| 2147 |
|
17년 전 | 2399 | |
| 2146 | 17년 전 | 2484 | ||
| 2145 | 17년 전 | 1186 | ||
| 2144 | 17년 전 | 1303 | ||
| 2143 | 17년 전 | 3248 | ||
| 2142 | 17년 전 | 2837 | ||
| 2141 | 17년 전 | 4109 | ||
| 2140 | 17년 전 | 2260 | ||
| 2139 | 17년 전 | 2349 | ||
| 2138 | 17년 전 | 1399 | ||
| 2137 | 17년 전 | 2515 | ||
| 2136 | 17년 전 | 2200 | ||
| 2135 | 17년 전 | 2961 | ||
| 2134 |
아름다운세상
|
17년 전 | 2469 | |
| 2133 |
Juinjang
|
17년 전 | 1630 | |
| 2132 | 17년 전 | 2431 | ||
| 2131 | 17년 전 | 1590 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기