작은숲:위키노트/Postfix

큰숲백과, 나무를 보지 말고 큰 숲을 보라.
Utolee90 (토론 | 기여)님의 2022년 5월 7일 (토) 19:19 판 (Utolee90님이 Postfix 문서를 넘겨주기를 만들지 않고 작은숲:위키노트/Postfix 문서로 이동했습니다: 위키노트 문서 작은숲으로 이동)
(차이) ← 이전 판 | 최신판 (차이) | 다음 판 → (차이)

CentOS에서 기본적으로 설치되는 메일 서버.

설치

CentOS를 설치하면 기본적으로 Postfix가 설치되지만 혹시 설치되지 않았다면 설치하도록 한다.

# yum -y install postfix

설정

/etc/postfix/main.cf 파일을 수정한다.

# 75번째 줄: 주석 해제 후 실제 서버 이름 설정
myhostname = mail.sample.com
# 83번째 줄: 주석 해제 후 도메인 네임 설정
mydomain = sample.com
# 99번째 줄: 주석 해제
myorigin = $mydomain
# 113번째 줄: 주석 해제하고 116번째 줄 주석 처리
inet_interfaces = all
#inet_interfaces = $myhostname
#inet_interfaces = $myhostname, localhost
#inet_interfaces = localhost
# 119번째 줄: IPv4만 사용하도록 수정
inet_protocols = ipv4
# 164번째 줄: 주석 처리하고 165번째 줄 주석 해제, 혹은 166, 167번째 줄 주석 해제
#mydestination = $myhostname, localhost.$mydomain, localhost
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
#mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain,
#   mail.$mydomain, www.$mydomain, ftp.$mydomain
# 264번째 줄: 주석 해제하고 서버의 로컬 네트워크 주소 설정
mynetworks = 182.0.0.94/24, 127.0.0.0/8
# 296번째 줄: 주석 해제. 릴레이를 허용할 도메인.
relay_domains = $mydestination
# 419번째 줄: Maildir을 사용하도록 주석 해제
home_mailbox = Maildir/
# 571번째 줄: 보안을 위해 아래 내용 추가
smtpd_banner = $myhostname ESMTP
# 이후 마지막 줄까지 설정 추가
# 메일 크기를 10M로 제한
message_size_limit = 10485760
# mailbox의 크기를 1G로 제한
mailbox_size_limit = 1073741824
# SMTP 인증을 위한 설정
smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth
smtpd_sasl_auth_enable = yes
smtpd_sasl_security_options = noanonymous
smtpd_sasl_local_domain = $myhostname
smtpd_recipient_restrictions = permit_mynetworks,permit_auth_destination,permit_sasl_authenticated,reject

Postfix 재기동

# /etc/rc.d/init.d/postfix restart
Shutting down postfix:                                     [  OK  ]
Starting postfix:                                          [  OK  ]

참고

이 작은숲 문서의 출처는 위키노트의 위키노트/Postfix 문서입니다.