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

5. DNS¿Í Sendmail

5.1 MX(Mail eXchange) ¾Ë°í¸®Áò

MX ·¹ÄÚµå´Â ÇØ´ç È£½ºÆ®·Î ¼ö½ÅµÇ´Â ÆíÁö¸¦ ´Ù¸¥ È£½ºÆ®·Î ¶ó¿ìÆà Çϵµ·Ï ÇÑ´Ù. ¿ø°Ý È£½ºÆ®¿¡¼­ ´ÙÀ½°ú °°ÀÌ ¼³Á¤µÈ µµ¸ÞÀÎ, NOBREAK.COMÀ¸·Î ÆíÁö¸¦ ¼Û½ÅÇÒ °æ¿ì¿¡ SendmailÀÇ µ¿ÀÛÀ» ¾Ë¾Æº¸ÀÚ.

nobreak.com.            IN      MX 10   layla.nobreak.com.
                        IN      MX 20   marie.nobreak.com.
                        IN      MX 20   suzi.nobreak.com.

  1. ·ÎÄÃÈ£½ºÆ®°¡ ÇØ´ç µµ¸ÞÀο¡ ´ëÇØ ÀÎÁõÀ» °®´ÂÁö È®ÀÎÇÑ´Ù.
  2. layla·Î ¹è´ÞÀ» ½ÃµµÇÑ´Ù.
  3. marie ȤÀº suzi·Î ¹è´ÞÀ» ½ÃµµÇÑ´Ù.
  4. (3)¿¡¼­ ½ÃµµµÇÁö ¾ÊÀº È£½ºÆ®·Î ¹è´ÞÀ» ½ÃµµÇÑ´Ù.
  5. ÀÚü Å¥À× ÈÄ, ÀÏÁ¤ ±â°£µ¿¾È ÁÖ±âÀûÀ¸·Î 2-4ÀÇ °úÁ¤À» ¹Ýº¹ÇÑ´Ù.

ÈçÈ÷ °®´Â À߸øµÈ MXÀÇ ÀÌÇØ Áß Çϳª´Â, layla°¡ ´Ù¿îµÇ¾î marie·Î ÆíÁö°¡ ¹è´ÞµÇ¾úÀ» ¶§, ÆíÁö°¡ marieÀÇ ¸ÞÀϹڽº¿¡ ÀúÀå µÈ´Ù´Â »ý°¢À¸·Î, ´Ù¼öÀÇ MX ·¹ÄÚµå ¼³Á¤À» ²¨¸®´Â °æ¿ìÀÌ´Ù. ÀÌ·¸°Ô µÇ¸é, »ç¿ëÀÚ °èÁ¤À» ¾çÂÊ È£½ºÆ®¿¡ ¼³Á¤ÇÏ¿© µÎ¾î¾ß Çϸç, »ç¿ëÀÚ´Â ¸Å¹ø ¾çÂÊÀÇ °èÁ¤À» ¸ðµÎ È®ÀÎÇÏ¿©¾ß ÇÑ´Ù´Â ³ëÆÄ½É ¶§¹®ÀÏÅÙµ¥, ÀϹÝÀûÀ¸·Î ³·Àº priority¸¦ °®´Â È£½ºÆ®´Â Å¥À×¼­¹ö·Î µ¿ÀÛÇϵµ·Ï ¼³Á¤Çϱ⠶§¹®¿¡ °á±¹ ÆíÁö´Â ÇϳªÀÇ È£½ºÆ®(layla)·Î Áý°á µÈ´Ù. À§ÀÇ °æ¿ì marie¿Í suziÀÇ SendmailÀÌ ´ÙÀ½ Á¶°ÇÀ» ¸¸Á·Çϵµ·Ï ¼³Á¤µÇ¾î ÀÖÀ¸¸é ¸ÞÀÏ Å¥À×¼­¹ö·Î µ¿ÀÛÇÑ´Ù.

  1. ÇØ´ç µµ¸ÞÀÎ(nobreak.com)¿¡ ´ëÇÑ ÀÎÁõÀ» °®Áö ¾Ê¾Æ¾ß ÇÑ´Ù.
  2. ¼­¹ö´Â ÇØ´ç È£½ºÆ®·ÎÀÇ ¸ÞÀÏ ¸±·¹ÀÌ(Relay)¸¦ Çã¿ëÇÏ¿©¾ß ÇÑ´Ù.

