[펌] 웹방화벽 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>
덕분에 추가 했습니다..^^
아무튼 화이팅 하시길 바랍니다.
게시판 목록
프로그램
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 2030 | 17년 전 | 2800 | ||
| 2029 | 17년 전 | 1605 | ||
| 2028 | 17년 전 | 1352 | ||
| 2027 | 17년 전 | 1611 | ||
| 2026 |
진정한승리
|
17년 전 | 2520 | |
| 2025 | 17년 전 | 1742 | ||
| 2024 | 17년 전 | 2021 | ||
| 2023 | 17년 전 | 1314 | ||
| 2022 |
SE7EN
|
17년 전 | 1051 | |
| 2021 | 17년 전 | 1129 | ||
| 2020 | 17년 전 | 2931 | ||
| 2019 | 17년 전 | 2475 | ||
| 2018 | 17년 전 | 2051 | ||
| 2017 | 17년 전 | 2052 | ||
| 2016 | 17년 전 | 1805 | ||
| 2015 | 17년 전 | 2254 | ||
| 2014 | 17년 전 | 2019 | ||
| 2013 | 17년 전 | 1987 | ||
| 2012 | 17년 전 | 1878 | ||
| 2011 | 17년 전 | 1218 | ||
| 2010 | 17년 전 | 1824 | ||
| 2009 | 17년 전 | 2231 | ||
| 2008 | 17년 전 | 2309 | ||
| 2007 | 17년 전 | 1642 | ||
| 2006 |
Arone
|
17년 전 | 1515 | |
| 2005 |
|
17년 전 | 1364 | |
| 2004 | 17년 전 | 2588 | ||
| 2003 |
suerte
|
17년 전 | 2682 | |
| 2002 |
suerte
|
17년 전 | 2083 | |
| 2001 |
suerte
|
17년 전 | 2425 | |
| 2000 |
|
17년 전 | 2730 | |
| 1999 |
|
17년 전 | 1333 | |
| 1998 |
|
17년 전 | 1199 | |
| 1997 | 17년 전 | 6335 | ||
| 1996 | 17년 전 | 1190 | ||
| 1995 | 17년 전 | 1633 | ||
| 1994 | 17년 전 | 1783 | ||
| 1993 | 17년 전 | 1111 | ||
| 1992 | 17년 전 | 1201 | ||
| 1991 | 17년 전 | 1898 | ||
| 1990 |
sdjsu
|
17년 전 | 1526 | |
| 1989 | 17년 전 | 3625 | ||
| 1988 |
smilesol
|
17년 전 | 1215 | |
| 1987 |
|
17년 전 | 1911 | |
| 1986 | 17년 전 | 1192 | ||
| 1985 | 17년 전 | 1394 | ||
| 1984 | 17년 전 | 2369 | ||
| 1983 | 17년 전 | 2028 | ||
| 1982 | 17년 전 | 1044 | ||
| 1981 | 17년 전 | 1051 | ||
| 1980 | 17년 전 | 1109 | ||
| 1979 |
오렌지76
|
17년 전 | 6055 | |
| 1978 |
오렌지76
|
17년 전 | 5854 | |
| 1977 | 17년 전 | 2042 | ||
| 1976 |
없어씨바라
|
17년 전 | 1034 | |
| 1975 | 17년 전 | 1121 | ||
| 1974 | 17년 전 | 2087 | ||
| 1973 | 17년 전 | 1521 | ||
| 1972 | 17년 전 | 1161 | ||
| 1971 |
smilesol
|
17년 전 | 1201 | |
| 1970 | 17년 전 | 1150 | ||
| 1969 |
smilesol
|
17년 전 | 1070 | |
| 1968 |
소행성블루
|
17년 전 | 3974 | |
| 1967 |
소행성블루
|
17년 전 | 2179 | |
| 1966 | 17년 전 | 1654 | ||
| 1965 |
소행성블루
|
17년 전 | 2781 | |
| 1964 |
고양Ol아빠
|
17년 전 | 1484 | |
| 1963 | 17년 전 | 1172 | ||
| 1962 | 17년 전 | 1191 | ||
| 1961 |
choijinhee
|
17년 전 | 1252 | |
| 1960 | 17년 전 | 1136 | ||
| 1959 | 17년 전 | 1257 | ||
| 1958 |
하이웹솔루션
|
17년 전 | 2411 | |
| 1957 | 17년 전 | 4194 | ||
| 1956 | 17년 전 | 1195 | ||
| 1955 | 17년 전 | 3955 | ||
| 1954 | 17년 전 | 4111 | ||
| 1953 | 17년 전 | 1238 | ||
| 1952 | 17년 전 | 2186 | ||
| 1951 | 17년 전 | 1624 | ||
| 1950 | 17년 전 | 3220 | ||
| 1949 | 17년 전 | 1368 | ||
| 1948 | 17년 전 | 3616 | ||
| 1947 | 17년 전 | 3407 | ||
| 1946 | 17년 전 | 2577 | ||
| 1945 | 17년 전 | 2942 | ||
| 1944 | 17년 전 | 2634 | ||
| 1943 | 17년 전 | 1953 | ||
| 1942 | 17년 전 | 3315 | ||
| 1941 | 17년 전 | 2629 | ||
| 1940 | 17년 전 | 3527 | ||
| 1939 |
|
17년 전 | 1166 | |
| 1938 | 17년 전 | 2251 | ||
| 1937 | 17년 전 | 1327 | ||
| 1936 |
smilesol
|
17년 전 | 1200 | |
| 1935 |
AHEEZII
|
17년 전 | 1065 | |
| 1934 |
smilesol
|
17년 전 | 1044 | |
| 1933 | 17년 전 | 1419 | ||
| 1932 | 17년 전 | 2862 | ||
| 1931 | 17년 전 | 3254 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기