Virtual Services HowtoBrian Ackerman, ( brian@nycrc.net)v2.1, 15 August 1998 ±ÇÅÂÁØ, ( linusben@bawi.org) 06 April 1999ÀÌ ¹®¼´Â ½Ã½ºÅÛ¿¡¼ °¡»ó ¼ºñ½º(virtualize)¸¦ Á¦°øÇÏ´Â °Í¿¡ ´ëÇÑ ¸¹Àº ¿äûµéÀ» À§ÇØ ¸¸µé¾îÁ³´Ù. 1. ¼Ò°³1.1 ÇÊ¿äÇÑ Áö½Äµé½Ã½ºÅÛÀÇ °¡»ó ¼ºñ½º¸¦ Á¦°øÇÏ´Â ÀÏÀº ¾î·Á¿î ÀÏÀÌ ¾Æ´ÏÁö¸¸, ±âÃÊÀûÀÎ Áö½Ä ÀÌ»óÀ» ¿ä±¸ÇÑ´Ù. ÀÌ ¹®¼°¡ ¸®´ª½º ¸Ó½ÅÀ» ÀüüÀûÀ¸·Î ¼³Á¤ÇÏ´Â ¹æ¹ý¿¡ ´ëÇÑ ÀÔ¹®¼(primer)´Â ¾Æ´Ï´Ù. ÀÌ ÇÏ¿ìÅõ ¹®¼´Â ´ç½ÅÀÌ ¾Æ·¡ÀÇ ³»¿ëµé¿¡ ´ëÇؼ ¾î´ÀÁ¤µµ ÀÌÇظ¦ ÇÏ°í ÀÖ´Ù´Â °¡Á¤ÇÏ¿¡ ÀÌ·ç¾îÁø °ÍÀÌ´Ù:(ÇÑ±Û ÀÚ·á´Â ¿øº»¿¡ ¾ø´Â °ÍÀÔ´Ï´Ù. ´ç¿¬ÇÏÁÒ?-¿ªÀÚÁÖ)
¸¸¾à ´ç½ÅÀÌ À§ÀÇ ¾î¶² °Í¿¡ ´ëÇØ È®½ÅÀÌ ¾ø´Ù¸é, ¸µÅ©¸¦ ÂѾư¡¼ ³»¿ëÀ» ¸ÕÀú È®½ÇÇÏ°Ô ÀÌÇØÇϱ⠹ٶõ´Ù. À§ÀÇ »çÇ׿¡ ´ëÇؼ´Â ³ ¸ÞÀÏ¿¡ ´ëÇØ °áÄÚ ´äÀåÀ» º¸³»Áö ¾ÊÀ» °ÍÀÌ´Ù. °ü·ÃµÈ HOWTOÀÇ ÀúÀÚ¿¡°Ô Á÷Á¢ Áú¹®À» ÇÏ´Â °ÍÀÌ ÁÁÀ» °ÍÀÌ´Ù. 1.2 ¸ñÀû°¡»ó(virtual) ¼ºñ½ºÀÇ ¸ñÀûÀº ÇϳªÀÇ ¸Ó½Å¿¡ ¿©·¯°³ÀÇ ³×Æ®¿öÅ© Ä«µå ¾øÀ̵µ ¿©·¯°³ÀÇ IP ÁÖ¼Ò¸¦ ÀνÄÇϵµ·Ï ÇÏ´Â µ¥ ÀÖ´Ù. IP ¾Ù¸®¾î½Ì(aliasing)Àº ¿©·¯°³ÀÇ ³×Æ®¿öÅ© Ä«µå°¡ ÀÖÀ» ¶§ °¢°¢ÀÇ Àåºñ¿¡¼ Çϳª ÀÌ»óÀÇ IP ÁÖ¼Ò¸¦ Çã¿ëÇÏ´Â Ä¿³Î ¿É¼ÇÀÌ´Ù. ÀÌ ¶§ Ä¿³ÎÀº µÚ¿¡¼ ´ÙÁßÀÇ Á¤º¸±³È¯ÀÌ ÀÌ·ç¾îÁö°í(ÀÌ°ÍÀº ¸Å¿ì ºü¸£°Ô ÀÌ·ç¾îÁø´Ù) »ç¿ëÀÚ´Â ¸¶Ä¡ Çϳª ÀÌ»óÀÇ ¼¹ö¸¦ °¡Áö°í ÀÖ´Â °Íó·³ ÀνÄÇÏ°Ô µÈ´Ù. ÀÌ·± ´ÙÁß Á¤º¸±³È¯(multiplexing)Àº ÇϳªÀÇ µµ¸ÞÀÎÀ» È£½ºÆÃÇÏ´Â °Í°ú °°Àº ºñ¿ëÀ¸·Î ¿©·¯°³ÀÇ µµ¸ÞÀÎ(www.domain1.com www.domain2.com µî)À» È£½ºÆÃÇÒ ¼ö ÀÖ´Ù. ºÒÇàÇÏ°Ôµµ ´ëºÎºÐÀÇ ¼ºñ½º(FTP, web, mail)´Â ´ÙÁß µµ¸ÞÀÎÀ» ´Ù·ê ¼ö ÀÖµµ·Ï ¼³°èµÇ¾îÀÖÁö ¾Ê´Ù. À̵éÀ» Àû´çÇÏ°Ô ÀÛµ¿½ÃÅ°±â À§Çؼ´Â ¼³Á¤ »Ó¸¸ ¾Æ´Ï¶ó ¼Ò½º Äڵ嵵 º¯Çü½ÃÄÑ¾ß ÇÑ´Ù. ÀÌ ¹®¼´Â ¾î¶»°Ô ÀÌ·± º¯ÇüÀ» ½ÃÄѼ °¡»ó ¸Ó½ÅÀ» ¼³Á¤ÇÒ °ÍÀÎÁö¿¡ ´ëÇØ ±â¼úÇÑ´Ù. °¡»ó ¼ºñ½º ±â´ÉÀ» À§Çؼ´Â µ¥¸ó ¿ª½Ã ÇÊ¿äÇÏ´Ù. ÀÌ µ¥¸ó(virtuald) ¿ª½Ã ÀÌ ¹®¼ÀÇ ÈĹݿ¡¼ ´Ù·ê °ÍÀÌ´Ù. 1.3 Çǵå¹é(Feedback)ÀÌ ¹®¼´Â ÆÐÅ°ÁöµéÀÌ ¾÷µ¥ÀÌÆ®µÇ°í ¼Ò½ºÄڵ峪 ¼³Á¤ ³»¿ëµéÀÌ º¯°æµÉ ¶§¸¶´Ù È®ÀåµÉ °ÍÀÌ´Ù. ¸¸¾à ÀÌ ¹®¼ÀÇ Æ¯Á¤ºÎºÐÀÌ ºÒºÐ¸íÇÏ´Ù°í »ý°¢µÇ¸é °Å¸®³¦¾øÀÌ ³ª¿¡°Ô ´ç½ÅÀÇ Á¦¾ÈÀ̳ª Áú¹®À» email·Î º¸³»¶ó. ³»°¡ ÀÌ ÇÏ¿ìÅõ ¹®¼ÀÇ ¸ðµç ºÎºÐÀ» µÚÁöÁö ¾Êµµ·Ï °¡±ÞÀûÀ̸é ƯÁ¤ÇÑ(specific) ºÎºÐÀ» Áý¾î¼ È®½ÇÇÏ°Ô ÇØÁÖ°í, ºÒºÐ¸íÇÑ ºÎºÐÀÌ À§Ä¡ÇÑ ¼½¼ÇÀ» °°ÀÌ Ç¥½ÃÇØ Áֱ⠹ٶõ´Ù. ¶ÇÇϳª Áß¿äÇÑ Á¡Àº Á¦¸ñ¿¡ VIRTSERVICES HOWTO¶ó´Â ¹®ÀåÀ» ³Ö¾î ¸ÞÀÏÀ» º¸³»¶ó´Â Á¡ÀÌ´Ù. ±×·¸Áö ¾ÊÀº ´Ù¸¥ ¸ÞÀϵéÀº °³ÀÎÀûÀÎ ¸ÞÀÏ·Î Ãë±ÞµÉ °ÍÀ̱⠶§¹®¿¡ ¹«½ÃµÉ ¼öµµ ÀÖ´Ù. (³» Ä£±¸µé ¿ª½Ã ³»°¡ °³ÀÎÀûÀÎ ¸ÞÀÏÀ» ´Ù ÀÐÁö ¾Ê´Â´Ù´Â »ç½ÇÀ» ¾Ë°í ÀÖ´Ù.) ³ªÀÇ ¿¹Á¦µéÀº ´ÜÁö ¿¹Á¦ÀÏ »ÓÀ̹ǷΠ±×´ë·Î º¹»çÇؼ »ç¿ëÇÏÁö´Â ¸»±â ¹Ù¶õ´Ù. ´ç½ÅÀÌ ÀÌ ¿¹Á¦¸¦ »ç¿ëÇÏ°íÀÚ ÇÑ´Ù¸é, ´ç½Å ½Ã½ºÅÛ¿¡ ¸Â´Â °ªÀ» ³Ö¾î¾ß ÇÒ °ÍÀÌ´Ù. ¸¸¾à ¾î¶² ¹®Á¦°¡ »ý±ä´Ù¸é ³ª¿¡°Ô ¸ÞÀÏÀ» º¸³»¶ó. ¼³Ä¡¿¡ »ç¿ëÇÑ ¼³Á¤ ÆÄÀÏ°ú ¼³Ä¡¿¡ ¹ß»ýÇÑ ¿¡·¯ ¸Þ¼¼ÁöµéÀ» ¸ðµÎ ³ª¿¡°Ô º¸³»ÁØ´Ù¸é ³»°¡ ±×°ÍÀ» º» µÚ ³ªÀÇ ÀÇ°ßÀ» ´äÀå¿¡ ½á¼ º¸³»ÁÙ °ÍÀÌ´Ù. 1.4 °»½Å ±â·Ï (Revision History)V1.0 ÃÖÃÊÀÇ ¹öÀü V1.1 ¹öÃß¾ó À¥ ¼³Á¤ ºÎºÐÀÇ ¿¡·¯ ¼öÁ¤ V1.2 ³¯Â¥ ¼öÁ¤ V2.0 HTML ¸µÅ© °»½Å À¥ °»½Å »õ·Î¿î ¼¾µå¸ÞÀÏ ¿É¼Ç »õ·Î¿î Qmail ¼½¼Ç Syslogd °»½Å FTP °»½Å Virtuald ±âº» ¿É¼Ç »õ·Î¿î »ï¹Ù(SAMBA) ¼½¼Ç FAQ °»½Å V2.1 ¸ðµç Æнº(path)¸¦ /usr/local·Î ¼öÁ¤ Changed all paths to /usr/local. VirtualdÀÇ VERBOSELOG ÄÄÆÄÀÏ ¿É¼Ç Ãß°¡ VirtualmailfilterÀÇ setuid/setgid ¹ö±× ¼öÁ¤ VirtualmailfilterÀÇ excel ¹ö±× ¼öÁ¤ VirtualmailfilterÀÇ ´ë¼Ò¹®ÀÚ ¹ö±× ¼öÁ¤. VirtualmailfilterÀÇ È¯°æ º¯¼ö È®ÀÎ ¼öÁ¤ Virtualmailfilter/virtmaildelivery¿¡¼ mbox ÄÚµå Á¦°Å Qmail¿¡¼ tcpserver.init pop ¼½¼Ç Ãß°¡ FAQ¿¡ ¾Ù¸®¾î½º µµ¸ÞÀγ×ÀÓ Áú¹® Ãß°¡ Virtmailfilter°¡ Ȩ µð·ºÅ丮¸¦ virtmaildelivery·Î º¸³»´Â ºÎºÐ ¼öÁ¤ 1.5 ÀúÀÛ±Ç/¹èÆ÷ÀÌ ¹®¼ÀÇ ÀúÀÛ±ÇÀº Copyright (c) 1997 by The Computer Resource Center Inc. ¿¡ ÀÖ´Ù. ÀÌ ¹®¼ÀÇ º¹»çº»Àº ÀúÀÚÀÇ µ¿ÀÇ ¾øÀÌ ¾î¶² ¸Åü(¹°¸®Àû, ÀüÀÚÀû)¸¦ ÅëÇؼµµ ¹èÆ÷ ¹× Àç»ý»êÀÌ °¡´ÉÇÏ´Ù. ¹ø¿ª ¿ª½Ã ºñ½ÁÇÏ°Ô Çã¿ëµÇ´Âµ¥, ´Ù¸¸ ¹ø¿ªÀÚ¸¦ ¹®¼¿¡ ¸í½ÃÇÑ´Ù´Â °ÍÀ» °¡Á¤ÇÑ´Ù. »ó¾÷ÀûÀÎ Àç¹èÆ÷ ¿ª½Ã Çã¿ëµÇ¸ç Àå·ÁµÇÁö¸¸ ÀÌ·± Á¾·ùÀÇ ¹èÆ÷¿¡ ´ëÇؼ´Â Computer Resource Center ¿¡°Ô ¾Ë·ÁÁֱ⠹ٶõ´Ù. ÀÌ ¹®¼ÀÇ ¹ßÃé ¿ª½Ã »çÀü µ¿ÀÇ ¾øÀÌ ÀÌ·ç¾îÁú ¼ö ÀÖ´Ù. ÀÌ ¹®¼ÀÇ º¹»çº» Á¦ÀÛ ¹× ¹èÆ÷´Â ÀúÀ۱ǿ¡ ´ëÇÑ ¸í½Ã¿Í Çã°¡¿¡ ´ëÇÑ ÀÌ ±Ç°í°¡ ¸ðµç ¹èÆ÷º»¿¡ Æ÷Ç﵃ ¶§¿¡¸¸ ÀÎÁ¤µÈ´Ù. ¿ä¾àÇϸé, ¿ì¸®´Â °¡´ÉÇÑ ¸¹Àº °æ·Î¸¦ ÅëÇؼ ÀÌ ¹®¼°¡ ³Î¸® ÆÛÁö±â¸¦ ¹Ù¶õ´Ù. ÇÏÁö¸¸, ¿ì¸®´Â ¶ÇÇÑ ÀÌ ¹®¼ÀÇ ÀúÀÛ±Ç ¿ª½Ã °è¼Ó °®°íÀֱ⸦ ¿øÇϹǷÎ, ÀÌ ¹®¼ÀÇ Àç¹èÆ÷¿¡ ´ëÇÑ °ÍÀ» ¾Ë±â¸¦ ¹Ù¶õ´Ù. 2. IP ¾Ù¸®¾î½Ì(IP Aliasing)IP ¾Ù¸®¾î½ÌÀº °¡»ó È£½ºÆà ¸Ó½ÅÀ» ½ÇÇà½ÃÅ°±â À§ÇÑ ¼³Á¤À¸·Î ÇÊ¿äÇÑ Ä¿³Î ¿É¼ÇÀÌ´Ù. ÀÌ¹Ì ÀÌ°Í¿¡ ´ëÇÑ ¹Ì´Ï-ÇÏ¿ìÅõ°¡ ³ª¿ÍÀÖ´Ù. IP aliasing ¸®´ª½º¿¡¼ IP Aliasing ¼¼ÆÃÇϱâ mini-HOWTO ÀÌ°ÍÀ» ¾î¶»°Ô ¼³Á¤ÇÏ´ÂÁö ¾Ë°í ½Í´Ù¸é ÀÌ ¹®¼¸¦ Âü°íÇ϶ó. 3. Virtuald3.1 ¼Ò°³¸ðµç ³×Æ®¿öÅ© ¿¬°áÀº 2°³ÀÇ IP ¾îµå·¹½º/Æ÷Æ® ½ÖÀ¸·Î ÀÌ·ç¾îÁø´Ù.
³×Æ®¿öÅ© ÇÁ·Î±×·¡¹ÖÀ» À§ÇÑ API(Applications Program Interface)´Â
¼ÒÄÏ API·Î ºÒ¸°´Ù. ¼ÒÄÏÀº ¸¶Ä¡ ¿·ÁÀÖ´Â ÆÄÀÏ°ú °°ÀÌ ÀÛµ¿Çϱ⠶§¹®¿¡
³×Æ®¿öÅ© ¿¬°áÀ» ÅëÇØ µ¥ÀÌÅ͸¦ ÁÖ°í¹Þ´Â °ÍÀº ¼ÒÄÏ¿¡ ¾²°íÀд °úÁ¤À¸·Î
ÀÌÇصȴÙ. ·ÎÄà ¼ÒÄÏÀÇ ÁÖ¼Ò¸¦ µ¹·ÁÁÖ´Â ÇÔ¼ö´Â 3.2 InetdInetd´Â ¿ÜºÎ¿¡¼ ³×Æ®¿öÅ©¸¦ ÅëÇØ ¿¬°áÀ» ½ÃµµÇÒ ¶§(¿¹¸¦ µé¸é POP¼¹öÀÇ ¿äû) ¿©·¯ °³ÀÇ Æ÷Æ®¸¦ °¨½ÃÇÏ°í ÀÖ´Ù°¡ ¿äû¿¡ ´ëÇÑ Àû´çÇÑ ¿¬°áÀ» ±¸ÇöÇØÁÖ´Â ³×Æ®¿öÅ© super serverÀÌ´Ù. Inetd´Â ³×Æ®¿öÅ©¸¦ Àü¹ÝÀûÀ¸·Î °ü¸®ÇÏ¸é¼ Æ¯Á¤ ÇÁ·Î±×·¥¿¡ ´ëÇØ ³×Æ®¿öÅ©¸¦ ¿¬°áÇØ ÁÖ´Â ÀÏÀ» ÇÑ´Ù. ÀÌ·± °úÁ¤À» ÅëÇØ ¾î¶² ¼ºñ½º°¡ ³×Æ®¿öÅ© ¿¬°áÀÌ ÇÊ¿ä ¾øÀ» ¶§ ºÒÇÊ¿äÇÏ°Ô ½ÇÇàµÇ´Â °ÍÀ» ¸·À» ¼ö ÀÖ´Ù. Ç¥ÁØÀûÀÎ /etc/inetd.conf ÆÄÀÏÀº ´ÙÀ½°ú °°´Ù:
ftp stream tcp nowait root /usr/sbin/tcpd \ wu.ftpd -l -a pop-3 stream tcp nowait root /usr/sbin/tcpd \ in.qpop -s °¡»ó ¼ºñ½º¸¦ ÇÒ ¶§ /etc/inetd.conf ÆÄÀÏÀº ´ÙÀ½°ú °°ÀÌ µÈ´Ù:
ftp stream tcp nowait root /usr/local/bin/virtuald \ virtuald /virtual/conf.ftp wu.ftpd -l -a pop-3 stream tcp nowait root /usr/local/bin/virtuald \ virtuald /virtual/conf.pop in.qpop -s 3.3 ¼³Á¤ ÆÄÀÏ°¢°¢ÀÇ ¼ºñ½ºµéÀº ¾î¶² IPµé°ú µð·ºÅ丮µéÀ» »ç¿ëÇÏ°í °ü¸®ÇÒ °ÍÀÎÁö¿¡ ´ëÇÑ Á¤º¸¸¦ ¼³Á¤ ÆÄÀÏ¿¡¼ ¾ò°Ô µÈ´Ù. ´ç½ÅÀº ÇϳªÀÇ Àüü ¼³Á¤ ÆÄÀÏ (master config file)À» °®´øÁö ¾Æ´Ï¸é ¸î¸îÀÇ ¼³Á¤ ÆÄÀϵéÀ» ÅëÇؼ °¢°¢ÀÇ ¼ºñ½º¿¡¼ µµ¸ÞÀÎÀÇ ´Ù¸¥ ¸®½ºÆ®¸¦ ¾ò°Ô ÇÒ ¼ö ÀÖ´Ù. ¼³Á¤ ÆÄÀÏÀº ´ÙÀ½°ú °°´Ù:
# This is a comment and so are blank lines # Format IP SPACE dir NOSPACES 10.10.10.129 /virtual/domain1.com 10.10.10.130 /virtual/domain2.com 10.10.10.157 /virtual/domain3.com # Default option for all other IPs default / 3.4 ¼Ò½ºÄÚµå¾Æ·¡´Â virtuald ÇÁ·Î±×·¥¿¡ ´ëÇÑ C ¼Ò½º ÄÚµåÀÌ´Ù. ÀÌ°ÍÀ» ÄÄÆÄÀÏÇÏ°í /usr/local/bin ¾Æ·¡¿¡ 0755ÀÇ Æ۹̼ÇÀ¸·Î ¼³Ä¡Ç϶ó.(¼ÒÀ¯ÀÚ¿Í ±×·ìÀº ¸ðµÎ root·Î ÇÑ´Ù.) ÄÄÆÄÀϽÿ¡´Â VERBOSELOG°¡ ¿É¼ÇÀ¸·Î »ç¿ëµÉ ¼ö Àִµ¥ (¿ÀÁ÷ ÀÌ ¿É¼Ç¸¸ÀÌ Á¸ÀçÇÑ´Ù), ÀÌ°ÍÀº ¿¬°á½Ã ±â·ÏÀ» ³²±æ°ÍÀÎÁö¸¦ Á¤ÇÑ´Ù.
#include <netinet/in.h> #include <sys/socket.h> #include <arpa/inet.h> #include <stdarg.h> #include <unistd.h> #include <string.h> #include <syslog.h> #include <stdio.h> #undef VERBOSELOG #define BUFSIZE 8192 int getipaddr(char **ipaddr) { struct sockaddr_in virtual_addr; static char ipaddrbuf[BUFSIZE]; int virtual_len; char *ipptr; virtual_len=sizeof(virtual_addr); if (getsockname(0,(struct sockaddr *)&virtual_addr,&virtual_len)<0) { syslog(LOG_ERR,"getipaddr: getsockname failed: %m"); return -1; } if (!(ipptr=inet_ntoa(virtual_addr.sin_addr))) { syslog(LOG_ERR,"getipaddr: inet_ntoa failed: %m"); return -1; } strncpy(ipaddrbuf,ipptr,sizeof(ipaddrbuf)-1); *ipaddr=ipaddrbuf; return 0; } int iptodir(char **dir,char *ipaddr,char *filename) { char buffer[BUFSIZE],*bufptr; static char dirbuf[BUFSIZE]; FILE *fp; if (!(fp=fopen(filename,"r"))) { syslog(LOG_ERR,"iptodir: fopen failed: %m"); return -1; } *dir=NULL; while(fgets(buffer,BUFSIZE,fp)) { buffer[strlen(buffer)-1]=0; if (*buffer=='#' || *buffer==0) continue; if (!(bufptr=strchr(buffer,' '))) { syslog(LOG_ERR,"iptodir: strchr failed"); return -1; } *bufptr++=0; if (!strcmp(buffer,ipaddr)) { strncpy(dirbuf,bufptr,sizeof(dirbuf)-1); *dir=dirbuf; break; } if (!strcmp(buffer,"default")) { strncpy(dirbuf,bufptr,sizeof(dirbuf)-1); *dir=dirbuf; break; } } if (fclose(fp)==EOF) { syslog(LOG_ERR,"iptodir: fclose failed: %m"); return -1; } if (!*dir) { syslog(LOG_ERR,"iptodir: ip not found in conf file"); return -1; } return 0; } int main(int argc,char **argv) { char *ipaddr,*dir; openlog("virtuald",LOG_PID,LOG_DAEMON); #ifdef VERBOSELOG syslog(LOG_ERR,"Virtuald Starting: $Revision: 1.1 $"); #endif if (!argv[1]) { syslog(LOG_ERR,"invalid arguments: no conf file"); exit(0); } if (!argv[2]) { syslog(LOG_ERR,"invalid arguments: no program to run"); exit(0); } if (getipaddr(&ipaddr)) { syslog(LOG_ERR,"getipaddr failed"); exit(0); } #ifdef VERBOSELOG syslog(LOG_ERR,"Incoming ip: %s",ipaddr); #endif if (iptodir(&dir,ipaddr,argv[1])) { syslog(LOG_ERR,"iptodir failed"); exit(0); } if (chroot(dir)<0) { syslog(LOG_ERR,"chroot failed: %m"); exit(0); } #ifdef VERBOSELOG syslog(LOG_ERR,"Chroot dir: %s",dir); #endif if (chdir("/")<0) { syslog(LOG_ERR,"chdir failed: %m"); exit(0); } if (execvp(argv[2],argv+2)<0) { syslog(LOG_ERR,"execvp failed: %m"); exit(0); } closelog(); exit(0); } 4. ¼Ð ½ºÅ©¸³Æ®4.1 Virtfs°¢°¢ÀÇ µµ¸ÞÀÎÀº ÀڽŸ¸ÀÇ µð·ºÅ丮 ±¸Á¶¸¦ °¡Áø´Ù. µû¶ó¼ ¸¸¾à
¹°·Ð ´õ ¸¹Àº µð½ºÅ©ÀÇ °ø°£ÀÌ ÇÊ¿äÇÏ°Ô µÇÁö¸¸, ±×°ÍÀÌ »õ·Î¿î ¸Ó½Å°ú ³×Æ®¿öÅ© Ä«µå¸¦ ¼³Ä¡ÇÏ´Â °Íº¸´Ù´Â °ªÀÌ Àú·ÅÇÏ´Ù. ¸¸¾à ´ç½ÅÀÌ °ø°£À» Àý¾àÇÏ°í ½Í´Ù¸é ÇÏµå ¸µÅ©¸¦ ÀÌ¿ëÇÒ ¼ö Àִµ¥, ³» °æ¿ì ÀÌ ¹æ¹ýÀ» »ç¿ëÇϸé 2M°¡ ¾à°£ ³Ñ´Â °ø°£¸¸À» »ç¿ëÇÏ°Ô µÈ´Ù. ÇÏÁö¸¸, ÀÌ ½ºÅ©¸³Æ®´Â °¡±ÞÀû ÀϹÝÀûÀÎ ½Ã½ºÅÛÀ» ¸¸µé±â À§ÇØ ¸ÞÀÎ ÆÄÀϽýºÅÛ¿¡¼ ¸ðµç ÆÄÀÏÀ» º¹»çÇÏ·Á ÇÒ °ÍÀÌ´Ù. ¿©±â °£´ÜÇÑ virtfs ½ºÅ©¸³Æ®°¡ ÀÖ´Ù:
#!/bin/sh echo '$Revision: 1.1 $' echo -n "Enter the domain name: " read domain if [ "$domain" = "" ] then echo Nothing entered: aborting exit 0 fi leadingdir=/virtual echo -n "Enter leading dir: (Enter for default: $leadingdir): " read ans if [ "$ans" != "" ] then leadingdir=$ans fi newdir=$leadingdir/$domain if [ -d "$newdir" ] then echo New directory: $newdir: ALREADY exists exit 0 else echo New directory: $newdir fi echo Create $newdir mkdir -p $newdir echo Create bin cp -pdR /bin $newdir echo Create dev cp -pdR /dev $newdir echo Create dev/log ln -f /virtual/log $newdir/dev/log echo Create etc mkdir -p $newdir/etc for i in /etc/* do if [ -d "$i" ] then continue fi cp -pd $i $newdir/etc done echo Create etc/skel mkdir -p $newdir/etc/skel echo Create home for i in a b c d e f g h i j k l m n o p q r s t u v w x y z do mkdir -p $newdir/home/$i done echo Create home/c/crc mkdir -p $newdir/home/c/crc chown crc.users $newdir/home/c/crc echo Create lib mkdir -p $newdir/lib for i in /lib/* do if [ -d "$i" ] then continue fi cp -pd $i $newdir/lib done echo Create proc mkdir -p $newdir/proc echo Create sbin cp -pdR /sbin $newdir echo Create tmp mkdir -p -m 0777 $newdir/tmp chmod +t $newdir/tmp echo Create usr mkdir -p $newdir/usr echo Create usr/bin cp -pdR /usr/bin $newdir/usr echo Create usr/lib mkdir -p $newdir/usr/lib echo Create usr/lib/locale cp -pdR /usr/lib/locale $newdir/usr/lib echo Create usr/lib/terminfo cp -pdR /usr/lib/terminfo $newdir/usr/lib echo Create usr/lib/zoneinfo cp -pdR /usr/lib/zoneinfo $newdir/usr/lib echo Create usr/lib/\*.so\* cp -pdR /usr/lib/*.so* $newdir/usr/lib echo Create usr/sbin cp -pdR /usr/sbin $newdir/usr echo Linking usr/tmp ln -s /tmp $newdir/usr/tmp echo Create var mkdir -p $newdir/var echo Create var/lock cp -pdR /var/lock $newdir/var echo Create var/log mkdir -p $newdir/var/log echo Create var/log/wtmp cp /dev/null $newdir/var/log/wtmp echo Create var/run cp -pdR /var/run $newdir/var echo Create var/run/utmp cp /dev/null $newdir/var/run/utmp echo Create var/spool cp -pdR /var/spool $newdir/var echo Linking var/tmp ln -s /tmp $newdir/var/tmp echo Create var/www/html mkdir -p $newdir/var/www/html chown webmast.www $newdir/var/www/html chmod g+s $newdir/var/www/html echo Create var/www/master mkdir -p $newdir/var/www/master chown webmast.www $newdir/var/www/master echo Create var/www/server mkdir -p $newdir/var/www/server chown webmast.www $newdir/var/www/server exit 0 4.2 Virtexec
°¡»ó ȯ°æ¿¡¼ ¸í·É¾î¸¦ ½ÇÇà½ÃÅ°±â À§Çؼ ´ç½ÅÀº
#!/bin/sh echo '$Revision: 1.1 $' BNAME=`basename $0` FIRST4CHAR=`echo $BNAME | cut -c1-4` REALBNAME=`echo $BNAME | cut -c5-` if [ "$BNAME" = "virtexec" ] then echo Cannot run virtexec directly: NEED a symlink exit 0 fi if [ "$FIRST4CHAR" != "virt" ] then echo Symlink not a virt function exit 0 fi list="" num=1 for i in /virtual/* do if [ ! -d "$i" ] then continue fi if [ "$i" = "/virtual/lost+found" ] then continue fi list="$list $i $num" num=`expr $num + 1` done if [ "$list" = "" ] then echo No virtual environments exist exit 0 fi dialog --clear --title 'Virtexec' --menu Pick 20 70 12 $list 2> /tmp/menu.$$ if [ "$?" = "0" ] then newdir=`cat /tmp/menu.$$` else newdir="" fi tput clear rm -f /tmp/menu.$$ echo '$Revision: 1.1 $' if [ ! -d "$newdir" ] then echo New directory: $newdir: NOT EXIST exit 0 else echo New directory: $newdir fi echo bname: $BNAME echo realbname: $REALBNAME if [ "$*" = "" ] then echo args: none else echo args: $* fi echo Changing to $newdir cd $newdir echo Running program $REALBNAME chroot $newdir $REALBNAME $* exit 0 ÀÌ ½ºÅ©¸³Æ®°¡ ½ÇÇàµÇ±â À§Çؼ ´ç½Å ½Ã½ºÅÛ¿¡
ln -s /usr/local/bin/virtexec /usr/local/bin/virtpasswd ln -s /usr/local/bin/virtexec /usr/local/bin/virtvi ln -s /usr/local/bin/virtexec /usr/local/bin/virtpico ln -s /usr/local/bin/virtexec /usr/local/bin/virtemacs ln -s /usr/local/bin/virtexec /usr/local/bin/virtmailq ¸µÅ©¸¦ ½ÃŲ ÈÄ virtvi¸¦ ½ÇÇà½ÃÅ°¸é °¡»ó ½Ã½ºÅÛÀÇ vi¸¦ ½ÇÇà½Ãų °ÍÀÌ´Ù. ¸¶Âù°¡Áö·Î virtpasswd´Â °¡»ó ½Ã½ºÅÛÀÇ »ç¿ëÀÚ ºñ¹Ð¹øÈ£¸¦ ¹Ù²Ü °ÍÀÌ°í, virtmailq´Â °¡»ó °ø°£ÀÇ ¸ÞÀÏ Å¥(queue)¸¦ È®ÀÎÇÒ °ÍÀÌ´Ù. ´ç½ÅÀº ¿øÇÏ´Â ¸¸Å virtexec¸¦ ¸¸µé ¼ö ÀÖ´Ù. ¸¸¾à ´ç½ÅÀÇ ÇÁ·Î±×·¥ÀÌ °øÀ¯ ¶óÀ̺귯¸®¸¦ ÇÊ¿ä·Î ÇÑ´Ù¸é ¹ÙÀ̳ʸ®¿Í ¸¶Âù°¡Áö·Î °¡»ó ÆÄÀϽýºÅÛ¿¡ À§Ä¡½Ãų ¼ö ÀÖ´Ù. 4.3 °ø°í(Note)³ª´Â ¸ðµç ½ºÅ©¸³Æ®µéÀ» /usr/local/bin¿¡ ¼³Ä¡Çß´Ù. ±× ÀÌ¿Ü¿¡ °¡»ó ÆÄÀϽýºÅÛ¿¡ ³Ö°í½ÍÁö ¾ÊÀº °ÍµéÀº /usr/local¿¡ µÎ¾ú´Ù. ½ºÅ©¸³Æ®´Â /usr/local¿¡ ÀÖ´Â ÆÄÀÏÀ» °¡»ó ÆÄÀϽýºÅÛÀ¸·Î º¹»çÇÏÁö ¾Ê´Â´Ù. °¡»ó ÆÄÀϽýºÅÛÀ¸·Î ³Ñ¾î¿À¸é ¾ÈµÇ´Â Áß¿äÇÑ ÆÄÀϵéÀº ¹Ýµå½Ã °¡»ó ½Ã½ºÅÛ¿¡¼ Á¦°ÅµÇ¾î¾ß ÇÑ´Ù. ÇÑ ¿¹·Î, ³» ½Ã½ºÅÛ¿¡´Â ssh°¡ ¼³Ä¡µÇ¾î Àִµ¥, ¸ðµç °¡»óÀÇ ÆÄÀÏ ½Ã½ºÅÛÀÇ ¼¹ö¿¡¼´Â °³ÀÎÅ°(private key)¸¦ ¿øÇÏÁö ¾Ê±â ¶§¹®¿¡, virtfs¸¦ ½ÇÇà½ÃŲ ÀÌÈÄ¿¡ °¢°¢ÀÇ °¡»ó ÆÄÀÏ ½Ã½ºÅÛ¿¡¼ ÀÌ°ÍÀ» Á¦°ÅÇß´Ù. ¶ÇÇÑ resolv.conf¸¦ ¹Ù²Ù°í, ±× ¾È¿¡ ÀÖ´ø ´Ù¸¥ µµ¸ÞÀεéÀÇ À̸§À» °¡Áø ¸ðµç °ÍµéÀ» »èÁ¦Çß´Ù. ÀÌ·± °Íµé·Î´Â /etc/hosts³ª /etc/HOSTNAME µîÀÌ ÀÖ´Ù. ³»°¡ virtexec·Î ½Éº¼¸¯ ¸µÅ©½ÃŲ ÇÁ·Î±×·¥µéÀÌ´Ù:
5. DNSDNS ¿ª½Ã Á¤»óÀûÀ¸·Î ¼³Á¤µÉ ¼ö ÀÖ´Ù. ÀÌ°ÍÀº DNS HOWTO. ¸¦ ÂüÁ¶Ç϶ó. 6. Syslogd6.1 ¹®Á¦µéSyslogd´Â ÀϹÝÀûÀÎ À¯´Ð½º ½Ã½ºÅÛ¿¡¼ »ç¿ëµÇ´Â ½Ã½ºÅÛ ±â·Ï µµ±¸ÀÌ´Ù. Syslogd´Â FIFO¶ó ºÒ¸®´Â Ưº°ÇÑ ÆÄÀÏÀ» ¿©´Â µ¥¸óÀε¥, FIFO´Â ÇϳªÀÇ ÆÄÀÌÇÁ¿Í °°ÀÌ ÀÛµ¿Çϴ Ưº°ÇÑ ÆÄÀÏÀÌ´Ù. ¾²´Â ÂÊ¿¡¼ ±â·ÏÇÑ ³»¿ëÀº ¸ðµÎ Àд ÂÊ¿¡ ³ªÅ¸³ª°Ô µÈ´Ù. Syslogd´Â Àд ÂÊ¿¡¼ º¸³»´Â µ¥ÀÌÅ͸¦ ±â´Ù¸®°í ÀÖ´Ù. CÀÇ ÇÔ¼ö °¡¿îµ¥¿¡´Â ¾²´Â ÂÊ¿¡ ¹«¾ð°¡¸¦ ±â·ÏÇÒ ¼ö ÀÖ´Â ÇÔ¼ö°¡ Àִµ¥, ÇÁ·Î±×·¥¿¡¼ ÀÌ ÇÔ¼ö¸¦ »ç¿ëÇÑ´Ù¸é, ´ç½ÅÀÇ Ãâ·Â °á°ú´Â syslogd·Î °¡°Ô µÈ´Ù.
6.2 SolutionSetup LinksSyslogd´Â ¸í·É¾î ¶óÀο¡¼ ¼³Á¤À» ÇØÁØ´Ù¸é ´Ù¸¥ FIFO¸¦ ãÀ» ¼ö ÀÖ´Ù:
syslogd -p /virtual/log ±×¸®°í´Â /virtual/log¸¦ /dev/log·Î ½Éº¼¸µ ¸µÅ©½ÃŲ´Ù:
ln -sf /virtual/log /dev/log ±×¸®°í´Â ¸ðµç /dev/logÀÇ º¹»çº»À» ÀÌ ÆÄÀÏ·Î Çϵ帵ũ ½ÃŲ´Ù:
ln -f /virtual/log /virtual/domain1.com/dev/log virtfs ½ºÅ©¸³Æ®´Â ÀÌ¹Ì ÀÌ °úÁ¤À» ¼öÇàÇÑ´Ù. /virtualÀÌ µð½ºÅ© °ø°£¿¡ ÀÎÁ¢ÇØ ÀÖ°í
/dev/log°¡ Çϵ帵ũµÇ¾î ÀÖ´Â »óÅÂÀ̱⠶§¹®¿¡, À̵éÀº °°Àº inode ¼ýÀÚ¸¦ °¡Áö°í
°°Àº µ¥ÀÌÅ͸¦ °¡¸®Å°°í ÀÖ´Ù. ¸ðµç °¡»óÀÇ /dev/log µéÀÌ µ¿½Ã¿¡ ÀÛµ¿ÁßÀ̱⠶§¹®¿¡
Syslogd.initsyslogd.initÀÇ ÀÌ ¹öÀüÀº syslogd°¡ ½ÃÀÛÇÒ ¶§¸¶´Ù /dev/log FIFO¸¦ Áö¿ì°í »õ·Î ¸¸µé±â ¶§¹®¿¡ ¸Å¹ø /dev/log¿¡ Çϵ帵ũ½ÃÄÑ¾ß ÇÑ´Ù. ¿©±â º¯ÇüµÈ syslogd.init ÆÄÀÏÀÌ ÀÖ´Ù:
#!/bin/sh . /etc/rc.d/init.d/functions case "$1" in start) echo -n "Starting dev log: " ln -sf /virtual/log /dev/log echo done echo -n "Starting system loggers: " daemon syslogd -p /virtual/log daemon klogd echo echo -n "Starting virtual dev log: " for i in /virtual/* do if [ ! -d "$i" ] then continue fi if [ "$i" = "/virtual/lost+found" ] then continue fi ln -f /virtual/log $i/dev/log echo -n "." done echo " done" touch /var/lock/subsys/syslogd ;; stop) echo -n "Shutting down system loggers: " killproc syslogd killproc klogd echo rm -f /var/lock/subsys/syslogd ;; *) echo "Usage: syslogd {start|stop}" exit 1 esac exit 0 6.3 ¿©·¯°³ÀÇ SyslogdÇϳªÀÇ µð½ºÅ©¿¡ ÇÑ°³ÀÇ syslogd¸¸¾à ´ç½ÅÀÌ ¼³Á¤ÇÑ ÇϳªÀÇ ÆÄÀϽýºÅÛÀÌ ³ÑÃļ ´Ù¸¥ µð½ºÅ©¿¡ ÀÖ´Â °ø°£À» °¡»ó
½Ã½ºÅÛ¿¡¼ »ç¿ëÇÏ°íÀÚ ÇÑ´Ù¸é, ÇÏµå ¸µÅ©¸¦ ÅëÇؼ ¼·Î ´Ù¸¥ µð½ºÅ©¸¦ ¿¬°áÇÒ ¼ö
¾ø´Ù´Â »ç½ÇÀ» ¸í½ÉÇϱ⠹ٶõ´Ù. ÀÌ°ÍÀº ÇÑ µµ¸ÞÀο¡ ´ëÇؼµµ ¼·Î ´Ù¸¥ µð½ºÅ©¿¡¼´Â
°¢°¢ÀÇ syslogd¸¦ ½ÇÇà½ÃÄÑ¾ß ÇÑ´Ù´Â °ÍÀ» ÀǹÌÇÑ´Ù. ÇÑ ¿¹·Î, ¸¸¾à ´ç½ÅÀÌ /virtual1¿¡
13°³ÀÇ µµ¸ÞÀÎÀ» °¡Áö°í ÀÖ°í, /virtual2¿¡ 15°³ÀÇ µµ¸ÞÀÎÀ» °¡Áö°í ÀÖ´Ù¸é,
13°³ÀÇ µµ¸ÞÀο¡ ´ëÇؼ´Â /virtual1/log¿¡ ÇÏµå ¸µÅ©¸¦
½ÃŲ ÈÄ, ÇϳªÀÇ µµ¸ÞÀο¡ ÇϳªÀÇ syslogd¸¸¾à ´ç½ÅÀÌ ¸ðµç ±â·ÏµéÀ» ÇϳªÀÇ À§Ä¡·Î ÁýÁß½ÃÅ°°í ½ÍÁö ¾Ê´Ù¸é °¢°¢ÀÇ µµ¸ÞÀο¡
´ëÇؼ syslogd¸¦ µû·Î ½ÇÇà½Ãų ¼ö ÀÖ´Ù. ÀÌ°ÍÀº ÇÁ·Î¼¼½º ID¸¦ ³¶ºñÇϱ⠶§¹®¿¡
±ÇÇÏ°í ½ÍÀº ¹æ¹ýÀº ¾Æ´ÏÁö¸¸, ÀÌ°ÍÀ» ±¸ÇöÇÏ´Â °ÍÀº ½¬¿î ÀÏÀÌ´Ù. ´ç½ÅÀº syslogd.init
ÆÄÀÏ¿¡¼ 7. °¡»ó FTP7.1 InetdWu-ftpd´Â ÀÚüÀûÀ¸·Î °¡»ó ½Ã½ºÅÛ¿¡ ¸Â°Ô ±¸¼ºµÉ ¼ö ÀÖ´Ù. ÇÏÁö¸¸, °¢°¢ÀÇ µµ¸ÞÀο¡
´ëÇؼ ºÐ¸®µÈ ºñ¹Ð¹øÈ£ ÆÄÀÏÀ» °ü¸®ÇÒ ¼ö´Â ¾ø´Ù. ¿¹¸¦ µé¸é,
wu-ftpd¸¦ À§ÇÑ inetd.confÀÇ ¿£Æ®¸®´Â ´ÙÀ½°ú °°´Ù:
ftp stream tcp nowait root /usr/local/bin/virtuald \ virtuald /virtual/conf.ftp wu.ftpd -l -a 7.2 À͸íÀÇ FTP(Anonymous FTP)ÀÌ°ÍÀº virtualdÀÇ ¼³Á¤¿¡ ¿µÇâÀ» ¹ÞÁö ¾Ê´Â´Ù. ¿ì¼± /virtuald/domain1.com/etc/passwd ¾È¿¡ ÀϹÝÀûÀÎ °æ¿ì¿Í ¸¶Âù°¡Áö·Î FTP »ç¿ëÀÚ¸¦ »ý¼ºÇÑ´Ù.
ftp:x:14:50:Anonymous FTP:/var/ftp:/bin/false ±×¸®°í´Â À͸íÀÇ FTP¸¦ À§ÇÑ µð·ºÅ丮¸¦ ¼³Á¤ÇÑ´Ù. °¢°¢ÀÇ µµ¸ÞÀο¡ ´ëÇؼ
¼·Î ´Ù¸¥ ºñ¹Ð¹øÈ£ ÆÄÀÏÀ» °¡Áö°í Àֱ⠶§¹®¿¡ À͸íÀÇ FTP¸¦ Á¦°øÇÒ µµ¸ÞÀÎÀ»
¼±ÅÃÇÒ ¼ö ÀÖ´Ù. FTP ¼¹ö´Â ÀÌ¹Ì 7.3 °¡»óÀÇ FTP »ç¿ëÀÚµéWu-ftpd´Â ¹æ¹®ÀÚ ±×·ì(guest group)À̶ó´Â °ÍÀ» Áö¿øÇÑ´Ù. ÀÌ°ÍÀ» ÀÌ¿ëÇϸé
°¢°¢ÀÇ »ç¿ëÀڵ鿡 ´ëÇؼ ´Ù¸¥ FTP °ø°£À» ¸¸µé ¼ö ÀÖ´Ù. ¶ÇÇÑ FTP ¼¹ö´Â
ƯÁ¤ °ø°£¿¡ ´ëÇØ ¹æ¹®ÀÚ ±×·ìÀº /virtual/domain1.com/etc/ftpaccess ÆÄÀÏ¿¡ Ãß°¡µÈ´Ù. /virtual/domain1.com/etc/passwd ¾È¿¡ ¿£Æ®¸®¸¦ ¸¸µé°í ½ÃÀÛÇϴ Ȩ µð·ºÅ丮´Â
chroot µð·ºÅ丮¿Í
guest1:x:8500:51:Guest FTP:/home/g/guest1/./incoming:/bin/false ±× ´ÙÀ½¿¡´Â ¹æ¹®ÀÚÀÇ È¨À» À͸íÀÇ FTP¸¦ ¼³Á¤ÇÏ´ø ¶§¿Í ¸¶Âù°¡Áö·Î ¼³Á¤ÇØ ÁØ´Ù.
°¢°¢ÀÇ µµ¸ÞÀο¡ ´ëÇؼ ºñ¹Ð¹øÈ£ ÆÄÀÏÀ» µû·Î °ü¸®Çϱ⠶§¹®¿¡ ¾î¶² µµ¸ÞÀο¡
¹æ¹®ÀÚ °èÁ¤ÀÌ Á¸ÀçÇÏ´ÂÁö, ±×¸®°í °¢ µµ¸ÞÀÎÀÇ ¾î¶² »ç¿ëÀÚµéÀÌ ¹æ¹®ÀÚ ±×·ìÀ¸·Î
¼³Á¤µÇ¾î ÀÖ´ÂÁö¸¦ ¼³Á¤ÇÒ ¼ö ÀÖ´Ù. ´Ù½Ã Çѹø °Á¶Çϴµ¥, ÀÌ¹Ì 8. °¡»óÀÇ À¥8.1 Virtuald¿Í ½ÇÇàÇϱâ±ÇÇÏÁö ¾ÊÀ½!(Not recommended)¾ÆÆÄÄ¡´Â ±âº»ÀûÀ¸·Î °¡»óÀÇ µµ¸ÞÀÎÀ» À§ÇÑ Áö¿øÀ» ÇØÁØ´Ù. ¾ÆÆÄÄ¡´Â ³»°¡ ³»ºÎÀÇ °¡»ó µµ¸ÞÀÎ ±âÀÛÀ» »ç¿ëÇÏ´Â °ÍÀ» ±ÇÇÏ´Â À¯ÀÏÇÑ ÇÁ·Î±×·¥ÀÌ´Ù. inetd¸¦ ÅëÇؼ ¾î¶² ÇÁ·Î±×·¥ÀÌ ½ÇÇàµÇ´Â °ÍÀº ¸¹Àº ´ë°¡¸¦ ÇÊ¿ä·Î Çϸç, ÇÁ·Î±×·¥ÀÌ ½ÃÀÛÇϱâ À§Çؼ´Â Ç×»ó inetd°¡ ½ÃÀ۵Ǿî¾ß ÇÑ´Ù´Â ´ÜÁ¡ÀÌ ÀÖ´Ù. ÀÌ·± °á°ú·Î ¹ÝÀÀ ½Ã°£ÀÌ ´À·ÁÁú °ÍÀε¥, ´Ù¸¥ ³×Æ®¿öÅ© ¼ºñ½º¿¡¼´Â ÀÌ·± ´À·ÁÁüÀÌ °ßµô¸¸ ÇÏÁö¸¸ À¥ ¼ºñ½º¿¡¼´Â ±×·¸Áö ¾ÊÀ» °ÍÀÌ´Ù. ¾ÆÆÄÄ¡´Â ¶ÇÇÑ ³Ê¹« ¸¹Àº ¿äûÀÌ µé¾î¿À´Â °æ¿ì Á¦¾î¸¦ ÇÒ ¼ö ÀÖ´Â ±â´ÉÀ» °¡Áö°í Àִµ¥, ÀÌ ±â´ÉÀº Å©Áö ¾ÊÀº ±Ô¸ðÀÇ »çÀÌÆ®¿¡¼µµ Áß¿äÇÑ ¹®Á¦°¡ µÉ ¼ö ÀÖ´Ù. °£´ÜÈ÷ ¸»Çϸé, ¾ÆÆÄÄ¡ ¼¹ö¸¦ virtuald¿Í ÇÔ²² »ç¿ëÇÏ¿© °¡»ó ½Ã½ºÅÛÀ» ±¸ÃàÇÏ´Â °ÍÀº Á¤¸» ¾ÈÁÁÀº »ý°¢ÀÌ´Ù. virtuald°¡ ÁöÇâÇÏ´Â °ÍÀº Á¦°øÇÏ°íÀÚ ÇÏ´Â ¼ºñ½º°¡ ³»ºÎ¿¡¼ °¡»ó °ø°£¿¡ ´ëÇÑ ¸¸Á·½º·¯¿î Áö¿øÀ» ÇÏÁö ¾ÊÀ» °æ¿ì¿¡ ºÎÁ·ÇÑ ºÎºÐÀ» ä¿ì´Â ÀÏÀÌ´Ù. virtuald°¡ ÀÌ¹Ì ¿Ïº®ÇÏ°Ô °¡»ó ½Ã½ºÅÛÀ» Áö¿øÇÏ´Â ÁÁÀº Äڵ带 ´ëüÇϱâ À§ÇÑ °ÍÀº ¾Æ´Ï´Ù. ¹°·Ð À§ÀÇ Ãæ°íµµ ²À ±×·¸°³ ÇÏ°í ¸»¸®¶ó »ý°¢ÇÏ´Â ¹«¸ðÇÑ »ç¶÷µé¿¡°Ô´Â º° È¿¿ëÀÌ ¾øÀ» °ÍÀÌÁö¸¸. Inetd/etc/inetd.conf ¸¦ ÆíÁýÇ϶ó.
vi /etc/inetd.conf # Add this line www stream tcp nowait www /usr/local/bin/virtuald \ virtuald /virtual/conf.www httpd -f /var/www/conf/httpd.conf Httpd.conf/var/www/conf/httpd.conf¸¦ ÆíÁýÇ϶ó.
vi /var/www/conf/httpd.conf # Or wherever you put the Apache config files It should say: ServerType standalone Replace it with: ServerType inetd ¼³Á¤±×¸®°í´Â ¾ÆÆÄÄ¡ ¼¹öÀ» ÀϹÝÀûÀ¸·Î ¼³Á¤ÇÏ´Â °úÁ¤À» ¼öÇàÇÑ´Ù. Httpd.initinetd¸¦ ÅëÇؼ ¾ÆÆÄÄ¡°¡ ½ÇÇàµÉ ¶§¿¡´Â httpd.initÀº ÇÊ¿ä¾ø´Ù. 8.2 Apache VirtualHost¿Í °°ÀÌ ½ÇÇàÇϱâ¾ÆÆÄÄ¡´Â ¼¼ °³ÀÇ ¼³Á¤ ÆÄÀÏ - Access.confÀÌ ¼³Á¤ÆÄÀÏÀº À¥ µð·ºÅ丮 ±¸Á¶¿¡¼ Á¢±ÙÀ» ÅëÁ¦Çϴµ¥ »ç¿ëµÈ´Ù. ¿©±â °¢°¢ÀÇ µµ¸ÞÀο¡ ¾î¶»°Ô ¼·Î ´Ù¸¥ ¿É¼ÇÀ» ¼³Á¤ÇÒ ¼ö ÀÖ´ÂÁö¸¦ º¸¿©ÁÖ´Â ¿¹Á¦ ¼³Á¤ÆÄÀÏÀÌ ÀÖ´Ù.
# /var/www/conf/access.conf: Global access configuration # Options are inherited from the parent directory # Set the main directory with default options <Directory /> AllowOverride None Options Indexes </Directory> # Give one domain a passwd protected directory <Directory /virtual/domain1.com/var/www/html/priv> AuthUserFile /var/www/passwd/domain1.com-priv AuthGroupFile /var/www/passwd/domain1.com-priv-g AuthName PRIVSECTION AuthType Basic <Limit GET PUT POST> require valid-user </Limit> </Directory> # Give another domain Server Side Includes <Directory /virtual/domain2.com/var/www/html> Options IncludesNOEXEC </Directory> Httpd.confÀÌ ¼³Á¤ÆÄÀÏÀº ¾ÆÆÄÄ¡ ¼¹öÀÇ ÁÖµÈ ¿É¼ÇÀ» °ü¸®ÇÑ´Ù. ¿©±â °¢°¢ÀÇ µµ¸ÞÀο¡ ´ëÇؼ ¼·Î ´Ù¸¥ ¿É¼ÇÀ» ¼³Á¤ÇÏ´Â °Í¿¡ ´ëÇÑ ¿¹Á¦ ÆÄÀÏÀÌ ÀÖ´Ù.
# /var/www/conf/httpd.conf: Main server configuration file # Begin: main conf section # Needed since not using inetd ServerType standalone # Port to run on Port 80 # Log clients with names vs IP addresses HostnameLookups on # User to run server as User www Group www # Where server config, error and log files are ServerRoot /var/www # Process Id of server in this file PidFile /var/run/httpd.pid # Internal server process info ScoreBoardFile /var/www/logs/apache_status # Timeout and KeepAlive options Timeout 400 KeepAlive 5 KeepAliveTimeout 15 # Number of servers to run MinSpareServers 5 MaxSpareServers 10 StartServers 5 MaxClients 150 MaxRequestsPerChild 30 # End: main conf section # Begin: virtual host section # Tell server to accept requests for ip:port # I have one for each IP needed so you can explicitly ignore certain domains Listen 10.10.10.129:80 Listen 10.10.10.130:80 # VirtualHost directive allows you to specify another virtual # domain on your server. Most Apache options can be specified # within this section. <VirtualHost www.domain1.com> # Mail to this address on errors ServerAdmin webmaster@domain1.com # Where documents are kept in the virtual domain DocumentRoot /virtual/domain1.com/var/www/html # Name of the server ServerName www.domain1.com # Log files Relative to ServerRoot option ErrorLog logs/domain1.com-error_log TransferLog logs/domain1.com-access_log RefererLog logs/domain1.com-referer_log AgentLog logs/domain1.com-agent_log # Use CGI scripts in this domain ScriptAlias /cgi-bin/ /var/www/cgi-bin/domain1.com/ AddHandler cgi-script .cgi AddHandler cgi-script .pl </VirtualHost> <VirtualHost www.domain2.com> # Mail to this address on errors ServerAdmin webmaster@domain2.com # Where documents are kept in the virtual domain DocumentRoot /virtual/domain2.com/var/www/html # Name of the server ServerName www.domain2.com # Log files Relative to ServerRoot option ErrorLog logs/domain2.com-error_log TransferLog logs/domain2.com-access_log RefererLog logs/domain2.com-referer_log AgentLog logs/domain2.com-agent_log # No CGI's for this host </VirtualHost> # End: virtual host section Srm.confÀÌ ¼³Á¤ÆÄÀÏÀº ¾î¶² ¿äû¿¡ ´ëÇØ ¼ºñ½º¸¦ Á¦°øÇÒ °ÍÀÎÁö¿Í ±× Çü½ÄÀÌ ¾î¶»°Ô µÉ °ÍÀÎÁö¿¡ ´ëÇÑ °ÍÀ» Á¶ÀýÇÑ´Ù. °¡»ó µµ¸ÞÀο¡ ´ëÇؼ ÀÌ°ÍÀ» ¹Ù²Ü ÇÊ¿ä´Â ¾ø´Ù. ¾ÆÆÄÄ¡¿¡¼ ±âº»ÀûÀ¸·Î Á¦°øÇÏ´Â ¿¹Á¦ ÆÄÀÏ Çü½Ä ±×´ë·Î °¡»ó ½Ã½ºÅÛ¿¡ Àû¿ëÇصµ ÀÛµ¿ÇÒ °ÍÀÌ´Ù. Httpd.inithttpd.init ÆÄÀÏ¿¡ ´ëÇؼ Ưº°È÷ ÇØÁÙ °ÍÀº ¾ø´Ù. ¾ÆÆÄÄ¡ÀÇ Ç¥ÁØÀûÀÎ ¼³Á¤À» ÀÌ¿ëÇ϶ó. 8.3 ÆÄÀÏ ¼¼úÀÚ ¿À¹öÇ÷οì(File Descriptor Overflow)°æ°íÀÌ°ÍÀº ¿ÀÁ÷ µ¶¸³Àû(standalone style)ÀÎ ¾ÆÆÄÄ¡ ¼¹ö¿¡¸¸ ÇØ´çµÈ´Ù. inetd¸¦ ÅëÇؼ ¼¹ö°¡ ½ÇÇàµÉ ¶§¿¡´Â ´Ù¸¥ µµ¸ÞÀΰú ¿¬°üÀÌ ¾ø±â ¶§¹®¿¡ ¸ðµç ÆÄÀÏ ¼¼úÀÚ Å×À̺íÀ» °®´Â´Ù. ¾ÆÆÄÄ¡ ¼¹ö°¡ ¿©´Â ¸ðµç ·Î±× ÆÄÀϵéÀº ÇÁ·Î¼¼½º¿¡ ´ëÇÑ ¶Ç´Ù¸¥ ÆÄÀÏ ¼¼úÀÚ (file descriptor)°¡ µÈ´Ù. ¸®´ª½º¿¡¼´Â °¢°¢ÀÇ ÇÁ·Î¼¼½º¿¡ ´ëÇؼ 256°³ ±îÁö ÆÄÀÏ ±â¼úÀÚ¸¦ °¡Áú ¼ö ÀÖ´Ù´Â Á¦¾àÀÌ ÀÖ´Ù. Áï ¿©·¯°³ÀÇ µµ¸ÞÀÎÀ» »ç¿ëÇÑ´Ù¸é ±¸¸ÕÄñ ¸¹Àº ÆÄÀÏ ±â¼úÀÚµéÀÌ ÇÊ¿äÇÏ°Ô µÈ´Ù. ¸¸¾à ÇϳªÀÇ ¾ÆÆÄÄ¡ ¼¹ö ÇÁ·Î¼¼½º¿¡¼ ³Ê¹« ¸¹Àº µµ¸ÞÀÎÀ» ¼³Á¤ÇÏ°í »ç¿ëÇÑ´Ù¸é ÀÌ Å×À̺íÀÌ ³ÑÃij¯(overflow) ¼öµµ ÀÖ´Ù. ÀÌ°ÍÀº ƯÁ¤ÇÑ ·Î±×°¡ ÀÛµ¿ÇÏÁö ¾ÊÀ» ¼öµµ ÀÖÀ¸¸ç, CGI°¡ ½ÇÆÐÇÒ ¼öµµ ÀÖ´Ù´Â °ÍÀ» ÀǹÌÇÑ´Ù. ¿©·¯°³ÀÇ ¾ÆÆÄÄ¡ ¼¹ö¸¸¾à ÇÑ µµ¸ÞÀο¡ ´ëÇؼ ´Ù¼¸°³ÀÇ ÆÄÀÏ ±â¼úÀÚ¸¦ °¡Áö°í ÀÖ´Ù°í °¡Á¤ÇÏ¸é ´ç½ÅÀº ¾ÆÆÄÄ¡ ¼¹ö¿¡¼ 50°³ÀÇ µµ¸ÞÀÎÀ» ¾Æ¹« ¹®Á¦¾øÀÌ ½ÇÇà½Ãų ¼ö ÀÖ´Ù. ÇÏÁö¸¸, ¸¸¾à ÀÌ·± »óȲ¿¡¼ ¹®Á¦°¡ ¹ß»ýÇÑ´Ù¸é /var/www1¿¡ µµ¸ÞÀÎ1-µµ¸ÞÀÎ25 ÀÇ ¾ÆÆÄÄ¡ ¼¹ö¸¦ ÇÒ´çÇÏ°í, /var/www2¿¡ µµ¸ÞÀÎ26-µµ¸ÞÀÎ50ÀÇ ¾ÆÆÄÄ¡ ¼¹ö¸¦ ÇÒ´çÇÏ´Â ¹æ½ÄÀ» »ç¿ëÇÒ ¼ö ÀÖ´Ù. ÀÌ°ÍÀº °¢°¢ÀÇ ¼¹ö¿¡ ´ëÇØ ÀڽŸ¸ÀÇ ¼³Á¤°ú ¿¡·¯, ·Î±× µð·ºÅ丮¸¦ °®°Ô µÈ´Ù. °¢°¢ÀÇ ¼¹ö´Â ¶ÇÇÑ ÀڽŸ¸ÀÇ Listen°ú VirtualHost µð·ºÅ丮¸¦ °¡Áö°í ÀÖ¾î¾ß ÇÑ´Ù. httpd.init ÆÄÀÏ¿¡¼µµ ¿©·¯°³ÀÇ ¼¹ö¸¦ ¼³Á¤ÇØ ÁÖ¾î¾ß ÇÑ´Ù´Â »ç½ÇÀ» ÀØÁö ¸»¶ó. 8.4 ÇϳªÀÇ IP¿¡¼ ¼¹ö °øÀ¯IP Àý¾àÇϱâHTTP(HyperText Transfer Protocol) ¹öÀü 1.1¿¡´Â ¼¹öÀÇ À̸§À» Ŭ¶óÀ̾ðÆ®¿¡ ¾Ë¸®´Â ±â´ÉÀÌ Ãß°¡µÇ¾ú´Ù. ÀÌ°ÍÀº Ŭ¶óÀ̾ðÆ®°¡ ¼¹ö¸¦ ãÀ» ¶§ IP ¾îµå·¹½º·Î ºÎÅÍ Ã£À» ÇÊ¿ä°¡ ¾ø´Ù´Â °ÍÀ» ÀǹÌÇÑ´Ù. µû¶ó¼ µÎ°³ÀÇ °¡»ó ¼¹ö°¡ °°Àº IP ¾îµå·¹½º¸¦ °¡Áö°í ¼·Î ´Ù¸¥ À¥ »çÀÌÆ®·Î ²Ù¹Ð ¼ö ÀÖ´Ù. ¾ÆÆÄÄ¡ ¼³Á¤Àº À§¿Í ¶È°°Àºµ¥, ´ÜÁö ¼·Î ´Ù¸¥ ListenÀ» Áö½ÃÇÒ ÇÊ¿ä°¡ ¾ø´Ù´Â Á¡¸¸ ´Ù¸£´Ù. (µÎ°³ÀÇ µµ¸ÞÀÎÀÌ °°Àº IP¸¦ ¾²±â ¶§¹®¿¡ Listen ¿ª½Ã °°°Ô µÈ´Ù.) °áÁ¡¿ÀÁ÷ ¹®Á¦°¡ µÇ´Â Á¡Àº virtuald°¡ µµ¸ÞÀÎÀ» ±¸ºÐÇϱâ À§Çؼ IP ¾îµå·¹½º¸¦
»ç¿ëÇÑ´Ù´Â Á¡ÀÌ´Ù. Áö±Ý ÇöÀçÀÇ virtuald ÇüÅ·δ °¢°¢ÀÇ µµ¸ÞÀο¡ ´ëÇÑ
½ºÇ® µð·ºÅ丮¸¦ 8.5 ´õ ¸¹Àº Á¤º¸ÀÌ ÇÏ¿ìÅõ´Â ´ÜÁö ¾î¶»°Ô °¡»ó ½Ã½ºÅÛÀ» ¾ÆÆÄÄ¡ À¥ ¼¹ö¿¡¼ Á¦°øÇÒ ¼ö ÀÖ´ÂÁö¸¸À» º¸¿©ÁÖ°í ÀÖ´Ù. ´ëºÎºÐÀÇ À¥ ¼¹öµéÀº ºñ½ÁÇÑ ÀÎÅÍÆäÀ̽º¸¦ °®´Â´Ù. °¡»ó À¥ È£½ºÆÿ¡ ´ëÇØ ´õ ¸¹Àº ³»¿ëÀ» ¾Ë°í½Í´Ù¸é WWW HOWTO, ¸¦ Âü°íÇϰųª, ¾ÆÆÄÄ¡¿¡ ´ëÇÑ ¹®¼µé ( Apache »çÀÌÆ®¿¡¼ ±¸ÇÒ ¼ö ÀÖ´Ù) ȤÀº ApacheWeek¸¦ ã¾Æº¸¶ó. 9. °¡»ó ¸ÞÀÏ/POP ¼¹ö9.1 ¹®Á¦°¡»ó ¸ÞÀÏÀÇ Áö¿ø¿¡ ´ëÇÑ ¿äûÀº ³¯·Î Áõ°¡ÇÏ°í ÀÖ´Ù. ¼¾µå¸ÞÀÏÀº °¡»ó ¸ÞÀÏ ½Ã½ºÅÛÀ» Áö¿øÇÑ´Ù°í ¸»ÇÑ´Ù. ÇÏÁö¸¸ ±×°ÍÀÌ Áö¿øÇÏ´Â °ÍÀº ¿©·¯ µµ¸ÞÀο¡¼ ¸ÞÀϵéÀ» °Ë»çÇÏ´Â ±â´ÉÀÌ´Ù. ±× ÈÄ ´ç½ÅÀº ƯÁ¤ ¸ÞÀÏÀ» ´Ù¸¥ °÷À¸·Î Æ÷¿öµù ÇÒ ¼ö ÀÖ´Ù. ÇÏÁö¸¸, ·ÎÄà ¸Ó½ÅÀ¸·Î Æ÷¿öµùµÈ ¸ÞÀÏÀ̳ª bob@domain1.com°ú bob@domain2.com¿¡ ¿Â ¸ÞÀÏÀº °°Àº ¸ÞÀÏ Æú´õ¿¡ µé¾î°¡ ÀÖ°Ô µÈ´Ù. À̵éÀÌ ¼·Î ´Ù¸¥ ¸ÞÀÏÀÌ°í µÎ¸íÀÇ bobÀÌ ¼·Î ´Ù¸¥ »ç¶÷ÀÏ ¶§¿¡´Â ¹®Á¦°¡ µÈ´Ù. 9.2 ÇØ°áÃ¥´ç½ÅÀº °¢°¢ÀÇ »ç¿ëÀÚ À̸§¿¡ ¼ýÀÚ¸¦ ºÙ¿©¼, ȤÀº Á¤ÇØÁø ¹®ÀÚ¸¦ ¾Õ¿¡ ºÙ¿©¼ Áߺ¹µÇ´Â »ç¿ëÀÚ°¡ ¾Æ´ÔÀ» ±¸ºÐÇÒ ¼ö ÀÖ´Â ¹æ¹ýÀÌ ÀÖ´Ù.(¿¹: bob1, bob2 ȤÀº dom1bob, dom2bob) ´ç½ÅÀº ¶ÇÇÑ mailÀ̳ª pop¸¦ °íÃļ ÀÌ·± ÀüȯÀÌ º¸ÀÌÁö ¾Ê°Ô ÀÌ·ç¾îÁú ¼ö ÀÖ°Ô ¸¸µé¼öµµ ÀÖ´Ù. ¿ÜºÎ·Î ³ª°¡´Â ¸ÞÀÏ ¿ª½Ã ÀÌ·± ½ÄÀ¸·Î °¢°¢ÀÇ ¼ºêµµ¸ÞÀο¡ ´ëÇؼ ±× À̸§À» »ç¿ëÇÏ°Ô ¸¸µé ¼ö ÀÖ´Ù. ³»°¡ °¡Áø ÇØ°áÃ¥Àº µÎ°¡ÁöÀÌ´Ù. Çϳª´Â sendmailÀ» ÀÌ¿ëÇÏ´Â °ÍÀÌ°í, ´Ù¸¥ Çϳª´Â QmailÀ» ÀÌ¿ëÇÏ´Â °ÍÀÌ´Ù. SendmailÀ» ÀÌ¿ëÇÑ ÇØ°áÃ¥Àº ÀÌ ±â´ÉÀ» Ãß°¡ÇÏ¿© sendmail À» ¼³Ä¡ÇÏ´Â °ÍÀÌ´Ù. ÇÏÁö¸¸, ÀÌ ¹æ¹ýÀº ¸ðµç Á¦¾àÀÌ sendmail¿¡ ¶È°°ÀÌ Àû¿ëµÈ´Ù. ÀÌ ¹æ¹ýÀº ¶ÇÇÑ °¢°¢ÀÇ µµ¸ÞÀο¡ ´ëÇؼ Çϳª¾¿ÀÇ sendmailÀÌ queue mode·Î ½ÇÇàµÇ¾î¾ß ÇÑ´Ù´Â ´ÜÁ¡À» °¡Áö°í ÀÖ´Ù. 50°³ ȤÀº ±× ÀÌ»óÀÇ senmail queue ÇÁ·Î¼¼½º´Â ¸Å½Ã°£ ½Ã½ºÅÛÀ» ¹Ù»Ú°Ô ¸¸µé °ÍÀÌ´Ù. QmailÀ» ÀÌ¿ëÇÏ´Â ÇØ°áÃ¥Àº ¿©·¯°³ÀÇ QmailÀ» ÇÊ¿ä·ÎÇÏÁöµµ ¾Ê°í, ÇϳªÀÇ queue µð·ºÅ丮 ÀÌ¿Ü¿¡¼µµ ½ÇÇà °¡´ÉÇÏ´Ù. ÀÌ ¹æ¹ýÀº QmailÀÌ virtuald¿Í ¸ÂÁö ¾Ê±â ¶§¹®¿¡ Ãß°¡ÀûÀÎ ÇÁ·Î±×·¥À» ÇÊ¿ä·Î ÇÑ´Ù. ³ sendmailÀ» ÀÌ¿ëÇÑ ¹æ¹ý ¿ª½Ã ºñ½ÁÇÑ °úÁ¤À» ÇÊ¿ä·Î ÇÑ´Ù°í ¹Ï´Â´Ù. ÇÏÁö¸¸, QmailÀº ÀÌ °æ¿ì º¸´Ù ÇØ°áÃ¥À» À§ÇÑ Áغñ°¡ Àß µÇ¾îÀÖ´Â °Í °°´Ù. ³»°¡ ÇÑ ÇÁ·Î±×·¥ÀÌ ´Ù¸¥ ÇÁ·Î±×·¥º¸´Ù ³´´Ù´Â °ÍÀ» º¸ÁõÇÏ´Â °ÍÀº ¾Æ´Ï´Ù. Sendmail ¼³Ä¡´Â º¸´Ù Á÷Á¢ÀûÀÎ ÇØ°áÃ¥ÀÌÁö¸¸, QmailÀ» ÀÌ¿ëÇÏ´Â ¹æ¹ýÀÌ ¾Æ¸¶ ´õ °·ÂÇÑ ÇØ°áÃ¥ÀÌ µÉ ¼ö ÀÖ´Ù. 9.3 SendmailÀ» ÀÌ¿ëÇÑ ÇØ°áÃ¥¼Ò°³°¢°¢ÀÇ °¡»ó ÆÄÀÏ ½Ã½ºÅÛÀº ÀÚ½ÅÀÇ /etc/passwd ¾È¿¡ µµ¸ÞÀÎÀ» ¼³Á¤ÇÑ´Ù. ÀÌ°ÍÀº bob@domain1.com°ú bob@domain2.comÀÌ ¼·Î ´Ù¸¥ »ç¿ëÀÚ·Î /etc/passwd ¾È¿¡ µî·ÏµÇ¾î ÀÖ´Ù´Â °ÍÀ» ÀǹÌÇϸç, ¸ÞÀÏ ÇÁ·Î±×·¥¿¡¼ µÎ »ç¿ëÀÚ¸¦ ±¸ºÐÇÏ´Â µ¥¿¡´Â ¾Æ¹« ¹®Á¦°¡ ¾ø´Ù. ¶ÇÇÑ ÀڽŸ¸ÀÇ ½ºÇ® µð·ºÅ丮 ¿ª½Ã °¡Áö°í ÀÖÀ¸¹Ç·Î ´Ù¸¥ °¡»ó ÆÄÀÏ ½Ã½ºÅÛ¿¡ ´ëÇؼ ¼·Î ´Ù¸¥ ÆÄÀϷμ ¸ÞÀÏ Æú´õ°¡ Á¸ÀçÇÏ°Ô µÈ´Ù. Sendmail ¼³Á¤ ÆÄÀÏ ¸¸µé±âÀϹÝÀûÀÎ /etc/sendmail.cf ¸¦ m4¸¦ ÅëÇØ ¸¸µç´Ù. ³»°¡ »ç¿ëÇÏ´Â °ÍÀº ´ÙÀ½°ú °°´Ù:
divert(0) VERSIONID(`tcpproto.mc') OSTYPE(linux) FEATURE(redirect) FEATURE(always_add_domain) FEATURE(use_cw_file) FEATURE(local_procmail) MAILER(local) MAILER(smtp) Sendmail ¼³Á¤ÆÄÀÏ ÆíÁýÇϱâ/virtual/domain1.com/etc/sendmail.cf ¸¦ °¡»ó µµ¸ÞÀο¡ ¹ÝÀÀÇÒ ¼ö ÀÖµµ·Ï ÆíÁýÇÑ´Ù:
vi /virtual/domain1.com/etc/sendmail.cf # Approximately Line 86 It should say: #Dj$w.Foo.COM Replace it with: Djdomain1.com Sendmail Áö¿ª ¹è´Þ/virtual/domain1.com/etc/sendmail.cw¸¦ Áö¿ª È£½ºÆ®À̸§À¸·Î ÆíÁýÇÑ´Ù.
vi /virtual/domain1.com/etc/sendmail.cw mail.domain1.com domain1.com domain1 localhost °¡»ó µµ¸ÞÀÎ »çÀÌÀÇ Sendmail : The Hack (PRE8.8.6)ÇÏÁö¸¸, sendmailÀº ÀÛÀº ¼Ò½º ÄÚµå º¯È¯À» ÇÊ¿ä·Î ÇÑ´Ù. SendmailÀº /etc/sendmail.cw ¶ó´Â ÆÄÀÏÀ» °¡Áö°í Àִµ¥, ¿©±â¿¡´Â sendmailÀÌ ·ÎÄà ³»¿¡¼(¿ÜºÎÀÇ ´Ù¸¥ ¸Ó½ÅÀÌ ¾Æ´Ñ) ¹è´ÞÇÒ ¸ðµç ¸Ó½ÅµéÀÇ À̸§ÀÌ ±â·ÏµÇ¾î ÀÖ´Ù. SendmailÀº ³»ºÎ¿¡¼ ¸Ó½ÅÀÇ ¸ðµç ÀåÄ¡µé¿¡ ´ëÇØ °Ë»çÇÏ¿© ÀÌ ¸®½ºÆ®¸¦ ·ÎÄà IP¸¦ °¡Áö°í ÃʱâÈÇÑ´Ù. ÀÌÁ¡ ¶§¹®¿¡ ¸¸¾à °°Àº ¸Ó½Å ³»ÀÇ °¡»ó µµ¸ÞÀÎ »çÀÌ¿¡¼ ¸ÞÀÏÀ» ÁÖ°í¹Þ°íÀÚ ÇÒ ¶§ ¹®Á¦°¡ µÉ ¼ö ÀÖ´Ù. SendmailÀº ´Ù¸¥ °¡»ó µµ¸ÞÀÎÀ» ·ÎÄà ¾îµå·¹½º·Î »ý°¢ÇÏ°í ·ÎÄà Áö¿ªÀ¸·Î ¸ÞÀÏÀ» ½ºÇ®¸µÇÏ°Ô µÈ´Ù. ¿¹¸¦ µé¸é, bob@domain1.comÀÌ fred@domain2.com¿¡°Ô ¸ÞÀÏÀ» º¸³Â´Ù°í ÇÏÀÚ. ±×·¯¸é domain1.comÀÇ sendmailÀº domain2.comÀ» ·ÎÄ÷ΠÀνÄÇÏ°í ¸ÞÀÏÀ» domain1.com¿¡ ½ºÇ®¸µÇÒ °ÍÀÌ´Ù. (´ç¿¬È÷ domain2.comÀ¸·Î´Â ¸ÞÀÏÀÌ °¡Áö ¾ÊÀ» °ÍÀÌ´Ù.) µû¶ó¼ ´ç½ÅÀº sendmailÀ» º¯Çü½ÃÄÑ¾ß ÇÑ´Ù. (ÀÌ º¯ÇüÀº v8.8.5¿¡¼ Å×½ºÆ®Çغ» °á°ú ¾Æ¹« ¹®Á¦°¡ ¾ø¾ú´Ù.)
vi v8.8.5/src/main.c # Approximately Line 494 It should say: load_if_names(); Replace it with: /* load_if_names(); Commented out since hurts virtual */ ¸¸¾à °¡»ó µµ¸ÞÀÎ »çÀÌ¿¡¼ ¸ÞÀÏÀ» ÁÖ°í¹ÞÀ» ÇÊ¿ä°¡ ÀÖÀ» °æ¿ì¿¡¸¸ ÀÌ ¼³Á¤À» ÀÌ¿ëÇ϶ó. (¾Æ¸¶ ´ëºÎºÐÀÇ °æ¿ì ±×·¯ÇÏ°ÚÁö¸¸) ÀÌ°ÍÀº ¹®Á¦Á¡À» ÇØ°áÇÒ °ÍÀÌ´Ù. ÇÏÁö¸¸, ÁÖµÈ ÀÌ´õ³Ý ÀåÄ¡ÀÎ eth0´Â ¾ø¾îÁöÁö ¾Ê´Â´Ù. µû¶ó¼, ¸¸¾à ´ç½ÅÀÌ °¡»ó IP¿¡¼ eth0·Î ¸ÞÀÏÀ» º¸³»°Ô µÇ¸é ÀÌ°ÍÀº ·ÎÄ÷Π¹è´ÞÀÌ µÉ °ÍÀÌ´Ù. µû¶ó¼ ³ª´Â ÀÌ°ÍÀ» ´õ¹Ì(dummy) IPÀÎ virtual1.maindomain.com(10.10.10.157)·Î ÀÌ¿ëÇÑ´Ù. ³ Àý´ë ÀÌ È£½ºÆ®·Î ¸ÞÀÏÀ» º¸³»Áö ¾ÊÀ¸¸ç, ¹°·Ð ±× °¡»ó µµ¸ÞÀÎÀ¸·Îµµ ¸ÞÀÏÀº °¡Áö ¾Ê´Â´Ù. ÀÌ ¹æ¹ýÀº ¶ÇÇÑ ³»°¡ ssh¸¦ »ç¿ëÇÏ´Â IP¸¦ °¡Áø ½Ã½ºÅÛÀÌ Á¤»óÀûÀÎÁö¸¦ È®ÀÎÇÏ´Â ¹æ¹ýÀ̱⵵ ÇÏ´Ù. °¡»ó µµ¸ÞÀÎ »çÀÌÀÇ Sendmail : SendmailÀÇ »õ·Î¿î ±â´É (POST8.8.6)Sendmail V8.8.6ºÎÅÍ´Â Ãß°¡ÀûÀÎ ³×Æ®¿öÅ© ÀÎÅÍÆäÀ̽ºÀÇ ºñ»ç¿ë žÀç(disable loading)¿¡
´ëÇÑ »õ·Î¿î ¿É¼ÇÀÌ »ý°å´Ù. µû¶ó¼ Äڵ带 ¹Ù²Ü ÇÊ¿ä´Â ¾ø°Ô µÇ¾ú´Âµ¥, ÀÌ°ÍÀ»
/virtual/domain1.com/etc/sendmail.cf¸¦ ÆíÁýÇ϶ó.
vi /virtual/domain1.com/etc/sendmail.cf # Add the line O DontProbeInterfaces=True Sendmail.initSendmailÀº µ¶¸³ÀûÀ¸·Î ½ÇÇàÀÌ ºÒ°¡´ÉÇÏ°í Ç×»ó inetd¸¦ ÅëÇؼ ½ÇÇàµÇ°Ô µÈ´Ù.
ÀÌ ¹æ¹ýÀº ºñÈ¿À²ÀûÀÌ°í ½ÃÀÛÇÏ´Â µ¥ ½Ã°£ÀÌ °É¸®°ÚÁö¸¸, ¸¸¾à ´ç½ÅÀÌ ¿î¿µÇÏ´Â
»çÀÌÆ®°¡ ÀÌ·± Á¡ÀÌ ¹®Á¦°¡ µÉ Á¤µµ·Î ³×Æ®¿öÅ©°¡ ºó¹øÇÏ´Ù¸é ÇϳªÀÇ ½Ã½ºÅÛ¿¡¼
°¡»óÀÇ ¿©·¯ µµ¸ÞÀÎÀ» °°ÀÌ »ç¿ëÇÏ´Â °ÍÀº ÁÁÀº ¹æ¹ýÀÌ ¾Æ´Ï´Ù.
#!/bin/sh . /etc/rc.d/init.d/functions case "$1" in start) echo -n "Starting sendmail: " daemon sendmail -q1h echo echo -n "Starting virtual sendmail: " for i in /virtual/* do if [ ! -d "$i" ] then continue fi if [ "$i" = "/virtual/lost+found" ] then continue fi chroot $i sendmail -q1h echo -n "." done echo " done" touch /var/lock/subsys/sendmail ;; stop) echo -n "Stopping sendmail: " killproc sendmail echo rm -f /var/lock/subsys/sendmail ;; *) echo "Usage: sendmail {start|stop}" exit 1 esac exit 0 Inetd ¼³Á¤Pop´Â ´Ù¸¥ ¿µÇâ¾øÀÌ Á¤»óÀûÀ¸·Î ¼³Ä¡µÉ °ÍÀÌ´Ù. ´ÜÁö inetdÀÇ ¿£Æ®¸®¿¡¼ ÀÌ Ç×À» °¡»óÀÇ Æ÷Æ®¿Í ÇÔ²² °í·ÁÇÒ ÇÊ¿ä°¡ ÀÖ´Ù. inetd.conf ¿£Æ®¸®¿¡¼ sendmail°ú pop¿¡ ´ëÇÑ °ÍÀº ´ÙÀ½°ú °°´Ù:
pop-3 stream tcp nowait root /usr/local/bin/virtuald \ virtuald /virtual/conf.pop in.qpop -s smtp stream tcp nowait root /usr/local/bin/virtuald \ virtuald /virtual/conf.mail sendmail -bs 9.4 QmailÀ» ÀÌ¿ëÇÑ ¹æ¹ý¼Ò°³ÀÌ ¹æ¹ýÀº qmail-localÀÇ ¹è´Þ ½Ã½ºÅÛÀ» Â÷¿ëÇϱ⠶§¹®¿¡, °¡»óÀÇ È¨ µð·ºÅ丮 ¾ÈÀÇ .qmail ÆÄÀÏÀº ÀÛµ¿ÇÏÁö ¾Ê°Ô µÈ´Ù. ÇÏÁö¸¸, °¢°¢ÀÇ µµ¸ÞÀÎÀº µµ¸ÞÀÎ ÀüüÀÇ ¾Ù¸®¾î½Ì (aliasing)À» ÅëÁ¦ÇÏ´Â µµ¸ÞÀÎ ÁÖÀÎ »ç¿ëÀÚ(domain master user)¸¦ °®´Â´Ù. µÎ °³ÀÇ ¿ÜºÎ ÇÁ·Î±×·¥µéÀÌ µµ¸ÞÀÎ ÁÖÀÎÀÇ .qmail-default ÆÄÀÏÀ» »ç¿ëÇÒ ¼ö ÀÖ°Ô ÇØÁÙ °ÍÀÌ´Ù. °¢°¢ÀÇ µµ¸ÞÀο¡ ¸ÞÀÏÀÌ ¹è´ÞµÇ±â À§Çؼ´Â ÀÌµé µÎ ÇÁ·Î±×·¥À» ÅëÇØ¾ß ÇÒ °ÍÀÌ´Ù. µÎ °³ÀÇ ÇÁ·Î±×·¥ÀÌ ÇÊ¿äÇѵ¥, ±× °¡¿îµ¥ Çϳª´Â setuid root »óÅ·Π½ÇÇàµÈ´Ù. ÀÌ ÀÛÀº ÇÁ·Î±×·¥Àº ÀÏ´Ü ÇÁ·Î¼¼½ºÀÇ ¼ÒÀ¯±ÇÀ» root°¡ ¾Æ´Ñ »ç¿ëÀÚ·Î ¹Ù²Ù°í, ´Ù½Ã µÎ¹ø° ÇÁ·Î±×·¥À» ½ÇÇà½ÃŲ´Ù. °¡±î¿î º¸¾È °ü·Ã »çÀÌÆ®¿¡¼ ¿Ö ÀÌ·± ¹æ½ÄÀÌ ÇÊ¿äÇÑÁö¸¦ Âü°íÇÒ ¼ö ÀÖÀ» °ÍÀÌ´Ù. ÀÌ ¹æ¹ýÀº virtuald¸¦ »ç¿ëÇÒ Çʿ伺ÀÌ º°·Î ¾ø´Ù. QmailÀº ¸Å¿ì À¯µ¿ÀûÀÎ ÇÁ·Î±×·¥À̶ó ÀϹÝÀûÀÎ virtuald ¼³Á¤À» ÇÊ¿ä·ÎÇÏÁö ¾Ê´Â´Ù. QmailÀº ¸ÞÀÏÀÇ ¹è´ÞÀ» À§ÇØ ÇÁ·Î±×·¥µéÀÇ ¿¬°áÀ» ÀÌ¿ëÇϵµ·Ï ¼³°èµÇ¾ú´Ù. ÀÌ µðÀÚÀÎÀº °¡»ó ¼ºñ½º ºÎºÐÀ» Qmail ¹è´Þ ÇÁ·Î¼¼½º Áß°£¿¡ ½±°Ô »ðÀÔÇÒ ¼ö ÀÖ°Ô ÇÑ´Ù. ´ç½ÅÀÌ QmailÀ» »ç¿ëÇÑ´Ù¸é ¸ÞÀÎ ¼¹öÀÇ µµ¸ÞÀο¡¼ ¹«Á¦ÇÑÀÇ µµ¸ÞÀÎ À̸§À» ¸¸µé¾î ³¾ ¼ö ÀÖ´Ù. ÀÌ°ÍÀº °¢°¢ÀÇ µµ¸ÞÀο¡ ´ëÇØ ºÐ¸®µÈ QmailÀ» °®´Â °ÍÀÌ ¾Æ´Ï±â ¶§¹®¿¡ °¡´ÉÇÏ´Ù. ¸ÞÀÏ Å¬¶óÀ̾ðÆ® ÇÁ·Î±×·¥(À¯µµ¶ó³ª elm, mutt µî)¿¡¼ ´ç½ÅÀÌ ÀÓÀÇ·Î ¸¸µé¾î³½ µµ¸ÞÀÎ À̸§À» ÀνÄÇÏ´Â °ÍÀ» È®ÀÎÇØ º¸¶ó. °¡»ó µµ¸ÞÀÎ ¼³Á¤QmailÀº ´ç½ÅÀÌ Á¦°øÇÏ´Â °¢°¢ÀÇ °¡»ó µµ¸ÞÀÎÀ» ¹Þ¾ÆµéÀÏ ¼ö ÀÖµµ·Ï ¼³Á¤µÇ¾î¾ß ÇÑ´Ù. ¾Æ·¡ÀÇ ¸í·É¾îµéÀ» ¼öÇàÇ϶ó.
echo "domain1.com:domain1" >> /var/qmail/control/virtualdomains µµ¸ÞÀÎÀÇ ÁÖÀÎ(Domain Master User) ¼³Á¤¸ÞÀÎ /etc/passwd ÆÄÀÏ¿¡ domain1ÀÇ »ç¿ëÀÚµéÀ» Ãß°¡ÇÑ´Ù. ³ª´Â /bin/false ¼ÐÀ» ¸¸µé¾î µµ¸ÞÀÎ ÁÖÀÎ(the domain master)ÀÌ ·Î±×ÀÎÇÏÁö ¸øÇÏ°Ô ¸¸µé¾ú´Ù. µµ¸ÞÀÎ ÁÖÀÎÀº domain1ÀÇ .qmail ÆÄÀϵéÀ» Ãß°¡ÇÒ ¼ö ÀÖ°í, µµ¸ÞÀÎÀÇ ¸ðµç ¸ÞÀϵéÀº ÀÌ °èÁ¤À» ÅëÇÏ¿© ¹ß¼ÛµÈ´Ù. »ç¿ëÀÚ À̸§Àº ¿©´ü ÀÚ¸®±îÁö °¡´ÉÇÏ¸ç µµ¸ÞÀÎ À̸§Àº ´õ ±æ¾îÁö ¼ö ÀÖ´Ù´Â °ÍÀ» ÁÖÀÇÇϱ⠹ٶõ´Ù. ³ª¸ÓÁö ¹®ÀÚµéÀº ¹«½ÃµÈ´Ù. ÀÌ°ÍÀº domain12¶ó´Â »ç¿ëÀÚ¿Í domain123À̶ó´Â »ç¿ëÀÚ°¡ °°Àº »ç¿ëÀÚ·Î ÀνĵDZ⠶§¹®¿¡ QmailÀÌ È¥µ¿ÇÒ ¼ö ÀÖ´Ù´Â °ÍÀ» ÀǹÌÇÑ´Ù. µû¶ó¼ µµ¸ÞÀÎ ÁÖÀÎ À̸§ °áÁ¤¿¡ ÁÖÀǸ¦ ±â¿ïÀ̱⠹ٶõ´Ù. ´ÙÀ½°ú °°Àº ÀýÂ÷¸¦ ÅëÇÏ¿© µµ¸ÞÀÎ ÁÖÀÎÀÇ .qmail ÆÄÀÏÀ» ¸¸µéÀÚ. ´Ù¸¥ ½Ã½ºÅÛ ¾Ù¸®¾î½º - ¿¹¸¦ µé¸é À¥¸¶½ºÅͳª È£½ºÆ®¸¶½ºÅÍ- °¡ ÀÌ ÁöÁ¡¿¡ Ãß°¡µÈ´Ù.
echo "user@domain1.com" > /home/d/domain1/.qmail-mailer-daemon echo "user@domain1.com" > /home/d/domain1/.qmail-postmaster echo "user@domain1.com" > /home/d/domain1/.qmail-root µµ¸ÞÀÎ ÁÖÀÎÀÇ .qmail-default ÆÄÀÏÀ» ¸¸µéÀÚ. ÀÌ°ÍÀº ¸ðµç ¸ÞÀÏÀ» °¡»óÀÇ µµ¸ÞÀÎÀ¸·Î °É·¯ÁÖ°Ô µÉ °ÍÀÌ´Ù.
echo "| /usr/local/bin/virtmailfilter" > /home/d/domain1/.qmail-default TcpserverQmailÀº Maildir Çü½ÄÀ» Áö¿øÇϴ Ưº°ÇÑ popÀ» ÇÊ¿ä·Î ÇÑ´Ù. ÀÌ pop ÇÁ·Î±×·¥ ¶ÇÇÑ °¡»ó ½Ã½ºÅÛ¿¡ ¸Â°Ô µÇ¾î¾ß ÇÑ´Ù. QmailÀÇ ÀúÀÚ´Â tcpserver(inetd ´ë¿ë)¸¦ Qmail°ú ÇÔ²² »ç¿ëÇÒ °ÍÀ» ±ÇÇϴµ¥, ³ªÀÇ ¿¹Á¦¿¡¼µµ inetd ´ë½Å¿¡ tcpserver¸¦ »ç¿ëÇÏ¿´´Ù. Tcpserver´Â ¼³Á¤ ÆÄÀÏÀ» ÇÊ¿ä·Î ÇÏÁö ¾Ê´Â´Ù. ¸ðµç Á¤º¸´Â ¸í·ÉÇà¿¡¼ ÁÖ¾îÁö°Ô µÈ´Ù. ¿©±â ¸ÞÀÏ µ¥¸ó°ú popper¸¦ »ç¿ëÇϱâ À§ÇÑ tcpserver.initÀÌ ÀÖ´Ù.
#!/bin/sh . /etc/rc.d/init.d/functions QMAILDUSER=`grep qmaild /etc/passwd | cut -d: -f3` QMAILDGROUP=`grep qmaild /etc/passwd | cut -d: -f4` # See how we were called. case "$1" in start) echo -n "Starting tcpserver: " tcpserver -u 0 -g 0 0 pop-3 /usr/local/bin/virtuald \ /virtual/conf.pop qmail-popup virt.domain1.com \ /bin/checkpassword /bin/qmail-pop3d Maildir & echo -n "pop " tcpserver -u $QMAILDUSER -g $QMAILDGROUP 0 smtp \ /var/qmail/bin/qmail-smtpd & echo -n "qmail " echo touch /var/lock/subsys/tcpserver ;; stop) echo -n "Stopping tcpserver: " killall -TERM tcpserver echo -n "killing " echo rm -f /var/lock/subsys/tcpserver ;; *) echo "Usage: tcpserver {start|stop}" exit 1 esac exit 0 Qmail.init´ç½ÅÀº Á¦°øµÇ´Â Ç¥ÁØ Qmail Ãʱ⠽ºÅ©¸³Æ®¸¦ ¹Ù·Î »ç¿ëÇÒ ¼ö ÀÖ´Ù. QmailÀº ÀÌ°ÍÀ» ¾î¶»°Ô ¼³Á¤ÇØ¾ß ÇÏ´ÂÁö¿¡ ´ëÇØ »ó´çÈ÷ ÁÁÀº ¹®¼¿Í ÇÔ²² ¹èÆ÷µÈ´Ù. ¼Ò½º(Source)Qmail·Î °¡»ó ¸ÞÀÏ ¼ºñ½º¸¦ ±¸ÃàÇϱâ À§Çؼ´Â µÎ°³ÀÇ ¼·Î ´Ù¸¥ ÇÁ·Î±×·¥ÀÌ ÇÊ¿äÇÏ´Ù. Çϳª´Â virtmailfilterÀÌ°í, ´Ù¸¥ Çϳª´Â virtmaildeliveryÀÌ´Ù. ¿©±â virtmailfilter¿¡ ´ëÇÑ C ¼Ò½º Äڵ尡 ÀÖ´Ù. ÀÌ ÇÁ·Î±×·¥Àº /usr/local/bin¿¡ 4750ÀÇ ¼ÒÀ¯±ÇÀ» °¡Áö°í, root ¼ÒÀ¯, nofiles ±×·ìÀ¸·Î ¼³Ä¡µÇ¾î¾ß ÇÑ´Ù.
#include <sys/wait.h> #include <unistd.h> #include <string.h> #include <stdlib.h> #include <stdio.h> #include <ctype.h> #include <pwd.h> #define VIRTPRE "/virtual" #define VIRTPWFILE "etc/passwd" #define VIRTDELIVERY "/usr/local/bin/virtmaildelivery" #define VIRTDELIVERY0 "virtmaildelivery" #define PERM 100 #define TEMP 111 #define BUFSIZE 8192 int main(int argc,char **argv) { char *username,*usernameptr,*domain,*domainptr,*homedir; char virtpath[BUFSIZE]; struct passwd *p; FILE *fppw; int status; gid_t gid; pid_t pid; if (!(username=getenv("EXT"))) { fprintf(stdout,"environment variable EXT not set\n"); exit(TEMP); } for(usernameptr=username;*usernameptr;usernameptr++) { *usernameptr=tolower(*usernameptr); } if (!(domain=getenv("HOST"))) { fprintf(stdout,"environment variable HOST not set\n"); exit(TEMP); } for(domainptr=domain;*domainptr;domainptr++) { if (*domainptr=='.' && *(domainptr+1)=='.') { fprintf(stdout,"environment variable HOST has ..\n"); exit(TEMP); } if (*domainptr=='/') { fprintf(stdout,"environment variable HOST has /\n"); exit(TEMP); } *domainptr=tolower(*domainptr); } for(domainptr=domain;;) { snprintf(virtpath,BUFSIZE,"%s/%s",VIRTPRE,domainptr); if (chdir(virtpath)>=0) break; if (!(domainptr=strchr(domainptr,'.'))) { fprintf(stdout,"domain failed: %s\n",domain); exit(TEMP); } domainptr++; } if (!(fppw=fopen(VIRTPWFILE,"r+"))) { fprintf(stdout,"fopen failed: %s\n",VIRTPWFILE); exit(TEMP); } while((p=fgetpwent(fppw))!=NULL) { if (!strcmp(p->pw_name,username)) break; } if (!p) { fprintf(stdout,"user %s: not exist\n",username); exit(PERM); } if (fclose(fppw)==EOF) { fprintf(stdout,"fclose failed\n"); exit(TEMP); } gid=p->pw_gid; homedir=p->pw_dir; if (setgid(gid)<0 || setuid(p->pw_uid)<0) { fprintf(stdout,"setuid/setgid failed\n"); exit(TEMP); } switch(pid=fork()) { case -1: fprintf(stdout,"fork failed\n"); exit(TEMP); case 0: if (execl(VIRTDELIVERY,VIRTDELIVERY0,username,homedir,NULL)<0) { fprintf(stdout,"execl failed\n"); exit(TEMP); } default: if (wait(&status)<0) { fprintf(stdout,"wait failed\n"); exit(TEMP); } if (!WIFEXITED(status)) { fprintf(stdout,"child did not exit normally\n"); exit(TEMP); } break; } exit(WEXITSTATUS(status)); } ¼Ò½º(Source)¿©±â¿¡´Â virtmaildelivery¿¡ ´ëÇÑ C ¼Ò½º Äڵ尡 ÀÖ´Ù. ÀÌ°ÍÀº /usr/local/bin¿¡ 0755ÀÇ ¼ÒÀ¯±ÇÀ¸·Î, ¼ÒÀ¯ÀÚ¿Í ±×·ì ¸ðµÎ root·Î ¼³Ä¡µÇ¾î¾ß ÇÑ´Ù.
#include <sys/stat.h> #include <sys/file.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #include <stdio.h> #include <errno.h> #include <time.h> #define TEMP 111 #define BUFSIZE 8192 #define ATTEMPTS 10 int main(int argc,char **argv) { char *user,*homedir,*dtline,*rpline,buffer[BUFSIZE],*p,mail[BUFSIZE]; char maildir[BUFSIZE],newmaildir[BUFSIZE],host[BUFSIZE]; int fd,n,nl,i,retval; struct stat statp; time_t thetime; pid_t pid; FILE *fp; retval=0; if (!argv[1]) { fprintf(stdout,"invalid arguments: need username\n"); exit(TEMP); } user=argv[1]; if (!argv[2]) { fprintf(stdout,"invalid arguments: need home directory\n"); exit(TEMP); } homedir=argv[2]; if (!(dtline=getenv("DTLINE"))) { fprintf(stdout,"environment variable DTLINE not set\n"); exit(TEMP); } if (!(rpline=getenv("RPLINE"))) { fprintf(stdout,"environment variable RPLINE not set\n"); exit(TEMP); } while (*homedir=='/') homedir++; snprintf(maildir,BUFSIZE,"%s/Maildir",homedir); if (chdir(maildir)<0) { fprintf(stdout,"chdir failed: %s\n",maildir); exit(TEMP); } time(&thetime); pid=getpid(); if (gethostname(host,BUFSIZE)<0) { fprintf(stdout,"gethostname failed\n"); exit(TEMP); } for(i=0;i<ATTEMPTS;i++) { snprintf(mail,BUFSIZE,"tmp/%u.%d.%s",thetime,pid,host); errno=0; stat(mail,&statp); if (errno==ENOENT) break; sleep(2); time(&thetime); } if (i>=ATTEMPTS) { fprintf(stdout,"could not create %s\n",mail); exit(TEMP); } if (!(fp=fopen(mail,"w+"))) { fprintf(stdout,"fopen failed: %s\n",mail); retval=TEMP; goto unlinkit; } fd=fileno(fp); if (fprintf(fp,"%s",rpline)<0) { fprintf(stdout,"fprintf failed\n"); retval=TEMP; goto unlinkit; } if (fprintf(fp,"%s",dtline)<0) { fprintf(stdout,"fprintf failed\n"); retval=TEMP; goto unlinkit; } while(fgets(buffer,BUFSIZE,stdin)) { for(p=buffer;*p=='>';p++) ; if (!strncmp(p,"From ",5)) { if (fputc('>',fp)<0) { fprintf(stdout,"fputc failed\n"); retval=TEMP; goto unlinkit; } } if (fprintf(fp,"%s",buffer)<0) { fprintf(stdout,"fprintf failed\n"); retval=TEMP; goto unlinkit; } } p=buffer+strlen(buffer); nl=2; if (*p=='\n') nl=1; for(n=0;n<nl;n++) { if (fputc('\n',fp)<0) { fprintf(stdout,"fputc failed\n"); retval=TEMP; goto unlinkit; } } if (fsync(fd)<0) { fprintf(stdout,"fsync failed\n"); retval=TEMP; goto unlinkit; } if (fclose(fp)==EOF) { fprintf(stdout,"fclose failed\n"); retval=TEMP; goto unlinkit; } snprintf(newmaildir,BUFSIZE,"new/%u.%d.%s",thetime,pid,host); if (link(mail,newmaildir)<0) { fprintf(stdout,"link failed: %s %s\n",mail,newmaildir); retval=TEMP; goto unlinkit; } unlinkit: if (unlink(mail)<0) { fprintf(stdout,"unlink failed: %s\n",mail); retval=TEMP; } exit(retval); } 9.5 °¨»ç (Acknowledgement)Qmail¿¡ ÀÇÇÑ ÇØ°áÃ¥À» °¡´ÉÇÏ°Ô µµ¿òÀ» ÁØ Vicente Gonzalez (vince@nycrc.net) ¿¡°Ô °¨»çÇÑ´Ù. ¾Æ¸¶ Vince¿¡°Ô °¨»çÀÇ ¸ÞÀÏ Á¤µµ´Â º¸³¾ ¼ö ÀÖ°ÚÁö¸¸, Qmail¿¡ ´ëÇÑ °ÍÀ» Æ÷ÇÔÇÏ¿© ÀÌ HOWTO¿¡ Æ÷ÇÔµÈ ³»¿ëÀÇ Áú¹®°ú ÀÇ°ßÀº ¸ðµÎ ³ª¿¡°Ô º¸³»µµ·Ï Ç϶ó. 10. °¡»ó »ï¹Ù (Virtual Samba)10.1 ¼³Á¤°¡»ó SAMBA´Â ¸Å¿ì ¼³Á¤Çϱ⠽±´Ù. ¾Æ·¡ÀÇ ÆÄÀϵéÀÌ ÀûÀýÇÏ°Ô ¼³Á¤À» ÇØÁÙ °ÍÀÌ´Ù.
10.2 Inetd/etc/inetd.conf¸¦ ÆíÁýÇÑ´Ù.
vi /etc/inetd.conf # Add this line netbios-ssn stream tcp nowait root /usr/local/bin/virtuald \ virtuald /virtual/conf.smbd smbd 10.3 Smb.init¼¹ö°¡ inetd¸¦ ÅëÇؼ ½ÇÇàµÇ¹Ç·Î ÀÌ smb.init ÆÄÀÏÀº ÇÊ¿äÇÏÁö ¾Ê´Ù. 11. ´Ù¸¥ °¡»ó ¼ºñ½º´Ù¸¥ °¡»ó ¼ºñ½ºµµ ºñ½ÁÇÑ °úÁ¤À¸·Î Á¦°øµÉ ¼ö ÀÖ´Ù.
12. °á·ÐÀÌ°ÍÀÌ ÇÊ¿äÇÑ ¸ðµç ´Ü°èÀÌ´Ù. ´Ù½ÃÇѹø ¸»Çϴµ¥, ȸ½ÅÀº Computer Resource Center·Î º¸³»¶ó. ¸¸¾à ´ç½ÅÀÌ Áú¹®À» °¡Áö°í Àְųª ÀÌ ¹®¼¸¦ °»½ÅÇÒ ³»¿ëÀÌ ÀÖ´Ù¸é, ³ª¿¡°Ô ±×°ÍÀ» ¾Ë·ÁÁֱ⠹ٶõ´Ù. ÁÁÀº ¹ÝÀÀµéÀÌ ÀÌ ¹®¼¸¦ Áö¼ÓÀûÀ¸·Î ¸¸µé¾î¿Ô´Ù. ³ª¿¡°Ô Áú¹®À» º¸³½ ¸ðµç »ç¶÷µéÀÌ ÀÌ ¹®¼ÀÇ ÇüŸ¦ ¸¸µå´Â µ¥ µµ¿òÀ» ÁÖ¾ú°í, ´Ù½Ã Çʿ伺À» ´À³¢´Â ¸¹Àº °÷ÀÇ »ç¶÷µé¿¡°Ô µµ¿òÀ» ÁÖ°Ô ÇÑ °Í¿¡ ´ëÇؼ °¨»çÇÏ°Ô »ý°¢ÇÑ´Ù. Áú¹®Çϱâ Àü¿¡ FAQ¸¦ ¸ÕÀú Àо°í ÇØ´ç Áú¹®°ú ±×¿¡ ´ëÇÑ ´äÀÌ ÀÖ´ÂÁö È®ÀÎÇØÁֱ⠹ٶõ´Ù. ´Ù½ÃÇѹø ¹®¼¿¡ °ü½ÉÀ» °¡Á®ÁØ ¿©·¯ºÐµé¿¡°Ô °¨»çÀÇ ¶æÀ» ÀüÇÑ´Ù. Brian 13. ÀÚÁÖ Áú¹®µÇ´Â »çÇ×µé(FAQ)Q1. sendmail.init°ú syslogd.initÀ» ¸¸µé¾ú½À´Ï´Ù. À̰͵éÀ» /usr/local/bin¿¡ ³Ö°í ½ÇÇà½ÃÅ°¸é ¿¡·¯°¡ ³³´Ï´Ù. A1. ÀÌ ÆÄÀϵéÀº init ½ºÅ©¸³Æ®¶ó°í ÇÑ´Ù. ÀÌ ÇÁ·Î±×·¥µéÀº ÄÄÇ»ÅÍ°¡ óÀ½ ºÎÆÃµÉ ¶§ initÀ̶ó´Â ÇÁ·Î±×·¥¿¡ ÀÇÇØ ½ÇÇàµÈ´Ù. init ÇÁ·Î±×·¥Àº /usr/local ¹ØÀÇ ¹ÙÀ̳ʸ® ÆÄÀÏÀ» ÂüÁ¶ÇÏÁö ¾Ê´Â´Ù. ½Ã½ºÅÛ¿¡¼ init ½ºÅ©¸³Æ®¸¦ »ç¿ëÇϱâ À§ÇÑ ¹æ¹ýÀº Linux System Administrators Guide³ª Linux Getting Started Guide¸¦ Âü°íÇ϶ó. Q2. ´ÙÀ½°ú °°Àº ³»¿ëÀ» /etc/sendmail.cf¿¡ ³Ö¾ú½À´Ï´Ù.
divert(0) VERSIONID(`tcpproto.mc') OSTYPE(linux) FEATURE(redirect) FEATURE(always_add_domain) FEATURE(use_cw_file) FEATURE(local_procmail) MAILER(local) MAILER(smtp) Ãâ·Â °á°ú°¡ ÀÌ»óÇÏ°Ô ³ª¿À´Âµ¥ ±× ÀÌÀ¯°¡ ¹«¾ùÀԴϱî? A2. ÀÌ°ÍÀ» /etc/sendmail.cf¿¡ Á÷Á¢ ³ÖÀ¸¸é ¾ÈµÈ´Ù. sendmail.cf´Â sendmailÀÌ ÀÌÇØÇϱ⠽±°Ô ¾²¿©Á³±â ¶§¹®¿¡ º¸Åë »ç¶÷µéÀÌ º¸°í ÀÌÇØÇϱâ´Â ½±Áö ¾Ê´Ù. µû¶ó¼ º¸Åë m4¶ó´Â ÇÁ·Î±×·¥À̳ª ÀÌ°ÍÀÇ ¸ÅÅ©·Î¸¦ ÀÌ¿ëÇÏ¿© sendmail.cf ÆÄÀÏÀ» ¸¸µé°Ô ÇÔÀ¸·Î½á ¼³Á¤À» º¸´Ù ½±°Ô ÇÏ´Â °ÍÀÌ ÀϹÝÀûÀÌ´Ù. À§ÀÇ ¶óÀεéÀº sendmailÀÇ ¼³Á¤ ÆÄÀÏÀ» À§ÇÑ ¸ÅÅ©·ÎÀÌ´Ù. ¸ÅÅ©·Î¸¦ ÀÌ¿ëÇؼ sendmailÀ» ¼³Á¤ÇÏ´Â ¹æ¹ýÀ» ¾Ë°íÀÚ ÇÑ´Ù¸é sendmail¿¡ ´ëÇÑ ¹®¼¸¦ ÂüÁ¶Çϱ⠹ٶõ´Ù. /etc/sendmail.cf ÆÄÀÏÀ» ¸¸µç ´ÙÀ½ virtfs ½ºÅ©¸³Æ®¸¦ ÀÌ¿ëÇÏ¿© /virtual/domain1.com/etc/sendmail.cf·Î ÆÄÀÏÀ» º¹»çÇÏ´Â °ÍÀ» ÀØÁö ¸»¶ó. ±×¸®°í´Â sendmail.cf ÆÄÀÏÀ» °¢°¢ÀÇ µµ¸ÞÀο¡ ¸Â°Ô ¼³Á¤ÇØ¾ß µÈ´Ù. Q3. virtuald´Â ¾îµð¼ ±¸ÇÒ¼ö ÀÖ½À´Ï±î? ±×°ÍÀÌ °ú¿¬ ¹«¾ù¿¡ ¾²´Â °ÍÀΰ¡¿ä? ¶Ç ±×°ÍÀ» ¾î¶»°Ô »ç¿ëÇÒ ¼ö ÀÖ½À´Ï±î? A3.
Virtuald´Â °¡»ó ¼ºñ½º¸¦ Á¦°øÇϱâ À§ÇÑ ÇÁ·Î±×·¥À¸·Î ³»°¡ ¸¸µç C ÇÁ·Î±×·¥ÀÌ´Ù.
ÀÌ ÇÁ·Î±×·¥ÀÇ ¼Ò½º´Â ´ç½ÅÀÌ º¸°í ÀÖ´Â ¹Ù·Î ÀÌ HOWTO¿¡ Æ÷ÇԵǾî ÀÖ´Ù. º¸ÅëÀÇ C ÇÁ·Î±×·¥Ã³·³
À̰͵µ Q4. ³» ½Ã½ºÅÛ¿¡´Â dialog°¡ ¾ø´Âµ¥¿ä? A4. dialog´Â ´ç½ÅÀÌ ¼Ð ½ºÅ©¸³Æ®¿¡ ´ÙÀ̾ó·Î±× Æ˾÷ À©µµ¸¦ ³ÖÀ» ¼ö ÀÖ°Ô ÇØÁÖ´Â ÇÁ·Î±×·¥ÀÌ´Ù. À§¿¡¼ ¼Ò°³ÇÑ ³ªÀÇ virtual ¼Ð ½ºÅ©¸³Æ® ¿¹Á¦¸¦ ½ÇÇà½ÃÅ°±â À§Çؼ´Â ÀÌ ÇÁ·Î±×·¥ÀÌ ¹Ýµå½Ã ÇÊ¿äÇÏ´Ù. dialog´Â sunsite. ¿¡¼ ¾òÀ» ¼ö ÀÖÀ» °ÍÀÌ´Ù. ÀÌ ÇÁ·Î±×·¥ÀÇ ÄÄÆÄÀÏÀº ¸Å¿ì ½±±â ¶§¹®¿¡ ¼³Ä¡¿¡ º° ¹®Á¦°¡ ¾øÀ» °ÍÀÌ´Ù. Q5. °¡»óÀÇ syslogd°¡ ÀÛµ¿ÁßÀÎÁö¸¦ ¾î¶»°Ô ¾Ë ¼ö ÀÖÁö¿ä? A5. virtuald°¡ ÀÛµ¿ÁßÀÏ ¶§¿¡´Â ¾Æ·¡ÀÇ ¸Þ¼¼Áö°¡ syslogd(/var/log/messages)¿¡ ³²°Ô µÈ´Ù:
Nov 19 17:21:07 virtual virtuald[10223]: Virtuald Starting: $Revision: 1.1 $ Nov 19 17:21:07 virtual virtuald[10223]: Incoming ip: 204.249.11.136 Nov 19 17:21:07 virtual virtuald[10223]: Chroot dir: /virtual/domain1.com
¸¸¾à ´ç½ÅÀÌ ÄÄÆÄÀÏ ½Ã°£ ¿É¼Ç VERBOSELOG¸¦ ÄѳõÁö ¾Ê¾Ò´Ù¸é virtuald´Â ÀüÇô ±â·ÏÀ» ³²±âÁö ¾ÊÀ» °ÍÀÌ´Ù. ÀÌ·± °æ¿ì °¡»óÀÇ syslogd°¡ ½ÇÇàµÇ´ÂÁö¸¦ È®ÀÎÇÒ ¼ö ÀÖ´Â À¯ÀÏÇÑ ¹æ¹ýÀº °¡»ó ½Ã½ºÅÛÀ» ±¸¼ºÇÏ´Â µ¥¸óµéÀÌ µ¶¸³ÀûÀ¸·Î syslogd¿¡ ¹«¾ùÀΰ¡¸¦ ±â·ÏÇÏ´Â °ÍÀ» Âü°íÇÏ´Â °ÍÀÌ´Ù. Q6. °¡»óÀÇ ÆÄÀϽýºÅÛ¿¡ °ÉÃÄ ÄõŸ(quota)¸¦ ¼³Á¤ÇÏ·Á¸é ¾î¶»°Ô ÇÏÁÒ? A6. º¸Åë ÇÏ´Â ¹æ½ÄÀ¸·Î ÄõŸ¸¦ ¼³Á¤ÇÑ´Ù. Quota mini-HOWTO ¸¦ Âü°íÇ϶ó. ÇÏÁö¸¸, µµ¸ÞÀÎÀÌ ´Ù¸¥ °æ¿ì¿¡µµ uid¿¡ È¥¶õÀ» Á־ ¾ÈµÈ´Ù´Â »ç½ÇÀ» ±â¾ïÇ϶ó. ¸¸¾à uid¿¡ È¥¶õÀÌ ¿Â´Ù¸é »ç¿ëÀÚµéÀÌ ÄõŸ¸¦ °øÀ¯ÇÏ°Ô µÉ °ÍÀÌ´Ù. ÄõŸ¸¦ ¼³Á¤ÇÒ uidÀÇ ¹üÀ§¸¦ ÁöÁ¤ÇÏ°í, µµ¸ÞÀο¡ ÄõŸ¸¦ ¼³Á¤ÇÒ »ç¿ëÀÚ ÀÌ¿Ü¿¡´Â ±× ¹üÀ§ÀÇ uid¸¦ »ç¿ëÇÒ ¼ö ¾ø°Ô ¸¸µé¾î¶ó. Q7. inet.conf ¿£Æ®¸®¿¡ ÀÖ´Â \ Ç¥½Ã´Â ¹«½¼ ¶æÀÌÁÒ? A7. ´ÜÁö ¼³Á¤ ÆÄÀÏ¿¡¼ µÎ ÁÙ¿¡ °ÉÃÄ ÇÑ ³»¿ëÀ» »ç¿ëÇÒ ¶§ ÁٹٲÞÀ» Ç¥½ÃÇÏ´Â °ÍÀÌ´Ù. ³»°¡ ÀÌ Ç¥½Ã¸¦ »ç¿ëÇÑ °ÍÀº ´Ü¾î¸¦ Àû´çÇÑ À§Ä¡¿¡ ³õ¾Æ º¸±âÁÁ°Ô ÇÏ°íÀÚ ÇÏ´Â Àǵµ¿´´Ù. \À» ¾ø¾Ö°í ÇϳªÀÇ ÁÙ·Î ¼³Á¤ ÆÄÀÏÀ» ¹Ù²Ù¾îµµ »ó°ü¾ø´Ù. Q8.
passwd³ª ´Ù¸¥ login ÇÁ·Î±×·¥À» »ç¿ëÇÒ ¶§ A8. À̰͵éÀº PAM ¿¡·¯ ¸Þ½ÃÁöµéÀÌ´Ù. ³ª´Â ÀÌ ½ºÅ©¸³Æ®µéÀ» PAMÀÌ ³ª¿À±â ÀÌÀü¿¡ ÀÛ¼ºÇÏ¿´´Ù. ³»°¡ ÀÛ¼ºÇÑ virtfs ½ºÅ©¸³Æ®´Â /etc/pam.d, /usr/lib/cracklib_dict.*, /lib/security, ȤÀº ±×¹ÛÀÇ PAMÀÌ ¿ä±¸ÇÏ´Â ÆÄÀϵéÀ» º¹»çÇÏ´Â ºÎºÐÀ» °¡Áö°í ÀÖÁö ¾Ê´Ù. PAMÀº À̵é ÆÄÀϵéÀ» ÇÊ¿ä·Î ÇÑ´Ù. ´ç½ÅÀÌ virtfs ½ºÅ©¸³Æ®¸¦ ÆíÁýÇÏ¿© À̵é ÆÄÀϵéÀ» º¹»çÇÏ°Ô ¸¸µç´Ù¸é ÀÌµé ¹®Á¦´Â »ç¶óÁú °ÍÀÌ´Ù. Q9. virtuald´Â tcpdÀÇ hosts.allow¿Í hosts.deny ÆÄÀϵéÀ» »ç¿ëÇÒ ¼ö ÀÖ³ª¿ä? A9. ¹°·Ð. ¾à°£ÀÇ ¼öÁ¤À¸·Î °¡´ÉÇÏ´Ù. ¿ì¼± ¼Ò½ºÀÇ µÎºÎºÐÀ» ¹Ù²ã¾ß ÇÑ´Ù. arguments¸¦ È®ÀÎÇÏ´Â ºÎºÐ¿¡ ¾Æ·¡ ³»¿ëÀ» ÷°¡ÇØ¾ß ÇÑ´Ù.
if (!argv[3]) { syslog(LOG_ERR,"invalid arguments: no program to run"); exit(0); }exec ¶óÀÎ ¿ª½Ã ´ÙÀ½°ú °°ÀÌ ¹Ù²î¾î¾ß ÇÑ´Ù. º¯°æ Àü: if (execvp(argv[2],argv+2)<0) º¯°æ ÈÄ: if (execvp(argv[2],argv+3)<0) ´ÙÀ½À¸·Î inetd.conf ¶óÀÎÀ» º¯°æÇÑ´Ù. º¯°æ Àü: ftp stream tcp nowait root /usr/local/bin/virtuald \ virtuald /virtual/conf.ftp wu.ftpd -l -a º¯°æ ÈÄ: ftp stream tcp nowait root /usr/local/bin/virtuald \ virtuald /virtual/conf.ftp tcpd wu.ftpd -l -a ´ÙÀ½¿¡ /virtual/domain1.com/etc/hosts.allow ¿Í /virtual/domain1.com/etc/hosts.deny ÆÄÀÏÀ» ¼³Á¤ÇÏ¿© ÀÌ¿ëÇÒ ¼ö ÀÖ´Ù. Q10. °¡»ó È£½ºÆ®¿¡¼ CGI¸¦ ½ÇÇà½Ãų ¼ö ÀÖ³ª¿ä? A10.
¹°·Ð ½ÇÇàÀÌ °¡´ÉÇÏÁö¸¸, /cgi-bin À» ´ç½ÅÀÌ Á¢±ÙÇÒ ¼ö ÀÖ´Â Q11. ³» ¼³Á¤ÆÄÀϵéÀº ÀÌ ¹®¼ÀÇ ¿¹Á¦¿Í ´Ù¸¨´Ï´Ù. ¾î¶»°Ô ÇØ¾ß ÇÏÁÒ? A11. ¼³Á¤ ÆÄÀÏ¿¡´Â ±âº»ÀûÀ¸·Î µÎ°¡Áö ÇüÅ°¡ Á¸ÀçÇÑ´Ù: ½Ã½ºÅÛV¿Í BSD°¡ ±×°ÍÀÌ´Ù. ÀÌ ¹®¼¿¡¼ Á¦°øÇÏ´Â ¿¹Á¦´Â ½Ã½ºÅÛV ÇüÅÂÀÇ ¼³Á¤ ÆÄÀÏ¿¡ ±âÃÊÇÏ°í ÀÖ´Ù. µÎ ½Ã½ºÅÛ ¸ðµÎ¿¡¼ °¡»ó ¼ºñ½º´Â ¼º°øÀûÀ¸·Î ÀÛµ¿ÇÑ´Ù. BSD ÇüÅÂÀÇ ¼³Á¤ ÆÄÀϵ鿡 ´ëÇÑ Á¤º¸´Â ½Ã½ºÅÛ ±¸ÀÔó¿¡ ¹®ÀÇÇϰųª °¡±î¿î LDP »çÀÌÆ®¸¦ ÂüÁ¶Ç϶ó. Q12. ´ç½Å¿¡°Ô ¸ÞÀÏÀ» º¸³Â´Âµ¥, ȸ½ÅÀÌ ¾ø°Å³ª ȸ½Å¿¡ ¾ÆÁÖ ¿À·£ ½Ã°£ÀÌ °É¸³´Ï´Ù. ¿ÖÁÒ? A12. ¾Æ¸¶ ¸ÞÀÏÀÇ Á¦¸ñ¿¡ VIRTSERVICES HOWTO¶ó´Â Çì´õ¸¦ ³ÖÁö ¾Ê¾Æ¼ ±×·² °ÍÀÌ´Ù. ³»°¡ ³×Æ®¿öÅ© °ü¸®ÀÚ·Î °¡»ó ¼¹öµé°ú ±× Ŭ¶óÀ̾ðÆ®µéÀ» °ü¸®ÇÏ´Â µ¥ ÇÊ¿äÇÑ ¸¹Àº ÀÏÀ» ÇÏ°í ÀÖ´Ù´Â Á¡À» Á» »ý°¢ÇØÁÖ°í, Âü¾ÆÁֱ⠹ٶõ´Ù. ÀÌ ÇÏ¿ìÅõ ¹®¼¿¡ ´ëÇÑ ¸ÞÀÏÀ» Á¤È®È÷ º¸³Â´Ù¸é 2ÀÏ¿¡¼ 3ÀÏ ¾È¿¡ Ç×»ó ´äÀåÀ» ¹ÞÀ» ¼ö ÀÖÀ» °ÍÀÌ´Ù. Á¤È®È÷ ¸ÞÀÏÀ» º¸³»Áö ¾Ê¾Ò´Ù¸é ³ªÀÇ VIRTSERVICES ¸ÞÀϹڽº¿¡ °É·¯Á® µé¾î¿ÀÁö ¸øÇßÀ» °ÍÀÌ°í, ±×·¯¸é ¸çÄ¥ ȤÀº ¸îÁÖ µ¿¾È ³»°¡ ¸ð¸¥ ä ¹æÄ¡µÇ¾î ÀÖÀ»Áöµµ ¸ð¸¥´Ù. Q13. virtuald´Â 100M ºñÆ® ȯ°æ¿¡¼µµ ÀÛµ¿Çϳª¿ä? A13 ³×Æ®¿öÅ© Ä«µåÀÇ ¼Óµµ´Â virtuald°¡ ÀÛµ¿ÇÏ´ÂÁöÀÇ ¿©ºÎ¿Í ¾Æ¹« »ó°üÀÌ ¾ø´Ù. 10M ºñÆ® ȯ°æ¿¡¼ 100M ºñÆ® ³×Æ®¿öÅ© Ä«µå¸¦ »ç¿ëÇصµ Á¤»óÀûÀ¸·Î ÀÛµ¿ÇÑ´Ù´Â »ç½ÇÀ» È®ÀÎÇØ º¸¶ó. Q14. sendmailÀÇ virthost Å×À̺íÀ» »ç¿ëÇÒ ¼ö ÀÖ³ª¿ä? A14.
¾ÈµÈ´Ù. ÀÌ°ÍÀº sendmailÀÌ ¿©·¯ µµ¸ÞÀο¡ ´ëÇÑ Á¤º¸¸¦ ¹Þ±â À§ÇÑ ±â´ÉÀÌ´Ù. virtuald´Â
°¢°¢ÀÇ sendmail¿¡ ´ëÇؼ ºÐ¸®µÈ Q15. °¡»ó telnetÀ» ¼³Ä¡ÇÒ ¼ö ÀÖ³ª¿ä? °¡»óÀÇ root °èÁ¤À» ¸¸µé¾î »ç¿ëÀÚµéÀÌ ÀڽŵéÀÇ µµ¸ÞÀÎÀ» °ü¸®ÇÏ°Ô ¸¸µé ¼ö ÀÖ³ª¿ä? A15. ÀÌ Áú¹®Àº ±²ÀåÈ÷ ÀÚÁÖ ³ª¿À´Â Áú¹®ÀÌ°í, ¼ÖÁ÷È÷ ¸»Çϸé ÀÌ Áú¹®¿¡ ´ëÇØ ´äÇÏ´Â °ÍÀº Á» ÇÇ°ïÇÑ ÀÏÀÌ´Ù. ÀÌ ¹®¼¿¡¼ ÀÌ¹Ì ¿©·¯¹ø ¸»ÇßµíÀÌ, ±× ´äÀº inetd¸¦ ÅëÇÏ´Â ¸ðµç ¼ºñ½º´Â virtuald¸¦ ÀÌ¿ëÇÏ¿© °¡»ó ¼ºñ½º·Î ¸¸µé¼ö ÀÖÀ¸¸ç À§ÀÇ Áú¹®¿¡ ´ëÇØ ¾ÈµÉ ÀÌÀ¯´Â Çϳªµµ ¾ø´Ù´Â °ÍÀÌ´Ù. »ó½ÄÀûÀÎ °ÍÀÌ´Ù. telnet °¡»ó ¼ºñ½º¸¦ Á¦°øÇÏ¿© ¾ò´Â À̵æÀÌ ¹«¾ùÀÎÁö ¸ð¸£°ÚÁö¸¸, ÀÌ·± ¼³Á¤Àº °¡»ó ¸Ó½ÅÀÇ º¸¾È µîÀÇ ¹®Á¦¿¡ ¸¹Àº ÅõÀÚ¸¦ ÇÊ¿ä·ÎÇÒ °ÍÀÌ´Ù. ¿©±â ÀÌ¿Í °ü·ÃµÈ ¸î°¡Áö ³»¿ëµéÀÌ ÀÖ´Ù:
±âº»ÀûÀ¸·Î °¡»ó ½Ã½ºÅÛ¿¡ ´ëÇؼ loginÀ» Çã¿ëÇÏ´Â °ÍÀº ÁøÂ¥ ¾ÈÁÁÀº »ý°¢ÀÌ´Ù. ¸¸¾à ÀÌ°ÍÀÌ Çã¿ëµÈ´Ù¸é, ±× ¸Ó½Å¿¡¼ È£½ºÆÃÇÏ´Â ¸ðµç »çÀÌÆ®°¡ À§Çè¿¡ ºüÁú ¼ö ÀÖ´Ù. ¸¸¾à ƯÁ¤ »çÀÌÆ®¸¦ »ç¿ëÀÚ¿¡ ÀÇÇØ °ü¸®µÉ ¼ö ÀÖµµ·Ï ¼³Á¤ÇÏ°íÀÚ ÇÑ´Ù¸é, ssh¸¦ ÅëÇØ ·Î±×ÀÎÇÒ ¼ö ÀÖ´Â »ç¿ëÀÚµéÀ» Ãß°¡, »èÁ¦, º¯°æ °¡´ÉÇÏ°Ô ÇØÁÙ ¼ö ÀÖ´Â °¡»ó ÇÁ·Î¼¼½º¿¡ ´ëÇÑ ÇÁ·Î±×·¥À»(½ºÅ©¸³Æ®°¡ ¾Æ´Ñ) ÀÛ¼ºÇÏ´Â °ÍÀÌ ÁÁÀ» °ÍÀÌ´Ù. ÀÌ ÇÁ·Î±×·¥Àº ¸Þ´º ±âµ¿ ¹æ½Ä(menu driven)ÀÌ µÇ¾î¾ß Çϸç, ÄܼÖÀ» Çã°¡ÇÏÁö ¾Ê°í, root·Î ½ÇÇàµÇ´Â °ÍÀ» ±ÝÁö½ÃÄÑ¾ß ÇÑ´Ù. ±×·¯±â À§Çؼ´Â ÆÄÀÏÀÇ ¼ÒÀ¯±ÇÀ» root¿¡¼ ¸î¸î ´Ù¸¥ »ç¿ëÀÚ·Î ¹Ù²Ü ÇÊ¿ä°¡ ÀÖ´Ù. ÀÌ·± Á¶Ä¡´Â °¡»ó ½Ã½ºÅÛÀ» Á¶±ÝÀÌ¶óµµ ¾ÈÀüÇÏ°Ô ¸¸µç´Ù. Àý´ë root°¡ telnetÀ̳ª ssh¸¦ ÅëÇØ Á¢¼ÓÇÏ´Â °ÍÀ» Çã¿ëÇÏÁö ¸»¶ó. ÀÌ·± Á¶Ä¡´Â Àç¾ÓÀ» ºÒ·¯¿Ã °ÍÀÌ´Ù. ¸¸¾à °¡»ó ½Ã½ºÅÛ¿¡¼ ºÒ°¡ÇÇÇÏ°Ô telnetÀ» »ç¿ëÇÒ ÇÊ¿ä°¡ ÀÖ´Ù¸é ÇÇÇØ°¡ ÃÖ¼ÒÈ µÉ ¼ö ÀÖ´Â ¸Ó½ÅÀ» ¼±ÅÃÇ϶ó. Á¤»óÀûÀÎ °ü¸®ÀÚ¶ó¸é ÀÌ·¸°Ô±îÁö À̾߱âÇߴµ¥¿¡µµ ÅÚ³ÝÀ» Á¦°øÇÏÁö´Â ¾ÊÀ¸¸®¶ó ¹Ï°í, ´õÀÌ»ó ½Ã°£³¶ºñ´Â ÇÏÁö ¾Ê°Ú´Ù. Q16. virtuald³ª Virtual-Services HOWTO¿¡ ´ëÇÑ ¸ÞÀϸµ ¸®½ºÆ®, À¥ÆäÀÌÁö, rpm, tar µîÀÇ Á¤º¸°¡ ÀÖ³ª¿ä? A16. ÇöÀç´Â ¾Æ¹«°Íµµ ¾ø´Ù. ÀÌ HOWTO ¹®¼°¡ ³»°¡ ÇöÀç ÇÏ°íÀÖ´Â °¡»ó ¼ºñ½º¿Í °ü·ÃµÈ ÇÁ·ÎÁ§Æ®ÀÇ ÀüºÎÀÌ´Ù. ³ª ¿ª½Ã ³»°¡ ´Ù·çÁö ¸øÇÑ ºÎºÐ¿¡ ´ëÇÑ HOWTO¸¦ ã°í ÀÖ´Ù. Q17.
ÀÏ¹Ý À¯Àú·Î virtexec¸¦ ½ÇÇàÇÏ·Á Çß´õ´Ï A17.
Q18. pop°ú sendmailÀ» ¼³Á¤Çߴµ¥, popÀÌ Á¦´ë·Î ÀÛµ¿ÇÏÁö ¾Ê´Â°Í °°±º¿ä. ¾î¶»°Ô ´ëóÇÒ±î¿ä? A18. ¸î¸î pop ÇÁ·Î±×·¥µéÀº /usr/spool/mailÀ» ¸ÞÀÏ ÆÄÀϵéÀ» ³õ±â À§ÇØ »ç¿ëÇÑ´Ù. ³»°¡ ¾Ë±â·Î´Â qpopÀÇ °æ¿ì ÀÌ ¹®Á¦¸¦ ÇØ°áÇϱâ À§ÇØ ¼öµ¿À¸·Î ÆíÁýÀ» ÇØÁÖ¾î¾ß ÇÑ´Ù. ¼Ò½º Äڵ带 ´Ù½Ã ÄÄÆÄÀÏÇϰųª /virtual/domain1.com/usr/spool À» /virtual/domain1.com/var/spool·Î ÇÏµå ¸µÅ© ½ÃÅ°¸é µÈ´Ù. Q19. ³ª´Â ´ç½ÅÀÌ ¸»ÇÑ ÇÁ·Î±×·¥À» ¾²Áö ¾Ê°í, ´ë½Å XXX¶ó´Â ÇÁ·Î±×·¥À» ½è´Âµ¥, ÀÛµ¿ÀÌ µÇÁö ¾Ê´Â±º¿ä. ¿ÖÁÒ? A19. ³ª´Â °¡±ÞÀûÀÌ¸é ³Î¸® »ç¿ëµÇ´Â ÀϹÝÀûÀÎ ¼¹öµé¿¡ ´ëÇØ ±â¼úÇÏ·Á°í Çß´Ù. ÇÏÁö¸¸, ³ª´Â ¸ðµç »ç¶÷µéÀÌ ÀÚ½ÅÀÌ Æ¯º°È÷ ÁÁ¾ÆÇÏ´Â ¼¹ö°¡ ÀÖ´Ù´Â °Íµµ ¾Ë°í ÀÖ´Ù. ÀÌ·± °æ¿ì °¡±ÞÀû ¸¹Àº Á¤º¸¸¦ ³ª¿¡°Ô º¸³»Áشٸé, ´ç½ÅÀÇ ¹®Á¦Á¡À» Ç®±â À§ÇÑ ½Ãµµ¸¦ ÇÒ °ÍÀÌ°í, ´õºÒ¾î ÀÌ FAQ¿¡ ¹®¼È ÇÏ´Â ÀÛ¾÷À» ÇÒ °ÍÀÌ´Ù. ³ª¿¡°Ô º¸³¾ Á¤º¸ °¡¿îµ¥ °¡Àå Áß¿äÇÑ °ÍÀº ´ç½ÅÀÌ ½ÇÇà½ÃŲ ¹öÀüÀÇ ÇÁ·Î±×·¥À» ¾îµð¿¡¼ ¾ò¾ú´Â°¡ ÇÏ´Â Á¡ÀÌ´Ù. (ftp://ftp.domain1.com/subdir/subdir/file.tgzÀÇ Çü½ÄÀ¸·Î º¸³»¶ó) Q20.
virtexec°¡ ½ÇÇàµÉ ¶§ A20.
virtexec´Â óÀ½ 4°³ÀÇ ¹®ÀÚ¸¦ 0¹ø° argument·Î ÃëÇÏ°í ³ª¸ÓÁö À̸§À» °¡»ó ȯ°æ¿¡¼
½ÇÇà½ÃÅ°°Ô µÈ´Ù. ÇÑ ¿¹·Î virtpaswd´Â passwd¸¦ ½ÇÇà½ÃŲ´Ù. µû¶ó¼ ¸¸¾à óÀ½ Á¦°ÅÇÏ´Â
³× ¹®ÀÚ°¡ Q21. virtuald¿Í´Â »ó°üÀÌ ¾øÁö¸¸ QmailÀ̳ª SAMBA, Apache µî¿¡ ´ëÇؼ Áú¹®ÀÌ ÀÖ½À´Ï´Ù. A21. À§¿¡¼ ¸»ÇÑ ¸ðµç ÇÁ·Î±×·¥µéÀº ÈǸ¢ÇÑ ¹®¼µéÀ» ÀÌ¹Ì °¡Áö°í ÀÖ´Ù. ¸î¸î ÇÁ·Î±×·¥ÀÇ °æ¿ì¿¡´Â www.(ÆÐÅ°Áö À̸§).org ¿Í °°ÀÌ Àü¿ë À¥»çÀÌÆ®±îÁö ¸¶·ÃµÇ¾î ÀÖ´Ù. ±×·¸°Ô °¡»ó ¼ºñ½º¿Í °ü°è¾ø´Â Áú¹®µé¿¡ ´ëÇؼ´Â ÀÌµé »çÀÌÆ®¿¡¼ Àû´çÇÑ Áú¹®Ã³¸¦ ã±â ¹Ù¶õ´Ù. Q22. ¸î°³ÀÇ µµ¸ÞÀÎ ¾Ù¸®¾î½º¸¦ domain1.com¿¡ °¡Áö°í Àִµ¥, ¸ÅÀÏÀÌ ÀÚ²Ù µÇµ¹¾Æ¿É´Ï´Ù. ¿Ö ±×·²±î¿ä? A22. Virtmaildelivery´Â Àü´ÞµÇ´Â ȯ°æ º¯¼öµé¿¡ ÀÇÇؼ ¸ÞÀÏÀ» º¸³¾ /virtual/domain1.com µð·ºÅ丮¸¦ ÆÇ´ÜÇÑ´Ù. ÀÌ°ÍÀº ¸ÞÀÏÀÇ ÁÖ¼Ò¸¦ È®ÀÎÇϱâ À§ÇØ ¾î¶² DNS È®ÀÎ ÀýÂ÷µµ °®Áö ¾Ê´Â´Ù. ÇÏÁö¸¸, ¸¸¾à ÁÖ¼Ò°¡ submail.mail.domain1.comÀÌ µÈ´Ù¸é, virtmaildelivery´Â ÁÖ¼Ò¿¡ ´ëÇؼ È®ÀÎÀ» ÇÏ°í, Â÷·Ê´ë·Î mail.domain1.com, domain1.com, comÀ» È®ÀÎÇÏ¸é¼ ÁÖ¼Ò¸¦ °Ë»öÇÏ°Ô µÈ´Ù. ÀÌ·± ¹æ¹ýÀ¸·Î´Â Á¤ÇØÁø ¾Ù¸®¾î½ÌÀÇ ÁÖ¼Ò¸¦ Á¤È®ÇÏ°Ô ¾Ë¾Æ³¾ ¼ö ¾ø´Ù. ÇÏÁö¸¸, ¸¸¾à ¼ºêµµ¸ÞÀÎÀÇ ÇüÅ°¡ ¾Æ´Ñ µµ¸ÞÀÎ ¾Ù¸®¾î½º¸¦ °¡Áö°í ÀÖ´Ù¸é, ´ÙÀ½°ú °°Àº ½Éº¼¸¯ ¸µÅ©¸¦ ÅëÇØ ±¸ÇöÀÌ °¡´ÉÇÏ´Ù:
cd /virtual ln -s domain1.com domain1alias.com virtmaildelivery´Â µÎ µð·ºÅ丮¸¦ ¸ðµÎ Á¸ÀçÇÏ´Â µð·ºÅ丮·Î ÀνÄÇÒ °ÍÀÌ°í (ÇÑÂÊÀº ½Éº¼¸¯ ¸µÅ©ÀÓ¿¡µµ ºÒ±¸ÇÏ°í), ¸ÞÀÏÀº user@domain1.com°ú user@domainalias.com ¸ðµÎ¿¡°Ô º¸³»Áú ¼ö ÀÖ°Ô µÈ´Ù. virtexec´Â µÎ µµ¸ÞÀÎ ¸ðµÎ¸¦ ´ÙÀ̾ó·Î±× ¹Ú½º¿¡ Ç¥½ÃÇÑ´Ù´Â Á¡À» ÁÖÀÇÇ϶ó. µÎ ÆÄÀÏ ½Ã½ºÅÛÀÌ °°Àº °ÍÀ̱ä ÇÏÁö¸¸, ´ç½ÅÀº µÎ µµ¸ÞÀÎ °¡¿îµ¥ Çϳª¸¦ ¼±ÅÃÇÒ ¼ö ÀÖ´Ù. |
Your own qualities will help prevent your advancement in the world. |