介绍
警告 !
我知道,这个问题已经被问过了。但是结果对我没有帮助,所以我将我的错误详细说明给你。
我的演说
您好,我是一名 IT 科学专业的法国学生,我正在参与创建电子邮件服务器的项目!
我过去在发送和接收邮件时遇到了几个问题......
今天的结果
现在我又遇到了发送和接收邮件的问题!
但我在 SSL/TLS 中,所以 IMAP 端口是 993,SMTP 端口是 465。
为了创建我的电子邮件服务器,我使用 postfix 和 Dovecot。对于域名,我使用 NoIP。
保密问题,域名为:cookie.ddns.net,邮件域名为:cookiemail.ddns.net。
在 NoIP 中,我在 cookie.ddns.net 中添加了一个 MX ,即cookiemail.ddns.net。
服务器在 Xubuntu 上。
错误代码
NOQUEUE: reject: RCPT from localhost[127.0.0.1]: 554 5.7.1 <localhost[127.0.0.1]>: Client host rejected: Access denied; from=<admin@cookie.ddns.net> to=<xxxxxx@protonmail.com> prot
o=ESMTP helo=<cookiemail.ddns.net>
我的配置
/etc/postfix/main.cf
# See /usr/share/postfix/main.cf.dist for a commented, more complete version
# Debian specific: Specifying a file name will cause the first
# line of that file to be used as the name. The Debian default
# is /etc/mailname.
myorigin = /etc/mailname
myhostname = cookiemail.ddns.net
mydomain = cookie.ddns.net
smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
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
# See http://www.postfix.org/COMPATIBILITY_README.html -- default to 2 on
# fresh installs.
compatibility_level = 2
# TLS parameters
smtpd_tls_mandatory_protocols =
smtpd_tls_protocols =
smtp_use_tls = yes
smtp_tls_note_starttls_offer = yes
smtpd_tls_auth_only = no
smtpd_tls_key_file = /etc/letsencrypt/live/cookie.ddns.net/privkey.pem
smtpd_tls_cert_file = /etc/letsencrypt/live/cookie.ddns.net/cert.pem
smtpd_tls_CAfile = /etc/letsencrypt/live/cookie.ddns.net/chain.pem
smtpd_tls_loglevel = 3
#smtpd_tls_protocols = !SSLv2, !SSLv3
smtpd_tls_received_header = yes
smtpd_tls_session_cache_timeout = 3600s
tls_random_source = dev:/dev/urandom
smtpd_recipient_limit = 100
#smtpd_helo_restrictions = reject_invalid_hostname
smtpd_sender_restrictions = reject_unknown_address
smtpd_recipient_restrictions = permit_sasl_authenticated,
check_recipient_access,
permit_mynetworks,
reject_unauth_destination,
reject_unknown_sender_domain,
reject_unknown_client,
permit
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
# See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for
# information on enabling SSL in the smtp client.
smtpd_sasl_local_domain = $myhostname
smtp_sasl_auth_enable = yes
smtp_sasl_security_options = noplaintext,noanonymous
smtp_sasl_tls_security_options = noanonymous
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
broken_sasl_auth_clients = yes
smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth
smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
transport_maps = hash:/etc/postfix/transport
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = $mydomain $myhostname localhost.$mydomain localhost
relayhost = cookie.ddns.net:587
mynetworks_style = subnet
mynetworks = 127.0.0.0/8 192.168.1.0/24
mailbox_size_limit = 51200000
recipient_delimiter = +
inet_interfaces = all
inet_protocols = all
mailbox_command =
home_mailbox = Maildir/
message_size_limit = 20480000
/etc/postfix/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" or
# on-line: http://www.postfix.org/master.5.html).
#
# Do not forget to execute "postfix reload" after editing this file.
#
# ==========================================================================
# service type private unpriv chroot wakeup maxproc command + args
# (yes) (yes) (no) (never) (100)
# ==========================================================================
smtp inet n - y - - smtpd
#smtp inet n - y - 1 postscreen
#smtpd pass - - y - - smtpd
#dnsblog unix - - y - 0 dnsblog
#tlsproxy unix - - y - 0 tlsproxy
submission inet n - y - - smtpd
-o syslog_name=postfix/submission
-o smtpd_tls_security_level=encrypt
-o smtpd_sasl_auth_enable=yes
-o smtpd_sasl_type=dovecot
-o smtpd_sasl_path=private/auth
-o smtpd_sasl_security_options=noanonymous
-o smtpd_sasl_local_domain=$myhostname
-o smtpd_sender_restrictions=reject_sender_login_mismatch
-o smtpd_recipient_restrictions=reject_non_fqdn_recipient,reject_unknown_recipient_domain,permit_sasl_authenticated,reject
-o smtpd_tls_auth_only=yes
-o smtpd_reject_unlisted_recipient=no
-o smtpd_client_restrictions=permit_sasl_authenticated,reject
# -o smtpd_helo_restrictions=$mua_helo_restrictions
# -o smtpd_sender_restrictions=$mua_sender_restrictions
-o smtpd_relay_restrictions=permit_sasl_authenticated,reject
-o milter_macro_daemon_name=ORIGINATING
smtps inet n - y - - smtpd
-o syslog_name=postfix/smtps
-o smtpd_tls_wrappermode=yes
-o smtpd_sasl_auth_enable=yes
-o broken_sasl_auth_clients=yes
-o content_filter=
-o smtpd_reject_unlisted_recipient=no
# -o smtpd_client_restrictions=$mua_client_restrictions
# -o smtpd_helo_restrictions=$mua_helo_restrictions
# -o smtpd_sender_restrictions=$mua_sender_restrictions
-o smtpd_recipient_restrictions=permit_sasl_authenticated,reject
-o smtpd_relay_restrictions=permit_sasl_authenticated,reject
-o milter_macro_daemon_name=ORIGINATING
#628 inet n - y - - qmqpd
pickup unix n - y 60 1 pickup
cleanup unix n - y - 0 cleanup
qmgr unix n - n 300 1 qmgr
#qmgr unix n - n 300 1 oqmgr
tlsmgr unix - - y 1000? 1 tlsmgr
rewrite unix - - y - - trivial-rewrite
bounce unix - - y - 0 bounce
defer unix - - y - 0 bounce
trace unix - - y - 0 bounce
verify unix - - y - 1 verify
flush unix n - y 1000? 0 flush
proxymap unix - - n - - proxymap
proxywrite unix - - n - 1 proxymap
smtp unix - - y - - smtp
relay unix - - y - - smtp
-o syslog_name=postfix/$service_name
# -o smtp_helo_timeout=5 -o smtp_connect_timeout=5
showq unix n - y - - showq
error unix - - y - - error
retry unix - - y - - error
discard unix - - y - - discard
local unix - n n - - local
virtual unix - n n - - virtual
lmtp unix - - y - - lmtp
anvil unix - - y - 1 anvil
scache unix - - y - 1 scache
postlog unix-dgram n - n - 1 postlogd
#
# ====================================================================
# 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}
/etc/后缀/传输
cookie.ddns.net :
/etc/dovecot/dovecot.conf
disable_plaintext_auth = no
mail_privileged_group = mail
mail_location = mbox:~/mail:INBOX=/var/mail/%u
userdb {
driver = passwd
}
passdb {
args = %s
driver = pam
}
protocols = " imap"
auth_mechanisms = plain login
protocol imap {
mail_plugins = " autocreate"
}
plugin {
autocreate = Trash
autocreate2 = Sent
autosubscribe = Trash
autosubscribe2 = Sent
}
service auth {
unix_listener /var/spool/postfix/private/auth {
group = postfix
mode = 0660
user = postfix
}
}
ssl=required
ssl_cert = </etc/letsencrypt/live/cookie.ddns.net/cert.pem
ssl_key = </etc/letsencrypt/live/cookie.ddns.net/privkey.pem
ssl_min_protocol=TLSv1
结果挖掘命令
; <<>> DiG 9.11.5-P4-5.1ubuntu2.1-Ubuntu <<>> cookie.ddns.net MX
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 57899
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 65494
;; QUESTION SECTION:
;cookie.ddns.net. IN MX
;; ANSWER SECTION:
cookie.ddns.net. 1047 IN MX 5 cookiemail.ddns.net.
;; Query time: 0 msec
;; SERVER: 127.0.0.53#53(127.0.0.53)
;; WHEN: mar. avril 21 12:15:30 CEST 2020
;; MSG SIZE rcvd: 65
测试
在 mynetworks 变量上添加 [::1]/128
当我收到一条消息时,我遇到了这个错误:
NOQUEUE: reject: RCPT from mail-40131.protonmail.ch[185.70.40.131]: 451 4.3.5 Server configuration error; from=<xxxxxx@protonmail.com> to=<admin@cookie.ddns.net> proto=ESMTP helo=<mail-40131.
protonmail.ch>
但是当我编辑我的 /etc/postfix/main.cf 时:
smtpd_recipient_restrictions = permit_sasl_authenticated,
#check_recipient_access,
#permit_mynetworks,
#reject_unauth_destination,
#reject_unknown_sender_domain,
#reject_unknown_client,
#permit
我没有这个错误,我有:
Apr 21 16:17:55 postfix/smtpd[53393]: connect from mail1.protonmail.ch[185.70.40.18]
Apr 21 16:17:55 postfix/smtpd[53393]: 767E842C002D: client=mail1.protonmail.ch[185.70.40.18]
Apr 21 16:17:55 postfix/cleanup[53397]: 767E842C002D: message-id=<cBVyJEUSK36qCWUokN9mqHqAx5Mt7FYCL9Jq2FgO3TQ9dk-bEFs6ZkRD336yrrN3Qb8P04okSJjHrDVMZlGm2Qx_WtjJydAYpljxY7n9V9E=@protonmail.com>
Apr 21 16:17:55 postfix/smtpd[53393]: disconnect from mail1.protonmail.ch[185.70.40.18] ehlo=1 mail=1 rcpt=1 data=1 quit=1 commands=5
Apr 21 16:17:55 postfix/qmgr[53040]: 767E842C002D: from=<xxxxxx@protonmail.com>, size=1862, nrcpt=1 (queue active)
Apr 21 16:17:55 postfix/local[53398]: 767E842C002D: to=<admin@cookie.ddns.net>, relay=local, delay=0.07, delays=0.06/0.01/0/0, dsn=2.0.0, status=sent (delivered to maildir)
Apr 21 16:17:55 postfix/qmgr[53040]: 767E842C002D: removed
但是我没有收到任何消息。
在决赛中
预先感谢您的帮助 !
我希望你能帮助我!