보안 루피

리눅스 마스터 1급 실기 : 메일 작업 /etc/mail/virtusertable, /etc/aliases 본문

리눅스 마스터 1급

리눅스 마스터 1급 실기 : 메일 작업 /etc/mail/virtusertable, /etc/aliases

잔망 루피 2023. 5. 3. 22:23

 

/etc/mail/access

/etc/mail/Virtusertable                    : 같은 이름, 다른 도메인

/etc/aliases                                      : 메일링

/etc/mail/local-host-names            : 메일 서버에 사용하는 도메인 등록(다른 파일들이 이걸 참고함)

 

이 두개 문제 유형이 오묘하게 다름

[ rpm -qc sendmail ]

더보기

[root@localhost ~]# rpm -qc sendmail
/etc/mail/Makefile
/etc/mail/access
/etc/mail/domaintable
/etc/mail/helpfile
/etc/mail/local-host-names
/etc/mail/mailertable
/etc/mail/make
/etc/mail/sendmail.cf
/etc/mail/sendmail.mc
/etc/mail/submit.cf
/etc/mail/submit.mc
/etc/mail/trusted-users
/etc/mail/virtusertable
/etc/pam.d/smtp.sendmail
/etc/sasl2/Sendmail.conf
/etc/sysconfig/sendmail
/var/log/mail/statistics

/etc/mail/access

  • OK               무조건 허용
  • RELAY         허용
  • REJECT       폐기
  • DISCARD     폐기후 메시지 X

 

이 파일 수정후 makemap hash  /etc/mail/access <  /etc/mail/access  설정   

m4는 > 방향

 

/etc/mail/virtusertable : 하나 메일서버에 다른사용자가 같은 메일 계정을 요구한경우

수정후 makemap hash    /etc/mail/virtusertable   <   /etc/mail/virtusertable

 

더보기

[root@user ~ ]# vi   /etc/mail/virtusertable

 

# A domain-specific form of aliasing, allowing multiple virtual domains to be
# hosted on one machine.
#
# info@foo.com  foo-info                       예시
# info@bar.com  bar-info                       예시
# joe@bar.com   error:nouser 550 No such user here
# jax@bar.com   error:5.7.0:550 Address invalid
# @baz.org      jane@example.net
#
# then mail addressed to info@foo.com will be sent to the address foo-info,
# mail addressed to info@bar.com will be delivered to bar-info, and mail
# addressed to anyone at baz.org  will be sent to jane@example.net, mail to
# joe@bar.com will be rejected with the specified error message, and mail to
# jax@bar.com will also have a RFC 1893  compliant error code 5.7.0.
#
# The username from the original address is passed as %1 allowing:
#
# @foo.org      %1@example.com
#
# Additionally, if the local part consists of "user+detail" then "detail" is
# passed as %2 and "+detail" is passed as %3  when a match against user+* is
# attempted, so entries like

문제

가.  ihd.or.kr 계정(도메인)과 kait.or.kr 계정(도메인) 모두 ceo 라는 메일 계정을 요구한 상태이다. ihd.or.kr 의 ceo 메일계정은 ihduser 로 포워딩시키고 ,  kait.or.kr 의 ceo 메일 계정은 kaituser로 포워딩시킨다.

#vi  /etc/mail/virtusertable

ceo@ihd.or.kr              ihduser

ceo@kait.or.kr             kaituser


/etc/aliase : 특정 계정으로 들어오는 메일 다른 쪽으로 보내기

newaliase,    sendmail -bi     필수

 

name 이메일 계정을 user1, user 에게 보내는 경우

vi   /etc/aliases

name: user1, user2

 

사용자 리스트 파일이 있는 경우 (/etc/ mail_admin)

name::inclue:/etc/mail_admin

 

위 내용으로 /etc/aliases 수정후 newaliases,     sendmail  -bi 필수 !

 


/etc/mail/sendmail.cf

파일설정 항목

  • Cw : 호스트지정
  • Fw : 파일 지정
  • Dj : 특정 도메인 강제지정