Subject : sendmail.cf file Description : 1. sendmail.cf file ¼Ò°³ * sendmail ÀÇ ¼öÇàÀº ÁÖ·Î ±¸µ¿½Ã¿¡ configuration file ¿¡ ÀÇÇØ ÅëÁ¦µÈ´Ù. ÀÌ ÈÀÏÀÌ ÇÏ´ÂÀÏÀº 1) ¸ÅÅ©·Î Á¤ÀÇ Çؼ® 2)Ŭ·¡½º Á¤ÀÇ Çؼ® 3) optios Çؼ® 4) precedence Á¤ÀÇ Çؼ®, 5) trusted users. 6) header ¼±¾ðÇؼ® 7) rewriting rules. 8) mailer Çؼ®. * ÇÑ line ÀÇ ¿ÀÁ÷ ù¹ø° character °¡ command type À» °áÁ¤ÇÑ´Ù. (Macro, Class, Rewriting Rules, Mailer, etc.) EX:DnMailer-Daemon D Àº macro define À» ³ªÅ¸³»¸ç n Àº ±× macro ÀÇ À̸§ÀÌ´Ù. macro ´Â º¯¼ö¸¦ Á¤ÀÇÇÒ¶§¿¡ »ç¿ëµÈ´Ù. Dmsvc.hei.co.kr ¿¡¼ mail domain name À» Á¤ÀÇÇÏ°í ÀÖ´Ù. * Class ´Â class type ÀÇ variable ¿¡°Ô ¿©·¯°ªÀ» ÁÙ¶§ »ç¿ëÇÔ. ¿¹¸¦µé¸é, Cm Àº incoming mail À» À§ÇØ, Dm Àº outgoing mail À» À§ÇØ »ç¿ëµÇ¸ç ÀÌ°ÍÀº º¸³»´Â ÁÖ¼Ò¿¡ domain name ÀÌ ºÙ¿©Á®¼ ³ª°£´Ù. * Rewriting Rules Àº ÇϳªÀÇ mail address ·Î¼ ¼öÇàµÇ´Â ¸í·É. Áï, sendmail Àº address ÀÇ parsing °ú ÇÊ¿äÇϸé ÀÌ address ¸¦ ´Ù½Ã¾µ¼öÀÖµµ·Ï rewriting rule À» »ç¿ëÇÑ´Ù. ÀÌ°ÍÀº sendmail.cf file ÀÇ °¡Àå Áß¿äÇѺκÐÀÌ¸ç ¼öÁ¤Çϱ⿡ °¡Àå¾î·Á¿î ºÎºÐÀÌ´Ù. functions À¸·Î½á º¸¿©Áú¼öÀÖ´Â ¸î°³ÀÇ rewriting rules °¡ ÀÖ´Ù. sendmail Àº rewriting rules À» ÀûÀýÇÑ mailer ¸¦ ¼±ÅÃÇϱâÀ§ÇØ »ç¿ëÇÑ´Ù. ÀÌ°ÍÀº ¶ÇÇÑ sender ¿Í receiver address ¸¦ ´Ù½Ã¾²±âÀ§Çؼµµ »ç¿ëµÈ´Ù. (¿¹¸¦µé¸é, user name º¯°æ, internal machine name ¼û±è, domain name Á¤º¸ Ãß°¡) * Mailer ´Â ¼·Î´Ù¸¥ rule set À» ÅëÇÑ address ÀÇ ºÐ¼®ÈÄ¿¡ È£ÃâµÇ¸ç rule set À» ÅëÇÑ ¸î°³ÀÇ Ãß°¡ÀûÀÎ ÀÏÀÌ ¼öÇàµÈ´Ù. ¸¸¾à¿¡ address °¡ local À̸é local À̶ó´Â ÇϳªÀÇ mailer °¡ È£ÃâµÈ´Ù. ¸¸¾à¿¡ address °¡ uucp style À̸é, uucp mailer °¡ È£ÃâµÈ´Ù. Ưº°ÇÑ mailer ÀÎ error ´Â ÇØ´ç address °¡ ÀÌÇصÇÁö¾ÊÀ»¶§¿¡ È£ÃâµÈ´Ù. Mailer ´Â sendmail.cf file ÀÇ M column ÀÇ Ã¹¹ø° character ·Î¼ ºÐº°µÈ´Ù. Ex: Mlocal, P=/bin/mail, F=flsSDFMmnP, S=10,R=20,A=mail -d $u ¼³¸í: local - mailer ÀÇ À̸§ /bin/mail - program ÀÇ À§Ä¡ mail -d $u : -d $u argument ·Î mail command ¼öÇà. F= : set µÉ flag Á¤ÀÇ. ºÎ·ÏÂüÁ¶. S= º¸³»´Â ÁÖ¼Ò¿¡ Àû¿ëµÉ rule sets R= º¸³»´Â ÁÖ¼Ò¿¡ Àû¿ëµÉ rule sets 2. Macros ¸ÅÅ©·Î´Â º¯¼ö¸¦ Á¤ÀÇÇÒ¶§ »ç¿ëµÈ´Ù. sendmail Àº pre-defined variables °ú user-defined variables À» »ç¿ëÇÑ´Ù. ¸¸¾à ´ç½ÅÀÌ º¯¼ö¸¦ Á¤ÀÇÇÑ´Ù¸é ¼Ò¹®ÀÚ¸¦ ¾²Áö¸¶¶ó, ¿Ö³ÄÇϸé internal º¯¼ö·Î »ç¿ëÇϱ⠶§¹®ÀÌ´Ù. sendmail Àº ¶ÇÇÑ ´ë¹®ÀÚ·Î M,R,L,G,V ¸¦ ³»ºÎÀûÀ¸·Î »ç¿ëÇÑ´Ù. Ex: Built-in Macros used by sendmail internally. a : The origination date in ARPANET format b : The current date in ARPANET format c : hop count d : the date in UNIX format e : SMTP entry message f : sender(from) address g : sender name relative to the recipient h : recipient host i : queue ID j : official domainname of this site l : format of the UNIX Form line m : domainname n : name of the daemon ( for error messages) o : the set of "separators" in named p : sendmail process ID q : Default format for sender names r : Protocol used s : Sender`s host name t : A numeric representation of the current time u : The recipient user v : version number of sendmail w : host name of this site x : full name of the sender z : home directory of the recipient * ¸ÅÅ©·Î Á¤ÀÇ : sendmail.cf ´Â ´Ü¼øÇÑ text file ÀÌ ¾Æ´Ï¶ó ÇϳªÀÇ ÇÁ·Î±×·¥ÀÌ´Ù. ´ç½ÅÀÌ ¸¸¾à ÇÁ·Î±×·¥À» §´Ù¸é Ç×»ó field ¸¦ ¼±¾ðÇÒ ÇÊ¿ë°¡ ÀÖÀ»°ÍÀÌ´Ù. ÀÌ·¯ÇÑ field ´Â ÃʱâÈµÇ°í ¼öÁ¤µÇ°í, check µÇ°í test µÈ´Ù. sendmail.cf ÈÀÏ¿¡ variables ´Â ÀÌ·¯ÇÑ ¸ñÀûÀ¸·Î »ç¿ëµÈ´Ù. ¿¹¸¦µé¸é ´ç½ÅÀÌ address ¿¡ mail domain name À» Ãß°¡Çؾ߸¸µÈ´Ù¸é, macro m ÀÌ »ç¿ëµÈ´Ù. ÀÌ°ÍÀº ÇѹøÁ¤ÀÇµÇ¸é ´ç½ÅÀÌ ¿øÇÏ´Â ¸¸Å¸¹ÀÌ »ç¿ëµÈ´Ù. ¿©±â¿¡ µÎ°¡Áö Á¾·ùÀÇ macro ¸¦ Á¤ÀÇÇÏ´Â ¹æ¹ýÀÌ ÀÖ´Ù. : D ¿Í ¤Ó command. 1) D command : D command ´Â ÇϳªÀÇ macro variable À» ÃʱâÈ Çϴµ¥ »ç¿ëµÊ. Syntax: Dmstring ( m Àº ÇÑ character macro name, string Àº macro º¯¼ö) DMsvc.hei.co.kr ¿¹¸¦µé¸é DRmailhost ´Â macro R º¯¼ö¿¡ mailhost °ªÀ» ÇÒ´ç. #DR ddn-gateway 2) L command : L command ´Â ÇϳªÀÇ macro variable À» ÃʱâÈ Çϴµ¥ »ç¿ëµÉ¼ö ÀÖ´Ù. command »ó¿¡ ÁÖ¾îÁø ±× macro ÀÇ °ªÀº sendmailvars ¶ó´Â database ¿¡¼ ÇϳªÀÇ search key ·Î »ç¿ëµÈ´Ù. ¹°·Ð sendmailvars ´Â NIS+ ¿¡ table ·Î Á¤Àǵɼö ÀÖ´Ù. ¿¡¸¦µé¸é Lmmaildomain Àº ³»ºÎº¯¼ö m À» search key ·Î¼ maildomain À» ÀÌ¿ëÇÏ¿© sendmailvars database ¿¡ ¼ ¹ß°ßµÇ´Â º¯¼ö·Î setting ÇÑ´Ù.¸¸¾à sendmailvars databae °¡ maildomain Eng.Sun.COM ÀÌ¸é º¯¼ö m Àº Eng.Sun.COM ÀÌ µÈ´Ù. 3) ¸ÅÅ©·Î ÀÇ ÂüÁ¶. $x Ç¥½Ã´Â ÇϳªÀÇ º¯¼ö¸¦ È®ÀÎÇÒ¶§ »ç¿ëµÈ´Ù. rewriting rules ³»¿¡¼ ÀÌ°ÍÀº testing ¸ñÀûÀ» À§ÇØ »ç¿ëµÈ´Ù. ¿ì¸®´Â ³ªÁß¿¡ rewriting rule ¿¡¼ º¼¼ö ÀÖ´Ù. ¿¹: Dj$s.$m ÀÌ°ÍÀº j ¿¡ w ¿Í m ¸ÅÅ©·ÎÀÇ concatenated º¯¼ö¸¦ ÇÒ´çÇÑ´Ù´Â ÀǹÌÀÌ´Ù. ¸¸¾à, w(hostname) ÀÌ hyundai3 ÀÌ°í m ÀÌ svc.hei.co.kr À̸é j ´Â hyundai3.svc.hei.co.kr ÀÌ µÈ´Ù. 3. Classes macro ´Â À¯ÀÏÇÑ º¯¼ö¿Í °ü·ÃÀÌÀÖ´Ù. ¸¸¾à, ÇϳªÀÌ»óÀÇ º¯¼ö¸¦ ÇÒ´çÇÒ ÇÊ¿ä°¡ ÀÖÀ¸¸é class ¸¦ »ç¿ëÇ϶ó. ´ç½ÅÀº À§¿¡¼ ÇϳªÀÇ º¯¼ö¸¦ retrieve ÇϱâÀ§ÇØ ¶Ç´Â ±×µéÀÇ Ãʱâȸ¦ check ÇϱâÀ§ÇØ macro °¡ »ç¿ëµÇ´Â°ÍÀ» º¸¾Ò´Ù. ¿¹¸¦µé¸é ´ç½ÅÀÌ mail address ¿¡¼ ¸í½ÃµÈ host name ÀÌ local ÀÎÁö ¾Æ´ÑÁö¸¦ check ÇÏ°í ½ÍÀ¸¸é pre-defined class y ´Â host database ¿¡¼ hosts ÀÇ list ¸¦ Æ÷ÇÔÇÏ°í ÀÖ´Ù. * Ŭ·¡½º Á¤Àǹæ¹ý(C,F,G command) 3-1) C command C command ´Â ¸í½ÃµÈ °ªÀ» Á÷Á¢ ÇÒ´çÇÑ´Ù. ¿¹: CC word1 word2 .. C´Â ÇϳªÀÇ character class name ÀÌ°í word ´Â ±× class ¸¦ À§ÇÑ value list ÀÌ´Ù; 3-2) F command F command ´Â file ¶Ç´Â ´Ù¸¥ command ·Î ºÎÅÍ value ¸¦ Àд´Ù. ¿¹: FC file ( FC /.rhosts : /.rhosts ÀÇ ³»¿ëÀ» class C ¿¡ load) (FC | command ) ex: FC | awk '{print $2}' /etc/inet/hosts 3-3) G command G command ´Â sendmailvars database ¿¡¼ ãÀº value ¸¦ ÇÒ´çÇÑ´Ù. ¿¹: GCkey_name : C ´Â class name, key_name Àº sendmailvars ÀÇ search key. GVuucp_list ´Â sendmailvars database ¿¡¼ uucp_list ¸¦ ckwdk ±× °ªÀ» V ¿¡ ÇÒ´ç. ¿¹¸¦ µé¸é sendmailvars ¿¡ uucp-list °¡ hyundai3 À̸é V ÀÇ °ªÀº hyundai3 À̵ȴÙ. 3-4) Class ÀÇ ÂüÁ¶ class type ÀÇ º¯¼ö´Â address ÀÇ testing À» À§Çؼ ÀûÀýÇÏ´Ù. ´ÙÀ½Àº ÇϳªÀÇ class ·Î½á ´ç½Å ÀÌ ¼öÇàÇÒ¼ö ÀÖ´Â ´Ù¸¥ operation À» ³ªÅ¸³¿. $%x : Match any tocken in an NIS map or NIS+ table $x $!x : Match any tocken not in NIS map or NIS+ table Sx $=x : Match any tocken in class x $~x : Match any tocken not in class x $x ´Â ãÀ» table ÀÇ name À» ¹ÝȯÇÑ´Ù. $%x ¿Í $!x ´Â table ÀÇ ³»¿ëÀ» ã´Â´Ù. ÀÌ ³×°³ÀÇ symbol Àº rewriting rules ¿¡ ÀÚÁÖ»ç¿ëµÈ´Ù. Class y ´Â host database ¸¦ À§ÇØ reserve µÇ¾îÀÖ´Ù. $%y ´Â hosts.byname map ¶Ç´Â /etc/host ( not NIS) ¿¡¼ ¾î¶² hostname À» ¹Ýȯ. True answer(T) ´Â $=x ¿¡¼ class x ¿¡ ±× string ÀÌ ÀÖÀ»¶§, $~x ´Â ¾øÀ»¶§ °¡°¢ True ÀÌ´Ù. ¿¹¸¦µé¸é, class v °¡ ¸ðµç local machine À» °¡Áø´Ù°íÇÒ¶§ sendmail ÀÌ class v ¿¡¼ ÁÖ¾îÁø value ¿Í email address ¸¦ ºñ±³ÇÒ¶§, sendmail Àº ±× machine ÀÌ ÁÖ¾îÁø address ¿¡¼ local ÀÎÁö ¾Æ´ÑÁö¸¦ È®ÀÎÇÒ¼ö ÀÖ¾î¾ß ÇÑ´Ù. 4. Rewriting Rules Address parsing Àº rewriting rules ¿¡ ÀÇÇØ ¿Ï¼ºµÈ´Ù. ÀÌ°ÍÀº °£´ÜÇÑ pattern-matching °ú replacement system ¿¡ »ç¿ëµÇ°í rule sets ·Î¼ ±¸¼ºµÈ´Ù. * Rule Sets : A rule set is a set of rewriting rules. ÇϳªÀÇ rule set Àº Sn line À¸·Î ½ÃÀ۵ȴÙ. ¿©±â¼ S ´Â rule set ÀÌ°í n Àº rule number ÀÌ´Ù. °¢ rewriting rule line Àº ÇϳªÀÇ program ¿¡¼ÀÇ code ÀÇ ÇÑ line °ú °°´Ù. ÀÌ°ÍÀº ¶ÇÇÑ ±× rule set ³»¿¡¼ ¼ø¼ÀûÀ¸·Î ¼öÇàµÈ´Ù. rewriting rule Àº ÀÔ·Â address ¸¦ ´Ù¸¥ string À¸·Î ©¶ó¼ input pattern À¸·Î ºñ±³ÇÏ°í ÇϳªÀÇ match °¡ ¹ß»ýÇÏ¸é ±× input ¸¦ output pattern À¸·Î Àç¹èÄ¡ÇÑ´Ù. ´ÙÀ½ÀÇ Àç¹èÄ¡¿¡ µû¶ó ±× process ´Â no match or exit Á¶°ÇÀ» ¸¸³¯¶§±îÁö µ¿ÀÏÇÑ rewriting ¸¦ ¹Ýº¹ÇÑ´Ù. Strings Àº o macro ¿¡ ÀÇÇØ ¸í½ÃµÈ delimiters À» »ç¿ëÇÏ¿© ±¸¼ºµÈ´Ù. default o macro ´Â Do.:%@!^=/[] ÀÌ´Ù. o µÚ¿¡ ³ª¿À´Â °¢ character ´Â delimiter ÀÌ´Ù. Syntax of a rule set: Sn ( n ¿¡ ºÐ·ùµÉ ÇöÀç rule set À» set ÇÑ´Ù.) Syntax of a rewriting rule : Rlhsrhs comments lhs:(left-hand side) ´Â input ¿¡ Àû¿ëµÉ pattern addresses ´Â words ¶Ç´Â tokens ·Î ³ª´©¾îÁø´Ù. ¸¸¾à, lhs °¡ match µÇ¸é input Àº rhs ·Î rewrittne µÈ´Ù. pattern ¿¡ ÀÖ¾î metasymbols ÀÌ »ç¿ëµÊ. $* - Match zero or more tokens $+ - Match one or more tokens $- - Match exactly one tokens $=x - Match any token in class x $~x - Match any token in NIS map or NIS+ table $x $%x - Match any token not NIS map or NIS+ table $x $!x - Match any token not NIS map or NIS+ table $x $x - Match macro x rhs:(right-hand side) ´Â address ¸¦ ´Ù½Ã ¾²´Âµ¥ »ç¿ëµÈ´Ù. 5. Ç¥ÁØ Rule Sets 8 °³ÀÇ pre-defined rule set ÀÌ ÀÖÀ¸¸ç ƯÁ¤ÇÑ ¼ø¼¿¡ µû¶ó Àû¿ëµÈ´Ù. ÀÌ°ÍÀº sendmail.cf ¿¡ ¼ø¼¿¡µû¶ó Àû¿ëµÇ´Â°ÍÀº ¾Æ´Ï´Ù. Rule Set3 : puts the address into the canonical form local-address@hostdomain. This rule is always executed first. Rule Set0 : determines what the destination is, and which mailer program to use to send it. Rule Set R :allows each mailer to specify an additional rule set to be applied on the sender addresses. Rule Set S : allows each mailer to specify an additional rule set to be applied on the sender addresses. Rule Set 4 : is applied last to all names in the message, usually from internal to external form Rule Set D : adds sender domain information to addresses that have no domain Rule Set 1 : is applied to all From: addresses. This rule set is generally empty(no associated rewriting rules) Rule Set 2 : is applied to all To: and Cc: lines. This rule set is generally empty(no associated rewriting rules) Revision History ÀÛ¼ºÀÏÀÚ : 96.09.05 ÀÛ¼ºÀÚ : À̽ÂÈÆ ¼öÁ¤ÀÏÀÚ : ¼öÁ¤ÀÚ :