´ÙÀ½ ÀÌÀü Â÷·Ê

5. tcpwraper´Â ½Ãü°¡ ¾Æ´Ï´Ù!

tcp_wraper... ¿ä°Å »ç¿ëÇÏ´Â »ç¶÷ º°·Î ¾øÀ»°ÍÀ̶ó »ý°¢µË´Ï´Ù. ¿ä°ÍÀÌ ¹«¾ùÀ̳Ä! ¹Ù·Î °ü¸®ÀÚ°¡ ¼±ÅÃÀûÀ¸·Î Á¢¼ÓÇϴ ȣ½ºÆ®¸¦ ¸·´Â ÅøÀÌ´Ù  ÀÌ°Ì´Ï´Ù. ÀÚ, ÇÊ¿äÇÑ ÆÄÀϵéÀ» º¼±î¿ä?

/etc/hosts.allow
/etc/hosts.deny

±×¸®°í ¼­ºñ½º·Î Çϳª ¸¸µé °ÍÀÌ ÀÖÁÒ. ÆÄÀÏÀ̸§Àº host_check·Î ÇÒ²²¿ä.


#!/bin/sh
 
 ################################  º¯¼öÁ¤ÀǺι®
 
 # ¸ÞÀÏ ¼ö½ÅÀÚ
 mailto=reduck96
 
 # È­¸éÃâ·Â ¿©ºÎ, ¸ÞÀÏÀü¼Û ¿©ºÎ
 dsp=$1; msg=$2
 
 # Á¢¼ÓÀÚ Á¤º¸ µî
 a=$3; c=$4; d=$5; h=$6; n=$7; p=$8; s=$9; u=$10
 
 # ÇöÀç ½Ã°£
 time=`date`
 
 # Á¢¼Ó½ÃµµÀÚ ¼Ò¼Ó ¼­¹öÀÇ finger Á¤º¸
 finger=`/usr/bin/finger -l @$h 2> /dev/null`
 
 
 ################################  È­¸é Ãâ·ÂºÎ¹®
 
 if [ $dsp = Y ]
    then
 
 /bin/echo "
                      ===================================\n\
                           Á¢¼ÓÀÌ Çã¿ëµÇÁö ¾Ê½À´Ï´Ù.     \n\
                      ===================================\n\
 \n\
               Access Time             : $time\n\
               Client host address     : $a\n\
               Client information      : $c\n\
               Client host name(or IP) : $h\n\
               Client host name        : $n\n\
               Client user name        : $u\n\n
"
 
 fi
 
 
 ################################  ¸ÞÀÏ ¼Û½ÅºÎ¹®
 
 if [ $msg = Y ]
    then
 
 /bin/echo "
                        ===============================\n\
                              Á¢¼Ó °ÅºÎÀÚ »ó¼¼Á¤º¸     \n\
                        ===============================\n\
 \n\
         Access Time                    : $time\n\
         Access client host address     : $a\n\
         Access client information      : $c\n\
         The daemon process name        : $d\n\
         Access client host name(or IP) : $h\n\
         Access client host name        : $n\n\
         The daemon process id          : $p\n\
         Server information             : $s\n\
         Access client user name        : $u\n\
 \n\
--------------------------------------------------------\n\
                       Access client finger information                    \n\
 --------------------------------------------------------\n\
 $finger\n\
 ---------------------------------------------------------\n\
 \n\n" | \
      /bin/mail -s "tcp_wrapper report [$d]" $mailto
 
 fi

ÀÌ·¸°Ô host_check ÆÄÀÏÀ» ¸¸µçµÚ, /etc/¿¡ ³Ö¾îµÓ½Ã´Ù. Âü, ÀÌ°Å ÀØÁö ¸¶¼¼¿ä.

chmod a+rx /etc/host_check

¿ä·¸°Ô ½ÇÇàÇÒ ¼ö ÀÖ°Ô ¸¸µé¾î ³õ¾Æ¾ß µÇ¿ä. ÀÚ¾Æ, ÀÌÁ¦ ³ª¸ÓÁö hosts.allow¿Í hosts.deny¸¦ Àۻ쳻º¾½Ã´Ù. hosts.allowÀÇ ³»¿ëÀÔ´Ï´Ù.


#
# hosts.allow   This file describes the names of the hosts which are
#               allowed to use the local INET services, as decided
#               by the '/usr/sbin/tcpd' server.
#
in.telnetd : \
    127.0.0.1 \
    203.249.111. \
    133.207. \
    203.249.107.174 \
    nec.co.jp \
: rfc931: ALLOW 

±×¸®°í, hosts.denyÀÇ ³»¿ëÀÔ´Ï´Ù.