ÀÎÁõÀ» °®Áö ¾Ê¾Æ¾ß ÇÑ´Ù´Â °ÍÀº SendmailÀÇ w Ŭ·¡½º(sendmail.cw ȤÀº sendmail.cfÀÇ Cw)¿¡ nobreak.com µµ¸ÞÀÎÀÌ ¾ø¾î¾ß ÇÔÀ» ÀǹÌÇÏ°í, ¸ÞÀÏ ¸±·¹À̶õ ¼ö½ÅµÇ´Â ÆíÁöÀÇ ÃÖÁ¾ ¹è´ÞÁö°¡ ÀÚ½ÅÀÌ ¾Æ´Ò °æ¿ì, Áï ÀÎÁõÀ» °®Áö ¾ÊÀ» °æ¿ì ÆíÁö¸¦ ÇØ´ç È£½ºÆ®·Î Æ÷¿öµùÇÔÀ» ¶æÇÑ´Ù. ±Ù·¡ÀÇ ¸î¸î OS ¹èÆ÷ÆǵéÀº ±âº»ÀûÀ¸·Î SendmailÀÌ ¸±·¹À̸¦ °ÅºÎÇϵµ·Ï ¼³Á¤µÇ¾î Àִµ¥, ÀÌ·¯ÇÒ °æ¿ì ÇØ´ç È£½ºÆ®´Â Å¥À×¼­¹ö·Î µ¿ÀÛÇÏÁö ¸øÇÔ¿¡ À¯ÀÇÇÏÀÚ. º¸Åë ±â°üÀÇ SMTP ¼­¹ö´Â ŸÀο¡ ÀÇÇÑ ³²¿ëÀ» ¸·±âÀ§ÇØ ³»ºÎ IP(ȤÀº µµ¸ÞÀÎ)¿¡ ´ëÇؼ­¸¸ ¸±·¹À̸¦ Çã¿ëÇϵµ·Ï ¼³Á¤ÇÏÁö¸¸, ¸ÞÀÏ Å¥À× ¼­¹öÀÇ °æ¿ì´Â º» ǻó¸¦ ²ô°Å³ª ÇØ´ç È£½ºÆ®¸¦ ¸ñÀûÁö·Î ÇÏ´Â ÆíÁö¿¡ ´ëÇؼ­´Â ¸±·¹À̸¦ Çã¿ëÇϵµ·Ï(ÀÌ ¸»ÀÇ ÀǹÌÇÏ´Â ¹Ù¸¦ Àß ¸ð¸£°Ú´Ù¸é, ¸ðµç IP¿¡ ´ëÇØ ¸±·¹À̸¦ Çã¿ëÅä·Ï ¼³Á¤Ç϶ó) Á¶Á¤ÇÏ¿©¾ß ÇÑ´Ù. (Âü°í: ``Allowing controlled SMTP relaying in Sendmail 8.9'')

laylaÀÇ ¼ö½Å ºÒ´ÉÀ¸·Î ÀÎÇØ marie·Î Àü´ÞµÇ´Â ÆíÁö´Â ¸ÞÀÏÅ¥¿¡ ÀúÀåµÇ¾î ÀÖÀ¸¸é¼­, ÀÏÁ¤ ±â°£(Sendmail.cf¿¡¼­ ÁöÁ¤µÈ Timeout.queuereturn=5d ¸¸Å­)µ¿¾È ÁÖ±âÀû(Sendmail ±¸µ¿½Ã ÁöÁ¤µÈ, ÀϹÝÀûÀ¸·Î 30ºÐ -q30m)À¸·Î ¹è´ÞÀÌ ½ÃµµµÈ´Ù. µû¶ó¼­ ¹Ýµå½Ã layla¸¸ÀÌ NOBREAK.COM¿¡ ´ëÇÑ ÀÎÁõÀ» °¡Á®¾ß ÇÑ´Ù.

* laylaÀÇ /etc/sendmail.cw (Solaris: /etc/mail/sendmail.cw)
nobreak.com

marie¿Í suzi°¡ ¿ì¼±¼øÀ§°¡ °°´Ù´Â Á¡¿¡¼­ ´ÙÀ½°ú °°Àº ¹«ÇÑ·çÇÁ ½Ã³ª¸®¿À¸¦ »ý°¢ÇØ º¼ ¼ö ÀÖ´Ù. layla°¡ ´Ù¿îµÇ¾úÀ» °æ¿ì ÆíÁö´Â marie(ȤÀº suzi)·Î ¹è´ÞµÉ °ÍÀÌ°í, ÇØ´ç µµ¸ÞÀÎÀÇ Å¥À×¼­¹öÀÎ marie´Â ´Ù½Ã MX ¸®½ºÆ®ÀÇ ¿ì¼±¼øÀ§¿¡ ÀÔ°¢ÇÏ¿© Æ÷À§µùÀ» ½ÃµµÇÒ °ÍÀÌ´Ù. °á±¹ ÆíÁö´Â suzi·Î ¹è´ÞµÉ °ÍÀÌ°í suzi ¶ÇÇÑ ÀÌ °úÁ¤À» ¹Ýº¹ÇÑ´Ù.

Á¤¸» ±×·²±î? ±×·²¼öµµ ÀÖ´Ù. ÇÏÁö¸¸ SendmailÀº ÆíÁö¸¦ Æ÷¿öµù ÇϱâÀü¿¡ ÇØ´ç µµ¸ÞÀÎÀÇ MX ¸®½ºÆ®¸¦ ÆľÇÇÏ°í, ÀÚ½ÅÀÇ ÀÎÁõµÈ µµ¸ÞÀÎ(sendmail.cw¿¡ ±â·ÏµÈ)ÀÌ Æ÷ÇԵǾî ÀÖ´ÂÁö È®ÀÎÇÑ´Ù. ¸¸¾à Æ÷ÇԵǾî ÀÖ´Ù¸é, ¸ÅĪµÇ´Â µµ¸ÞÀÎÁß °¡Àå ³ôÀº(´Ù¼ö°¡ ¸ÅĪ µÉ ¼öµµ Àֱ⠶§¹®¿¡) ¿ì¼±¼øÀ§¸¦ °®´Â µµ¸ÞÀÎÀ» Æ÷ÇÔÇÏ¿© °°°Å³ª ÀûÀº(MX °ªÀÌ Å«) ·¹Äڵ带 MX ¸®½ºÆ®¿¡¼­ Á¦¿ÜÇÑ´Ù.

