Linux Information
 
ÃÑ °Ô½Ã¹° 125°Ç, ÃÖ±Ù 0 °Ç
   
Sendmail ÀÎÁõ ¼³Á¤ ( SMTP Auth )
±Û¾´ÀÌ : ½Å¿µÃ¶ ³¯Â¥ : 2013-01-18 (±Ý) 11:45 Á¶È¸ : 32478

¿ì¼± smtp ¿¡¼­ smtp auth ±â´ÉÀÌ »ç¿ëÀÌ °¡´ÉÇÑÁö ºÎÅÍ »ìÆì º¸µµ·Ï ÇÑ´Ù.
ÀÏ´Ü °¡Àå °£´ÜÇÑ ¹æ¹ýÀº sendmail.cf ¿¡¼­ ´ÙÀ½À» È®ÀÎÇÑ´Ù.
( /etc/mail/... )


# list of authentication mechanisms

O AuthMechanisms=LOGIN PLAIN DIGEST-MD5 CRAM-MD5

¶óÀÎÀÇ ÁÖ¼®ÀÌ Ç®·Á Àְųª ¶Ç´Â ÇØ´ç ¶óÀÎÀÌ ¼³Á¤ÀÌ ÀÖ´ÂÁö¸¦ È®ÀÎÇÏ¸é µÈ´Ù.
º¸Åë RedHat 7.x ºÎÅÍ´Â smtp auth ±â´ÉÀÌ Áö¿øÀÌ µÇÁö¸¸ ¿©±â¼­ ³íÇÏ´Â login ¹æ½ÄÀÌ ¾Æ´Ï¶ó pam ÀÎÁõ ¹æ½ÄÀ» Áö¿øÇÑ´Ù.
¿©±â¼­´Â login ¹æ½ÄÀ» Áö¿ø ¼³¸íÇÒ °ÍÀÌ´Ù.

ÀÏ´Ü ¾ÈµÇ¾î ÀÖ´Ù°í ÆÇ´ÜÀÌ µÈ´Ù¸é ´ÙÀ½À» µû¶ó Çϵµ·Ï ÇÑ´Ù.
´ÙÀ½Àº sendamil 8.10 ÀÌ»ó ¹öÁ¯ÀÌ ¼³Ä¡ µÇ¾î ÀÖ°í, libsasl ¶Ç´Â cyrus-sasl package °¡ ¼³Ä¡°¡ µÇ¾î ÀÖ´Â »óȲ¿¡¼­ sendmail auth °¡ ¾ÈµÈ´Ù¸é µÇ°Ô ÇÏ´Â ¹æ¹ýÀÌ´Ù.
ÀÏ´Ü /etc/mail ¿¡ º¸¸é sendmail.mc ¶ó´Â ÆÄÀÏÀÌ ÀÖÀ» °ÍÀÌ´Ù.
ÀÌ ÆÄÀÏ¿¡ ´ÙÀ½ÀÇ ³»¿ëÀ» ±â¼úÇϵµ·Ï ÇÑ´Ù.


dnl # These are the allowed auth mechanisms. To allow relaying for a user

dnl # that uses one of them, you must set TRUST_AUTH_MECH.

