Ä¿ÇǴнº, ½Ã½ºÅÛ ¿£Áö´Ï¾îÀÇ ½°ÅÍ
  ¾ÆÆÄÄ¡ ¼³Á¤ È°¿ë ¿¹(¼­ºñ½º Á¦ÇÑÃø¸é) ÀÛ¼ºÀÏ : 2005/01/28 23:48
 
  • ±Û¾´ÀÌ : ÁÁÀºÁøÈ£ ( http://coffeenix.net/ )
  • Á¶È¸¼ö : 13727
     
    Á¦  ¸ñ : ¾ÆÆÄÄ¡ ¼³Á¤ È°¿ë ¿¹(¼­ºñ½º Á¦ÇÑÃø¸é)
    ÀÛ¼ºÀÚ : ÁÁÀºÁøÈ£(truefeel, http://coffeenix.net/ )
    ÀÛ¼ºÀÏ : 2003.2~
    Á¤¸®ÀÏ : 2005.1.28(±Ý)
    ¼öÁ¤ÀÏ : 2005.7.16(Åä) : 2-4) ³»¿ë Ãß°¡
             2005.11.5(Åä) : 2-3) ³»¿ë Ãß°¡

    ¾ÆÆÄÄ¡ À¥¼­¹öÀÇ È°¿ë¿¡ ÀÖ¾î, º¸´Ù³ªÀº º¸¾È ¼³Á¤ ¹æ¹ý ¸î °¡Áö¸¦ ¼Ò°³ÇÑ´Ù.

    ƯÁ¤ Agent°¡ ÀÚ²Ù »çÀÌÆ®¿¡ µé¾î¿Í¼­ ±Ü¾î°£´ÙµçÁö,
    À̹ÌÁö ÆÄÀÏÀ» ¿ÜºÎ¿¡¼­ ¸µÅ©ÇÏÁö ¸øÇϵµ·Ï ÇÑ´ÙµçÁö,
    ƯÁ¤ IP¿¡¼­´Â ÀÎÁõ¾øÀÌ, ±× ÀÌ¿Ü IP¿¡¼­´Â ¾ÆÆÄÄ¡ ÀÎÁõÀ» ÅëÇؼ­¸¸ ÆäÀÌÁö¸¦ º¸°ÔÇÏ´Â
    µîÀÇ ÀÀ¿ëÀûÀÎ Ãø¸é¿¡¼­ ¹æ¹ýµéÀÌ´Ù.
    ÀÌ ¹æ¹ýµéÀº Á¦°¡ »ç¿ëÇÏ°í ÀÖ´Â ¸î°¡Áö ¹æ¹ýÀ» Á¤¸®ÇÏ´Â Àǹ̿¡¼­ ÀûÀº °ÍÀÌ´Ù.

    1. ƯÁ¤ ºê¶ó¿ìÀúÀÇ Á¢¼ÓÀ» Â÷´Ü

     
    SetEnvIfNoCase User-Agent "^Microsoft URL Control" dont_want

    <Directory /usr/local/apache/htdocs>
       <Limit GET POST>
    ¡¡¡¡¡¡Order Allow,Deny
    ¡¡¡¡¡¡Allow from all
    ¡¡¡¡¡¡Deny  from env=dont_want
       </Limit>
    </Directory>
     


    ----------------------------------------------
    SetEnvIfNoCase User-Agent "^Wget" bad_bot
    SetEnvIfNoCase User-Agent "^EmailSiphon" bad_bot
    SetEnvIfNoCase User-Agent "^EmailWolf" bad_bot

    The 'SetEnvIfNoCase' simply sets an enviornment (SetEnv) variable called
    'bad_bot' If (SetEnvIf) the 'User-Agent' string contains Wget, EmailSiphon, or
    EmailWolf, regardless of case (SetEnvIfNoCase). In english, anytime a browser
    with a name containing 'wget, emailsiphon, or emailwolf' accesses our website,
    we set a variable called 'bad_bot'. We'd also want to add a line for the
    User-Agent string of any other Spidert we want to deny.

    Now we tell Apache which directories to block the Spiderts from with the
    <Directory> directive:

    <Directory "/home/evolt/public_html/users/">
            Order Allow,Deny
            Allow from all
            Deny from env=bad_bot
    </Directory>

    2.  ´Ù¸¥ °÷¿¡¼­ images¸¦ linkÇÏÁö ¸øÇϵµ·Ï (hotlink ¹æÁö)
                                                                                                            
    ´Ù¸¥ °÷¿¡¼­ ÆÄÀÏÀ» ¸µÅ©ÇÏÁö ¸øÇϵµ·Ï ÇÏ´Â °ÍÀ» hotlink ¹æÁö¶ó°í ÇÑ´Ù.
    hotlink ¹æÁö¼³Á¤À» ÅëÇÏ¿©
    - ¿ÜºÎ »çÀÌÆ®¿¡¼­ ¸µÅ©¸¦ ÅëÇÑ ÄÁÅÙÃ÷ À¯Ãâ ¹æÁö¿Í
    - Æ®·¡ÇÈ °¨¼Ò È¿°ú¸¦ º¼ ¼ö ÀÖ´Ù.
                                                                                                            
    1) µð·ºÅ丮¸¦ Á¦ÇÑÇÏ´Â ¹æ¹ý
                                                                                                            
    referer üũ¸¦ ÅëÇØ ¿ÜºÎ¿¡¼­ /images ÀÌÇϵð·ºÅ丮ÀÇ ÆÄÀÏÀ» linkÇÏÁö ¸øÇϵµ·Ï ÇÑ´Ù.
    À̸¦Å׸é truefeel.kr À̶ó´Â »çÀÌÆ®°¡ ÀÖÀ» ¶§
    truefeel.kr³»¿¡ ÀÖ´Â µ¿¿µ»óÀ» ÀÌ µµ¸ÞÀο¡¼­´Â ¸µÅ©ÇÒ ¼ö ÀÖÁö¸¸
    ¿ÜºÎ »çÀÌÆ®¿¡¼­´Â ÀÌ µ¿¿µ»óÀ» ¸µÅ©Çصµ ±ÇÇÑÀÌ ¾øµµ·Ï ÇÒ ¼ö ÀÖ´Ù.
                                                                                                            
     
    SetEnvIf Referer "^http://localhost/"  local_referal
    SetEnvIf Referer "^http://127.0.0.1/"  local_referal
    SetEnvIf Referer "^http://ȨÆäÀÌÁö¸í/" local_referal
    SetEnvIf Referer "^$"                  local_referal
                                                                                                            
    <Directory /usr/local/apache/htdocs/images>
       Order Deny,Allow
       Deny  from all
       Allow from env=local_referal
    </Directory>
     

                                                                                                            
    2) À̹ÌÁö ÆÄÀÏ È®ÀåÀÚ·Î Á¦ÇÑÇÏ´Â ¹æ¹ý (Referer »ç¿ë)
       ¼­ºñ½º ÆäÀÌÁö°¡ ????.truefeel.kr ÀÏ ¶§
                                                                                                            
     
    SetEnvIfNoCase Referer "^http://localhost/"        local_referal
    SetEnvIf       Referer "^http://127.0.0.1/"        local_referal
    SetEnvIfNoCase Referer "^http://(.*).truefeel.kr/" local_referal
    SetEnvIfNoCase Referer "^http://truefeel.kr/"      local_referal
    SetEnvIfNoCase Referer "^$"                        local_referal
                                                                                                            
    <Files ~ "\.(gif|jpg|jpeg|png|bmp)$">
       Order deny,allow
       Deny  from all
       Allow from env=local_referal
    </Files>
     

                                                                                                            
    3) À̹ÌÁö ÆÄÀÏ È®ÀåÀÚ·Î Á¦ÇÑÇÏ´Â ¹æ¹ý 2 (Rewriting Rule »ç¿ë)
                                                                                                            
     
    RewriteEngine On
    RewriteCond %{HTTP_REFERER} !^$
    RewriteCond %{HTTP_REFERER} !^http://truefeel.aaa/.*$          [NC]
    RewriteCond %{HTTP_REFERER} !^http://www.truefeel.aaa/.*$      [NC]
    RewriteRule \.(jpg|jpeg|gif|png|bmp)$ /images/deny.jpg [NC,L]
     


    À§Ã³·³ ¼³Á¤Çϸé À§ 2°³ÀÇ URL°ú ºê¶ó¿ìÀúÀÇ ÁÖ¼Òâ¿¡ À̹ÌÁö¸¦ Á÷Á¢ÀÔ·ÂÇÑ °æ¿ì¸¦ Á¦¿ÜÇÏ°í´Â
    /images/deny.jpg¸¦ º¸¿©ÁÖ°Ô µÈ´Ù.
    NC(no case)´Â ´ë¼Ò¹®ÀÚ ±¸ºÐÇÏÁö ¾ÊÀ½. LÀº ¸¶Áö¸· ·êÀÓÀ» Ç¥½ÃÇÑ´Ù.
                                                                                                            
    4) À̹ÌÁö ÆÄÀÏ È®ÀåÀÚ·Î Á¦Çѽà ƯÁ¤ µð·ºÅ丮´Â Á¦¿ÜÇÏ´Â ¹æ¹ý
                                                                                                            
    À§ÀÇ '2)' ¼³Á¤¿¡ ´ÙÀ½ ³»¿ëÀ» Ãß°¡Çϸé /upload/ µð·ºÅ丮¿¡ ÀÖ´Â .jpg ÆÄÀÏÀ̶óµµ
    ¿ÜºÎ ¸µÅ©¸¦ Çã¿ëÇÏ°Ô µÈ´Ù.
                                                                                                            
     
    SetEnvIfNoCase Request_URI "^/upload/"            local_referal
     


    3. ƯÁ¤ IP¿¡¼­¸¸ Á¢±Ù °¡´ÉÇÏ°Ô

    ³Ê¹«³ªµµ ÈçÇÑ ¹æ¹ýÀ̱ä Çѵ¥, °³ÀÎÀûÀ¸·Î Àú¿¡°Ô ÀÌ·± ºÎºÐÀ» ¹°¾îº¸½Ã´Â ºÐÀÌ ¸¹¾Ò´Ù.
    ¾Æ·¡ÀÇ ¿¹´Â /usr/local/apache/htdocs µð·ºÅ丮¸¦ 211.111.222.0/24 ´ë¿ª¿¡¼­¸¸ Á¢±Ù°¡´ÉÇÑ ¼³Á¤ÀÌ´Ù.

     
    <Directory "/usr/local/apache/htdocs">
        Options FollowSymLinks MultiViews
        AllowOverride AuthConfig
        Order deny,allow
        Deny from all
        Allow from 211.111.222.0/255.255.255.0
    </Directory>
     


    ¹Ý´ë·Î ¾Æ·¡¿Í °°ÀÌ Çϸé ÁöÁ¤ÇÑ IP´ë¿ª¿¡¼­¸¸ Á¢±ÙÇÒ ¼ö ¾ø´Ù.

     
    ... »ý·« ...
        Order allow,deny
        Allow from all
        Deny from 211.111.222.0/255.255.255.0
    ... »ý·« ...
     


    4. ƯÁ¤ÆäÀÌÁö¸¦ ÀÎÁõµÈ »ç¿ëÀÚ¸¸ º¼ ¼ö ÀÖ´Â ¾ÆÆÄÄ¡ ÀÎÁõ ¼³Á¤

    À̹ø ±ÛÀº 5¹øÀÇ ÀÎÁõ ¼³Á¤À» ¾Ë±â Àü¿¡ ¾ÆÆÄÄ¡ ÀÎÁõ¿¡ ´ëÇØ ¸ð¸£´Â ºÐÀ» À§ÇØ ÀûÀº °ÍÀ¸·Î
    ¾ÆÆÄÄ¡ ÀÎÁõÀÌ ¹«¾ùÀÎÁö ¾È´Ù¸é 5¹øÀ¸·Î ¹Ù·Î ³Ñ¾î°¡±â ¹Ù¶õ´Ù.

    ¾ÆÆÄÄ¡¿¡¼­´Â ƯÁ¤ ÆäÀÌÁö¸¦ Á¢±ÙÇÒ ¶§ ID¿Í ºñ¹Ð¹øÈ£¸¦ ¾Ë¾Æ¾ß¸¸ Á¢±ÙÇϵµ·Ï ¼³Á¤ÇÒ ¼ö ÀÖ´Ù.
    ´ÙÀ½ ¿¹¸¦ º¸ÀÚ.

     
    <Directory "/home/truefeel/public_html">
                Options FollowSymLinks MultiViews
                AllowOverride AuthConfig
    </Directory>
     


    À§ ó·³ AllowOverride AuthConfig ¼³Á¤À» Çϸé ~truefeel/public_html µð·ºÅ丮¿¡ ÀÎÁõ °úÁ¤À»
    °ÅÄ¡´Â ±âº» ¼³Á¤Àº µÈ °ÍÀÌ´Ù.
    ¸¸¾à ~truefeel/public_html/manager/ ¾Æ·¡ÀÇ µð·ºÅ丮¿¡ ÀÎÁõÀ» °É·Á°í ÇÑ´Ù¸é ±× µð·ºÅ丮¿¡
    ´ÙÀ½°ú °°Àº Çü½ÄÀÇ .htaccess ÆÄÀÏÀ» »ý¼ºÇÑ´Ù.

    [ ~truefee/public_html/manger/.htaccess ÆÄÀÏ ³»¿ë ]
     
    AuthType Basic
    AuthName User   <-- "User" ´Â ÀÎÁõâ¿¡ Ç¥½ÃµÉ ¸Þ½ÃÁö ÁßÀÇ ÇϳªÀÏ »Ó ½Å°æ¾µ ÇÊ¿ä ¾ø´Ù.
    AuthUserFile /home/truefeel/manage/.htpasswd
    AuthGroupFile /dev/null
    <Limit GET POST>
    require valid-user
    </Limit>
     


    .htpasswd ÆÄÀÏ¿¡ ID/PW¸¦ »ý¼ºÇصθé ÇØ´çÆäÀÌÁö ÀÎÁõÀ» ÇÒ ¼ö ÀÖ°Ô µÈ´Ù.

    5. ƯÁ¤ IP´Â ÀÎÁõ¾øÀÌ, ±× ÀÌ¿Ü´Â ¾ÆÆÄÄ¡ ÀÎÁõ °ÅÄ¡µµ·Ï

    ¾Æ·¡ÀÇ ¼³Á¤Àº À§ÀÇ 4¹ø ±ÛÀ» Àоú´Ù¸é ¹º°¡ Á¾ÇÕÀûÀÎ ¼³Á¤À» ÇÑ °Í ó·³ º¸ÀÏ °ÍÀÌ´Ù.

     
    <Location />
        AuthType Basic
        AuthName User
        AuthUserFile /home/truefeel/manage/.htpasswd
        AuthGroupFile /dev/null

        require valid-user
        order deny,allow
        deny  from all
        allow from 211.111.222.0/255.255.255.0
        Satisfy any
    </Location>
     


    À§ÀÇ ¼³Á¤Àº
    - 211.111.222.0/24 IP ´ë¿ª¿¡ ÀÖ´Â Á¢¼ÓÀÚ´Â ÀÎÁõ¾øÀÌ Åë°úÇÏ°í,
    - ±× ÀÌ¿ÜÀÇ IP ´ë¿ª¿¡¼­ Á¢¼ÓÇϸé ÀÎÁõÀ» °ÅÃľßÇÏ´Â ¼³Á¤ÀÌ´Ù.
    ÀÌ ¼³Á¤Àº Satisfy any Áö½ÃÀÚ¸¦ ÅëÇؼ­ ÀÌ·ïÁø´Ù. IP°¡ ¸Â°Å³ª ID/PW°¡ ¸ÂÀ¸¸é µÇ´Â °ÍÀÌ´Ù. (OR)

    ¸¸¾à Satisfy all À̶ó°í Àû¾ú´Ù¸é
    - IP´ë¿ªÀÌ 211.111.222.0/24 À̸鼭
    - ÀÎÁõ±îÁö ¸ðµÎ Åë°ú Çؾß
    ÇØ´ç ÆäÀÌÁö¿¡ Á¢±ÙÀÌ °¡´ÉÇÏ´Ù. (AND)

    6. ¾÷·Îµå µð·ºÅ丮ÀÇ .phpÆÄÀÏÀº textó·³ ÀνÄÇϱâ

    php³ª cgi µîÀ¸·Î ÆÄÀÏ ¾÷·Îµå °¡´ÉÇϵµ·Ï ±¸ÇöµÈ °æ¿ì .php³ª .html µîÀÇ ÆÄÀÏÀ» ¾÷·ÎµåÇÒ ¼ö
    ÀÖ´Â ½Ç¼ö¸¦ ¹üÇÒ ¼ö ÀÖ´Ù.

    ÀÌ·± ½Ç¼ö¸¦ ÇÏ´õ¶óµµ ÁöÁ¤ÇÑ ¾÷·Îµå µð·ºÅ丮¿¡ ÀÖ´Â .php³ª .html ÆÄÀÏÀ» phpÇÁ·Î±×·¥À¸·Î
    ÀνÄÇÏÁö ¾Ê°í ÀÏ¹Ý ÅؽºÆ® ÆÄÀÏ·Î ÆÇ´ÜÇϵµ·Ï ¼³Á¤ÇÏ¿© º¸´Ù ¾ÈÀüÇÑ À¥ÆäÀÌÁö ±¸¼ºÀÌ °¡´ÉÇÏ´Ù.
    ´ÙÀ½Àº /upload/ ¿Í /files/ µð·ºÅ丮 ¾Æ·¡ÀÇ phpÆÄÀÏÀº ÀÏ¹Ý ÅؽºÆ®·Î ÀνÄÇ϶ó´Â ¼³Á¤ÀÌ´Ù.

     
    <Directory ~ "/usr/local/apache/htdocs/(upload|files)">
            RemoveType .html .php
    </Directory>
     


    À§¿¡¼­ ~ ±âÈ£´Â µð·ºÅ丮 °æ·Î¿¡ Á¤±Ô Ç¥Çö½ÄÀ» »ç¿ëÇÏ°Ú´Ù´Â Àǹ̷Π(upload|files) ºÎºÐÀ»
    Á¤±Ô Ç¥Çö½ÄÀ¸·Î ÀνÄÇÑ´Ù. µû¶ó¼­ htdocs/ ÀÌÇÏÀÇ upload µð·ºÅ丮¿Í files µð·ºÅ丮¸¦ ÀǹÌÇÑ´Ù.

    ´Ü¼øÈ÷ /home/truefeel/public_html/data µð·ºÅ丮¶ó¸é
    <Directory "/home/truefeel/public_html/data"> ¿Í °°ÀÌ ¼³Á¤ÇÏ¸é µÈ´Ù.

    7. Âü°í ÀÚ·á

    * Apache Directives
      http://httpd.apache.org/docs/mod/directives.html
    * Apache Authentication and Access Control
      http://www.apache.kr.net/documents/authplus-story.html


    Ä¿ÇǴнº, ½Ã½ºÅÛ ¿£Áö´Ï¾îÀÇ ½°ÅÍ / URL : http://coffeenix.net/board_view.php?bd_code=711