nobreak.com.            IN      MX 10   layla.nobreak.com.
                        IN      MX 20   marie.nobreak.com. (Á¦¿Ü)
                        IN      MX 20   suzi.nobreak.com.  (Á¦¿Ü)

°á±¹ marieÀÇ SendmailÀÌ À¯ÁöÇÏ´Â MX ¸®½ºÆ®¿¡´Â layla¸¸ÀÌ ³²°ÔµÇ°í, ±â´ëÇÑ ¹Ù´ë·Î ÆíÁö´Â layla°¡ Á¤»ó¿î¿µµÉ¶§ ±îÁö Å¥À׵ȴÙ.

nobreak.com.            IN      MX 10   layla.nobreak.com.

±×·¯³ª ¸¸¾à SendmailÀÌ ÀÚ½ÅÀ» MX ¸®½ºÆ®¿¡¼­ ãÁö ¸øÇϸé(sendmail.cw¿¡ 'marie.nobreak.com'ÀÌ µî·ÏµÇ¾î ÀÖÁö ¾ÊÀ¸¸é), suzi·ÎÀÇ ºÒÇÊ¿äÇÑ Æ÷¿öµùÀÌ ¹ß»ýÇÒ °ÍÀÌ°í, ºÒÇàÈ÷ suzi ¶ÇÇÑ °°Àº »óȲÀ̶ó¸é, °á±¹ ¹«ÇÑ·çÇÁ¿¡ ºüÁú¼ö ÀÖ´Ù. SendmailÀº ÀÌ·¯ÇÑ ÃÖ¾ÇÀÇ »óȲÀ» ¸·±âÀ§ÇØ, ÃÖ´ë Æ÷¿öµù Ƚ¼ö Á¦ÇÑ(Sendmail.cfÀÇ MaxHopCount=17, ±âº»°ª 25)À» °®°í ÀÖÀ¸¹Ç·Î, °á±¹ marie³ª suziÁß MaxHopCount¿¡ ¸ÕÀú °É¸®´Â ½Ã½ºÅÛÀÇ °ü¸®ÀÚ(postmaster)¿Í ¼Û½ÅÀÚ¿¡°Ô ´ÙÀ½°ú °°Àº ³»¿ëÀÇ ¿À·ù ÆíÁö¸¦ º¸³»¾îÁÙ °ÍÀÌ´Ù.

From: Mail Delivery Subsystem
To: postmaster@marie.nobreak.com
Subject: Returned mail: Too many hops 26 (25 max):...

----- The following addresses had permanent fatal errors -----

 ----- Transcript of session follows -----
554 Too many hops 26 (25 max):...
===========================================================
Received: from suzi.nobreak.com by marie.nobreak.com ...
Received: from marie.nobreak.com by suzi.nobreak.com ...
...
Received: from suzi.nobreak.com by marie.nobreak.com ...
Received: from marie.nobreak.com by suzi.nobreak.com ...
...

´ÙÀ½Àº ´ÜÀÏ Å¥À× ½Ã½ºÅÛ¿¡¼­ À§¿Í°°Àº ·çÇÁ°¡ ¹ß»ýÇÏ¿´À» °æ¿ìÀÇ ¸ÞÀÏ ¸Þ½ÃÁöÀÌ´Ù.

nobreak.com.            IN      MX 10   layla.nobreak.com.
                        IN      MX 20   marie.nobreak.com.

From: Mail Delivery Subsystem
To: postmaster@marie.nobreak.com
Subject: Returned mail: Local configuration error

----- The following addresses had permanent fatal errors -----

 ----- Transcript of session follows -----
553 marie.nobreak.com. config error: mail loops back to me (MX problem?)
554 ... Local configuration error
===========================================================
...

DNS¿¡ µî·ÏµÇ¾î Æ÷ÀÎÆõǴ ȣ½ºÆ®¸íÀ» sendmail.cw¿¡ ³ª¿­ÇÏÁö ¾Ê¾ÒÀ» °æ¿ì ¹ß»ýÇÒ ¹®Á¦¿¡ ´ëÇØ È®½ÅÇÒ ¼ö ¾ø´Ù¸é, aliasµÈ ¸ðµç È£½ºÆ®¸íÀ» sendmail.cw ÆÄÀÏ¿¡ Æ÷ÇÔÇϱ⠹ٶõ´Ù.

5.2 MX ·¹Äڵ带 °®Áö ¾Ê´Â È£½ºÆ®

È£½ºÆ®°¡ ÆíÁö¸¦ ¼ö½ÅÇÑ´Ù¸é MX ·¹Äڵ带 °®´Â °ÍÀÌ ÁÁ´Ù.

mailhub         IN      A       210.105.79.107

È£½ºÆ® mailhub´Â ¼ö½ÅµÇ´Â ÆíÁö¸¦ ´Ù¸¥ È£½ºÆ®·Î ¶ó¿ìÆÃÇÒ ÇÊ¿ä°¡ ¾ø±â ¶§¹®¿¡, °ü¸®ÀÚ´Â MX ·¹Äڵ带 ¼³Á¤ÇÏÁö ¾Ê¾Ò´Ù. ¹°·Ð ÀÌ°ÍÀÌ ¿À·ù´Â ¾Æ´ÏÁö¸¸ ÀÌ·¯ÇÑ °æ¿ì ÀÎÅͳݻóÀÇ ÇÑ MTA°¡ mailhub·Î ÆíÁö¸¦ ¼Û½ÅÇÒ¶§ ºÒÇÊ¿äÇÑ Æ®·¡ÇÈ ³¶ºñ°¡ ¹ß»ýÇÒ ¼ö ÀÖ´Ù.