define(`confAUTH_MECHANISMS', `LOGIN PLAIN DIGEST-MD5 CRAM-MD5')dnl

dnl # These are the SMTP auth mechanisms which, if used,

dnl # Sendmail will allow relaying for.

TRUST_AUTH_MECH(`LOGIN PLAIN DIGEST-MD5 CRAM-MD5')dnl

À§ 5ÁÙÀ» Ãß°¡ Çϰí

DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA')

ÁÙÀ» ã¾Æ¼­

DAEMON_OPTIONS(`Port=smtp,Addr=0.0.0.0, Name=MTA') À¸·Î ¼öÁ¤ÇÑ´Ù.



m4 sendmail.mc > sendmail.cf ·Î ´Ù½Ã »ý¼ºÇÏ¸é µÈ´Ù.
´Ü ÁÖÀÇ ÇÒ°ÍÀº rpm À¸·Î ¼³Ä¡¸¦ Çß°í sendmail.mc ¸¦ ÀÌ¿ëÇÏ¿© sendmail.cf ¸¦ ´Ù½Ã »ý¼ºÇÒ °æ¿ì¿¡´Â sendmail-cf package °¡ ¼³Ä¡°¡ µÇ¾î ÀÖ¾î¾ß ÇÑ´Ù.

ÀÏ´Ü ¼öÁ¤ÇÑ sendmail.mc ´Â ´ÙÀ½°ú °°´Ù. ¹°·Ð Á¶±Ý½Ä Ʋ¸±¼ö´Â ÀÖÁö¸¸ ÆÐŰ¡ ½Ã¿¡ ³ÖÀº ¿É¼Çµé¿¡ µû¶ó Á¶±Ý¾¿ Â÷À̰¡ ³¯°ÍÀÌ´Ù.


################################################################

Hanterm - cat /etc/mail/sendmail.mc



[root@oops mail]# cat sendmail.mc



divert(-1)

dnl This is the macro config file used to generate the /etc/sendmail.cf

dnl file. If you modify thei file you will have to regenerate the

dnl /etc/sendmail.cf by running this macro config through the m4

dnl preprocessor:

dnl

dnl m4 /etc/sendmail.mc > /etc/sendmail.cf

dnl

dnl You will need to have the sendmail-cf package installed for this to

dnl work.

include(`/usr/lib/sendmail-cf/m4/cf.m4')



À§ÀÇ ¶óÀÎÀÇ path ¸¦ ÁÖÀÇÇÏÀÚ. RH 7.x ÀÇ °æ¿ì¿¡´Â ¾Æ¸¶ m4 file ÀÇ À§Ä¡°¡

/usr/share/sendmail-cf/m4/cf.m4 ¿¡ À§Ä¡ÇÒ °ÍÀÌ´Ù. ³ªµµ Á¤È®ÇÏ°Ô ±â¾ïÀº

¾È³ª´Ï ¾Ë¾Æ¼­ À§ÀÇ °æ·Î¸¦ È®ÀÎÇϱ⠹ٶõ´Ù.



define(`confDEF_USER_ID',``8:12'')

OSTYPE(`linux')

undefine(`UUCP_RELAY')

undefine(`BITNET_RELAY')

define(`confAUTO_REBUILD')

dnl #

dnl # These are the allowed auth mechanisms. To allow relaying for a user

dnl # that uses one of them, you must set TRUST_AUTH_MECH.

define(`confAUTH_MECHANISMS', `LOGIN PLAIN DIGEST-MD5 CRAM-MD5')dnl

dnl # These are the SMTP auth mechanisms which, if used,

dnl # Sendmail will allow relaying for.

TRUST_AUTH_MECH(`LOGIN PLAIN DIGEST-MD5 CRAM-MD5')dnl

dnl #

define(`confTO_CONNECT', `1m')

define(`confTRY_NULL_MX_LIST',true)

define(`confDONT_PROBE_INTERFACES',true)

define(`PROCMAIL_MAILER_PATH',`/usr/bin/procmail')

dnl Security improvement by disallowing VRFY, EXPN

define(`confPRIVACY_FLAGS',`authwarnings,needmailhelo,novrfy,noexpn')dnl

FEATURE(`smrsh',`/usr/sbin/smrsh')

FEATURE(`virtusertable',`hash -o /etc/mail/virtusertable')

FEATURE(redirect)

FEATURE(always_add_domain)

FEATURE(use_cw_file)

FEATURE(local_procmail)

MAILER(smtp)

MAILER(procmail)

FEATURE(`access_db')

FEATURE(`blacklist_recipients')

dnl We strongly recommend to comment this one out if you want to protect

dnl yourself from spam. However, the laptop and users on computers that do

dnl not hav 24x7 DNS do need this.

FEATURE(`accept_unresolvable_domains')

dnl FEATURE(`relay_based_on_MX')

dnl To use multiple queue feature of 8.10.x

define(QUEUE_DIR,`/var/spool/mqueue/q*')

dnl change Statistics file name from statistics to sendmail.st

define(STATUS_FILE, `sendmail.st')

dnl OOPS



[root@oops mail]# m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf



À§ÀÇ ¸í·ÉÀ» ÀÌ¿ëÇÏ¿© sendmail.cf ¸¦ »õ·Î »ý¼ºÀ» ÇÒ¼ö ÀÖ´Ù.



[root@oops mail]



###############################################################



À§ÀÇ sendmail.mc ³»¿ë ´ÙÀ½ÀÇ ¸í·ÉÀ» ½ÇÇàÇϸé sendmail.cf °¡ »õ·Î »ý¼ºÀÌ µÇ°Ô µÈ´Ù. ´Ù½Ã ÁÖÀǸ¦ ÇϰǸ¸ m4 ¸í·ÉÀ» ÀÌ¿ëÇÏ¿© sendmail.cf ¸¦ »õ·Î »ý¼ºÇÒ °æ¿ì sendmail-cf package °¡ ¼³Ä¡ µÇ¾î ÀÖ¾î¾ß ÇÑ´Ù´Â °ÍÀÌ´Ù. (¹°·Ð ÀÌ´Â rpm package ·Î sendmail ÀÌ ÀÌ¹Ì ¼³Ä¡ µÇ¾î ÀÖ´Â °æ¿ìÀÌ´Ù.)



´ÙÀ½Àº sasl ¿¡¼­ auth ÀÇ ¹æ½ÄÀ» ÁöÁ¤Çϵµ·Ï ÇÑ´Ù. ÀÏ´Ü sasl Àº libsasl ¶Ç´Â cyrus-sasl À̶ó´Â À̸§À¸·Î ¼³Ä¡°¡ µÇ¾î ÀÖÀ» °ÍÀÌ´Ù. ¸¸¾à ÀÌ µÎÆÐŰÁö°¡ ¼³Ä¡ µÇ¾î ÀÖÁö ¾Ê´Ù¸é sendmail À» óÀ½ºÎÅÍ ´Ù½Ã ¼³Ä¡ÇØ Áà¾ß ÇÑ´Ù.



ÀÏ´Ü rpm -qa | grep Sendmail.conf ¸í·ÉÀ» ½ÇÇà ÇÏ¿© Sendmail.conf ¸¦ ã¾Æ¼­ ´ÙÀ½ÀÇ ³»¿ëÀ» »ðÀÔÇÑ´Ù.



pwcheck_method: shadow



Sendmail.conf °¡ Á¸ÀçÇÏÁö ¾ÊÀ» °æ¿ì¿¡´Â /usr/lib/sasl À̶ó´Â directory °¡ Á¸ÀçÇϸé /usr/lib/sasl/Sendmail.conf ¸¦ »ý¼ºÇÏ¿© À§ÀÇ ³»¿ëÀ» ³Ö¾îÁÖ¸é µÈ´Ù. ±×¸®°í sendmail À» Àç½ÃÀÛ ÇÑ´Ù. (ÇÊÀÚ°¡ ÆÐŰ¡ÇÑ sendmail À» ¼³Ä¡Çϸé À§ÀÇ ºÎºÐÀÌ shadow °¡ ¾Æ´Ï¶ó pam À¸·Î µÇ¾î ÀÖÀ» °ÍÀÌ´Ù. ÀÌ°Ç ´Ù¸¥ ±â´ÉÀ» Ãß°¡Ç߱⠶§¹®¿¡ pam À¸·Î ¼³Á¤À» ÇÑ °ÍÀÌ´Ù. À§ÀÇ °ÍÀÌ shadow À̵ç pam À̵ç Å©°Ô ¹®Á¦°¡ µÉ °ÍÀº ¾ø´Ù.)



±×·³ ¿î¿µÇÏ´Â ¹æ¹ý¿¡ ´ëÇØ¼­ º¸µµ·Ï ÇϰڴÙ. sendmail¿¡¼­ smtp server·Î »ç¿ëÀ» Çϱâ À§Çؼ­´Â /etc/mai/access ¿¡¼­ ÇØ´ç ´ë¿ª¿¡ ´ëÇÏ¿© RELAY¸¦ Çã¿ëÀ» ÇØ Áà¾ß ÇÑ´Ù. ÇÏÁö¸¸ smtp auth ±â´ÉÀÌ Á¤Àǰ¡ µÇ¾î ÀÖÀ¸¸é access¿¡¼­ ¼³Á¤À» ÇÒ ÇÊ¿ä ¾øÀÌ (À̰ÍÀº RELAY¼³Á¤À» ¾ÈÇØ Á൵ µÈ´Ù´Â ¶æÀÌÁö access file¿¡¼­ REJECT·Î ¸·¾Æ¼­´Â ¾ÈµÈ´Ù´Â ÀǹÌÀÌ´Ù) client side¿¡¼­ mail client¿¡¼­ ¼³Á¤¸¸ ÇØ ÁÖ¸é µÈ´Ù. ±×·³ Netscape Mailer¿Í Outlook Express¿¡¼­ÀÇ ¼³Á¤À» º¸µµ·Ï ÇÏÀÚ.



Netscpae mailer

Edit>Preferences>mail & Newgroups>Mail Servers



¿¡¼­ Outgoing mail server user name ¿¡ °èÁ¤À¯Àú¸¦ Àû¾î ÁÖ°í SSL ¸ðµå´Â If Possible ·Î Àâ¾Æ ÁÖ¸é µÈ´Ù. ¹°·Ð Plainµµ °¡´ÉÇÏ´Ù. ±×¸®°í ¸ÞÀÏÀ» º¸³»¸é ÀÎÁõ âÀÌ ¶ß°Ô µÇ¸ç ¿©±â¿¡ °èÁ¤ name°ú °èÁ¤ password·Î loginÀ» ÇÏ¸é µÈ´Ù.



Outlook Express 98

µµ±¸>°èÁ¤>¸ÞÀÏ>°èÁ¤µî·ÏÁ¤º¸>¼­¹ö>º¸³»´Â ¸ÞÀϼ­¹ö



¿¡¼­ "ÀÎÁõ ÇÊ¿ä"¿¡ üũ¸¦ ÇÏ°í ¿·ÀÇ "¼³Á¤"À» Ŭ¸¯ÇÑÈÄ ·Î±×¿Â Á¤º¸¿¡ °èÁ¤ ID¸¦ ³Ö¸é µÈ´Ù. ±×¸®°í º¸¾È¾ÏÈ£ÀÎÁõÀ» »ç¿ëÇÏ¿© ·Î±×¿ÂÀº ¼±ÅÃÇÏ¸é ¾ÈµÈ´Ù ^^; PlainÀ¸·Î ÇØ¾ß ÇÑ´Ù.



±×·³ ´ÙÀ½Àº °£´ÜÇÏ°Ô sendmail¿¡¼­ smtp auth±â´ÉÀÌ Á¦´ë·Î ÀÛµ¿À» ÇÏ´ÂÁö »ìÆì º¸µµ·Ï ÇÑ´Ù. ºÓÀº»ö ±ÛÀÚ´Â ÇÊÀÚ°¡ typingÀ» ÇÑ °ÍÀÌ´Ù.



###############################################################

Hanterm - telnet localhost 25



[root@oops mail]# telnet localhost 25



Trying 127.0.0.1...

Connected to localhost.

Escape character is '^]'.

220 oops.org ESMTP Sendmail 8.10.0/8.10.0; Tue, 4 Apr 2000 15:31:05 +0900

ehlo localhost

250-oops.org Hello localhost [127.0.0.1], pleased to meet you

250-ENHANCEDSTATUSCODES

250-EXPN

250-VERB

250-8BITMIME

250-SIZE

250-DSN

250-ONEX

250-ETRN

250-XUSR

250-AUTH LOGIN PLAIN

250 HELP

quit

221 2.0.0 oops.org closing connection

Connection closed by foreign host.



[root@oops etc]#

###############################################################


À§¿¡¼­ Èò»ö ±½Àº ±ÛÀÚ·Î AUTH LOGIN PLAINÀÌ ³ª¿À¸é Plain ¹æ½ÄÀÇ loginÀÌ °¡´ÉÇÏ´Ù´Â ÀǹÌÀÌ´Ù. ¹°·Ð compile½Ã¿¡ ¾î¶°ÇÑ ¹æ½ÄÀ¸·Î ÇÏ´À³Ä¿¡ µû¶ó ´Þ¶ó Áö¹Ç·Î ²À À§¿Í°°Àº °á°ú°¡ ³ª¿À¸®¶ó´Â ¹ýÀº ¾øÁö¸¸ ¾î¶°ÇÑ ÇüÅ·εç auth¿Í ºñ½ÁÇÑ ¹®±¸´Â ³ª¿Í¾ß ÇÑ´Ù´Â °ÍÀ» ¾Ë¾Æ¾ß ÇÑ´Ù.


ÀÚ, ±×·³ ½ÇÁ¦·Î sendmail auth °¡ ÀÛµ¿ÇÏ´ÂÁö¸¦ Å×½ºÆ® ÇÏ´Â °ÍÀº ¾Æ·¡ÀÇ °úÁ¤À¸·Î Å×½ºÆ®¸¦ ÇÒ ¼ö°¡ ÀÖ´Ù.



###############################################################

Hanterm - telnet localhost 25



[root@oops mail]# php -r 'echo base64_encode("user")."n";'

dXNlcg==



[root@oops mail]# php -r 'echo base64_encode("password")."n";'

cGFzc3dvcmQ=



[root@oops mail]# telnet localhost 25



Trying 127.0.0.1...

Connected to localhost.

Escape character is '^]'.

220 work.oops.org ESMTP Sendmail 8.12.9/8.12.9; Sat, 23 Aug 2003 01:27:54 +0900

AUTH LOGIN

334 VXNlcm5hbWU6

dXNlcg==

334 UGFzc3dvcmQ6

cGFzc3dvcmQ=

235 2.0.0 OK Authenticated

quit

221 2.0.0 work.oops.org closing connection

Connection closed by foreign host.



[root@oops mail]#

###############################################################


sendmail auth ¿¡¼­ÀÇ ÀÎÁõ½Ã user name °ú password ´Â base64 encoding ÀÌ µÈ °ªÀ» ÀÌ¿ëÇØ¾ß ÇÑ´Ù. Áï À§ÀÇ °úÁ¤¿¡¼­ óÀ½ php ¸¦ ½ÇÇàÇÏ´Â °ÍÀÌ À¯Àú¸í°ú ÆÐ½º¿öµåÀÇ base64 ÀÎÄÚµù °ªÀ» ±¸ÇÏ´Â °úÁ¤À̸ç, 25¹ø Æ÷Æ®·Î Á¢¼ÓÀ» ÇÑ ºÎºÐ¿¡¼­ ºÓÀº»ö ±Û¾¾ ºÎºÐÀÌ ¹Ù·Î À¯Àú¸í°ú ÆÐ½Ã¿öµå¸¦ ÀÔ·ÂÇÏ´Â ºÎºÐÀÌ´Ù. ÆÐ½º¿öµå¸¦ ³ÖÀº ÈÄ¿¡,



235 2.0.0 OK Authenticated



¸Þ¼¼Áö°¡ ³ª¿Â´Ù¸é ÀÎÁõ¿¡ ¼º°øÀ» ÇÑ °ÍÀÌ´Ù.



±×¸®°í ¹®Á¦ ¹ß»ý½Ã¿¡ ¸¶Áö¸·À¸·Î È®ÀÎÇØ¾ßÇÒ »çÇ×.

saslauthd µ¥¸óÀÌ ½ÇÇàÁßÀÎÁö È®ÀÎÇÑ´Ù.

¾ÈµÇ¾î ÀÖÀ¸¸é ¼­ºñ½º ±¸µ¿ ½Ã۰í, ntsysv ¿¡¼­µµ Ȱ¼ºÈ­ ½ÃÄÑ ÀçºÎÆÃ ½Ã¿¡µµ ÀÚµ¿½ÇÇà µÇµµ·Ï ó¸®ÇÑ´Ù.

½Å¿µÃ¶ ´ÔÀÇ Linux ÃÖ½Å±Û [´õº¸±â]


   

 

naver.com daum.net nate.com google.co.kr youtube.com


Copyright ¨Ï www.pronice.com. All rights reserved.