<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
	<channel>
		<title>거니네 ver 1.0</title>
		<link>http://guni.loveyust.net/</link>
		<description></description>
		<language>ko</language>
		<pubDate>Fri, 08 May 2009 09:03:33 +0800</pubDate>
		<generator>Tistory 1.1 (http://www.tistory.com/)</generator>
		<image>
		<title>거니네 ver 1.0</title>
		<url><![CDATA[http://cfs3.tistory.com/upload_control/download.blog?fhandle=YmxvZzQzODgwQGZzMy50aXN0b3J5LmNvbTovYXR0YWNoLzEvMTI2LnBuZw%3D%3D]]></url>
		<link>http://guni.loveyust.net/</link>
		<description></description>
		</image>
		<item>
			<title>Windows 7 에서 Virtual XP 사용기</title>
			<link>http://guni.loveyust.net/140</link>
			<description>&lt;div style=&quot;padding: 10px; background-color: rgb(93, 93, 93);&quot;&gt;
&lt;span style=&quot;font-weight: bold; color: rgb(255, 255, 255);&quot;&gt;인젠 Windows7 에서도 XP용 프로그램들을 사용할 수 있다~&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
Windows 7용 Virtual XP 가 유출 되었다는 뉴스를 접하고 웹 검색을 거쳐 그 유출본을 다운로드 받었다. &lt;br /&gt;
이미 노트북에 깔린 Windows 7은 7077 빌드 KOR 64비트이다. 아직 7100빌드 버젼은&amp;nbsp; 한글판이 유출되지 않아 설치하지 않은 상태.(한글판을 고집하는 이유는 없다~ㅎㅎ) &lt;br /&gt;
현재 Windows 7 7077버젼도 상당히 안정적으로 VAIO에서 돌아간다. 하지만 몇가지 필수 프로그램때문에 고생을 겪고 있다. 다름아닌 Windows 7를 지원하는 ICBC USB키 드라이버 아직 출시 하지 않아 인터넷 뱅킹을 할려면 별도로 다른 PC로 접근하여 작업을 해야하는 번거로움이 있다. (개인적으로 거의 PC게임을 하지 않으므로 게임호환성땜에 고생을 겪을 일은 없다.ㅎㅎ)&lt;br /&gt;
&lt;br /&gt;
일단 다운로드 받은 유출본을 보면 아래와 같이 5개 파일이 있다.&lt;br /&gt;
&lt;br /&gt;
&lt;table style=&quot;display: inline; border-collapse: collapse&quot;&gt;&lt;tr&gt;&lt;td&gt;&lt;a href=&quot;http://cfile24.uf.tistory.com/original/151DC81349FC0D5DF3D458&quot; rel=&quot;lightbox&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://cfile24.uf.tistory.com/image/151DC81349FC0D5DF3D458&quot; alt=&quot;&quot; filemime=&quot;image/jpeg&quot; filename=&quot;W7_Virtual_XP_2.png&quot; height=&quot;116&quot; width=&quot;253&quot;/&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;br /&gt;
&lt;br /&gt;
먼저 Virtual PC를 설치해야 한다. 현재 사용중인 W7이 64비트 용이므로 Windows6.1-KB958559-x64.msu를 실행하여 설치했다.&lt;br /&gt;
다음 XP도 64비트로 깔기 위하여 VirtualWindowsXP_64_en-US.msi를 설치했다.&lt;br /&gt;
&lt;br /&gt;
&lt;table style=&quot;display: inline; border-collapse: collapse&quot;&gt;&lt;tr&gt;&lt;td&gt;&lt;a href=&quot;http://cfile21.uf.tistory.com/original/1264F91049FC26DD2A4FD0&quot; rel=&quot;lightbox&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://cfile21.uf.tistory.com/image/1264F91049FC26DD2A4FD0&quot; alt=&quot;&quot; filemime=&quot;image/jpeg&quot; filename=&quot;W7_Virtual_XP_3.png&quot; height=&quot;388&quot; width=&quot;470&quot;/&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;br /&gt;
&lt;br /&gt;
지렁이가 대여섯마리 지나가고 XP가 부팅된다.&lt;br /&gt;
&lt;br /&gt;
&lt;table style=&quot;display: inline; border-collapse: collapse&quot;&gt;&lt;tr&gt;&lt;td&gt;&lt;a href=&quot;http://cfile2.uf.tistory.com/original/1666651049FC0E0DA13AB6&quot; rel=&quot;lightbox&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://cfile2.uf.tistory.com/image/1666651049FC0E0DA13AB6&quot; alt=&quot;&quot; filemime=&quot;image/jpeg&quot; filename=&quot;W7_Virtual_XP.png&quot; height=&quot;294&quot; width=&quot;470&quot;/&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;br /&gt;
&lt;br /&gt;
정확히 XP로 부팅이 되고 W7에서 사용중인 HDD 드라이버들이 네트워크 드라이버 형태로 마운트 된다. ^^ (모든 드라이버들이 깔리고 USB도 잘 인식 된다.)&lt;br /&gt;&lt;div class=&quot;entry-ccl&quot; style=&quot;clear: both; text-align: right; margin-bottom: 10px&quot;&gt;
	&lt;img id=&quot;ccl-icon-140-0&quot; class=&quot;entry-ccl-by&quot; src=&quot;http://cfs.tistory.com/static/admin/editor/ccl_black01.png&quot; alt=&quot;저작자 표시&quot;/&gt;
	&lt;img id=&quot;ccl-icon-140-1&quot; class=&quot;entry-ccl-nc&quot; src=&quot;http://cfs.tistory.com/static/admin/editor/ccl_black02.png&quot; alt=&quot;비영리&quot;/&gt;
	&lt;img id=&quot;ccl-icon-140-2&quot; class=&quot;entry-ccl-nd&quot; src=&quot;http://cfs.tistory.com/static/admin/editor/ccl_black03.png&quot; alt=&quot;변경 금지&quot;/&gt;
	&lt;!--
	&lt;rdf:RDF xmlns=&quot;http://web.resource.org/cc/&quot; xmlns:dc=&quot;http://purl.org/dc/elements/1.1/&quot; xmlns:rdf=&quot;http://www.w3.org/1999/02/22-rdf-syntax-ns#&quot;&gt;
		&lt;Work rdf:about=&quot;&quot;&gt;
			&lt;license rdf:resource=&quot;http://creativecommons.org/licenses/by-nc-nd/2.0/kr/&quot; /&gt;
		&lt;/Work&gt;
		&lt;License rdf:about=&quot;http://creativecommons.org/licenses/by-nc-nd/&quot;&gt;
			&lt;permits rdf:resource=&quot;http://web.resource.org/cc/Reproduction&quot;/&gt;
			&lt;permits rdf:resource=&quot;http://web.resource.org/cc/Distribution&quot;/&gt;
			&lt;requires rdf:resource=&quot;http://web.resource.org/cc/Notice&quot;/&gt;
			&lt;requires rdf:resource=&quot;http://web.resource.org/cc/Attribution&quot;/&gt;
			&lt;prohibits rdf:resource=&quot;http://web.resource.org/cc/CommercialUse&quot;/&gt;
		&lt;/License&gt;
	&lt;/rdf:RDF&gt;
	--&gt;
&lt;/div&gt;
</description>
			<category>잡동사니</category>
			<category>ICBC</category>
			<category>virtual pc</category>
			<category>Windows 7</category>
			<category>windows xp</category>
			<author>[GUNi]</author>
			<guid>http://guni.loveyust.net/140</guid>
			<comments>http://guni.loveyust.net/140#entry140comment</comments>
			<pubDate>Sat, 02 May 2009 18:57:10 +0800</pubDate>
		</item>
		<item>
			<title>RAID에 대한 소개 및 RAID를 이용한 시스템의 복구</title>
			<link>http://guni.loveyust.net/139</link>
			<description>RAID는 Redundant Array of Independent Disks의 줄임말이다. 스토리지 시스템에 RAID가 활성화되어 있으면 시스템에 두 개 이상의 드라이브를 연결하여 하나의 큰 드라이브처럼 사용할 수 있고 또는 시스템의 드라이브를 사용하여 사용자 데이터를 자동으로, 지속적으로 복제하여 실시간으로 백업하도록 설정할 수도 있다.&lt;br /&gt;
&lt;br /&gt;
RAID의 장점&lt;br /&gt;
&lt;br /&gt;
RAID 드라이브 시스템을 찾는 이유 세 가지:&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp; 1. 아주 큰 스토리지 공간이 필요한 동시에 속도 또한 빨라야 한다. (RAID 0)&lt;br /&gt;
&amp;nbsp;&amp;nbsp; 2. 데이터를 지속적으로, 자동으로 백업하고 싶다. (RAID 1)&lt;br /&gt;
&amp;nbsp;&amp;nbsp; 3. 두 가지 다 원한다. (RAID 5)&lt;br /&gt;
&lt;br /&gt;
어떤 RAID 모드를 사용해야 할까?&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-weight: bold;&quot;&gt;1. 속도 (RAID 0)&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
고성능 모드(일명 스트리핑 모드 또는 RAID 0)로 설정하면 다음의 경우 스토리지 시스템에서 사용자가 필요로 하는 파워를 제공 받을 수 있다.&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; * 대용량 그래픽 디자인 및 매우 빠른 Photoshop 스크래치 공간이 필요.&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; * 깨끗한 오디오 성능을 유지하면서 대용량 DV 파일을 녹화하려 할 때&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; * DV 또는 HD 비디오 편집 및 프레임 드롭없는 부드러운 워크플로우 요구.&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; * 복잡한 3D 오브젝트 또는 특수 효과를 렌더링할 때&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; * 디스크 집약적인 데이터베이스 작업을 수행할 때&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; * 놀라울 정도로 정말 빠른 컴퓨터에 처음으로 매료된 때&lt;br /&gt;
&lt;br /&gt;
RAID 0의 속도가 빠른 이유가 무엇을가? 설명하기 약간 복잡하긴 하지만, 헤드는 두 개 또는 그 이상, 이 경우, 드라이브는 하나 이상인 것이 좋다고 말할 수 있다. 여러 개의 호스로 동시에 하나의 양동이에 물을 채우고 있는 사진과 여러 사람이 하나의 보트를 노젓고 있는 사진을 보면, 스트리핑한 두 개 드라이브가 왜 하나보다 더 빠른지 이해할 수 있다. 데이터는 양쪽 드라이브에 저장되고 액세스는 모든 드라이브에서 병렬로 가능하기 때문에 사용자는 대용량 데이터 액세스시 데이터 전송률을 높일 수 있고 작은 데이터에 액세스할 때는 입출력 속도를 높일 수 있다.&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-weight: bold;&quot;&gt;2. 데이터 보호 (RAID 1)&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
시스템을 데이터 보호 모드로 설정하면(일명, 미러링 모드 또는 RAID 1) 용량이 절반으로 나누어진다. 용량의 절반은 데이터 보관에 이용되고 나머지 반은 사본 복제에 이용된다. (서버운영시 많이 사용하는 RAID방식~)&lt;br /&gt;
&lt;br /&gt;
그 런 중복성이 왜 필요한가요? 당신의 데이터, 가족 사진, 사랑스런 아기의 첫 걸음마에 관한 영상, 당신이 쓴 첫 소설. 다시 얻을 수 없는 중요한 자료이다. 또한 서버 운영시 한 HDD에 문제생김으로 인한 데이타의 유실 및 지속적인 서비스 등이 필요하기 때문에 RAID방식으로 시스템을 구성하면 더욱 안전하게 서버를 운영할 수 있다.&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-weight: bold;&quot;&gt;3. 데이터 보호 및 속도(RAID 5)&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
세 개 또는 그 이상의 드라이브를 갖춘 시스템(WD의 N8 TB WD ShareSpace™ 네트워크 스토리지 시스템처럼)의 경우 시스템을 RAID 5로 설정할 것을 권장한다. 이것이 최적의 구성이다. 모든 드라이브에 걸쳐 데이터를 스트리핑함으로써 성능을 높이고 각 드라이브의 1/4를 내고장성에 할애하고 나머지 부분은 데이터 저장 공간으로 남겨둠으로써 데이터 보호 성능을 최대화한다.&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-weight: bold;&quot;&gt;문제점 발생시 해결책&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
직접 /proc/mdstat를 읽는 방식으로 현재 구성된 RAID의 상태에 대하여 알아볼 수 있다. 하지만 이런 방식으로 상태를 알아보는건 그다지 효율적이지 못하다.&lt;br /&gt;
&lt;br /&gt;
mdadm --detail를 이용하여 다중 하드 디스크 상태를 알아보는것이 더욱 편하고 효율적이다.&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;border: 1px dotted rgb(144, 224, 255); padding: 10px; background-color: rgb(36, 46, 64);&quot;&gt;
&lt;span style=&quot;color: rgb(255, 255, 255);&quot;&gt;# mdadm --detail /dev/md2 | tail -n 3&lt;/span&gt;&lt;br style=&quot;color: rgb(255, 255, 255);&quot;&gt;&lt;span style=&quot;color: rgb(255, 255, 255);&quot;&gt;
&amp;nbsp;&amp;nbsp; Number&amp;nbsp;&amp;nbsp; Major&amp;nbsp;&amp;nbsp; Minor&amp;nbsp;&amp;nbsp; RaidDevice State&lt;/span&gt;&lt;br style=&quot;color: rgb(255, 255, 255);&quot;&gt;&lt;span style=&quot;color: rgb(255, 255, 255);&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 8&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; active sync&amp;nbsp;&amp;nbsp; /dev/sda3&lt;/span&gt;&lt;br style=&quot;color: rgb(255, 255, 255);&quot;&gt;&lt;span style=&quot;color: rgb(255, 255, 255);&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 8&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 19&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; active sync&amp;nbsp;&amp;nbsp; /dev/sdb3&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
위 예제는 md2 다중 하드 디스크 상태를 보여주는것이다.&lt;br /&gt;
상태를 보면 모두 active sync로 되었음을 알수 있다. 즉 RAID가 정상적으로 작동하고 있다.^^&lt;br /&gt;
만약 그중 한 하드디스크에 문제가 발생했다면 active sync대신 faulty spare라는 메세지가 뜰 것이다.&lt;br /&gt;
&lt;br /&gt;
만약 이런 상황에 맞띄웠다면 당황해할 필요가 없다. 우리가 설치한 보조 하드디스크가 나머지 데이타를 고스란히 가지고 있기 때문이다. 우리가 해야 할 작업은 망가진 하드디스크만 빼내면 그뿐이다.&lt;br /&gt;
&lt;br /&gt;
① mdadm MD_DEVICE --remove DEVICE를 이용하여 문제가 발생한 하드 디스크를 제거한다.&lt;br /&gt;
② 서버를 잠시 중지시키고 물리적으로 문제가 생긴 하드 디스크를 제거한다.&lt;br /&gt;
③ 정상적인 하드 디스크를 설치한후 새로운 파티션을 생성한다.&lt;br /&gt;
④ mdadm MD_DEVICE --add DEVICE를 이용하여 새롭게 만든 파티션을 md에 물린다.&lt;br /&gt;
&lt;br /&gt;
실제 문제가 발생할 였을 때 해결하는 과정을 보여주면 다음과 같다.&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;border: 1px dotted rgb(144, 224, 255); padding: 10px; background-color: rgb(36, 46, 64);&quot;&gt;
&lt;span style=&quot;color: rgb(255, 255, 255);&quot;&gt;# mdadm --detail /dev/md2 | tail -n 3&lt;/span&gt;&lt;br style=&quot;color: rgb(255, 255, 255);&quot;&gt;&lt;span style=&quot;color: rgb(255, 255, 255);&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; Number&amp;nbsp;&amp;nbsp; Major&amp;nbsp;&amp;nbsp; Minor&amp;nbsp;&amp;nbsp; RaidDevice State&lt;/span&gt;&lt;br style=&quot;color: rgb(255, 255, 255);&quot;&gt;&lt;span style=&quot;color: rgb(255, 255, 255);&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 8&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; faulty spare &amp;nbsp; /dev/sda3&lt;/span&gt;&lt;br style=&quot;color: rgb(255, 255, 255);&quot;&gt;&lt;span style=&quot;color: rgb(255, 255, 255);&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 8&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 19&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; active sync&amp;nbsp;&amp;nbsp; /dev/sdb3&lt;/span&gt;&lt;br style=&quot;color: rgb(255, 255, 255);&quot;&gt;&lt;span style=&quot;color: rgb(255, 255, 255);&quot;&gt;
# mdadm /dev/md2 --remove /dev/sdb3&lt;/span&gt;&lt;br style=&quot;color: rgb(255, 255, 255);&quot;&gt;&lt;span style=&quot;color: rgb(255, 255, 255);&quot;&gt;
mdadm: hot removed /dev/sda3&lt;/span&gt;&lt;br style=&quot;color: rgb(255, 255, 255);&quot;&gt;
&lt;br style=&quot;color: rgb(255, 255, 255);&quot;&gt;&lt;span style=&quot;color: rgb(255, 255, 255);&quot;&gt;reboot...&lt;/span&gt;&lt;br style=&quot;color: rgb(255, 255, 255);&quot;&gt;
&lt;br style=&quot;color: rgb(255, 255, 255);&quot;&gt;&lt;span style=&quot;color: rgb(255, 255, 255);&quot;&gt;// 새로 파티션을 만들어 주는 과정이 필요함...&lt;/span&gt;&lt;br style=&quot;color: rgb(255, 255, 255);&quot;&gt;
&lt;br style=&quot;color: rgb(255, 255, 255);&quot;&gt;&lt;span style=&quot;color: rgb(255, 255, 255);&quot;&gt;# mdadm --detail /dev/md2 | tail -n 3&lt;/span&gt;&lt;br style=&quot;color: rgb(255, 255, 255);&quot;&gt;&lt;span style=&quot;color: rgb(255, 255, 255);&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; Number&amp;nbsp;&amp;nbsp; Major&amp;nbsp;&amp;nbsp; Minor&amp;nbsp;&amp;nbsp; RaidDevice State&lt;/span&gt;&lt;br style=&quot;color: rgb(255, 255, 255);&quot;&gt;&lt;span style=&quot;color: rgb(255, 255, 255);&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0 &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0 &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; removed&lt;/span&gt;&lt;br style=&quot;color: rgb(255, 255, 255);&quot;&gt;&lt;span style=&quot;color: rgb(255, 255, 255);&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 8&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 19&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; active sync&amp;nbsp;&amp;nbsp; /dev/sdb3&lt;/span&gt;&lt;br style=&quot;color: rgb(255, 255, 255);&quot;&gt;
&lt;br style=&quot;color: rgb(255, 255, 255);&quot;&gt;&lt;span style=&quot;color: rgb(255, 255, 255);&quot;&gt;# mdadm /dev/md2 --add /dev/sdc3&lt;/span&gt;&lt;br style=&quot;color: rgb(255, 255, 255);&quot;&gt;&lt;span style=&quot;color: rgb(255, 255, 255);&quot;&gt;
mdadm: added /dev/sdc3&lt;/span&gt;&lt;br style=&quot;color: rgb(255, 255, 255);&quot;&gt;
&lt;br style=&quot;color: rgb(255, 255, 255);&quot;&gt;&lt;span style=&quot;color: rgb(255, 255, 255);&quot;&gt;# mdadm --detail /dev/md2 | tail -n 3&lt;/span&gt;&lt;br style=&quot;color: rgb(255, 255, 255);&quot;&gt;&lt;span style=&quot;color: rgb(255, 255, 255);&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; Number&amp;nbsp;&amp;nbsp; Major&amp;nbsp;&amp;nbsp; Minor&amp;nbsp;&amp;nbsp; RaidDevice State&lt;/span&gt;&lt;br style=&quot;color: rgb(255, 255, 255);&quot;&gt;&lt;span style=&quot;color: rgb(255, 255, 255);&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2 &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 8 &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 20 &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; spare rebuilding&amp;nbsp;&amp;nbsp;&amp;nbsp; /dev/sdc3&lt;/span&gt;&lt;br style=&quot;color: rgb(255, 255, 255);&quot;&gt;&lt;span style=&quot;color: rgb(255, 255, 255);&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 8&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 19&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; active sync&amp;nbsp;&amp;nbsp; /dev/sdb3&lt;/span&gt;&lt;br style=&quot;color: rgb(255, 255, 255);&quot;&gt;
&lt;br style=&quot;color: rgb(255, 255, 255);&quot;&gt;&lt;span style=&quot;color: rgb(255, 255, 255);&quot;&gt;# mdadm --detail /dev/md2 | tail -n 3&lt;/span&gt;&lt;br style=&quot;color: rgb(255, 255, 255);&quot;&gt;&lt;span style=&quot;color: rgb(255, 255, 255);&quot;&gt;

&amp;nbsp;&amp;nbsp;&amp;nbsp; Number&amp;nbsp;&amp;nbsp; Major&amp;nbsp;&amp;nbsp; Minor&amp;nbsp;&amp;nbsp; RaidDevice State&lt;/span&gt;&lt;br style=&quot;color: rgb(255, 255, 255);&quot;&gt;&lt;span style=&quot;color: rgb(255, 255, 255);&quot;&gt;

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0 &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 8 &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 20 &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; spare sync &amp;nbsp;&amp;nbsp; /dev/sdc3&lt;/span&gt;&lt;br style=&quot;color: rgb(255, 255, 255);&quot;&gt;&lt;span style=&quot;color: rgb(255, 255, 255);&quot;&gt;

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 8 &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 19 &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; active sync&amp;nbsp;&amp;nbsp; /dev/sdb3&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;&lt;div class=&quot;entry-ccl&quot; style=&quot;clear: both; text-align: right; margin-bottom: 10px&quot;&gt;
	&lt;img id=&quot;ccl-icon-139-0&quot; class=&quot;entry-ccl-by&quot; src=&quot;http://cfs.tistory.com/static/admin/editor/ccl_black01.png&quot; alt=&quot;저작자 표시&quot;/&gt;
	&lt;img id=&quot;ccl-icon-139-1&quot; class=&quot;entry-ccl-nc&quot; src=&quot;http://cfs.tistory.com/static/admin/editor/ccl_black02.png&quot; alt=&quot;비영리&quot;/&gt;
	&lt;img id=&quot;ccl-icon-139-2&quot; class=&quot;entry-ccl-nd&quot; src=&quot;http://cfs.tistory.com/static/admin/editor/ccl_black03.png&quot; alt=&quot;변경 금지&quot;/&gt;
	&lt;!--
	&lt;rdf:RDF xmlns=&quot;http://web.resource.org/cc/&quot; xmlns:dc=&quot;http://purl.org/dc/elements/1.1/&quot; xmlns:rdf=&quot;http://www.w3.org/1999/02/22-rdf-syntax-ns#&quot;&gt;
		&lt;Work rdf:about=&quot;&quot;&gt;
			&lt;license rdf:resource=&quot;http://creativecommons.org/licenses/by-nc-nd/2.0/kr/&quot; /&gt;
		&lt;/Work&gt;
		&lt;License rdf:about=&quot;http://creativecommons.org/licenses/by-nc-nd/&quot;&gt;
			&lt;permits rdf:resource=&quot;http://web.resource.org/cc/Reproduction&quot;/&gt;
			&lt;permits rdf:resource=&quot;http://web.resource.org/cc/Distribution&quot;/&gt;
			&lt;requires rdf:resource=&quot;http://web.resource.org/cc/Notice&quot;/&gt;
			&lt;requires rdf:resource=&quot;http://web.resource.org/cc/Attribution&quot;/&gt;
			&lt;prohibits rdf:resource=&quot;http://web.resource.org/cc/CommercialUse&quot;/&gt;
		&lt;/License&gt;
	&lt;/rdf:RDF&gt;
	--&gt;
&lt;/div&gt;
</description>
			<category>리눅스 자료</category>
			<category>Active Sync</category>
			<category>faulty spare</category>
			<category>mdadm</category>
			<category>raid</category>
			<category>Software RAID</category>
			<category>spare sync</category>
			<author>[GUNi]</author>
			<guid>http://guni.loveyust.net/139</guid>
			<comments>http://guni.loveyust.net/139#entry139comment</comments>
			<pubDate>Wed, 29 Apr 2009 09:49:26 +0800</pubDate>
		</item>
		<item>
			<title>SSH의 Brute Force Attak을 막기</title>
			<link>http://guni.loveyust.net/138</link>
			<description>&lt;div style=&quot;padding: 10px; background-color: rgb(93, 93, 93);&quot;&gt;
&lt;span style=&quot;color: rgb(255, 255, 255); font-weight: bold;&quot;&gt;가장 무식하지만서도 가장 확실한 SSH의 Brute Force Attack을 막기&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
SSH Brute Force Attack이란 흔한 사용자 이름과 암호로 ssh를 계속 접속해서 해킹을 시도하는 방법으로 잘못 이용되었을 경우 악영향을 끼친다. 기본으로 SSH 포트를 바꾸어버려 어느정도 SSH BFA를 막을 수도 있겠지만 확실한 해결책이 못된다.&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-weight: bold;&quot;&gt;방어방법&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;border: 1px dotted rgb(128, 184, 136); padding: 10px; background-color: rgb(40, 86, 58);&quot;&gt;
&lt;span style=&quot;color: rgb(255, 255, 255);&quot;&gt;1. 강한 비밀번호 설정&lt;/span&gt;&lt;br style=&quot;color: rgb(255, 255, 255);&quot;&gt;&lt;span style=&quot;color: rgb(255, 255, 255);&quot;&gt;
2. RSA 인증 방식 사용&lt;/span&gt;&lt;br style=&quot;color: rgb(255, 255, 255);&quot;&gt;&lt;span style=&quot;color: rgb(255, 255, 255);&quot;&gt;
3. iptables를 이용한 패킷 Drop&lt;/span&gt;&lt;br style=&quot;color: rgb(255, 255, 255);&quot;&gt;&lt;span style=&quot;color: rgb(255, 255, 255);&quot;&gt;
4. sshd 로그를 이용하여 공격을 막기&lt;/span&gt;&lt;span style=&quot;color: rgb(255, 255, 255);&quot;&gt;&lt;/span&gt;&lt;span style=&quot;color: rgb(255, 255, 255);&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;span style=&quot;font-weight: bold;&quot;&gt;1. 강한 비밀번호 설정&lt;/span&gt;&lt;br /&gt;
웬만하면 쉬운 비밀번호나 알아내기 쉬운 비밀번호를 쓰지 않도록 하는것이 좋다. 이미 쉬운비밀번호나 알아내기 쉬운 비밀번호들은 해커들의 Dic파일속에 존재하기 때문에 BFA를 몇시간째 돌리고 있으면 인츰 비밀번호가 깨질 수 있다. 특정된 구절의 이니셜을 이용하여 비밀번호를 설정하면 가장 좋다. 아니면 한글 사용자일 경우 다른 분의 이름 영문자타법에 특수문자 조합으로 설정하며 되겠다.&lt;br /&gt;
&lt;span style=&quot;color: rgb(48, 88, 210);&quot;&gt;우점: 너무 심플하다.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: rgb(200, 66, 5);&quot;&gt;결점: 비밀번호를 바꾸어도 BFA때문에 생기는 시스템 부하를 줄일수 없다.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-weight: bold;&quot;&gt;2. RSA 인증 방식&lt;/span&gt;&lt;br /&gt;
기존에 비밀번호를 통한 인증방식보다 좀 더 고급적인 인증방식이다. 이런 방식으로 인증방식으로 바꾸면 일반 비밀번호를 통한 해킹은 전혀 의미가 없게 된다. ^^&lt;br /&gt;
&lt;br /&gt;
① ssh-keygen -t rsa를 이용하여 RSA 키를 새로 생성한다. 위 명령어를 실행하면 /home/username/.ssh/id_rsa (private 키) and /home/username/.ssh/id_rsa.pub (public 키)가 생성된다.&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;border: 1px dotted rgb(144, 224, 255); padding: 10px; background-color: rgb(36, 46, 64);&quot;&gt;
&lt;span style=&quot;color: rgb(255, 255, 255);&quot;&gt;# ssh-keygen -t rsa&lt;/span&gt;&lt;br style=&quot;color: rgb(255, 255, 255);&quot;&gt;&lt;span style=&quot;color: rgb(255, 255, 255);&quot;&gt;
Generating public/private rsa key pair.&lt;/span&gt;&lt;br style=&quot;color: rgb(255, 255, 255);&quot;&gt;&lt;span style=&quot;color: rgb(255, 255, 255);&quot;&gt;
Enter file in which to save the key (/home/username/.ssh/id_rsa): &lt;/span&gt;&lt;br style=&quot;color: rgb(255, 255, 255);&quot;&gt;&lt;span style=&quot;color: rgb(255, 255, 255);&quot;&gt;
Enter passphrase (empty for no passphrase): &lt;/span&gt;&lt;br style=&quot;color: rgb(255, 255, 255);&quot;&gt;&lt;span style=&quot;color: rgb(255, 255, 255);&quot;&gt;
Enter same passphrase again: &lt;/span&gt;&lt;br style=&quot;color: rgb(255, 255, 255);&quot;&gt;&lt;span style=&quot;color: rgb(255, 255, 255);&quot;&gt;
Your identification has been saved in /home/username/.ssh/id_rsa.&lt;/span&gt;&lt;br style=&quot;color: rgb(255, 255, 255);&quot;&gt;&lt;span style=&quot;color: rgb(255, 255, 255);&quot;&gt;
Your public key has been saved in /home/username/.ssh/id_rsa.pub.&lt;/span&gt;&lt;br style=&quot;color: rgb(255, 255, 255);&quot;&gt;&lt;span style=&quot;color: rgb(255, 255, 255);&quot;&gt;
The key fingerprint is:&lt;/span&gt;&lt;br style=&quot;color: rgb(255, 255, 255);&quot;&gt;&lt;span style=&quot;color: rgb(255, 255, 255);&quot;&gt;
32-digit_hexadecimal_fingerprint username@hostname&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;

&lt;br /&gt;
② ssh 클라이언트 측 /home/username/.ssh/authorized_keys파일속에 기존에 만들어진 키들을 조합하여 넣는다. 알다싶이 이파일속에는 여러가지 public키들이 위치하여 이런 키들에 대한 관리가 용이해질 수 있다.&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;border: 1px dotted rgb(144, 224, 255); padding: 10px; background-color: rgb(36, 46, 64);&quot;&gt;
&lt;span style=&quot;color: rgb(255, 255, 255);&quot;&gt;# cat /home/username/.ssh/id_rsa.pub &amp;gt;&amp;gt; /home/username/.ssh/authorized_keys&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
이렇게 생성된 authorized_keys파일을 ssh클라이언트측에 저장하여 매번 ssh접속시 사용 할 수가 있다. 위에 든 예제는 Linux상에서 public 키를 이용하여 인증하는 방식이고 윈도우에서 접속하려면 위 방식과 좀 다르다. 일단 쉘접속 툴로 많이 사용되는 SecureCRT에서 RSA 인증을 하는 과정을 보여주면 다음과 같다.&lt;br /&gt;
SecureCRT상에서 SSH세션을 새로 생성해준다. 다음 Session Option-&amp;gt;Connection-&amp;gt;SSH2 를 클릭하면 다음과 같은 대화창이 뜰거다.&lt;br /&gt;
&lt;br /&gt;
&lt;table style=&quot;display: inline; border-collapse: collapse&quot;&gt;&lt;tr&gt;&lt;td&gt;&lt;a href=&quot;http://cfile2.uf.tistory.com/original/204C151349F69F6CED7D09&quot; rel=&quot;lightbox&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://cfile2.uf.tistory.com/image/204C151349F69F6CED7D09&quot; alt=&quot;&quot; filemime=&quot;image/jpeg&quot; filename=&quot;rsa_auth.png&quot; height=&quot;434&quot; width=&quot;470&quot;/&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;br /&gt;
&lt;br /&gt;
위 대화창에서 볼 수 있다싶이 Authentication 방식에서 password란이 체크가 되지 않았다. Default값으로 password가 체크되어있을 것이다. 체크를 해제하고 Publickey를 선택한 상태에서 옆에 Properties버튼을 클릭하여 이미 생성한 RSA Public 키를 불러 들여오자.&lt;br /&gt;
&lt;br /&gt;
&lt;table style=&quot;display: inline; border-collapse: collapse&quot;&gt;&lt;tr&gt;&lt;td&gt;&lt;a href=&quot;http://cfile22.uf.tistory.com/original/114C151349F69F6CEEF7C3&quot; rel=&quot;lightbox&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://cfile22.uf.tistory.com/image/114C151349F69F6CEEF7C3&quot; alt=&quot;&quot; filemime=&quot;image/jpeg&quot; filename=&quot;rsa_auth_2.png&quot; height=&quot;285&quot; width=&quot;470&quot;/&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: rgb(200, 66, 5);&quot;&gt;단 주의할 점은 서버상 유저 루트 디렉토리 퍼미션이 700으로 설정이 되어야 정확히 인증이 된다. (이점은 좀 이상하다. 하지만 퍼미션을 707로설정하고 로그인을 시도한 결과 인증을 받을 수 없었다.)&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;③ 서버측 /home/username/.ssh/id_rsa 여기에는 이미 private 키가 생성이 되었으므로 별도의 작업이 필요 없다.&lt;br /&gt;
&lt;br /&gt;
④ 마지막으로 /etc/ssh/sshd_config파일을 수정하여 비밀번호를 통한 인증방식을 무효화 한다. 또한 RSA Authentication 인증방식을 Yes을 바꾸어주고 주석문속에 해제한다.&lt;br /&gt;
마지막으로 service sshd restart하여 ssh데몬을 재시작 해준다.&lt;br /&gt;
&lt;span style=&quot;color: rgb(48, 88, 210);&quot;&gt;우점: 보안이 상당히 믿음직스럽다. 일반 password방식보다는 한단계 업그레이드 된 인증 방식이다. 또한 password를 통한 무단 Brute Force Attack을 줄일 수 있다.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: rgb(200, 66, 5);&quot;&gt;결점: 서버접속 할려면 public key를 갖고 있어야 할 뿐만 아니라 passphrase를 알고 있어야 한다. RSA인증 방식에 대한 이해를 못한 유저들은 이런 키를 자기절로 생성하여 쓸수 없으므로 다른 사람의 도움이 필요할것이다.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-weight: bold;&quot;&gt;3. iptables를 이용한 패킷 Drop&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
① 정말로 약한 암호를 사용하는 사용자가 있을 경우 해당 계정이 해킹당할 수 있으며, 이 해킹당한 계정으로 로컬 커널 익스플로잇 등을 사용해서 루트를 빼앗길 수도 있다. 되도록이면 로컬 사용자를 적게 만들고 또한 만들었으면 비밀번호를 복잡하게 설정하여 이런 BFA를 어느정도 막을 수 있어야 한다. 하지만 해커가 사용하고 있는 Dictionary가 막강하면 암호를 복잡하게 만들었다 할지라도 뚤릴수 밖에 없게 된다.&lt;br /&gt;
&lt;br /&gt;
② 그렇지 않더라도, 사용자 인증 로그(auth.log)에 짧은 시간 내에 수많은 실패 로그가 쌓여 다른 로그를 보는 데 방해가 될 수 있다.&lt;br /&gt;
&lt;br /&gt;
③ 접속을 받는 동안 SSH 데몬이 암호학적 계산을 해야 하므로 시스템 자원을 소모할수도 있다.&lt;br /&gt;
&lt;br /&gt;
iptables 는 리눅스 커널에 기본적으로 포함되어 있는 방화벽으로, 아주 다양한 방화벽 규칙을 만들 수 있으며, iptables 모듈을 사용해서 기능을 확장할 수도 있다. 다음은 iptables로 SSH Brute Force Attack을 막는 간단한 규칙이다. 이 규칙은 iptables 기본 모듈인 state와 recent를 사용한다.&lt;br /&gt;
&lt;br /&gt;
state 모듈과 recent 모듈은 man 페이지에 자세하게 문서화되어 있기 때문에 문서를 참조하면 구체적인 사용법데 대하여 알수 있으므로 여기서는 생략하겠다. state 모듈은 언제 접속이 시작되고 끝나는지 추적할 수 있게 하고, recent 모듈은 IP 주소의 목록을 만들고 최근 접속 시간을 기록할 수 있게 한다.&lt;br /&gt;
&lt;br /&gt;
규칙은 ssh 포트로 20초간 5회 이상 접속을 시도하면 10분간 접속을 차단하는 것이다.&lt;br /&gt;
&lt;br /&gt;
우선 blacklist와 ssh 체인을 만든다.&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;border: 1px dotted rgb(144, 224, 255); padding: 10px; background-color: rgb(36, 46, 64);&quot;&gt;
&lt;span style=&quot;color: rgb(255, 255, 255);&quot;&gt;# iptables -N blacklist&lt;/span&gt;&lt;br style=&quot;color: rgb(255, 255, 255);&quot;&gt;&lt;span style=&quot;color: rgb(255, 255, 255);&quot;&gt;
# iptables -N ssh&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
INPUT 체인에서 state 모듈로 ssh 포트인 22번 포트에 접속이 시작되면 ssh 체인으로 보낸다.&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;border: 1px dotted rgb(144, 224, 255); padding: 10px; background-color: rgb(36, 46, 64);&quot;&gt;
&lt;span style=&quot;color: rgb(255, 255, 255);&quot;&gt;# iptables -A INPUT -m state --state NEW -p tcp --dport ssh -j ssh&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
blacklist 체인에서는 recent 모듈로 &quot;blacklist&quot;라는 목록에 접속 주소를 기록하고 접속을 거부한다.&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;border: 1px dotted rgb(144, 224, 255); padding: 10px; background-color: rgb(36, 46, 64);&quot;&gt;
&lt;span style=&quot;color: rgb(255, 255, 255);&quot;&gt;# iptables -A blacklist -m recent --set --name blacklist&lt;/span&gt;&lt;br style=&quot;color: rgb(255, 255, 255);&quot;&gt;&lt;span style=&quot;color: rgb(255, 255, 255);&quot;&gt;
# iptables -A blacklist -j REJECT&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
규칙의 핵심인 ssh 체인은 다음과 같다.&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;border: 1px dotted rgb(144, 224, 255); padding: 10px; background-color: rgb(36, 46, 64);&quot;&gt;
&lt;span style=&quot;color: rgb(255, 255, 255);&quot;&gt;# iptables -A ssh -m recent --update --seconds 600 --hitcount 1 --name blacklist -j REJECT&lt;/span&gt;&lt;br style=&quot;color: rgb(255, 255, 255);&quot;&gt;&lt;span style=&quot;color: rgb(255, 255, 255);&quot;&gt;
# iptables -A ssh -m recent --set --name ssh&lt;/span&gt;&lt;br style=&quot;color: rgb(255, 255, 255);&quot;&gt;&lt;span style=&quot;color: rgb(255, 255, 255);&quot;&gt;
# iptables -A ssh -m recent --update --seconds 20 --hitcount 5 --name ssh -j blacklist&lt;/span&gt;&lt;br style=&quot;color: rgb(255, 255, 255);&quot;&gt;&lt;span style=&quot;color: rgb(255, 255, 255);&quot;&gt;
# iptables -A ssh -j ACCEPT&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
이 규칙을 순서대로 설명하면 다음과 같다.&lt;br /&gt;
첫 번째 규칙은 접속 주소가 이미 &quot;blacklist&quot;에 들어 있고, 지난 10분간 1회 이상 접속이 있었으면 접속을 거부한다.&lt;br /&gt;
두 번째 규칙은 접속 주소를 &quot;ssh&quot; 목록에 기록한다.&lt;br /&gt;
세 번째 규칙은 접속 주소가 이미 &quot;ssh&quot; 목록에 들어 있고, 지난 20초간 5회 이상 접속이 있었으면 blacklist 체인으로 보낸다.&lt;br /&gt;
네 번째 규칙은 여기까지 통과한 경우 ssh 접속을 허락한다.&lt;br /&gt;
&lt;br /&gt;
따라서 전체 스크립트는 다음과 같이 된다.&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;border: 1px dotted rgb(227, 143, 188); padding: 10px; background-color: rgb(112, 43, 56);&quot;&gt;
&lt;span style=&quot;color: rgb(255, 255, 255);&quot;&gt;iptables -N blacklist&lt;/span&gt;&lt;br style=&quot;color: rgb(255, 255, 255);&quot;&gt;&lt;span style=&quot;color: rgb(255, 255, 255);&quot;&gt;
iptables -N ssh&lt;/span&gt;&lt;br style=&quot;color: rgb(255, 255, 255);&quot;&gt;&lt;span style=&quot;color: rgb(255, 255, 255);&quot;&gt;
iptables -A INPUT -m state --state NEW -p tcp --dport ssh -j ssh&lt;/span&gt;&lt;br style=&quot;color: rgb(255, 255, 255);&quot;&gt;&lt;span style=&quot;color: rgb(255, 255, 255);&quot;&gt;
iptables -A blacklist -m recent --set --name blacklist&lt;/span&gt;&lt;br style=&quot;color: rgb(255, 255, 255);&quot;&gt;&lt;span style=&quot;color: rgb(255, 255, 255);&quot;&gt;
iptables -A blacklist -j REJECT&lt;/span&gt;&lt;br style=&quot;color: rgb(255, 255, 255);&quot;&gt;&lt;span style=&quot;color: rgb(255, 255, 255);&quot;&gt;
iptables -A ssh -m recent --update --seconds 600 --hitcount 1 --name blacklist -j REJECT&lt;/span&gt;&lt;br style=&quot;color: rgb(255, 255, 255);&quot;&gt;&lt;span style=&quot;color: rgb(255, 255, 255);&quot;&gt;
iptables -A ssh -m recent --set --name ssh&lt;/span&gt;&lt;br style=&quot;color: rgb(255, 255, 255);&quot;&gt;&lt;span style=&quot;color: rgb(255, 255, 255);&quot;&gt;
iptables -A ssh -m recent --update --seconds 20 --hitcount 5 --name ssh -j blacklist&lt;/span&gt;&lt;br style=&quot;color: rgb(255, 255, 255);&quot;&gt;&lt;span style=&quot;color: rgb(255, 255, 255);&quot;&gt;
iptables -A ssh -j ACCEPT&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;span style=&quot;font-weight: bold;&quot;&gt;4. sshd 로그를 이용하여 공격을 막기&lt;/span&gt;&lt;br /&gt;
서버에 들어오는 ssh 공격에 대하여 sshd 데몬은 그것들을 특정된 로그파일에 저장해주고 있는데 이렇게 생성된 파일을 참조하고 몇가지 프로그램을 조합하여 사용하는 것을 통하여 ssh 공격을 막을 수 있다.&lt;br /&gt;
&lt;br /&gt;
① sshdfilter는 iptables를 이용하여 블럭을 한다. 동작방식은 상당히 간단한데 firewall 룰을 iptables에 추가하여 특정된 공격을 막는것이다. 이 방식으로 공격을 막기위하여 sshd데몬대신 sshdfilter데몬을 작동시켜야 한다. sshdfilter데몬은 sshd데몬과 흡사한데 단지 다른점이라면 생성된 log에 대한 분석을 해준다는것이다.&lt;br /&gt;
&lt;br /&gt;
② Fail2Ban은 일종 Python스크립트인데 이 스크립트는 sshd로그에 근거하여 커스텀 Firewall룰을 적용시키는 방식으로 공격을 막는다. 공격을 막기 위하여 사용되는 툴로는 iptables, ipfwadm 혹은 ipfw등이다.&lt;br /&gt;
&lt;br /&gt;
③ DenyHosts는 firewall을 이용하여 공격을 막는것이 아니고 관련 룰들을 /etc/hosts.deny에 써주는 방식으로 공격을 차단한다. 단 이것을 사용하기 위하여서는 sshd 데몬이 컴파일 될시 tcp_wrappers를 지원하게끔 되어있어야 한다. 사실 DenyHosts도 Python 스크립트로 씌여졌다. tcp_wrappers를 지원하고 있는 지를 판단하는 방법은 상당히 심플한데 직접 hosts.deny를 편집하고 그 속에 127.0.0.1를 넣어준 상태에서 서버에서 ssh방식으로 자기자신을 접속하게 한다. 만약 접속이 안되면 tcp_wrappers를 지원하고 있는것이다.&lt;br /&gt;
&lt;br /&gt;
참조문서: &lt;a title=&quot;[http://la-samhna.de/library/brutessh.html]로 이동합니다.&quot; target=&quot;_blank&quot; href=&quot;http://la-samhna.de/library/brutessh.html&quot;&gt;http://la-samhna.de/library/brutessh.html&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;&lt;div class=&quot;entry-ccl&quot; style=&quot;clear: both; text-align: right; margin-bottom: 10px&quot;&gt;
	&lt;img id=&quot;ccl-icon-138-0&quot; class=&quot;entry-ccl-by&quot; src=&quot;http://cfs.tistory.com/static/admin/editor/ccl_black01.png&quot; alt=&quot;저작자 표시&quot;/&gt;
	&lt;img id=&quot;ccl-icon-138-1&quot; class=&quot;entry-ccl-nc&quot; src=&quot;http://cfs.tistory.com/static/admin/editor/ccl_black02.png&quot; alt=&quot;비영리&quot;/&gt;
	&lt;img id=&quot;ccl-icon-138-2&quot; class=&quot;entry-ccl-nd&quot; src=&quot;http://cfs.tistory.com/static/admin/editor/ccl_black03.png&quot; alt=&quot;변경 금지&quot;/&gt;
	&lt;!--
	&lt;rdf:RDF xmlns=&quot;http://web.resource.org/cc/&quot; xmlns:dc=&quot;http://purl.org/dc/elements/1.1/&quot; xmlns:rdf=&quot;http://www.w3.org/1999/02/22-rdf-syntax-ns#&quot;&gt;
		&lt;Work rdf:about=&quot;&quot;&gt;
			&lt;license rdf:resource=&quot;http://creativecommons.org/licenses/by-nc-nd/2.0/kr/&quot; /&gt;
		&lt;/Work&gt;
		&lt;License rdf:about=&quot;http://creativecommons.org/licenses/by-nc-nd/&quot;&gt;
			&lt;permits rdf:resource=&quot;http://web.resource.org/cc/Reproduction&quot;/&gt;
			&lt;permits rdf:resource=&quot;http://web.resource.org/cc/Distribution&quot;/&gt;
			&lt;requires rdf:resource=&quot;http://web.resource.org/cc/Notice&quot;/&gt;
			&lt;requires rdf:resource=&quot;http://web.resource.org/cc/Attribution&quot;/&gt;
			&lt;prohibits rdf:resource=&quot;http://web.resource.org/cc/CommercialUse&quot;/&gt;
		&lt;/License&gt;
	&lt;/rdf:RDF&gt;
	--&gt;
&lt;/div&gt;
</description>
			<category>리눅스 자료</category>
			<category>Authentication</category>
			<category>Brute force attack</category>
			<category>DSA</category>
			<category>iptables</category>
			<category>Port Knocking</category>
			<category>recent</category>
			<category>RSA</category>
			<category>script</category>
			<category>Shell</category>
			<category>ssh</category>
			<category>sshd logs</category>
			<category>state</category>
			<category>tcp_wrapper</category>
			<category>인증</category>
			<author>[GUNi]</author>
			<guid>http://guni.loveyust.net/138</guid>
			<comments>http://guni.loveyust.net/138#entry138comment</comments>
			<pubDate>Tue, 28 Apr 2009 15:37:55 +0800</pubDate>
		</item>
		<item>
			<title>DoS 공격 방어 모듈 mod_evasive 설치기</title>
			<link>http://guni.loveyust.net/136</link>
			<description>&lt;span style=&quot;font-weight: bold;&quot;&gt;1. mod_evasive이란 무엇인가?&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
이것은 HTTP Dos 또는 DDos 스택 또는 저돌적인 공격으로부터 아파치를 보호하는데 있다. 또한 ipchains, 방화벽, 라우터등으로 쉽게 구성될 수 있도록 디자인 되었다.&lt;br /&gt;
탐지는 주소, URI의 IP 내부 동적 해쉬테이블을 생성함으로 수행되고, 각 아이피별로 거부된다.&lt;br /&gt;
- 초당 몇번 이상의 같은 페이지를 요청하는 경우&lt;br /&gt;
- 초당 같은 자식노드를 동시에 50번 이상 생성하는 경우&lt;br /&gt;
- 일시적으로 블러킹되는 동안 어떠한 요청을 생성하는 경우&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-weight: bold;&quot;&gt;2.&amp;nbsp; mod_evasive의 설치&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;border: 1px dotted rgb(144, 224, 255); padding: 10px; background-color: rgb(36, 46, 64);&quot;&gt;
&lt;span style=&quot;color: rgb(255, 255, 255);&quot;&gt;# wget http://www.zdziarski.com/projects/mod_evasive/mod_evasive_1.10.1.tar.gz&lt;/span&gt;&lt;br style=&quot;color: rgb(255, 255, 255);&quot;&gt;&lt;br style=&quot;color: rgb(255, 255, 255);&quot;&gt;&lt;span style=&quot;color: rgb(255, 255, 255);&quot;&gt;# 압축해제&lt;/span&gt;&lt;br style=&quot;color: rgb(255, 255, 255);&quot;&gt;&lt;span style=&quot;color: rgb(255, 255, 255);&quot;&gt;# tar xvzf mod_evasive_1.10.1.tar.gz&lt;/span&gt;&lt;br style=&quot;color: rgb(255, 255, 255);&quot;&gt;&lt;br style=&quot;color: rgb(255, 255, 255);&quot;&gt;&lt;span style=&quot;color: rgb(255, 255, 255);&quot;&gt;# 디렉토리 이동&lt;/span&gt;&lt;br style=&quot;color: rgb(255, 255, 255);&quot;&gt;&lt;span style=&quot;color: rgb(255, 255, 255);&quot;&gt;# cd mod_evasive&lt;/span&gt;&lt;br style=&quot;color: rgb(255, 255, 255);&quot;&gt;&lt;br style=&quot;color: rgb(255, 255, 255);&quot;&gt;&lt;span style=&quot;color: rgb(255, 255, 255);&quot;&gt;# 모듈 추가&lt;/span&gt;&lt;br style=&quot;color: rgb(255, 255, 255);&quot;&gt;&lt;span style=&quot;color: rgb(255, 255, 255);&quot;&gt;# /usr/local/apache2/bin/apxs -iac mod_evasive.c -&amp;gt; Apache.1.x&lt;/span&gt;&lt;br style=&quot;color: rgb(255, 255, 255);&quot;&gt;&lt;span style=&quot;color: rgb(255, 255, 255);&quot;&gt;# /usr/local/apache2/bin/apxs -iac mod_evasive20.c -&amp;gt; Apache.2.x&lt;/span&gt;&lt;br style=&quot;color: rgb(255, 255, 255);&quot;&gt;&lt;br style=&quot;color: rgb(255, 255, 255);&quot;&gt;&lt;span style=&quot;color: rgb(255, 255, 255);&quot;&gt;# 환경설정&lt;/span&gt;&lt;br style=&quot;color: rgb(255, 255, 255);&quot;&gt;&lt;span style=&quot;color: rgb(255, 255, 255);&quot;&gt;# vi /usr/local/apache2/conf/httpd.conf&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
# 아파치 1.X와 2.X에서의 모듈명칭이 약간 차이가 있으므로 주의할 것!&lt;br /&gt;
# 아래에 해당하는 내용이 존재하는지 확인 한다. 없으면 추가.&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;border: 1px dotted rgb(128, 184, 136); padding: 10px; background-color: rgb(40, 86, 58);&quot;&gt;
&lt;span style=&quot;color: rgb(255, 255, 255);&quot;&gt;LoadModule evasive_module&amp;nbsp;&amp;nbsp;&amp;nbsp; modules/mod_evasive.so -&amp;gt; Apache.1.x&lt;/span&gt;&lt;br style=&quot;color: rgb(255, 255, 255);&quot;&gt;&lt;span style=&quot;color: rgb(255, 255, 255);&quot;&gt;LoadModule evasive20_module&amp;nbsp;&amp;nbsp;&amp;nbsp; modules/mod_evasive20.so -&amp;gt; Apache.2.x&lt;/span&gt;&lt;br style=&quot;color: rgb(255, 255, 255);&quot;&gt;&lt;br style=&quot;color: rgb(255, 255, 255);&quot;&gt;&lt;span style=&quot;color: rgb(255, 255, 255);&quot;&gt;&amp;lt;IfModule mod_evasive.c&amp;gt;&lt;/span&gt;&lt;br style=&quot;color: rgb(255, 255, 255);&quot;&gt;&lt;span style=&quot;color: rgb(255, 255, 255);&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DOSHashTableSize&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3097&lt;/span&gt;&lt;br style=&quot;color: rgb(255, 255, 255);&quot;&gt;&lt;span style=&quot;color: rgb(255, 255, 255);&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DOSPageCount&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3&lt;/span&gt;&lt;br style=&quot;color: rgb(255, 255, 255);&quot;&gt;&lt;span style=&quot;color: rgb(255, 255, 255);&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DOSSiteCount&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 50&lt;/span&gt;&lt;br style=&quot;color: rgb(255, 255, 255);&quot;&gt;&lt;span style=&quot;color: rgb(255, 255, 255);&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DOSPageInterval&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&lt;/span&gt;&lt;br style=&quot;color: rgb(255, 255, 255);&quot;&gt;&lt;span style=&quot;color: rgb(255, 255, 255);&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DOSSiteInterval&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&lt;/span&gt;&lt;br style=&quot;color: rgb(255, 255, 255);&quot;&gt;&lt;span style=&quot;color: rgb(255, 255, 255);&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DOSBlockingPeriod&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 30&lt;/span&gt;&lt;br style=&quot;color: rgb(255, 255, 255);&quot;&gt;&lt;br style=&quot;color: rgb(255, 255, 255);&quot;&gt;&lt;span style=&quot;color: rgb(255, 255, 255);&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DOSEmailNotify&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; webmaster@yoursite.com&lt;/span&gt;&lt;br style=&quot;color: rgb(255, 255, 255);&quot;&gt;&lt;span style=&quot;color: rgb(255, 255, 255);&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DOSLogDir&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &quot;/usr/local/apache2/logs/mod_evasive.log&quot;&lt;/span&gt;&lt;br style=&quot;color: rgb(255, 255, 255);&quot;&gt;&lt;span style=&quot;color: rgb(255, 255, 255);&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DOSSystemCommand&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &quot;su - someuser -c &#039;/sbin/... %s ...&#039;&quot;&lt;/span&gt;&lt;br style=&quot;color: rgb(255, 255, 255);&quot;&gt;&lt;span style=&quot;color: rgb(255, 255, 255);&quot;&gt;&amp;lt;/IfModule&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div style=&quot;border: 1px dotted rgb(144, 224, 255); padding: 10px; background-color: rgb(36, 46, 64);&quot;&gt;
&lt;span style=&quot;color: rgb(255, 255, 255);&quot;&gt;# 환경설정 검사&lt;/span&gt;&lt;br style=&quot;color: rgb(255, 255, 255);&quot;&gt;&lt;span style=&quot;color: rgb(255, 255, 255);&quot;&gt;# apachectl configtest&lt;/span&gt;&lt;br style=&quot;color: rgb(255, 255, 255);&quot;&gt;&lt;span style=&quot;color: rgb(255, 255, 255);&quot;&gt;# 재시작&lt;/span&gt;&lt;br style=&quot;color: rgb(255, 255, 255);&quot;&gt;&lt;span style=&quot;color: rgb(255, 255, 255);&quot;&gt;# apachectl -k restart&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;span style=&quot;font-weight: bold;&quot;&gt;3. 각 지시자에 대한 설명&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-weight: bold;&quot;&gt;- DOSHashTableSize&lt;/span&gt;&lt;br /&gt;
각 자식 해쉬테이블 마다 탑레벨 노드의 수를 지정한다.&lt;br /&gt;
수치가 높으면 높을수록 더 많은 퍼포먼스가 나타나지만 테이블스페이스에 메모리를 남기게 된다, 접속량이 많으면 이 수치를 높혀도 된다.&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-weight: bold;&quot;&gt;- DOSPageCount&lt;/span&gt;&lt;br /&gt;
이것은 같은 페이지 또는 URI, 인터벌당 요청수에 대한 카운트 수이다.&lt;br /&gt;
지정된 값이 초과되면 클라이언트에 대한 IP 정보가 블러킹리스트에 추가된다.&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-weight: bold;&quot;&gt;- DOSSiteCount&lt;/span&gt;&lt;br /&gt;
지정된 시간동안 같은 페이지를 지정된 수 보다 초과될경우 IP 정보가 블러킹리스트에 추가된다.&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-weight: bold;&quot;&gt;- DOSPageInterval&lt;/span&gt;&lt;br /&gt;
페이지 카운트 시발점, 디폴트는 1초이다.&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-weight: bold;&quot;&gt;- DOSSiteInterval&lt;/span&gt;&lt;br /&gt;
사이트 카운트 시발점, 디폴트는 역시 1초이다.&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-weight: bold;&quot;&gt;- DOSBlockingPeriod&lt;/span&gt;&lt;br /&gt;
클라이언트가 블랙리스트에 추가되어 블러킹되는 총 시간. 이때 클라이언트는 403 (Forbidden) 에러를 출력하게 된다.&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-weight: bold;&quot;&gt;- DOSEmailNotify&lt;/span&gt;&lt;br /&gt;
이 값이 지정되면, IP가 블러킹될때마다 지정된 이메일로 발동된다.&lt;br /&gt;
주의 : 메일러는 mod_dosevasive.c 에 정확하게 지정되야 한다. 디폴트는 &quot;/bin/mail -t %s&quot; 이다.&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-weight: bold;&quot;&gt;- DOSLogDir&lt;/span&gt;&lt;br /&gt;
로그 파일 경로&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-weight: bold;&quot;&gt;- DOSSystemCommand&lt;/span&gt;&lt;br /&gt;
이 값이 지정되면, 시스템은 아이피가 블러킹될때마다 명령행을 실행한다.&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-weight: bold;&quot;&gt;- DOSWhitelist&lt;/span&gt;&lt;br /&gt;
차단에서 제외될 호스트&lt;br /&gt;
DOSWhitelist&amp;nbsp;&amp;nbsp;&amp;nbsp; 127.0.0.1&lt;br /&gt;
DOSWhitelist&amp;nbsp;&amp;nbsp;&amp;nbsp; 127.0.0.* - (와일드카드는(*) 필요하다면 최대 8진수(xxx.*.*.*)까지 사용할 수 있다.)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-weight: bold;&quot;&gt;4. 테스트하기&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;border: 1px dotted rgb(227, 143, 188); padding: 10px; background-color: rgb(112, 43, 56);&quot;&gt;
&lt;span style=&quot;color: rgb(255, 255, 255);&quot;&gt;# perl test.pl &amp;lt;- 다운받은 파일 안에 포함되어 있다.&lt;/span&gt;&lt;br style=&quot;color: rgb(255, 255, 255);&quot;&gt;&lt;span style=&quot;color: rgb(255, 255, 255);&quot;&gt;&amp;nbsp;&amp;nbsp; HTTP/1.1 200 OK&lt;/span&gt;&lt;br style=&quot;color: rgb(255, 255, 255);&quot;&gt;&lt;span style=&quot;color: rgb(255, 255, 255);&quot;&gt;&amp;nbsp;&amp;nbsp; HTTP/1.1 403 Forbidden&lt;/span&gt;&lt;br style=&quot;color: rgb(255, 255, 255);&quot;&gt;&lt;span style=&quot;color: rgb(255, 255, 255);&quot;&gt;&amp;nbsp;&amp;nbsp; HTTP/1.1 200 OK&lt;/span&gt;&lt;br style=&quot;color: rgb(255, 255, 255);&quot;&gt;&lt;span style=&quot;color: rgb(255, 255, 255);&quot;&gt;&amp;nbsp;&amp;nbsp; HTTP/1.1 403 Forbidden&lt;/span&gt;&lt;br style=&quot;color: rgb(255, 255, 255);&quot;&gt;&lt;span style=&quot;color: rgb(255, 255, 255);&quot;&gt;&amp;nbsp;&amp;nbsp; HTTP/1.1 403 Forbidden&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;span style=&quot;font-weight: bold;&quot;&gt;5. 같이쓰면 좋은 iptables&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
흔히 DOS 공격방어라고 하면 mod_evasive 모듈을 사용한다고 알려져 있다.&lt;br /&gt;
특히, 과도한 DOS 공격이 들어올 경우 아파치가 부하를 견디지 못하고 죽어버리는 경우도 생긴다. 따라서 과다 접속 차단에 대해서는 iptables를 이용하시는것이 근본적이고 효과적 이다.&lt;br /&gt;
iptables를 보게되면 connlimit 기능이 있는데 이 설정을 잘 이용하시면&lt;br /&gt;
매우 효과적이고 안정적인 서버 운영이 가능하다.&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;border: 1px dotted rgb(144, 224, 255); padding: 10px; background-color: rgb(36, 46, 64);&quot;&gt;
&lt;span style=&quot;color: rgb(255, 255, 255);&quot;&gt;# 1초에 15번 이상의 HTTP 접근을 할경우 (DOS공격) 접근을 차단한다.&lt;/span&gt;&lt;br style=&quot;color: rgb(255, 255, 255);&quot;&gt;&lt;span style=&quot;color: rgb(255, 255, 255);&quot;&gt;# iptables -A INPUT -p tcp --syn --dport 80 -m connlimit --connlimit-above 15 -connlimit-mask 24 -j DROP&lt;/span&gt;&lt;br style=&quot;color: rgb(255, 255, 255);&quot;&gt;&lt;br style=&quot;color: rgb(255, 255, 255);&quot;&gt;&lt;span style=&quot;color: rgb(255, 255, 255);&quot;&gt;# 포트스캔을 차단한다.&lt;br /&gt;
# psd match를 사용하기 위하여 커널에 p-o-m패치를 적용시켜 놓아야 한다.&lt;br /&gt;
# 상세한 사항은 &lt;a title=&quot;[http://wiki.kldp.org/wiki.php/DocbookSgml/Netfilter-extensions-TRANS]로 이동합니다.&quot; target=&quot;_blank&quot; href=&quot;http://wiki.kldp.org/wiki.php/DocbookSgml/Netfilter-extensions-TRANS&quot;&gt;여기&lt;/a&gt;를 클릭하여 확인하기 바란다.&lt;br style=&quot;color: rgb(255, 255, 255);&quot;&gt;&lt;/span&gt;&lt;span style=&quot;color: rgb(255, 255, 255);&quot;&gt;# iptables -A INPUT -m psd -j DROP&lt;/span&gt;&lt;br style=&quot;color: rgb(255, 255, 255);&quot;&gt;&lt;br style=&quot;color: rgb(255, 255, 255);&quot;&gt;&lt;span style=&quot;color: rgb(255, 255, 255);&quot;&gt;# 만약서버가 해킹당해 DOS공격지로 사용될때 적용시킴.&lt;/span&gt;&lt;br style=&quot;color: rgb(255, 255, 255);&quot;&gt;&lt;span style=&quot;color: rgb(255, 255, 255);&quot;&gt;# DNS 쿼리이외에 UDP 패킷이 나가는 것을 방지&lt;/span&gt;&lt;br style=&quot;color: rgb(255, 255, 255);&quot;&gt;&lt;span style=&quot;color: rgb(255, 255, 255);&quot;&gt;# iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT&lt;/span&gt;&lt;br style=&quot;color: rgb(255, 255, 255);&quot;&gt;&lt;span style=&quot;color: rgb(255, 255, 255);&quot;&gt;# iptables -A OUTPUT -p udp ! --dport 53 -m state --state NEW -j DROP&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;&lt;div class=&quot;entry-ccl&quot; style=&quot;clear: both; text-align: right; margin-bottom: 10px&quot;&gt;
	&lt;img id=&quot;ccl-icon-136-0&quot; class=&quot;entry-ccl-by&quot; src=&quot;http://cfs.tistory.com/static/admin/editor/ccl_black01.png&quot; alt=&quot;저작자 표시&quot;/&gt;
	&lt;img id=&quot;ccl-icon-136-1&quot; class=&quot;entry-ccl-nc&quot; src=&quot;http://cfs.tistory.com/static/admin/editor/ccl_black02.png&quot; alt=&quot;비영리&quot;/&gt;
	&lt;img id=&quot;ccl-icon-136-2&quot; class=&quot;entry-ccl-nd&quot; src=&quot;http://cfs.tistory.com/static/admin/editor/ccl_black03.png&quot; alt=&quot;변경 금지&quot;/&gt;
	&lt;!--
	&lt;rdf:RDF xmlns=&quot;http://web.resource.org/cc/&quot; xmlns:dc=&quot;http://purl.org/dc/elements/1.1/&quot; xmlns:rdf=&quot;http://www.w3.org/1999/02/22-rdf-syntax-ns#&quot;&gt;
		&lt;Work rdf:about=&quot;&quot;&gt;
			&lt;license rdf:resource=&quot;http://creativecommons.org/licenses/by-nc-nd/2.0/kr/&quot; /&gt;
		&lt;/Work&gt;
		&lt;License rdf:about=&quot;http://creativecommons.org/licenses/by-nc-nd/&quot;&gt;
			&lt;permits rdf:resource=&quot;http://web.resource.org/cc/Reproduction&quot;/&gt;
			&lt;permits rdf:resource=&quot;http://web.resource.org/cc/Distribution&quot;/&gt;
			&lt;requires rdf:resource=&quot;http://web.resource.org/cc/Notice&quot;/&gt;
			&lt;requires rdf:resource=&quot;http://web.resource.org/cc/Attribution&quot;/&gt;
			&lt;prohibits rdf:resource=&quot;http://web.resource.org/cc/CommercialUse&quot;/&gt;
		&lt;/License&gt;
	&lt;/rdf:RDF&gt;
	--&gt;
&lt;/div&gt;
</description>
			<category>리눅스 자료</category>
			<category>Apache</category>
			<category>DDoS</category>
			<category>dos</category>
			<category>HTTP Dos</category>
			<category>iptables</category>
			<category>mod_evasive</category>
			<author>[GUNi]</author>
			<guid>http://guni.loveyust.net/136</guid>
			<comments>http://guni.loveyust.net/136#entry136comment</comments>
			<pubDate>Mon, 27 Apr 2009 20:06:44 +0800</pubDate>
		</item>
		<item>
			<title>CentOS 5.3 + Kernel 2.6.29.1 + iptables 의 connlimit 모듈 설치하기</title>
			<link>http://guni.loveyust.net/137</link>
			<description>&lt;div style=&quot;padding: 10px; background-color: rgb(93, 93, 93);&quot;&gt;
&lt;span style=&quot;color: rgb(255, 255, 255); font-weight: bold;&quot;&gt;CentOS에 최신커널을 컴파일하여 넣어 보자~&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
iptables를 건드리다가 connlimit옵션이 먹히지 않아서 찾아보니 현재 사용중인 커널 버젼이 낮음으로 하여 먹히지 않았던 것이 였다.&lt;br /&gt;
간단히&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;border: 1px dotted rgb(144, 224, 255); padding: 10px; background-color: rgb(36, 46, 64);&quot;&gt;
&lt;span style=&quot;color: rgb(255, 255, 255);&quot;&gt;# cat /proc/net/ip_tables_matches&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
를 통하여 현재 iptables상에 올라온 모듈들을 볼 수 있다.&lt;br /&gt;
connlimit 모듈이 깔리지 않은 상태에서 해당 모듈이 리스트에 뜨지 않을 것이다.&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-weight: bold;&quot;&gt;1. 최신 커널 및 iptables 소스 파일 다운로드 및 설치&lt;/span&gt;&lt;br /&gt;
현재 커널 버젼을 아래 명령어를 통하여 알아보도록 하자.&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;border: 1px dotted rgb(144, 224, 255); padding: 10px; background-color: rgb(36, 46, 64);&quot;&gt;
&lt;span style=&quot;color: rgb(255, 255, 255);&quot;&gt;# uname -a&lt;/span&gt;&lt;br style=&quot;color: rgb(255, 255, 255);&quot;&gt;&lt;span style=&quot;color: rgb(255, 255, 255);&quot;&gt;Linux localhost 2.6.18-128.el5 #1 SMP Wed Jan 21 10:44:23 EST 2009 i686 i686 i386 GNU/Linux&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
위에서 보다싶이 현재 사용중인 커널 버젼은 2.6.18이다.&lt;br /&gt;
http://www.kernel.org 에 접속하여 최신버젼 커널을 다운로드 받아 온다.&lt;br /&gt;
&lt;br /&gt;
Kernel 2.6.29.1 =&amp;gt; http://www.kernel.org/&lt;br /&gt;
Iptables 1.4.3.2 =&amp;gt; http://www.netfilter.org/ &lt;br /&gt;
정확히 다운로드 되었으면 다운로드 받은 커널 소스는 /usr/src에 압축을 풀고 iptables소스는 /usr/local/src/에 압축을 풀어놓는다.&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;border: 1px dotted rgb(144, 224, 255); padding: 10px; background-color: rgb(36, 46, 64);&quot;&gt;
&lt;span style=&quot;color: rgb(255, 255, 255);&quot;&gt;# cd /tmp&lt;/span&gt;&lt;br style=&quot;color: rgb(255, 255, 255);&quot;&gt;&lt;span style=&quot;color: rgb(255, 255, 255);&quot;&gt;
# wget http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.29.1.tar.bz2&lt;/span&gt;&lt;br style=&quot;color: rgb(255, 255, 255);&quot;&gt;&lt;span style=&quot;color: rgb(255, 255, 255);&quot;&gt;# wget http://ftp.netfilter.org/pub/iptables/iptables-1.4.3.tar.bz2&lt;/span&gt;&lt;br style=&quot;color: rgb(255, 255, 255);&quot;&gt;&lt;span style=&quot;color: rgb(255, 255, 255);&quot;&gt;
# tar xvfj linux-2.6.29.1.tar.bz2 -C /usr/src&lt;/span&gt;&lt;br style=&quot;color: rgb(255, 255, 255);&quot;&gt;&lt;span style=&quot;color: rgb(255, 255, 255);&quot;&gt;# tar xvfz iptables-1.4.3.2.tar.bz2 -C /usr/local/src&lt;/span&gt;&lt;span style=&quot;color: rgb(255, 255, 255);&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
작업을 좀 더 편하게 하기 위하여 미리 심볼릭 링크를 걸어 둔다.&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;border: 1px dotted rgb(144, 224, 255); padding: 10px; background-color: rgb(36, 46, 64);&quot;&gt;
&lt;span style=&quot;color: rgb(255, 255, 255);&quot;&gt;# ln -s /usr/src/linux-2.6.29.1 /usr/src/linux&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
커널 소스 디렉토리로 들어갔으면 기존에 정상적으로 사용하던 커널의 환경옵션을 그대로 가져 와서 컴파일하는 것이 좋다. &lt;br /&gt;
/boot 디렉토리 안을 보면 이름이 config 로 시작하는 커널 환경 변수 정보가 담겨있는 파일들이 있는데 이 중 가장 최근까지 정상적으로 사용해 오던 파일을 복사해다가 /usr/src/linux 디렉토리 안에 .config 라는 이름의 파일로 저장해서 불러들이는 방식을 취하면 된다.&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;border: 1px dotted rgb(144, 224, 255); padding: 10px; background-color: rgb(36, 46, 64);&quot;&gt;
&lt;span style=&quot;color: rgb(255, 255, 255);&quot;&gt;# cp /boot/config-2.6.18-128.el5 /usr/src/linux/.config&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;span style=&quot;font-weight: bold;&quot;&gt;2. 커널 설정 및 컴파일&lt;/span&gt;&lt;br /&gt;
자~ 기본적으로 커널 설정을 하기 위한 초기 작업이 끝났다.&lt;br /&gt;
새로 받은 커널 소스 폴더로 이동하여 커널 설정을 해주겠다.&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;border: 1px dotted rgb(144, 224, 255); padding: 10px; background-color: rgb(36, 46, 64);&quot;&gt;
&lt;span style=&quot;color: rgb(255, 255, 255);&quot;&gt;# cd /usr/src/linux&lt;/span&gt;&lt;br style=&quot;color: rgb(255, 255, 255);&quot;&gt;&lt;span style=&quot;color: rgb(255, 255, 255);&quot;&gt;
# make menuconfig&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
제일 하단에서 2번째에 있는 Load an Alternate Configuration File 메뉴를 통해 .config 파일을 로드한다.&lt;br /&gt;
&lt;br /&gt;
Networking --&amp;gt; Networking option --&amp;gt; Network packet filtering framework (Netfilter) 옵션으로 들어가서&lt;br /&gt;
Core Netfilter Configuration을 비롯하여 넷필터, iptables 관련 모듈을 모두 체크하고 빠져 나온다.&lt;br /&gt;
Core Netfilter Configuration 옵션 안의 모듈들은 가급적 &amp;lt;M&amp;gt; 체크하여 모듈 형태로 저장한다.&lt;br /&gt;
iptables관련 모듈들은 하나가 모듈로 컴파일되면 다른 것들도 모듈로 되기를 요구하는 것 같다. connlimit 모듈은 중간 쯤에 나온다. 이해를 돕기 위하여 아래에 스크린샷을 첨부하겠다.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;imageblock center&quot; style=&quot;text-align: center; clear: both;&quot;&gt;&lt;a href=&quot;http://cfile21.uf.tistory.com/original/1872B10D49F58754527A07&quot; rel=&quot;lightbox&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://cfile21.uf.tistory.com/image/1872B10D49F58754527A07&quot; alt=&quot;&quot; filemime=&quot;image/jpeg&quot; filename=&quot;conn_limit.PNG&quot; height=&quot;428&quot; width=&quot;470&quot;/&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
또한 IPv4 컨넥션 트래킹 모듈까지 설치하겠다. NAT에는 필수니까...&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;imageblock center&quot; style=&quot;text-align: center; clear: both;&quot;&gt;&lt;a href=&quot;http://cfile25.uf.tistory.com/original/1972B10D49F58754533B27&quot; rel=&quot;lightbox&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://cfile25.uf.tistory.com/image/1972B10D49F58754533B27&quot; alt=&quot;&quot; filemime=&quot;image/jpeg&quot; filename=&quot;conn_limit_2.PNG&quot; height=&quot;429&quot; width=&quot;470&quot;/&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div style=&quot;border: 1px dotted rgb(144, 224, 255); padding: 10px; background-color: rgb(36, 46, 64);&quot;&gt;
&lt;span style=&quot;color: rgb(255, 255, 255);&quot;&gt;# make bzImage&lt;/span&gt;&lt;br style=&quot;color: rgb(255, 255, 255);&quot;&gt;&lt;span style=&quot;color: rgb(255, 255, 255);&quot;&gt;
# make modules&lt;/span&gt;&lt;br style=&quot;color: rgb(255, 255, 255);&quot;&gt;&lt;span style=&quot;color: rgb(255, 255, 255);&quot;&gt;
# make modules_install&lt;/span&gt;&lt;br style=&quot;color: rgb(255, 255, 255);&quot;&gt;&lt;span style=&quot;color: rgb(255, 255, 255);&quot;&gt;
# make install&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
make install하면 아래와 같은 Warning문이 뜬다.&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;border: 1px dotted rgb(128, 184, 136); padding: 10px; background-color: rgb(40, 86, 58);&quot;&gt;
&lt;span style=&quot;color: rgb(255, 255, 255);&quot;&gt;WARNING: No module dm-mem-cache found for kernel 2.6.29.1, continuing anyway&lt;/span&gt;&lt;br style=&quot;color: rgb(255, 255, 255);&quot;&gt;&lt;span style=&quot;color: rgb(255, 255, 255);&quot;&gt;
WARNING: No module dm-message found for kernel 2.6.29.1, continuing anyway&lt;/span&gt;&lt;br style=&quot;color: rgb(255, 255, 255);&quot;&gt;&lt;span style=&quot;color: rgb(255, 255, 255);&quot;&gt;
WARNING: No module dm-raid45 found for kernel 2.6.29.1, continuing anyway&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
일단 커널 설치에는 영향을 주지 않으므로 건너뛰겠다.&lt;br /&gt;
&lt;br /&gt;
마지막으로 grub.conf파일을 편집하여 부팅시 우리가 새로 빌드한 커널을 기본으로 로드하겠다.&lt;br /&gt;
/boot/grub/grub.conf를 편집기로 열고 hiddenmenu를 주석문속에 넣는다. &lt;br /&gt;
이렇게 하면 부팅할 때 두가지 커널을 alternative하게 선택할 수 있게 된다.&lt;br /&gt;
또한 우리가 새로 컴파일한 커널을 Default커널로 띠우기 위하여 default값 1을 0으로 고친다.&lt;br /&gt;
서버를 재부팅하면 새롭게 컴파일된 커널을 만날 수 가 있다.^^&lt;br /&gt;
&lt;br /&gt;
새로 부팅하고 uname -a를 쳐보자.&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;border: 1px dotted rgb(144, 224, 255); padding: 10px; background-color: rgb(36, 46, 64);&quot;&gt;
&lt;span style=&quot;color: rgb(255, 255, 255);&quot;&gt;# uname -a&lt;/span&gt;&lt;br style=&quot;color: rgb(255, 255, 255);&quot;&gt;&lt;span style=&quot;color: rgb(255, 255, 255);&quot;&gt;Linux localhost 2.6.29.1 #1 SMP Mon Apr 27 15:30:11 CST 2009 i686 i686 i386 GNU/Linux&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
정확히 우리가 원하는 커널로 부팅이 되었음을 확인 할 수 있다. 이로써 커널 설치는 끝마리를 맺는다.&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-weight: bold;&quot;&gt;3. iptables 설치&lt;/span&gt;&lt;br /&gt;
자 이제 그럼 iptables를 새로 컴파일 하여 connlimit 모듈을 추가해보자.&lt;br /&gt;
일단 새로 부팅한후 &lt;br /&gt;
# iptables -L -n&lt;br /&gt;
해보면 아무내용도 뜨지 않음을 발견할 수 있다.&lt;br /&gt;
setup을 이용하여 새로 설정을 한후 iptables 을 내렸다 올리자.&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;border: 1px dotted rgb(144, 224, 255); padding: 10px; background-color: rgb(36, 46, 64);&quot;&gt;
&lt;span style=&quot;color: rgb(255, 255, 255);&quot;&gt;# lsmod | grep connlimit 해보면 모듈이 로드 되지 않았음을 알 수 있다.&lt;/span&gt;&lt;br style=&quot;color: rgb(255, 255, 255);&quot;&gt;&lt;span style=&quot;color: rgb(255, 255, 255);&quot;&gt;
# modprobe xt_connlimit 하여 connlimit 모듈을 로드하여 보자.&lt;/span&gt;&lt;br style=&quot;color: rgb(255, 255, 255);&quot;&gt;&lt;span style=&quot;color: rgb(255, 255, 255);&quot;&gt;
# lsmod | grep connlimit&lt;/span&gt;&lt;br style=&quot;color: rgb(255, 255, 255);&quot;&gt;&lt;span style=&quot;color: rgb(255, 255, 255);&quot;&gt;
xt_connlimit&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3500&amp;nbsp; 0 &lt;/span&gt;&lt;br style=&quot;color: rgb(255, 255, 255);&quot;&gt;&lt;span style=&quot;color: rgb(255, 255, 255);&quot;&gt;
nf_conntrack&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 58828&amp;nbsp; 4 xt_connlimit,nf_conntrack_netbios_ns,nf_conntrack_ipv4,xt_state&lt;/span&gt;&lt;br style=&quot;color: rgb(255, 255, 255);&quot;&gt;&lt;span style=&quot;color: rgb(255, 255, 255);&quot;&gt;
x_tables&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 13864&amp;nbsp; 7 xt_connlimit,ip_tables,ip6t_REJECT,ip6_tables,ipt_REJECT,xt_state,xt_tcpudp&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
정확히 로드가 되었음을 확인 할 수 있다. (커널에 컴파일하여 넣었으니 로드가 않되면 이상하다.ㅎㅎ)&lt;br /&gt;
&lt;br /&gt;
여기서는 기존의 rpm 버전 iptables를 삭제하지 않고 그 위에 소스컴파일로 덮어씌우는 방식으로 진행을 하겠다.&lt;br /&gt;
왜냐하면 rpm 버전을 삭제한 뒤 소스로 새롭게 설치하게 되면 기존의 rpm 버전에서 제공하던 system-config-securitylevel, lokkit, /etc/rc.d/init.d/iptables 와 같은 실행 스크립트 파일이 존재하지 않기 때문에 따로 스크립트로 구현하지 않는 한 일일이 iptables 룰을 추가해야 하는 불편함을 감수해야 한다. &lt;br /&gt;
다행스럽게도 iptables를 소스로 설치하게 되면 바이너리 파일, 환경설정 파일, 라이브러리 등이 rpm 버전과 거의 동일한 경로에 설치되므로 rpm 버전 위에 덮어 씌워 설치하면 기존의 관련 명령어를 그대로 활용할 수 있다는 장점이 있다. (찝찝함이 남아 있는것만은 사실이다. 허나 노가다를 줄이기 위해서는 이 방법이 최상책일 것이다.)&lt;br /&gt;
잠시 iptables를 중지하겠다.&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;border: 1px dotted rgb(144, 224, 255); padding: 10px; background-color: rgb(36, 46, 64);&quot;&gt;
&lt;span style=&quot;color: rgb(255, 255, 255);&quot;&gt;# service iptables stop&lt;/span&gt;&lt;br style=&quot;color: rgb(255, 255, 255);&quot;&gt;
&lt;br style=&quot;color: rgb(255, 255, 255);&quot;&gt;&lt;span style=&quot;color: rgb(255, 255, 255);&quot;&gt;
# cd /usr/local/src/iptables-1.4.3.2&lt;/span&gt;&lt;br style=&quot;color: rgb(255, 255, 255);&quot;&gt;&lt;span style=&quot;color: rgb(255, 255, 255);&quot;&gt;
# ./configure&lt;/span&gt;&lt;br style=&quot;color: rgb(255, 255, 255);&quot;&gt;&lt;span style=&quot;color: rgb(255, 255, 255);&quot;&gt;
# make&lt;/span&gt;&lt;br style=&quot;color: rgb(255, 255, 255);&quot;&gt;&lt;span style=&quot;color: rgb(255, 255, 255);&quot;&gt;
# make install&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
이제 기존의 rpm 버전 iptables에서 사용되던 명령어들을 백업하고 새로 설치한 소스 버전의 명령어들로 교체하는 작업이 필요하다.&lt;br /&gt;
/sbin 디렉토리안의 iptables 관련 명령 삭제 후, /usr/local/sbin 아래에 생성된 iptables 관련 명령들을 심볼릭 링크한다.(총 8개 명령)&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;border: 1px dotted rgb(144, 224, 255); padding: 10px; background-color: rgb(36, 46, 64);&quot;&gt;
&lt;span style=&quot;color: rgb(255, 255, 255);&quot;&gt;# cd /sbin&lt;/span&gt;&lt;br style=&quot;color: rgb(255, 255, 255);&quot;&gt;&lt;span style=&quot;color: rgb(255, 255, 255);&quot;&gt;
# mv ip6tables ip6tables.old&lt;/span&gt;&lt;br style=&quot;color: rgb(255, 255, 255);&quot;&gt;&lt;span style=&quot;color: rgb(255, 255, 255);&quot;&gt;
# mv ip6tables-restore ip6tables-restore.old&lt;/span&gt;&lt;br style=&quot;color: rgb(255, 255, 255);&quot;&gt;&lt;span style=&quot;color: rgb(255, 255, 255);&quot;&gt;
# mv ip6tables-save ip6tables-save.old&lt;/span&gt;&lt;br style=&quot;color: rgb(255, 255, 255);&quot;&gt;&lt;span style=&quot;color: rgb(255, 255, 255);&quot;&gt;
# mv iptables iptables.old&lt;/span&gt;&lt;br style=&quot;color: rgb(255, 255, 255);&quot;&gt;&lt;span style=&quot;color: rgb(255, 255, 255);&quot;&gt;
# mv iptables-restore iptables-restore.old&lt;/span&gt;&lt;br style=&quot;color: rgb(255, 255, 255);&quot;&gt;&lt;span style=&quot;color: rgb(255, 255, 255);&quot;&gt;
# mv iptables-save iptables-save.old&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
심볼릭 링크를 걸어줄 대상들을 확인해보자~&lt;br /&gt;
&lt;div style=&quot;border: 1px dotted rgb(144, 224, 255); padding: 10px; background-color: rgb(36, 46, 64);&quot;&gt;
&lt;span style=&quot;color: rgb(255, 255, 255);&quot;&gt;# ls /usr/local/sbin&lt;/span&gt;&lt;br style=&quot;color: rgb(255, 255, 255);&quot;&gt;&lt;span style=&quot;color: rgb(255, 255, 255);&quot;&gt;
ip6tables&amp;nbsp; ip6tables-multi&amp;nbsp; ip6tables-restore&amp;nbsp; ip6tables-save&amp;nbsp; iptables&amp;nbsp; iptables-multi&amp;nbsp; iptables-restore&amp;nbsp; iptables-save&lt;/span&gt;&lt;br style=&quot;color: rgb(255, 255, 255);&quot;&gt;
&lt;br style=&quot;color: rgb(255, 255, 255);&quot;&gt;&lt;span style=&quot;color: rgb(255, 255, 255);&quot;&gt;
# ln -s /usr/local/sbin/ip6tables /sbin&lt;/span&gt;&lt;br style=&quot;color: rgb(255, 255, 255);&quot;&gt;&lt;span style=&quot;color: rgb(255, 255, 255);&quot;&gt;
# ln -s /usr/local/sbin/ip6tables-restore /sbin&lt;/span&gt;&lt;br style=&quot;color: rgb(255, 255, 255);&quot;&gt;&lt;span style=&quot;color: rgb(255, 255, 255);&quot;&gt;
# ln -s /usr/local/sbin/iptables /sbin&lt;/span&gt;&lt;br style=&quot;color: rgb(255, 255, 255);&quot;&gt;&lt;span style=&quot;color: rgb(255, 255, 255);&quot;&gt;
# ln -s /usr/local/sbin/iptables-restore /sbin&lt;/span&gt;&lt;br style=&quot;color: rgb(255, 255, 255);&quot;&gt;&lt;span style=&quot;color: rgb(255, 255, 255);&quot;&gt;
# ln -s /usr/local/sbin/ip6tables-multi /sbin&lt;/span&gt;&lt;br style=&quot;color: rgb(255, 255, 255);&quot;&gt;&lt;span style=&quot;color: rgb(255, 255, 255);&quot;&gt;
# ln -s /usr/local/sbin/ip6tables-save /sbin&lt;/span&gt;&lt;br style=&quot;color: rgb(255, 255, 255);&quot;&gt;&lt;span style=&quot;color: rgb(255, 255, 255);&quot;&gt;
# ln -s /usr/local/sbin/iptables-multi /sbin&lt;/span&gt;&lt;br style=&quot;color: rgb(255, 255, 255);&quot;&gt;&lt;span style=&quot;color: rgb(255, 255, 255);&quot;&gt;
# ln -s /usr/local/sbin/iptables-save /sbin&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
iptable을 버젼을 확인 해보면...&lt;br /&gt;
&lt;br /&gt;&lt;div style=&quot;border: 1px dotted rgb(144, 224, 255); padding: 10px; background-color: rgb(36, 46, 64);&quot;&gt;
&lt;span style=&quot;color: rgb(255, 255, 255);&quot;&gt;# iptables -V&lt;/span&gt;&lt;br style=&quot;color: rgb(255, 255, 255);&quot;&gt;&lt;span style=&quot;color: rgb(255, 255, 255);&quot;&gt;
iptables v1.4.3.2&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
iptables가 정확히 업그레이드 되었음을 볼 수 있다.&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;border: 1px dotted rgb(144, 224, 255); padding: 10px; background-color: rgb(36, 46, 64);&quot;&gt;
&lt;span style=&quot;color: rgb(255, 255, 255);&quot;&gt;# service iptables start&lt;/span&gt;&lt;br style=&quot;color: rgb(255, 255, 255);&quot;&gt;&lt;span style=&quot;color: rgb(255, 255, 255);&quot;&gt;
# iptables -L -n&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
기존에 룰들이 그대로 존재하고 있을 것이다.&lt;br /&gt;
&lt;br /&gt;
connlimit 모듈을 적용해보자.&lt;br /&gt;&lt;div class=&quot;entry-ccl&quot; style=&quot;clear: both; text-align: right; margin-bottom: 10px&quot;&gt;
	&lt;img id=&quot;ccl-icon-137-0&quot; class=&quot;entry-ccl-by&quot; src=&quot;http://cfs.tistory.com/static/admin/editor/ccl_black01.png&quot; alt=&quot;저작자 표시&quot;/&gt;
	&lt;img id=&quot;ccl-icon-137-1&quot; class=&quot;entry-ccl-nc&quot; src=&quot;http://cfs.tistory.com/static/admin/editor/ccl_black02.png&quot; alt=&quot;비영리&quot;/&gt;
	&lt;img id=&quot;ccl-icon-137-2&quot; class=&quot;entry-ccl-nd&quot; src=&quot;http://cfs.tistory.com/static/admin/editor/ccl_black03.png&quot; alt=&quot;변경 금지&quot;/&gt;
	&lt;!--
	&lt;rdf:RDF xmlns=&quot;http://web.resource.org/cc/&quot; xmlns:dc=&quot;http://purl.org/dc/elements/1.1/&quot; xmlns:rdf=&quot;http://www.w3.org/1999/02/22-rdf-syntax-ns#&quot;&gt;
		&lt;Work rdf:about=&quot;&quot;&gt;
			&lt;license rdf:resource=&quot;http://creativecommons.org/licenses/by-nc-nd/2.0/kr/&quot; /&gt;
		&lt;/Work&gt;
		&lt;License rdf:about=&quot;http://creativecommons.org/licenses/by-nc-nd/&quot;&gt;
			&lt;permits rdf:resource=&quot;http://web.resource.org/cc/Reproduction&quot;/&gt;
			&lt;permits rdf:resource=&quot;http://web.resource.org/cc/Distribution&quot;/&gt;
			&lt;requires rdf:resource=&quot;http://web.resource.org/cc/Notice&quot;/&gt;
			&lt;requires rdf:resource=&quot;http://web.resource.org/cc/Attribution&quot;/&gt;
			&lt;prohibits rdf:resource=&quot;http://web.resource.org/cc/CommercialUse&quot;/&gt;
		&lt;/License&gt;
	&lt;/rdf:RDF&gt;
	--&gt;
&lt;/div&gt;
</description>
			<category>리눅스 자료</category>
			<category>Compile</category>
			<category>connlimit</category>
			<category>gcc</category>
			<category>iptables</category>
			<category>Kernel</category>
			<category>Module</category>
			<category>RPM</category>
			<category>커널</category>
			<category>컴파일</category>
			<author>[GUNi]</author>
			<guid>http://guni.loveyust.net/137</guid>
			<comments>http://guni.loveyust.net/137#entry137comment</comments>
			<pubDate>Mon, 27 Apr 2009 19:24:48 +0800</pubDate>
		</item>
	</channel>
</rss>