SendmailÀÇ °æ¿ì¸¦ »ìÆ캸ÀÚ. ¸ÕÀú SendmailÀº ·ÎÄà ³×ÀÓ¼­¹ö¸¦ ÅëÇØ mailhub¸¦ lookup(type=any) ÇÑ´Ù. Authoritative ȤÀº Non-authoritative Answer·Î A ·¹Äڵ常À» µ¹·Á¹Þ°Ô µÉÅÙµ¥, Authoritative AnswerÀÇ °æ¿ì MX ·¹Äڵ尡 ¾øÀ»Áö¶óµµ °á°ú¸¦ ½Å·ÚÇÏ¿© Ãß°¡ ÁúÀÇ ¾øÀÌ ÇØ´ç IP·Î Á¢¼ÓÀ» ½ÃµµÇÑ´Ù. ÇÏÁö¸¸ MX ·¹Äڵ尡 ¾ø´Â Non-authoritative Answer¿¡ ´ëÇØ SendmailÀº ¸í½ÃÀûÀ¸·Î MX ·¹Äڵ带 Àç °Ë»öÇÑ´Ù. ¹°·Ð mailhub´Â MX ·¹Äڵ带 °®Áö ¾Ê±â ¶§¹®¿¡ º¹±Í°ªÀº ¾ø°í ºÒÇÊ¿äÇÑ ÁúÀǸ¸À» ¼öÇàÇÏ¿´À» »ÓÀÌ´Ù. ÆíÁö¸¦ ¹è´ÞÇÑ´Ù´Â Á¡¿¡´Â µÎ °æ¿ì ¸ðµÎ ÀüÇô ¹®Á¦ ¾øÁö¸¸, ÈÄÀÚÀÇ °æ¿ì¿Í °°Àº ³¶ºñ¸¦ ¸·±â À§Çؼ­ mailhub´Â ´ÙÀ½°ú °°ÀÌ ¼³Á¤µÇ´Â °ÍÀÌ ¹Ù¶÷Á÷ÇÏ´Ù.

mailhub         IN      A       210.105.79.107
                IN      MX 10   mailhub.nobreak.com.

mailhub ÀÚ½ÅÀÌ ÃÖÁ¾ ÆíÁö ¹è´ÞÁöÀ̱⠶§¹®¿¡, ÀÚ½ÅÀ» MX·Î ¼³Á¤Çß´Ù. ÀÌ·¸µí, ÆíÁö¸¦ ¼ö½ÅÇÏ´Â ¸ðµç È£½ºÆ®´Â ºñ·Ï ÀÚ±â ÀÚ½ÅÀÏÁö¶óµµ ÇÑ°³ ÀÌ»óÀÇ MX ·¹Äڵ带 °®´Â °ÍÀÌ ÁÁ´Ù.

5.3 MX¿Í CNAMEÀÇ ¿¬µ¿ (Âü°í RFC974 p5)

MX ·¹Äڵ带 CNAME°ú ¿¬°áÇÏ´Â °ÍÀº ¸Å¿ì ¾È ÁÁÀº »ý°¢ÀÌ´Ù. »ç½Ç °ü·Ã RFC ¹®¼­ ¾îµð¿¡µµ ¾ÆÁ÷ MX ·¹ÄÚµå¿Í CNAMEÀÇ ¿¬µ¿¿¡ ´ëÇØ ÁÖÀÇ ¼öÁØÀ» ³Ñ¾î ¸íÈ®È÷ Á¦ÇÑÀ» µÐ ±ÛÀÌ ¾ø±â ¶§¹®¿¡ ÀÌ·¯ÇÑ »ç¿ëÀÌ ¹Ýµå½Ã ¾È µÈ´Ù°í ¸»ÇÒ ¼ö´Â ¾øÁö¸¸, ´ÙÀ½°ú °°ÀÌ ºÒÇÊ¿äÇÑ Ãß°¡ Äõ¸®·Î ÀÎÇØ ¹ß»ýµÇ´Â Æ®·¡ÇÈÀ» »çÀ¯·Î ¿À·£ ±â°£ À߸øµÈ »ç¿ëÀ¸·Î ÀÎ½ÄµÇ¾î ¿Ô°í, ´ëºÎºÐÀÇ °ü·Ã¹®¼­¿¡¼­´Â °°Àº ¿¬À¯·Î °­·ÂÈ÷ »ç¿ëÄ¡ ¸»±â¸¦ ±ÇÇÑ´Ù.

layla           IN      MX 10   marie.nobreak.com.
marie           IN      CNAME   suzi.nobreak.com.
suzi            IN      CNAME   mailhub.nobreak.com.
mailhub         IN      A       210.105.79.75
                IN      MX 10   mailhub.nobreak.com.

* layla·Î ÆíÁö¸¦ ¹è´ÞÇϱâ À§ÇÑ lookup °úÁ¤
1. lookup layla.nobreak.com   -> return marie.nobreak.com
2. lookup marie.nobreak.com   -> return suzi.nobreak.com
3. lookup suzi.nobreak.com    -> return mailhub.nobreak.com
4. lookup mailhub.nobreak.com -> return 210.105.79.75

