저는 데비안 7 시스템을 실행하고 있으며 smtp 서버로 postfix를 실행하고 있습니다. postfix에서 외부로 메일을 보낼 수 있는데(Google을 통해 스팸 폴더로 이동하더라도) Google 계정에서 내 서버로 메일을 보내려고 하면 오류가 발생합니다.
내 IP가 77.77.77.77이고 호스트 이름이 machine.host.org이고 dns: example.ru라고 가정해 보겠습니다. Google에서 다음 오류가 발생합니다.
Delivery to the following recipient failed permanently:
[email protected]
Technical details of permanent failure:
Google tried to deliver your message, but it was rejected by the server for the recipient domain example.ru by machine.host.org. [77.77.77.77].
The error that the other server returned was:
554 5.7.1 <[email protected]>: Relay access denied
내 main.cf는 다음과 같습니다.
#myorigin = /etc/mailname
smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)
biff = no
# appending .domain is the MUA's job.
append_dot_mydomain = no
# Uncomment the next line to generate "delayed mail" warnings
#delay_warning_time = 4h
readme_directory = no
# SSL/TLS certificates
smtpd_tls_cert_file=/etc/ssl/certs/mailcert.pem
smtpd_tls_key_file=/etc/ssl/private/mail.key
smtpd_use_tls = yes
smtpd_tls_auth_only = yes
# See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for
# information on enabling SSL in the smtp client.
# Hostname and domain name
myhostname = machine.host.org
mydomain = host.org
myorigin = /etc/mailname
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
mydestination = $myhostname localhost.$mydomain $mydomain
relayhost =
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128 example.ru
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
# Anti-SPAM rules adapted from https://wiki.debian.org/Postfix
smtpd_recipient_restrictions = permit_sasl_authenticated,
permit_mynetworks,
check_policy_service unix:private/policy-spf,
reject_invalid_hostname,
reject_unknown_recipient_domain,
reject_unauth_destination,
reject_rbl_client sbl.spamhaus.org,
permit
smtpd_helo_restrictions = reject_invalid_helo_hostname,
reject_non_fqdn_helo_hostname,
reject_unknown_helo_hostname
smtpd_client_restrictions = reject_rbl_client dnsbl.sorbs.net
# Mail will be stored in users ~/Maildir directories
home_mailbox = Maildir/
mailbox_command =
# From http://wiki2.dovecot.org/HowTo/PostfixAndDovecotSASL
smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth
smtpd_sasl_auth_enable = yes
# This changed the ups the policy time limit so the policy server won't time out while a message is still being processed.
policy-spf_time_limit = 3600s
# for OpenDKIM from https://tipstricks.itmatrix.eu/installing-opendkim-in-debian-squeeze/
milter_default_action = accept
milter_protocol = 6
smtpd_milters = inet:localhost:12345
내 master.cf는 다음과 같습니다.
# Postfix master process configuration file. For details on the format
# of the file, see the master(5) manual page (command: "man 5 master").
#
# Do not forget to execute "postfix reload" after editing this file.
#
# ==========================================================================
# service type private unpriv chroot wakeup maxproc command + args
# (yes) (yes) (yes) (never) (100)
# ==========================================================================
smtp inet n - - - - smtpd
#smtp inet n - - - 1 postscreen
#smtpd pass - - - - - smtpd
#dnsblog unix - - - - 0 dnsblog
#tlsproxy unix - - - - 0 tlsproxy
submission inet n - - - - smtpd
-o syslog_name=postfix/submission
-o smtpd_tls_security_level=encrypt
-o smtpd_sasl_auth_enable=yes
-o smtpd_client_restrictions=permit_sasl_authenticated,reject
-o milter_macro_daemon_name=ORIGINATING
smtps inet n - - - - smtpd
-o syslog_name=postfix/smtps
-o smtpd_tls_wrappermode=yes
-o smtpd_sasl_auth_enable=yes
-o smtpd_client_restrictions=permit_sasl_authenticated,reject
-o milter_macro_daemon_name=ORIGINATING
#628 inet n - - - - qmqpd
pickup fifo n - - 60 1 pickup
cleanup unix n - - - 0 cleanup
qmgr fifo n - n 300 1 qmgr
#qmgr fifo n - n 300 1 oqmgr
tlsmgr unix - - - 1000? 1 tlsmgr
rewrite unix - - - - - trivial-rewrite
bounce unix - - - - 0 bounce
defer unix - - - - 0 bounce
trace unix - - - - 0 bounce
verify unix - - - - 1 verify
flush unix n - - 1000? 0 flush
proxymap unix - - n - - proxymap
proxywrite unix - - n - 1 proxymap
smtp unix - - - - - smtp
relay unix - - - - - smtp
# -o smtp_helo_timeout=5 -o smtp_connect_timeout=5
showq unix n - - - - showq
error unix - - - - - error
retry unix - - - - - error
discard unix - - - - - discard
local unix - n n - - local
virtual unix - n n - - virtual
lmtp unix - - - - - lmtp
anvil unix - - - - 1 anvil
scache unix - - - - 1 scache
#
# ====================================================================
# Interfaces to non-Postfix software. Be sure to examine the manual
# pages of the non-Postfix software to find out what options it wants.
#
# Many of the following services use the Postfix pipe(8) delivery
# agent. See the pipe(8) man page for information about ${recipient}
# and other message envelope options.
# ====================================================================
#
# maildrop. See the Postfix MAILDROP_README file for details.
# Also specify in main.cf: maildrop_destination_recipient_limit=1
#
maildrop unix - n n - - pipe
flags=DRhu user=vmail argv=/usr/bin/maildrop -d ${recipient}
#
# ====================================================================
#
# Recent Cyrus versions can use the existing "lmtp" master.cf entry.
#
# Specify in cyrus.conf:
# lmtp cmd="lmtpd -a" listen="localhost:lmtp" proto=tcp4
#
# Specify in main.cf one or more of the following:
# mailbox_transport = lmtp:inet:localhost
# virtual_transport = lmtp:inet:localhost
#
# ====================================================================
#
# Cyrus 2.1.5 (Amos Gouaux)
# Also specify in main.cf: cyrus_destination_recipient_limit=1
#
#cyrus unix - n n - - pipe
# user=cyrus argv=/cyrus/bin/deliver -e -r ${sender} -m ${extension} ${user}
#
# ====================================================================
# Old example of delivery via Cyrus.
#
#old-cyrus unix - n n - - pipe
# flags=R user=cyrus argv=/cyrus/bin/deliver -e -m ${extension} ${user}
#
# ====================================================================
#
# See the Postfix UUCP_README file for configuration details.
#
uucp unix - n n - - pipe
flags=Fqhu user=uucp argv=uux -r -n -z -a$sender - $nexthop!rmail ($recipient)
#
# Other external delivery methods.
#
ifmail unix - n n - - pipe
flags=F user=ftn argv=/usr/lib/ifmail/ifmail -r $nexthop ($recipient)
bsmtp unix - n n - - pipe
flags=Fq. user=bsmtp argv=/usr/lib/bsmtp/bsmtp -t$nexthop -f$sender $recipient
scalemail-backend unix - n n - 2 pipe
flags=R user=scalemail argv=/usr/lib/scalemail/bin/scalemail-store ${nexthop} ${user} ${extension}
mailman unix - n n - - pipe
flags=FR user=list argv=/usr/lib/mailman/bin/postfix-to-mailman.py
${nexthop} ${user}
dovecot unix - n n - - pipe
flags=DRhu user=email:email argv=/usr/lib/dovecot/deliver -f ${sender} -d ${recipient}
policy-spf unix - n n - - spawn
user=nobody argv=/usr/bin/policyd-spf
/var/log/mail.log의 로그는 다음과 같습니다.
Jan 6 16:20:41 vps127955 postfix/smtpd[16499]: connect from mail-we0-f170.google.com[1.1.1.1]
Jan 6 16:20:43 vps127955 policyd-spf[16501]: None; identity=helo; client-ip=1.1.1.1; helo=mail-we0-f170.google.com; [email protected]; [email protected]
Jan 6 16:20:43 vps127955 policyd-spf[16501]: Pass; identity=mailfrom; client-ip=1.1.1.1; helo=mail-we0-f170.google.com; [email protected]; [email protected]
Jan 6 16:20:43 vps127955 postfix/smtpd[16499]: NOQUEUE: reject: RCPT from mail-we0-f170.google.com[1.1.1.1]: 554 5.7.1 <[email protected]>: Relay access denied; from=<[email protected]> to=<[email protected]> proto=ESMTP helo=<mail-we0-f170.google.com>
Jan 6 16:20:43 vps127955 postfix/smtpd[16499]: disconnect from mail-we0-f170.google.com[1.1.1.1]
이 문제를 어떻게 해결할 수 있나요?
편집 1: 내가 보내려고 할 때[이메일 보호됨]도착하다[이메일 보호됨]메일이 배달되지 않고 다음과 같은 메시지가 나타납니다.
Jan 6 17:09:22 vps127955 postfix/smtpd[16675]: A00BF2C00CBE: client=localhost[::1]
Jan 6 17:09:27 vps127955 postfix/cleanup[16685]: A00BF2C00CBE: message-id=<[email protected]>
Jan 6 17:09:27 vps127955 postfix/qmgr[16476]: A00BF2C00CBE: from=<[email protected]>, size=354, nrcpt=1 (queue active)
Jan 6 17:09:27 vps127955 postfix/smtp[16686]: A00BF2C00CBE: to=<[email protected]>, relay=none, delay=13, delays=13/0.03/0.02/0, dsn=5.4.6, status=bounced (mail for example.ru loops back to myself)
Jan 6 17:09:27 vps127955 postfix/cleanup[16685]: E5DB12C00CC1: message-id=<[email protected]>
Jan 6 17:09:27 vps127955 postfix/qmgr[16476]: E5DB12C00CC1: from=<>, size=2549, nrcpt=1 (queue active)
Jan 6 17:09:27 vps127955 postfix/bounce[16687]: A00BF2C00CBE: sender non-delivery notification: E5DB12C00CC1
Jan 6 17:09:27 vps127955 postfix/qmgr[16476]: A00BF2C00CBE: removed
Jan 6 17:09:27 vps127955 postfix/smtp[16686]: E5DB12C00CC1: to=<[email protected]>, relay=none, delay=0.01, delays=0.01/0/0/0, dsn=5.4.6, status=bounced (mail for example.ru loops back to myself)
Jan 6 17:09:27 vps127955 postfix/qmgr[16476]: E5DB12C00CC1: removed
그런데 보내려고 하면[이메일 보호됨]도착하다[이메일 보호됨]이메일이 전달됐어요, 받았어요
Jan 6 17:10:52 vps127955 postfix/smtpd[16675]: 1E2762C00CBE: client=localhost[::1]
Jan 6 17:10:57 vps127955 postfix/cleanup[16685]: 1E2762C00CBE: message-id=<[email protected]>
Jan 6 17:10:57 vps127955 opendkim[14116]: 1E2762C00CBE: no signing table match for '[email protected]'
Jan 6 17:10:57 vps127955 opendkim[14116]: 1E2762C00CBE: no signature data
Jan 6 17:10:57 vps127955 postfix/qmgr[16476]: 1E2762C00CBE: from=<[email protected]>, size=368, nrcpt=1 (queue active)
Jan 6 17:10:58 vps127955 postfix/local[16690]: 1E2762C00CBE: to=<[email protected]>, relay=local, delay=17, delays=16/0.14/0/0.01, dsn=2.0.0, status=sent (delivered to maildir)
Jan 6 17:10:58 vps127955 postfix/qmgr[16476]: 1E2762C00CBE: removed
답변1
main.cf에서 이 줄을 변경했습니다.
mydestination = $myhostname localhost.$mydomain $mydomain
행 입력
mydestination = $myhostname localhost.$mydomain $mydomain example.ru
이제 모든 것이 잘 돌아가고 있는 것 같습니다. 그러나 문제의 실제 원인이 무엇인지 아시는 분이 계시다면 알려주세요!