¿ì¸®°¡ ÀÚÁÖ »ç¿ëÇÏ´Â ssh ¼ºñ½º¿¡ Á¢¼ÓÇÒ ¶§ °£È¤ ¹æȺ®¿¡ °É·Á¼ ¸øµé¾î°¥¶§°¡ ÀÖ´Ù. À̶§ ¹æȺ®À̶ó ÇÏ¸é ¿©·¯ °¡Áö°¡ ÀÖÀ» ¼ö Àִµ¥ ±âº»ÀûÀ¸·Î ¸®´ª½º¿¡ Æ÷ÇԵǾî ÀÖ´Â TCP_WRAPPER ¿Í NETFILTER(iptables, ipchains) °¡ ÀÖ´Ù.
ÀÌ µÎ°¡Áö ¼³Á¤¿¡ µû¶ó ssh ¼ºñ½º¸¦ ¸·À» ¼öµµ ¿¾î ³õÀ» ¼öµµ Àִµ¥, ÀÌ ¼³Á¤Àº »ý°¢ÇÏÁö ¸øÇÏ°í ssh ¼ºñ½º Á¢¼ÓÀÌ ¾ÊµÇ¾î¼ ³°¨ÇØ ÇÒ °æ¿ì°¡ ÀÖ´Ù. ¿ì¼± ¾Æ·¡ÀÇ °¢°¢ÀÇ ¿¹¸¦ »ìÆ캸ÀÚ
1. Á¢¼Ó ´ë»óÀÌ ¾øÀ» °æ¿ì
[root@hackerz root]# ssh root@210.x.x.200 ssh: connect to host 210.x.x.200 port 22: No route to host [root@hackerz root]# ping 210.101.x.200 PING 210.x.x.200 (210.101.214.200) 56(84) bytes of data. From 210.x.x.20 icmp_seq=1 Destination Host Unreachable From 210.x.x.20 icmp_seq=2 Destination Host Unreachable From 210.x.x.20 icmp_seq=3 Destination Host Unreachable
--- 210.101.214.200 ping statistics --- 4 packets transmitted, 0 received, +3 errors, 100% packet loss, time 2999ms , pipe 4 [root@hackerz root]# | 2. netfilter(iptables) ·Î ¸·¾Æ³õ¾ÒÀ» °æ¿ì No route to host ¶ó°í ¶á´Ù.
[root@hackerz root]# ssh root@210.x.x.209 ssh: connect to host 210.101.214.209 port 22: No route to host [root@hackerz root]# [root@hackerz root]# ping 210.x.x.209 PING 210.101.214.209 (210.101.214.209) 56(84) bytes of data. 64 bytes from 210.x.x.209: icmp_seq=0 ttl=64 time=0.628 ms 64 bytes from 210.x.x.209: icmp_seq=1 ttl=64 time=0.200 ms
--- 210.101.214.209 ping statistics --- 2 packets transmitted, 2 received, 0% packet loss, time 1000ms rtt min/avg/max/mdev = 0.200/0.414/0.628/0.214 ms, pipe 2 [root@hackerz root]# | 3. sshd ¼ºñ½º°¡ È°¼ºÈ µÇ¾î ÀÖÁö ¾ÊÀ» °æ¿ì
[root@hackerz root]# ssh root@210.x.x.209 ssh: connect to host 210.x.x.209 port 22: Connection refused [root@hackerz root]# | 4. tcp_wrapper ·Î ¸·ÇôÁ® ÀÖÀ» °æ¿ì
[root@hackerz root]# ssh root@210.x.x.209 ssh_exchange_identification: Connection closed by remote host [root@hackerz root]# | 5. ¼ºñ½º µÇ´Â Æ÷Æ®°¡ ´Ù¸¦ °æ¿ì
[root@hackerz root]# ssh root@xxx.co.kr ssh: connect to host xxx.co.kr port 22: Connection refused [root@hackerz root]# ssh root@xxx.co.kr -p7700 root@linuxone.co.kr's password: Last login: Sat Mar 12 13:30:38 2005 from 211.x.x.205 [root@localhost root]# |
ÀÌÁ¦ ¿ì¸®´Â ssh ¼¹ö½Ã Á¢¼ÓÀÌ ¾ÊµÉ½Ã¿¡ ¿Ö ¾ÊµÉ±î? ¶ó°í °í¹ÎÇÏÁö ¾Ê¾Æµµ µÈ´Ù. ¿Ö ¾ÊµÇ´ÂÁö ãÀ¸·Á°í °í¹ÎÇÏ´Â ½Ã°£À» ÁÙ¿©ÁÖ´Â Æ®·¯ºí ½´ÆÃÀÌ ¾Æ´Ò±î?
¿©±â±îÁö ºÁ¼ Àß ÀÌÇØ°¡ °¡Áö ¾Ê´Â ´Ù´Â ºÐµéÀ» À§ÇØ ÇϳªÇϳª ¼³¸íÇØ º¸°Ú´Ù.
1¹øÀÇ °æ¿ì ´ë»ó ¼¹ö°¡ ¾Æ¿¹ Á¸Àç ÇÏÁö ¾Ê´Â °æ¿ìÀÌ´Ù °í·Î ÇÎ Á¢±Ùµµ ¾ÊµÇ°í ¼ºñ½º Á¢±Ù ¶ÇÇÑ ¾ÊµÈ´Ù. ¿©±â¼ ÁÖÀÇÇؼ ºÁ¾ß ÇÒ °ÍÀº No route to host ÀÌ´Ù.
2¹øÀÇ °æ¿ì ´ë»ó ¼¹ö¿¡ iptables ·Î ÇØ´ç ¼ºñ½ºÀÇ Á¢±ÙÀÌ °ÅºÎµÇ°Ô µÈ »óÅÂÀÌ´Ù. À̶§ ¶ÇÇÑ No route to host ¶ó°í ³ª¿Â´Ù ÇÏÁö¸¸ Ping Àº µ¹¾Æ¿À´Â °ÍÀº º¼¼ö ÀÖ´Ù. ¼¹ö°¡ Á¸ÀçÇѴٴ°ÍÀÌ´Ù.
¹°·Ð 1¹ø°ú 2¹øÀÇ °æ¿ì¿¡¼ Ping (ICMP) ¶ÇÇÑ ¸·¾Æ ³ù´Ù¸é °í¹ÎÇÏ´Â ½Ã°£ÀÌ ±æ¾îÁö°ÚÁö¸¸ ÀÌ°ÍÀº Å« ¹®Á¦°¡ ¾Æ´Ï¶ó°í »ý°¢ÇÑ´Ù. ¼³¸¶ Á¢¼ÓÇÏ´Â °÷ÀÇ ¾ÆÀÌÇǸ¦ Âø°¢ÇÒ ÀÏÀº ¾øÀ»°Å¶ó°í º»´Ù. ¸¸¾à ÀÖ´Ù¸é... µ¶ÀÚÀÇ ½Ç¼öÀÌ´Ï Àúµµ ¾î¿¼ö°¡ ¾ø´Ù.
3¹øÀÇ °æ¿ì¸¦ º¸ÀÚ 22¹ø Æ÷Æ®·Î Connection refused µÇ¾ú´Ù.
1¹ø°ú 2¹øÀÇ °æ¿ì¿Í ´Ù¸¥ °ÍÀ» ¾Ë¼ö ÀÖ´Ù. ÀÌ ¸Þ½ÃÁö°¡ È®ÀÎ µÇ¾úÀ»¶§´Â ssh ¼ºñ½º°¡ ´Ù¸¥ Æ÷Æ®·Î ¿î¿µµÇ°Å³ª, ¼ºñ½ºµÇ°í ÀÖÁö ¾Ê´Ù°í ÆÇ´ÜÇÒ ¼ö ÀÖÀ»°ÍÀÌ´Ù.
4¹øÀÇ °æ¿ì tcp_wrapper ·Î ¸·¾Æ³õÀº °æ¿ìÀÌ´Ù. Connection closed by remote host ÀÌ·¯ÇÑ ¸Þ½ÃÁö°¡ ÀÀ´äÀÌ ÀÖ¾ú´Ù. ÀÌ·¯ÇÑ ¸Þ½ÃÁö°¡ Ãâ·ÂµÇ¾úÀ»¶§´Â tcp_wrapper ·Î ¸·¾Æ³õ¾Ò´Ù´Â °ÍÀ» ¹Ù·Î ¾Ë ¼ö ÀÖÀ»°ÍÀÌ´Ù.
5¹øÀÇ °æ¿ì´Â ssh ·Î ¼ºñ½º µÇ´Â Æ÷Æ®°¡ ´Ù¸¥ °æ¿ìÀÌ´Ù. À̶§ ÀÀ´äµÇ´Â ¸Þ½ÃÁö´Â Connect refused ÀÌ´Ù
ÀÚ ±×·¯¸é ¿ì¸®´Â ÇϳªÀÇ Ç¥¸¦ ¾òÀ» ¼ö ÀÖ´Ù. No route to host : ¼¹ö°¡ Á¸ÀçÇÏÁö ¾ÊÀ»¶§, Netfilter(iptables, ipchains)·Î ¸·ÇôÀÖÀ» ¶§ Connection refused : ¼ºñ½º°¡ È°¼ºÈµÇÁö ¾Ê¾ÒÀ» ¶§, ¼ºñ½º Æ÷Æ®°¡ ´Ù¸¦¶§ Connection closed by remote host : Tcp_Wrapper·Î Â÷´ÜµÇ¾úÀ»¶§
5°¡Áö °æ¿ì¸¦ ³õ°í ¿ì¸®°¡ Á¢¼ÓÇÏ°íÀÚ ÇÏ´Â ssh ¼ºñ½º·Î Á¢¼ÓµÇÁö ¾ÊÀ»¶§ ½Å¼ÓÇÑ ¹®Á¦ÇØ°áÀÌ °¡´ÉÇÒ °ÍÀÌ´Ù. ¸Þ½ÃÁö¸¸ º¸°íµµ ¡°¾î´À ºÎºÐ¿¡¼ ¸·ÇôÀÖÀ»°Å¾ß...¡± ¶ó°í ¹Ù·Î ÀÎÁö ÇÒ ¼ö ÀÖ°Ô µÈ°ÍÀÌ´Ù.
ÀÌ ±ÛÀÌ ¸®´ª¼ ¿©·¯ºÐµéÀÇ Æ®·¯ºí ½´Æÿ¡ ¸¹Àº µµ¿òÀÌ µÇ¾úÀ¸¸é ÇÑ´Ù.
|