´À½¼ÇÑ Ç¥ÁØÀ¸·Î ÀÎÇØ °¢°¢ÀÇ ÀÀ¿ë¸¶´Ù Á¶±Ý¾¿ ±¸ÇöÀÌ ´Ù¸¥µ¥, ´ëÇ¥ÀûÀ¸·Î BINDÀÇ °æ¿ì´Â À̸¦ À߸øµÈ »ç¿ë(``layla.nobreak.com'' IN MX points to a CNAME marie.nobreak.com)À̶ó Syslog¸¦ ÅëÇØ ¾Ë·ÁÁֽø¸, ¸î¸î MTA¿Í Sendmail´Â À̸¦ ¼ö¿ë(±ÇÀåÇÏÁö´Â ¾ÊÁö¸¸)ÇÏ°í ÀÖ´Ù. ÇÏÁö¸¸, ¸î¸î MTA°¡ ÇØ´ç ½Ã½ºÅÛÀ¸·Î ÆíÁö¸¦ ¹è´ÞÇÏÁö ¸øÇÏ´Â ÀáÀçÀû ¹®Á¦¸¦ ¾È°íÀֱ⠶§¹®¿¡, MX¿Í CNAMEÀÇ ¿¬µ¿Àº ¿©ÀüÈ÷ ÁÁÁö ¾Ê°í, ´ÙÀ½°ú °°ÀÌ °íÃÄÁ®¾ß ÇÑ´Ù.

layla           IN      MX 10   mailhub.nobreak.com.
marie           IN      CNAME   mailhub.nobreak.com.
suzi            IN      CNAME   mailhub.nobreak.com.
mailhub         IN      A       210.105.79.75
                IN      MX 10   mailhub.nobreak.com.

¶ÇÇÑ, ÆíÁö ¼Û½ÅÀü SendmailÀº ¼ö½ÅÀÎÀÇ ÁÖ¼Ò¿¡ Æ÷ÇÔµÈ CNAMEÀ» ½ÇÁ¦ È£½ºÆ®¸íÀ¸·Î ¼öÁ¤ÇÑÈÄ ¹è´ÞÇÔ¿¡ À¯ÀÇÇÏÀÚ. Áï 'user@marie.nobreak.com'·Î º¸³»¾îÁö´Â ÆíÁö´Â, 'user@mailhub.nobreak.com'À¸·Î ¹ø¿ªµÈ ÈÄ ¼Û½ÅµÇ¸ç, ÀÌ´Â ¼ö½ÅÀÎÀÇ ÆíÁö Çì´õ¿¡ Ç¥½ÃµÇ´Â To: Á¤º¸°¡ 'user@marie.nobreak.com'ÀÌ ¾Æ´Ñ 'user@mailhub.nobreak.com'ÀÓÀ» ¶æÇÑ´Ù. Áß¿äÇÑ °ÍÀº ÀÌ·¯ÇÑ º¯È¯ÀÛ¾÷ÀÌ ¼Û½ÅÀü¿¡ ÀÌ·ç¾îÁø´Ù´Â Á¡À̸ç, À̴ ȥ¶õÀ» ¾ß±âÇÒ ¼ö ÀÖ°í, ÃßÈÄ ¼³¸íÇÒ SendmailÀÇ Virtual Domain ¼³Á¤¿¡¼­ ±â´ëÇÏÁö ¾ÊÀº ¸ÅÇÎ ¹®Á¦¸¦ ¹ß»ý½Ãų ¼öµµ ÀÖ´Ù. µû¶ó¼­ CNAMEÀ¸·Î ÁöÁ¤µÈ È£½ºÆ®´Â ¸ÞÀÏÁÖ¼Ò·Î »ç¿ëÇÏÁö ¸»°Å³ª, CNAME ´ë½Å A ·¹ÄÚµå¿Í MX ·¹Äڵ带 »ç¿ëÇÏ´Â °ÍÀÌ ÁÁ´Ù.

5.4 Nonrecursive MX lookup

´ÙÀ½°ú °°Àº °æ¿ì, mailhub·Î ¹è´ÞµÇ´Â ÆíÁö¸¦ °í·ÁÇغ¸ÀÚ. ÀϹÝÀûÀ¸·Î ÆíÁö°¡ mx2·Î ¹è´ÞµÇ¸®¶ó ±â´ëÇÒ ¼ö ÀÖÁö¸¸, SendmailÀº MX ·¹Äڵ忡´ëÇØ Nonrecursive Çϱ⠶§¹®¿¡, ½ÇÁ¦ ÆíÁö´Â mx1(¹Ýµå½Ã A ·¹Äڵ带 °®¾î¾ß ÇÑ´Ù)À¸·Î ¹è´ÞµÈ´Ù.

mailhub         IN      MX 10   mx1.nobreak.com.
mx1             IN      MX 10   mx2.nobreak.com.
                IN      A       210.105.79.231

¸¸¾à SendmailÀÌ MX ·¹Äڵ带 CNAME°°ÀÌ RecursiveÇÏ°Ô ÂѾư£´Ù¸é, ´ÙÀ½°ú °°Àº ÀáÀçÀûÀÎ ·çÇÁ¸¦ Çã¿ëÇÏ°Ô µÇ¹Ç·Î, SendmailÀº MX ·¹Äڵ带 ÂѾư¡Áö ¾Ê´Â´Ù.

