질문&답변
클라우드/리눅스에 관한 질문과 답변을 주고 받는 곳입니다.
리눅스 분류

sendmail관련 무단도용방지

작성자 정보

  • 임근식 작성
  • 작성일

컨텐츠 정보

본문

 

 

 

메일일 보낼때 인증을 통한 방법으로 보내도록 설정을 하시기 바랍니다.

Redhat 7.0 버젼이라고 하셨으니 아래의 방법을 통해서 기존의 셋팅에서

SMTP인증처리가 되도록 하여 님의 서버가 스팸 릴레이 서버로 도용되지

않도록 개선하시기 바랍니다.

     ----------------------  설치 방법 -------------------------------


★1. /etc/mail/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')
........ 이하 생략....................


★2.  m4 /etc/mail/sendmail.mc > /etc/sendmail.cf


★3. SMTP AUTH 기능을 위해 sendmail.conf 파일이 확인/수정
#>cat /usr/lib/sasl/sendmail.conf
pwcheck_method:pam
shadow를 설정하는 분들도 있는데, 인증 모듈인 pam을 사용할 것이다.

★4. /etc/rc.d/init.d/sendmail restart

★5. 이제 아웃룩에서 [인증필요]를 체크하면, /etc/mail/access에서 사용할 IP를
  적지 않아도 자유롭게 이용할수 있게 된다.

★6. Send Mail 아웃룩에서 사용가능하게 수정

Redhat7.2에선 보안이 강화되어서 그런지 local에선 잘되도 외부에서
접근하면 않되는것들이 많은데, sendmail도 같은 경우고요..

#>vi/etc/sendmail.cf
찾을 내용 => O DaemonPortOptions=Port=smtp,Addr=127.0.0.1, Name=MTA
변경 후 => O DaemonPortOptions=Port=smtp,Name=MTA

#>vi /etc/mail/access <--- 메일 중계 기능을 담당(sendmail중계)
invain.pe.kr   RELAY
210.118.56     RELAY <-- OutLook을 사용할 허가 IP영역을 할당★

#>makemap hash /etc/mail/access < /etc/mail/access

#>/etc/rc.d/init.d/sendmail restart
이렇게 하면 access에서 설정한 IP에서만 아웃룩 메일보내기가 작동됩니다.

이제 테스트 해보도록 합니다.
#>/usr/sbin/mailstats  
  => esmtp가 나온는지 확인 할것.

#>telnet invain.pe.kr 25
 ehlo localhost

250-ENHANCEDSTATUSCODES
250-8BITMIME
250-SIZE
250-DSN
250-ONEX
250-ETRN
250-XUSR
250-AUTH LOGIN PLAIN   <--- 이부분이 인증을 요구하는 부분(참조1)
250 HELP

sendmail로 메일 포워딩시키기  
#> cd /home/songks
#> touch .forward (rh9의 해당 계정의 홈디렉토리에 파일 생성)
#> vi .forward
hongba@naver.com (받을 메일주소 입력)
hongsu@naver.com

#> cat /etc/mail/sendmail.cf | grep forward
   232 # Forward file search path
   233 O ForwardPath=$z/.forward.$w:$z/.forward


★참조1)
[Netscpae mailer] : Edit>Preferences>mail & Newgroups>Mail Servers에서
Outgoing mail server user name 에 계정유저를 적어 주고 SSL 모드는
If Possible 로 잡아 주면 된다. 물론 Plain도 가능하다. 그리고 메일을
보내면 인증 창이 뜨게 되며 여기에 계정 name과 계정 password로 login을
하면 된다.

★[Outlook Express 98 ]
[도구][인터넷계정][메일][정등록정보][서버][보내는 메일서버] 에서
[인증 필요]에 체크를 하고 옆의 [설정]을 클릭한후 [로그온 정보]에
계정 ID를 넣면 된다. (보안암호인증을 사용하여 로그온을 선택하면 안된다.)
이작업을 해야만 메일 전송이 이루어짐.

관련자료

댓글 1

심선님의 댓글

  • 심선
  • 작성일
답변 대단히 감사합니다...잘 참조하겠습니다^_____^

공지사항


뉴스광장


  • 현재 회원수 :  60,045 명
  • 현재 강좌수 :  35,861 개
  • 현재 접속자 :  70 명