반응형
출처: 주홍점넷

1. sendmail 설정 (리눅스 레드햇9.0 기준)
- 먼저 rpm -qa |grep sendmail 명령으로 sendmail이 설치되어 있는지 확인, 없으면 시디로 팩키지를 설치해준다
- 설치할 팩키지 -> sendmail-cf-8.12.8-4,sendmail-doc-8.12.8-4,sendmail-8.12.8-4,sendmail-devel-8.12.8-4
- Pop3를 사용할려면 imap 팩키지가 설치되어 있어야 함.  

2. 설정파일 위치
- /etc/mail/sendmail.cf : 센드메일의 가장 기본적인 설치파일 ->
267라인에 addr 제거
- /etc/mail/access : 릴레이 허용파일,기본적으로 로컬만 허용, 허용할 IP,domain추가 한다.
  *엑세스 파일 교체되면 makemap hash /etc/mail/access < /etc/mail/access 실행
- /etc/mail/local-host-names : 메일을 수신할 호스트이름 결정

3. sendmail 데몬 시작 / 확인
- service sendmail start 또는 init/sendmail start
- [root@test mail]# ps -aux | grep sendmail
  root   1435 0.0 0.9 5912 2528 ?   S  Apr09 0:00 [sendmail]
  smmsp  1444 0.0 0.8 5712 2256 ?   S  Apr09 0:00 [sendmail]
  root   3958 0.0 0.2 4664 652 pts/0  S  14:16 0:00 grep sendmail
- 마지막으로 telnet localhost 25 로 접속해서 아래와 같은 화면이 나오면 정상적으로 SMTP데몬이 돌고 있다.
  [root@test mail]# telnet localhost 25
  Trying 127.0.0.1...
  Connected to localhost.
  Escape character is '^]'.
  220 localhost.localdomain ESMTP Sendmail 8.12.8/8.12.8; Mon, 12 Apr 2004 14:18:30 +0900
  help
  214-2.0.0 This is sendmail version 8.12.8
  214-2.0.0 Topics:
  214-2.0.0   HELO  EHLO  MAIL  RCPT  DATA
  214-2.0.0   RSET  NOOP  QUIT  HELP  VRFY
  214-2.0.0   EXPN  VERB  ETRN  DSN  AUTH
  214-2.0.0   STARTTLS
  214-2.0.0 For more info use "HELP ".
  214-2.0.0 To report bugs in the implementation send email to
  214-2.0.0   sendmail-bugs@sendmail.org.
  214-2.0.0 For local information send email to Postmaster at your site.
  214 2.0.0 End of HELP info

[SMTP-AUTH 인증기능 추가]
  * SASL 라이브러리가 설치되어 있어야 함
   cyrus-sasl-2.1.10-4
   cyrus-sasl-plain-2.1.10-4
   cyrus-sasl-devel-2.1.10-4
   cyrus-sasl-md5-2.1.10-4
  ==================================================================
  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
  =================================================================

  위의 내용을 sendmail.mc에 추가하고 sendmail.cf(516라인확인)를 다시 생성한다.
  m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf
  /usr/lib/sasl아래 Sendmail.cf 또는 Sendmail.conf에 pwcheck_method:shadow추가하고 sendmail를 다시 시작한다.

  * 인증확인
  [root@test etc]# telnet localhost 25
  Trying 127.0.0.1...
  Connected to localhost.
  Escape character is '^]'.
  220 localhost.localdomain ESMTP Sendmail 8.12.8/8.12.8; Mon, 12 Apr 2004 15:30:59 +0900
  EHLO localhost
  250-localhost.localdomain Hello test [127.0.0.1], pleased to meet you
  250-ENHANCEDSTATUSCODES
  250-PIPELINING
  250-8BITMIME
  250-SIZE
  250-DSN
  250-ETRN
  250-AUTH LOGIN PLAIN -> 인증기능이 활성화되어 있음
  250-DELIVERBY
  250 HELP

  * 현재 인증되는 서버
  516 O AuthMechanisms=LOGIN PLAIN DIGEST-MD5 CRAM-MD5
  /usr/lib/sasl아래 Sendmail.cf에 pwcheck_method:shadow
,