mailhub         IN      MX 10   mx1.nobreak.com.
mx1             IN      MX 10   mx2.nobreak.com.
mx2             IN      MX 10   mailhub.nobreak.com.   ; Loop

5.5 SendmailÀÇ Virtual Domain ¼³Á¤

ÇϳªÀÇ È£½ºÆ®¿¡ ¿¬°áµÈ µµ¸ÞÀÎ 'nobreak.com'°ú 'kr.freebsd.org'¿¡ ´ëÇØ, ÀϹÝÀûÀ¸·Î 'nobreak@nobreak.com'°ú 'nobreak@kr.freebsd.org'ÀÇ ¼ö½ÅÀÚ´Â °°´Ù. ¿©±â¿¡¼­´Â °¢°¢ÀÇ µµ¸ÞÀκ°·Î aliases Å×À̺íÀ» °®´Â °Í°ú °°ÀÌ, µµ¸ÞÀο¡ µû¶ó ¼ö½ÅµÇ´Â ÆíÁö¸¦ ´Ù¸£°Ô ó¸®ÇÏ´Â ¹æ¹ý¿¡ ´ëÇØ ¾Ë¾Æº»´Ù. º» ±ÛÀÌ SendmailÀ» ÁÖÁ¦·Î ÇÏÁö´Â ¾Ê±â¿¡, SendmailÀ» ¾î´À Á¤µµ ¾Ë°í ÀÖ´Ù´Â °¡Á¤À¸·Î °ñÀÚ³»¿ë¸¸À» ´Ù·çµµ·Ï ÇÏ°Ú´Ù. Sendmail¿¡ Àͼ÷Ä¡ ¾Ê´Ù¸é ³»¿ëÀ» ÀÌÇØÇϱâ À§ÇØ RuleSet, m4, aliases, dbm/btree/hash µî¿¡ ´ëÇÑ »çÀüÇнÀÀÌ ÇÊ¿äÇÒ ¼öµµ ÀÖ´Ù.

¼³¸íÇÏ°íÀÚ ÇÏ´Â ¹æ¹ýÀº Sendmail 8.8 À̻󿡼­ °¡´ÉÇϹǷÎ,¸ÕÀú ´ÙÀ½°ú °°ÀÌ ¼³Ä¡µÈ ¹öÁ¯À» È®ÀÎÇÑ´Ù.

$ telnet localhost smtp
Trying 127.0.0.1...
220 kfug2.kr.freebsd.org ESMTP Sendmail 8.9.3/8.9.3

¹öÁ¯ÀÌ 8.8º¸´Ù ³·´Ù¸é, ftp://ftp.sendmail.org/pub/sendmail/¿¡¼­ ÃֽŹöÁ¯À» ±¸Çϱ⠹ٶõ´Ù. Sendmail 8.2 À̻󿡼­´Â 'domaintable' ǻó¸¦ »ç¿ëÇØ ±¸ÇöµÉ ¼ö ÀÖÁö¸¸, ¿©±â¿¡¼­´Â ´Ù·çÁö ¾Ê°Ú´Ù.

m4¸¦ »ç¿ëÇÑ sendmail.cf »ý¼º

¸ÕÀú 'sendmail-VERSION/cf/cf/'¿¡¼­ ½Ã½ºÅÛ¿¡ ÀûÀýÇÑ mc ÆÄÀÏÀ» º¹»çÇÑ ÈÄ, Virtual Domain ¼³Á¤¿¡ ÇÊ¿äÇÑ 'virtusertable', 'genericstable' ǻó¸¦ Ãß°¡ÇÑ´Ù. ÀÛ¼ºµÈ mc ÆÄÀÏÀº ÀϹÝÀûÀ¸·Î ´ÙÀ½°ú °°ÀÌ º¸ÀδÙ.

