ÇÁ¶ô½Ã¸¦ ÅëÇؼ À¥¼¹ö¸¦ Á¢±ÙÇÏ°Ô µÇ¸é ½Ã½ºÅÛ³» ¾ÆÆÄÄ¡·Î±×¿¡´Â ÇÁ¶ô½Ã¾ÆÀÌÇÇ°¡ ÂïÈ÷°Ô µÈ´Ù...ÀÌ·²°æ¿ì ½ÇÁ¦ ¸®¾ó¾ÆÀÌÇǸ¦ È®ÀÎÇϱâÀ§ÇÑ ¹æ¹ýÀº... HTTP_X_FORWARDED_FOR ȯ°æº¯¼ö¸¦ »ç¿ë!!
½ÇÁ¦·Î HTTP Çì´õ¿¡´Â ¼ºñ½º¿äû½Ã¿¡ Çì´õºÎºÐ¿¡ Ŭ¶óÀ̾ðÆ®ÀÇ IP¸¦ Æ÷ÇÔÇÏ°Ô µÇ´Âµ¥ À̶§ ¼ºñ½º¸¦ ¿äûÇϴ Ŭ¶óÀ̾ðÆ®°¡ º¸³»´Â ÆÐŶÀÇ Çì´õ¸¦ °Ë»çÇϸé IP¸¦ ¿ªÃßÀûÀÌ °¡´ÉÇÏ´Ù..
Çì´õÀÇ X-Forwarded-For : IP ºÎºÐ¿¡ ³ª¿À´Â ¾ÆÀÌÇÇ°¡ ½ÇÁ¦ ¸®¾ó¾ÆÀÌÇÇ!!
ÆÐŶĸó(tcpdump)
17:45:42.048773 IP xxx.xxx.xxx.xxx.8932 > 218.236.115.222.80: P 3605509893:3605510720(827) ack 1557948306 win 170 <nop,nop,timestamp 675799409 1767044308>
E..o.f@.6...t}."..s."..P....\.g............
(G.qiR..GET /js/wrest.gif HTTP/1.0
Accept: */*
Referer:
http://board.mojily.com/Accept-Language: ko
UA-CPU: x86
Accept-Encoding: gzip, deflate
If-Modified-Since: Tue, 20 Feb 2007 01:20:48 GMT
If-None-Match: "9f38c-33-45da4cf0"
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; SV1; Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) ; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30; .NET CLR 3.0.04506.648)
Host: board.mojily.com
Cookie: f33d2ed86bd82d4c22123c9da444d8ab=MTIyNTk1Njk4NA%3D%3D; 2a0d2363701f23f8a75028924a3af643=MTE2LjEyNS4yOC4zNA%3D%3D; 96b28b766b7e0699aa91c9ff3d890663=aHR0cDovL2JvYXJkLm1vamlseS5jb20v; PHPSESSID=d3c0e000a9b2acdf8a6443dbb59426e1
Via: 1.1 proxy.smileserv.com:80 (squid)
X-Forwarded-For: 220.90.215.4Cache-Control: max-age=259200
Connection: keep-alive
»ùÇÃ ÆÄÀÏ
<?
if ($HTTP_X_FORWARDED_FOR)
{
echo "ÇöÀç Proxy Server »ç¿ëÁßÀ̳׿ä;;;<br>";
echo "Proxy IP : $REMOTE_ADDR<BR>";
echo "Real IP : $HTTP_X_FORWARDED_FOR<BR>";
}
else {
echo "ÇöÀç Proxy Server ¹Ì»ç¿ëÁß";
echo "Real IP : $REMOTE_ADDR <BR>";
}
?>
ASPÀÇ °æ¿ì
asp °æ¿ì¿¡µµ ¸¶Âù°¡Áö·Î
HTTP_X_FORWARDED_FOR °ªÀ¸·Î µ¿ÀÏÇÏ°Ô °ªÀ» ¹Þ½À´Ï´Ù. ¾Õ¿¡ $ ºÙ°í ¾ÊºÙ°í Â÷ÀÌ Á¤µµ ^^
±×¸®°í
HTTP_CLIENT_IP ·Îµµ Á¢¼ÓÀÚÀÇ ½ÇÁ¦ ¾ÆÀÌÇǸ¦ Ãâ·ÂÇÕ´Ï´Ù.
ÇÁ·Ï½Ã - Proxy ´Â Å©·¡Ä¿¸¦ ÁöÄÑÁÖÁö ¸øÇÑ´Ù.
ÀÎÅÍ³Ý »ó¿¡¼ µ¥ÀÌÅ͸¦ Àü¼ÛÇÒ ¶§ ²À ÇÊ¿äÇÑ °Í Áß¿¡ Çϳª°¡ IP Address ÀÌ´Ù.
³×Æ®¿öÅ© »ó¿¡¼ IP ´Â ÀÚ½ÅÀÇ °íÀ¯ ÁÖ¼Ò·Î½á µ¥ÀÌÅ͸¦ ¼Û/¼ö½ÅÇÒ ¶§ ²À ÇÊ¿äÇÑ
°Í Áß¿¡ ÇϳªÀÌ´Ù.
º»·¡ Proxy ´Â ³×Æ®¿öÅ©ÀÇ Áß°£¿¡ ¼³Ä¡ÇÔÀ¸·Î½á Cache µîÀÇ ±â´ÉÀ» È°¿ëÇÏ¿©
³×Æ®¿öÅ© Æ®·¡ÇÈÀ» ÁÙÀ̰ųª ÀÚ¿øÀÇ Àý¾àÀ» À§Çؼ »ç¿ëµÇ¾úÀ¸³ª ±Ù·¡¿¡ µé¾î¼
±× ¿ëµµ°¡ ¸¹ÀÌ º¯ÁúµÇ¾ú´Ù.
Proxy ¶ó ÇÔÀº ÁÖ·Î Web Proxy ¸¦ ¸¹ÀÌ ¶æÇϴµ¥, Web Proxy ¸¦ ÀÌ¿ëÇÏ¿© ÀÎÅͳÝÀ»
»ç¿ëÇÒ °æ¿ì ÀÚ½ÅÀÇ IP ¸¦ ³ëÃâ½ÃÅ°Áö ¾Ê°í Proxy Server ÀÇ IP ¸¦ ÀÌ¿ëÇÑ´Ù´Â
Á¡¿¡¼, »ç¿ëÀÚÀÇ ÇÁ¶óÀ̹ö½Ã¸¦ Áöų ¼ö ÀÖ´Ù´Â °Í¿¡ ¸¹Àº »ç¶÷µéÀÌ ¾Ö¿ëÇÏ°í ÀÖ´Ù.
±×·¯³ª ƯÁ¤ ºÎ·ùÀÇ °æ¿ì Proxy ¸¦ ÀÌ¿ëÇÏ¿© ¾Ç¼º ¸®ÇÃÀ» ³²±â°Å³ª, ºÒ¹ýÀûÀÎ
ÇàÀ§¸¦ ÇÏ´Â °æ¿ì°¡ Àִµ¥, Proxy ÀÇ ÀÍ¸í¼ºÀ» ÀÌ¿ëÇÏ¿© ÀÌ·¯ÇÑ ÇൿÀ» ÇÑ´Ù¸é
ÀÌ´Â À߸øµÈ »ý°¢ÀÌ´Ù. Proxy ´Â »ç¿ëÀÚ¸¦ ÁöÄÑÁÖ±â À§ÇØ °³¹ßµÈ °ÍÀÌ ¾Æ´Ï´Ù.
ÀÌ ±ÛÀº Proxy ÀÇ ÀÍ¸í¼ºÀ» ÀÌ¿ëÇÏ¿© ÀÎÅͳݿ¡¼ ¾ÇÀÇÀûÀÎ ÇൿÀ» ÇÏ´Â
»ç¶÷µéÀ» ´ë»óÀ¸·Î ¾µ °ÍÀÌ´Ù.
Proxy ¼ºñ½º¸¦ Á¦°øÇØÁÖ´Â A ¶ó´Â Proxy ¼¹ö°¡ ÀÖ´Ù°í °¡Á¤ÇÏÀÚ. B ¶ó´Â »ç¿ëÀÚ´Â
A Proxy ¼¹ö¸¦ ÀÌ¿ëÇÏ¿© C »çÀÌÆ®¿¡ ¿¬°áÇÒ °ÍÀÌ´Ù. B ´Â ÀÎÅÍ³Ý ÀͽºÇ÷ξîÀÇ
Proxy °ü·Ã ¼³Á¤À¸·Î A Proxy ¸¦ ÁöÁ¤ÇÏ¿´´Ù. ÀÌ·² °æ¿ì B »ç¿ëÀÚ´Â C »çÀÌÆ®¿¡ ¿¬°á
ÇÒ ¶§ ´ÙÀ½°ú °°Àº °æ·Î¸¦ °ÅÄ¡°Ô µÈ´Ù. (Áß°£ÀÇ Network °æ·Î´Â »ý·«ÇÏ¿´´Ù.)
B (»ç¿ëÀÚ) -> A (Proxy Server) -> C (À¥ »çÀÌÆ®)
º¸±â¿¡, B »ç¿ëÀÚ´Â A Proxy ¼¹ö¸¦ °ÅÃļ C ¿¡ °¡±â ¶§¹®¿¡, C »çÀÌÆ®´Â B »ç¿ëÀÚÀÇ
ÁÖ¼Ò¸¦ ¸ð¸¦ °Íó·³ º¸ÀδÙ. ÀÌ °ÍÀÌ Proxy ¼¹ö°¡ »ç¿ëÀÚÀÇ ÀÍ¸í¼ºÀ» ÁöÄÑÁشٰí
»ý°¢ÇÑ´Ù. ÇÏÁö¸¸ ½ÇÁ¦·Î´Â ±×·¸Áö ¾Ê´Ù.
Proxy ¼¹ö°¡ C »çÀÌÆ®¿¡ Web Contents ¸¦ ¿äûÇÒ ¶§, ¿©·¯ °¡Áö Çì´õ¸¦ ³Ñ±â°Ô
µÇ´Âµ¥, ÀÌ ¶§ Proxy ¸¦ ÀÌ¿ëÇÏ´Â ¿ø·¡ »ç¿ëÀÚÀÇ IP µµ °°ÀÌ ³Ñ°ÜÁֱ⠶§¹®ÀÌ´Ù.
¿©±â¼ A Proxy ¼¹ö´Â C »çÀÌÆ®¿¡ Web ¿äûÀ» º¸³¾ ¶§, B »ç¿ëÀÚÀÇ IP Á¤º¸µµ
°°ÀÌ ³Ñ°ÜÁÖ°Ô µÇ´Âµ¥, ±× ¸Þ¼Òµå´Â "X-Forwarded-For" ÀÌ´Ù.
Apache À¥ ¼¹ö¸¦ ´ë»óÀ¸·Î ¼³¸íÇÏÀÚ¸é, Apache À¥ ¼¹ö´Â Request ÀÇ Çì´õ Áß¿¡
X-Forwarded-For ¶ó´Â °ÍÀÌ ÀÖ´Ù¸é ÀÌ °ÍÀ» ȯ°æ º¯¼ö¿¡ ÀúÀåÇÑ´Ù. Áï, C »çÀÌÆ®´Â
A Proxy ¼¹ö¸¦ ÀÌ¿ëÇÏ´Â B »ç¿ëÀÚÀÇ IP ÁÖ¼Òµµ ¾Ë ¼ö ÀÖ´Ù´Â À̾߱Ⱑ µÈ´Ù.
¿©±â¼´Â À¥ »çÀÌÆ®¿¡ Á¢¼ÓÇÑ »ç¿ëÀÚ°¡ Proxy ¼¹ö¸¦ ÀÌ¿ëÇÏ¿© µé¾î¿Ô´ÂÁö ¾Ë¾Æ
³»´Â ¹æ¹ýÀ» PHP ¸¦ ´ë»óÀ¸·Î ¼³¸íÇغ¸°Ú´Ù. PHP ¿¡¼´Â Apache À¥ ¼¹ö¿¡¼ ÀúÀåÇÑ
ȯ°æ º¯¼ö¸¦ »ó¼Ó¹Þ¾Æ PHP ÀÇ È¯°æ º¯¼ö·Î ´Ù½Ã ÀúÀåÇϴµ¥, Proxy °¡ º¸³»¿Â
Çì´õÀÇ Á¤º¸ Áß "X-Forwarded-For" ´Â, PHP ¿¡¼ $HTTP_X_FORWARDED_FOR º¯¼ö¿¡
´ã±â°Ô µÈ´Ù.
¸¸¾à ¼¹ö °ü¸®ÀÚÀÇ ÀÔÀåÀ¸·Î½á, Proxy ¼¹ö¸¦ ÀÌ¿ëÇÏ´Â »ç¶÷µéÀ» ¸·°í ½Í´Ù¸é
HTTP_X_FORWARDED_FOR ȯ°æ º¯¼ö¸¦ üũÇÔÀ¸·Î ÀÌ¿ëÇÒ ¼ö ÀÖÀ» °ÍÀÌ´Ù. ±×·¯³ª
¿©±â¼ ÇÑ°¡Áö ÁÖÀÇÇØ¾ß ÇÒ Á¡Àº, ȸ»ç³ª Çб³ µî¿¡¼´Â ³»ºÎ IP ¸¦ »ç¿ëÇÏ´Â
°æ¿ì°¡ °¡²û Á¸ÀçÇϴµ¥, ÀÌ·² °æ¿ì ¿ÜºÎ·Î ³ª°¡´Â ÆÐŶÀº Áý´Ü ³»¿¡ Á¸ÀçÇÏ´Â
Proxy ¼¹ö¸¦ ÅëÇؼ ³ª°¡°Ô µÇ´Â °æ¿ì°¡ ÀÖ´Ù.
ÀÌ·² °æ¿ì¿¡, HTTP_X_FORWARDED_FOR ȯ°æ º¯¼ö°¡ Á¸ÀçÇÑ´Ù°í ¹«Á¶°Ç »ç¿ëÀÚÀÇ
Á¢±ÙÀ» Â÷´ÜÇÏ´Â ¹æ¹ýÀ» ÀÌ¿ëÇؼ´Â ¾ÈµÇ°í, Original IP °¡ °¡»ó IP ¿¡¼¸¸
Á¸ÀçÇÒ ¼ö ÀÖ´Â °ÍÀÎÁö È®ÀÎÀ» ÇÑ ÈÄ Ã³¸®¸¦ ÇؾßÇÒ °ÍÀÌ´Ù. ¿¹¸¦ µé¾î Original
IP °¡ "192.168.0.100" À̶ó¸é °¡»ó IP ÀÌ´Ù.