아파치 설정 관련해서 도움을 요청해 봅니다. ^^;

1,074 views
Skip to first unread message

gyehong park

unread,
Jan 19, 2012, 11:05:38 AM1/19/12
to xp...@googlegroups.com
안녕하세요. 박계홍입니다.

구정이 며칠 안 남았습니다. 음력으로도 2012년입니다.
연휴에도 편안하시기를 바랍니다.
인사는 여기까지 하고... ^^;;;

올해 서비스 검수를 하고 있는데 계속 험난한 길을 걷고 있습니다.
혹시 아시는 분이 있다면 도움을 요청드립니다.

테스트 방법
telent으로 아파치 서버에 접속합니다.
telnet 192.168.1.100 443
Trying  192.168.1.100  ...
Connected to aaa.abc.com ( 192.168.1.100).
Escape character is '^]'.

이렇게 되면 일정시간 후에 아파치서버에서 접속을 끊어야 한다고 합니다.
그런데 이 설정 방법을 모르겠습니다.

서버 정보는 아래와 같습니다.
# uname -a
Linux rpcs2 2.6.18-238.el5 #1 SMP Sun Dec 19 14:22:44 EST 2010 x86_64 x86_64 x86_64 GNU/Linux
# cat /etc/issue
Red Hat Enterprise Linux Server release 5.6 (Tikanga)
Kernel \r on an \m

Apache/2.2.21 (Unix) mod_ssl/2.2.21 OpenSSL/0.9.8e-fips-rhel5 DAV/2 PHP/5.3.8

기타 관련 타임아웃 설정
# cat httpd-default.conf
Timeout 5
KeepAlive Off
MaxKeepAliveRequests 1000
KeepAliveTimeout 5

그리고 관련 설정으로 보이는 부분을 하나 찾았는데 정확한지 잘 모르겠습니다.

관련 설정은 httpd.conf 에 맨 아래에 다음과 같이 추가했습니다.(역시 올바른 방법인지 모름)
<IfModule reqtimeout_module>
# Wait max 10 seconds for the first byte of the request line+headers
# From then, require a minimum data rate of 500 bytes/s, but don't
# wait longer than 20 seconds in total.
RequestReadTimeout header=10-20,minrate=500
# Wait max 10 seconds for the first byte of the request body (if any)
# From then, require a minimum data rate of 500 byte/s.
RequestReadTimeout body=5,minrate=500
</IfModule>

위 테스트를 패스할 수 있는 설정 방법을 좀 알려주시면 감사하겠습니다.

SeungBum Kim

unread,
Jan 19, 2012, 11:29:17 AM1/19/12
to xp...@googlegroups.com
예.. 마지막에 reqtimeout_module 설정을 하시면 될 거 같습니다. 보통 기본으로 해당 설정이 되어 있지 않나요?

2012/1/20 gyehong park <gyeho...@gmail.com>



--
김 승 범 (SeungBum Kim)
New Media Literacy Education
+ 82 - 10 - 2686 - 6855 | Twitter: @picxenk
http://xenbio.net | http://smalltalk.kr

SeungBum Kim

unread,
Jan 19, 2012, 11:34:55 AM1/19/12
to xp...@googlegroups.com
물론 그 전에 해당 모듈을 로딩해주셔야하구요. 

2012/1/20 SeungBum Kim <pic...@gmail.com>

JEONG, MunShik

unread,
Jan 19, 2012, 7:47:47 PM1/19/12
to xp...@googlegroups.com
올려주신 설정에서

<IfModule reqtimeout_module>
# Wait max 10 seconds for the first byte of the request line+headers
# From then, require a minimum data rate of 500 bytes/s, but don't
# wait longer than 20 seconds in total.
RequestReadTimeout header=10-20,minrate=500

# Wait max 10 seconds for the first byte of the request body (if any)
# From then, require a minimum data rate of 500 byte/s.
RequestReadTimeout body=5,minrate=500
</IfModule>


일부분을 아래처럼 바꾸고

RequestReadTimeout header=5-20,minrate=500

시험하니 원하시는 대로 잘 도는데요.
(telnet localhost 8090) 하고 5초후에
"Connection closed by foreign host" 라고 떨어집니다.

직접해보시니 좀 달랐던가요?

2012/1/20 SeungBum Kim <pic...@gmail.com>:

gyehong park

unread,
Jan 25, 2012, 8:17:00 AM1/25/12
to xp...@googlegroups.com
이 글을 읽어주신 분들, 답변을 주신 승범님, 문식님 감사드립니다. (__)

문제가 2가지 였습니다.
하나는 제가 했던 설정으로 해결이 된 것이었습니다.
이것의 확인은 telnet으로 접속후에 엔터를 한번 눌러주면, 5초 후에 접속이 끊어집니다.

두번째는 telnet으로 접속 후 엔터를 누르지 않아도 끊어지도록 하는 것입니다.
이 두번째는 syn flooding 공격 원리와 같습니다.
서버에서 
while true; do date; netstat -an | grep :80 ; sleep 1; done
으로 감시를 하고 있다가 telnet ip 80 으로 접속을 하면 SYN_RECV 가 나타납니다. 이것은 tcp/ip의 3way handshake가 아직 끝나지 않은 상태입니다. 제가 조사한 바로는 아파치나 리눅스 설정에서 timeout으로 막는 방법은 없었습니다.(혹시 아시는 분 있다면 알려주세요.)

syn flooding 공격을 막는 가장 효과적인 방법은 
# sysctl -w net.ipv4.tcp_syncookies=1  
같은 명령으로 씬쿠키를 사용하고 관련 설정이 몇 가지 있었습니다.

일단 중간 상황을 공유드립니다~ ^^*

2012년 1월 20일 오전 9:47, JEONG, MunShik <rus...@gmail.com>님의 말:
Reply all
Reply to author
Forward
0 new messages