* generic-bsd4.4.mc ÆÄÀÏÀ» »ç¿ëÇØ ÀÛ¼ºÇÑ freebsd.mc ÆÄÀÏ
divert(0)dnl
VERSIONID(`@(#)generic-bsd4.4.mc        8.7 (Berkeley) 5/19/1998')
OSTYPE(bsd4.4)dnl
DOMAIN(generic)dnl
MAILER(local)dnl
MAILER(smtp)dnl
FEATURE(virtusertable, btree /etc/domainaliases.db)dnl
FEATURE(genericstable, btree /etc/useraliases.db)dnl

'virtusertable' ǻó´Â ¼ö½Å(in-bound)µÇ´Â ÆíÁö¸¦ ·ÎÄà »ç¿ëÀÚ·Î ¸ÅÇÎÇÏ´Â RuleSetÀ» »ý¼ºÇÏ°í, 'genericstable' ǻó´Â ¹Ý´ë·Î ¼Û½Å(out-bound)µÇ´Â ÆíÁö¿¡ ´ëÇØ ·ÎÄà À¯Àú¿¡ ´ëÇÑ ¸ÞÀÏÁÖ¼Ò(¸ÞÀÏ Çì´õ»óÀÇ From: Çʵå)¸¦ ¸ÅÇÎÇÏ´Â RuleSetÀ» »ý¼ºÇÑ´Ù. DNSÀÇ Forward Zone°ú Reverse ZoneÀ» »ý°¢ÇÏ¸é µÇ°Ú´Ù.

'btree'´Â ÇØ´ç Å×À̺í(domainaliases.db)ÀÌ B-Tree(Berkeley DB) µ¥ÀÌÅͺ£À̽º ÇüÅ·ΠÀúÀåµÊÀ» ÀǹÌÇÑ´Ù. °¡´ÉÇÑ ´Ù¸¥ À¯ÇüÀ¸·Î´Â hash(Berkeley DB)¿Í dbm(NDBM)ÀÌ Àִµ¥, Å×À̺íÀÌ ¹æ´ëÇÒ °æ¿ì È¿À²Àº btree(Berkeley DB) > hash(Berkeley DB) > dbm(NDBM) ¼øÀÌ´Ù. ¼Óµµ°¡ ºü¸¥ btree¿Í hash¸¦ »ç¿ëÇϱâ À§Çؼ­´Â Berkeley DB(FreeBSD¸¦ ºñ·ÔÇØ ¸î¸î Unix¿¡´Â ±âº»À¸·Î Æ÷ÇԵȴÙ)°¡ ¼³Ä¡µÇ¾î ÀÖ¾î¾ß Çϸç, sendmail°ú makemap ÄÄÆÄÀϽà -DNEWDB Ç÷¡±×(Berkeley DB°¡ ¼³Ä¡µÇ¾î ÀÖ´Ù¸é ÀÚµ¿À¸·Î -DNEWDB Ç÷¡±×°¡ »ç¿ëµÈ´Ù)¸¦ »ç¿ëÇØ¾ß ÇÑ´Ù. Berkeley DB°¡ ¼³Ä¡µÇ¾î ÀÖÁö ¾ÊÀ» °æ¿ì¿£ -DNDBM Ç÷¡±×(NDBM ¶óÀ̺귯¸®´Â ´ëºÎºÐÀÇ Unix¿¡ ±âº»À¸·Î Æ÷ÇԵȴÙ)·Î ÄÄÆÄÀÏ µÇ´Âµ¥ À̶§¿¡´Â dbmÀ» »ç¿ëÇÏ¿©¾ß ÇÑ´Ù. ¸®´ª½º¿Í °°ÀÌ Berkeley DBÀÇ GNUÆÇÀÎ GDBMÀÌ »ç¿ëµÇ´Â °æ¿ì¿£ º°µµÀÇ ³ë·Â¾øÀÌ ¼¼ Á¾·ùÀÇ DB¸¦ ¸ðµÎ ÀÌ¿ëÇÒ ¼ö ÀÖ´Ù.

ÀÛ¼ºµÈ freebsd.mc ÆÄÀÏÀº ´ÙÀ½°ú °°ÀÌ m4(Macro Language Processor)¸¦ ÅëÇØ sendmail.cf·Î º¯È¯ÇÑ´Ù.

# cd sendmail-VERSION/cf/cf
# m4 ../m4/cf.m4 freebsd.mc > freebsd.cf
# cp freebsd.cf /etc/sendmail.cf

¸¸¾à ±âÁ¸ÀÇ sendmail.cf°¡ À¯ÁöµÇ¾î¾ß ÇÏ´Â »óȲÀ̶ó¸é, ½ÇÁ¦ º» µÎ ǻó°¡ »ý¼ºÇÏ´Â ´ÙÀ½ÀÇ RuleSetÀ» Âü°íÇÏ¿© sendmail.cf¸¦ Á÷Á¢ ¼öÁ¤ÇÏ¿©µµ ÁÁ´Ù. (RuleSetÀÌ »ðÀԵǴ À§Ä¡¸¦ ÆľÇÇϱâ À§ÇØ m4·Î sendmail.cf¸¦ »ý¼ºÇÏ¿© ºñ±³Çϱ⠹ٶõ´Ù)

* FEATURE(virtusertable, btree /etc/domainaliases.db)dnl
# Virtual user table (maps incoming users)
Kvirtuser btree /etc/domainaliases.db

# handle virtual users (RuleSet 0ÀÇ Parse1 ¾Æ·¡¿¡ À§Ä¡)
R$+ < @ $=w . >         $: < $(virtuser $1 @ $2 $@ $1 $: @ $) > $1 < @ $2 . >
R<@> $+ + $* < @ $* . >
                        $: < $(virtuser $1 + * @ $3 $@ $1 $: @ $) > $1 + $2 < @ $3 . >
R<@> $+ + $* < @ $* . >
                        $: < $(virtuser $1 @ $3 $@ $1 $: @ $) > $1 + $2 < @ $3 . >
R<@> $+ < @ $+ . >      $: < $(virtuser @ $2 $@ $1 $: @ $) > $1 < @ $2 . >
R<@> $+                 $: $1
R< error : $- $+ > $*   $#error $@ $(dequote $1 $) $: $2
R< $+ > $+ < @ $+ >     $: $>97 $1

* FEATURE(genericstable, btree /etc/useraliases.db)dnl
# Generics table (mapping outgoing addresses)
Kgenerics btree /etc/useraliases.db

# handle generics database (RuleSet 93 ¾Æ·¡¿¡ À§Ä¡)
R$+ < @ $=G . > $: < $1@$2 > $1 < @ $2 . > @    mark
R$+ < @ *LOCAL* >       $: < $1@$j > $1 < @ *LOCAL* > @ mark
R< $+ > $+ < $* > @     $: < $(generics $1 $: $) > $2 < $3 >
R< > $+ < @ $+ >        $: < $(generics $1 $: $) > $1 < @ $2 >
R< $* @ $* > $* < $* >  $@ $>3 $1 @ $2                  found qualified
R< $+ > $* < $* >       $: $>3 $1 @ *LOCAL*             found unqualified
R< > $*                 $: $1                           not found

Forward-map Å×À̺í ÀÛ¼º

¸ÕÀú, ÇØ´ç È£½ºÆ®°¡ ¼ö½ÅÇÏ´Â µµ¸ÞÀÎÀ» Ŭ·¡½º w(sendmail.cw)¿¡ ³ª¿­ÇÏ¿©¾ß ÇÑ´Ù.

* /etc/sendmail.cw ÆÄÀÏ
nobreak.com
kr.freebsd.org

'domainaliases' ÆÄÀÏÀ» ÆíÁý±â·Î ¿­¾î ´ÙÀ½°ú °°ÀÌ Virtual User TableÀ» ÀÛ¼ºÇÑ´Ù.

* /etc/domainaliases ÆÄÀÏ
webmaster@nobreak.com           dipper
moonhunt@nobreak.com            moonhunt@ieee.org
cjh@nobreak.com                 error:nouser Unknown User
@nobreak.com                    nobreak
@kr.freebsd.org                 %1@xfree86.org

¸ÞÀÏÁÖ¼Ò 'webmaster@nobreak.com'´Â ·ÎÄà »ç¿ëÀÚ dipper·Î ¸ÅÇεǰí, 'moonhunt@nobreak.com'·Î ¹è´ÞµÇ´Â ÆíÁö´Â 'moonhunt@ieee.org'·Î Æ÷¿öµù µÈ´Ù. 'cjh@nobreak.com'À¸·Î ¹è´ÞµÇ´Â ÆíÁö¿¡ ´ëÇؼ­´Â ¿¡·¯¸Þ½ÃÁö 'Unknown User'·Î ´äÇϸç, ±×¿Ü 'nobreak.com'À¸·Î ¼ö½ÅµÇ´Â ¸ðµç ÆíÁö´Â ·ÎÄà »ç¿ëÀÚ nobreak·Î Àü´ÞµÈ´Ù. ¶ÇÇÑ, 'kr.freebsd.org'·Î ¼ö½ÅµÇ´Â ¸ðµç ÆíÁö´Â 'xfree86.org'ÀÇ °°Àº »ç¿ëÀÚ¿¡°Ô Æ÷¿öµùµÈ´Ù. ´ÙÀ½°ú °°ÀÌ aliases ÆÄÀÏ°ú ¿¬µ¿ÇÏ¿© ´Ù¼öÀÇ »ç¿ëÀÚ¸¦ ¸ÅÇÎÇÏ´Â°Í ¶ÇÇÑ °¡´ÉÇÏ´Ù.

* /etc/domainaliases ÆÄÀÏ
announce@kr.freebsd.org         announce.ml
admin@kr.freebsd.org            admin.ml

* /etc/aliases ÆÄÀÏ
announce.ml:            :include:/var/ml/announce.ml
admin.ml:               nobreak, moonhunt@ieee.org

Reverse-map Å×À̺í ÀÛ¼º

È£½ºÆ®¸íÀÌ 'kfug2.kr.freebsd.org'À϶§, ½Ã½ºÅÛ¿¡¼­ out-boundµÇ´Â ÆíÁö´Â ±âº»ÀûÀ¸·Î 'user@kfug2.kr.freebsd.org'¸¦ FromÀ¸·Î °®´Â´Ù. ´ÙÀ½ÀÇ Reverse-map Å×À̺íÀº ·ÎÄà »ç¿ëÀÚÀÇ ¸ÞÀÏÁÖ¼Ò¸¦ º¯°æÇÑ´Ù.

* /etc/useraliases ÆÄÀÏ
nobreak                 nobreak@nobreak.com
cjh                     cjh@kr.freebsd.org

Å×ÀÌºí º¯È¯ ¹× ½ÇÇè

ÀÛ¼ºµÈ Å×À̺íÀº makemapÀ» »ç¿ëÇØ dbm/btree/hash ÇüÅ·Πº¯È¯µÇ¾î¾ß ÇÑ´Ù. ¿©±â¼­´Â btree¸¦ »ç¿ëÇÏ¿´À¸¹Ç·Î ´ÙÀ½°ú °°ÀÌÇÑ´Ù.

# makemap btree /etc/domainaliases.db < /etc/domainaliases
# makemap btree /etc/useraliases.db < /etc/useraliases
# ls /etc/domainaliases* /etc/useraliases*
/etc/domainaliases      /etc/useraliases
/etc/domainaliases.db   /etc/useraliases.db

ÀÌÁ¦ SendmailÀ» Çà¾÷ÇÏ°í µ¿ÀÛÀ» È®ÀÎÇÏÀÚ.

# kill -HUP `cat /var/run/sendmail.pid`

# sendmail -bv webmaster@nobreak.com
webmaster@nobreak.com... deliverable: mailer local, user dipper

# sendmail -bv cjh@nobreak.com
cjh@nobreak.com... Unknown User

# sendmail -bv anybody@kr.freebsd.org
anybody@kr.freebsd.org... deliverable: mailer esmtp,
host xfree86.org., user anybody@xfree86.org


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