#
# hosts.deny    This file describes the names of the hosts which are
#               *not* allowed to use the local INET services, as decided
#               by the '/usr/sbin/tcpd' server.
#
# The portmap line is redundant, but it is left to remind you that
# the new secure portmap uses hosts.deny and hosts.allow.  In particular
# you should know that NFS uses portmap!
ALL : ALL EXCEPT LOCAL :\
 twist ( /etc/host_check Y Y %a %c %d %h %n %p %s %u ) &

´ëÃæ º¸½Ã¸é ¾Æ½Ã°ÚÁÒ? hosts.allow¿¡´Â Çã¿ëÇÒ ÄÄÀÇ ip³»Áö domainÀ» ¾²¸é µË´Ï´Ù. ±×¸®°í hosts.deny´Â ¼öÁ¤ÇÒ °ÍÀÌ °ÅÀÇ ¾ø½À´Ï´Ù. ´Ü, ¸ÞÀϹ޴ »ç¶÷ÀÇ ID´Â ¹Ù²Ù¾î ÁÖ¼Å¾ß °ÚÁÒ? reduck96 ºÎºÐÀÔ´Ï´Ù. ÀÌ°ÍÀÌ ¿ì° ÀÛµ¿À» ÇÏ´À³Ä  ±Ã±ÝÇϽÃÁÒ? ÀÏ´Ü Çã¿ëµÇÁö ¾Ê´Â°÷ÀÇ IP¿¡¼­ telnetÀ¸·Î Á¢¼ÓÀ» ½ÃµµÇÕ´Ï´Ù. ±×·¯¸é ¹Ù·Î host_check°¡ µ¹ÁÒ. ±×¸®°í Á¢¼ÓÀ» ½ÃµµÇÑ ÄÄ¿¡°Ô finger¸¦ ½ÃµµÇؼ­ Á¤º¸¸¦ ¸ÞÀÏ·Î °ü¸®ÀÚ¿¡°Ô º¸³À´Ï´Ù. ¹°·Ð host_check¸¦ Ư¼öÇÑ ÇÁ·Î±×·¥À¸·Î ¹Ù²Ù¾î ÇÑ´Ù¸é ¹«Áö¹«Áö Àç¹ÌÀÖ°ÚÁÒ? ¿¹¸¦ µé¾î Tear_DropÀ̶óµçÁö, PING_DUMP°°Àº ¾ÆÁÖ ¼ºÁú ³ª»Û °ÍÀ¸·Î¿ä. ¿ä·± °Å ¾îµð¼­ ±¸Çϳı¸¿ä? ÈåÈåÈå    ÀÌ°÷¿¡ Çѹø °¡º¸¼¼¿ä. Àç¹ÌÀÖ´Â ÅøµéÀÌ ¸¹½À´Ï´Ù.

http://www.rootshell.com

ÀÚ, ¼¼ºÎ ¼³Á¤Àº ¿©·¯ºÐµé¿¡°Ô ¼÷Á¦·Î ³²±â°Ú½À´Ï´Ù. Àß ¼³Á¤Çؼ­ »ç¿ëÇϽñ⸦... Âü, telnet¸»°íµµ ´Ù¸¥°Íµµ ¸·°í½Í´Ù±¸¿ä? ±×·³ ¿¹Á¦¸¦ ´õ ³Ö¾îµå¸±²²¿ä.


portmap rpc.nfsd rpc.mountd: \
    127.0.0.1 \
    203.249.111. \
: ALLOW
in.fingerd in.cfingerd : rfc931:DENY 
in.timed ipop3d: ALL@ALL: rfc931: DENY 
in.ntalkd in.talkd: ALL: rfc931: ALLOW 
in.ftpd: ALL@ALL: rfc931: ALLOW

ÀÌÁ¤µµ¸é µÇ°ÚÁÒ? °£´ÜÇÏÁÒ? »ç¿ëÇÒ ´ë¸óÇÁ·Î±×·¥ÀÇ À̸§À» ¾Õ¿¡ ½áÁÖ°í Çü½ÄÀº °°À¸´Ï º¯ÇüÇؼ­ »ç¿ëÇÏ½Ã¸é µË´Ï´Ù. ¿ä·¸°Ô Çؼ­ °É¸° IPµéÀ» Á¶»çÇغ¸¸é, ´ëºÎºÐ sscanÀ¸·Î ÈÖÁý¾î ±ñ´Ù´Â °ÍÀ» ¾Æ½Ç ¼ö ÀÖÀ» °ÍÀÔ´Ï´Ù. Á¶½ÉÇϼ¼¿ä. Àú¿¡°Ô sscan°É¸®¸é Àü ¹Ù·Î Vs ¸ðµå(º¸º¹¸ðµå)·Î µ¹º¯Çϴϱî¿ä.


´ÙÀ½ ÀÌÀü Â÷·Ê