我使用 sendmail 和 dovecot 设置了一个新的远程 CentOS 电子邮件服务器。我能够将邮件接收到邮箱中,但无法使用 SMTP 发送。
尝试使用手动登录
# telnet mail.steelydev.com 25
Trying 100.100.100.100...
Connected to mail.domain.com.
Escape character is '^]'.
220 domain.com ESMTP
ehlo www.domain2.com
250-domain.com Hello pool-100-100-198-241.man.east.myfairpoint.net [100.100.198.241], pleased to meet you
250-ENHANCEDSTATUSCODES
250-PIPELINING
250-8BITMIME
250-SIZE 15000000
250-DSN
250-ETRN
250-AUTH GSSAPI CRAM-MD5 LOGIN PLAIN
250-STARTTLS
250-DELIVERBY
250 HELP
auth plain AGdlb2ZmAEpCUXhCOXJ6YnkxXX==
535 5.7.0 authentication failed
就好像我的用户都不存在一样。 那么 sendmail 从哪里获取密码?
编辑1
根据我的 ISP 实际上为我提供了他们的 SMTP 的建议,我修改了 sendmail.mc 以删除 DIGEST-MD5,正如您在上面更新的 telnet 会话中所看到的那样。
另外,我很欣赏其他的意见,但我还是会回到规范方法来调试服务器。我认为从 25 开始使用普通身份验证是最简单的。
通过 apache 运行的 roundcube webmail 可以毫无问题地发送和接收。我知道它使用 dovecot 和 /etc/dovecot/users 进行身份验证。
已安装的软件不包括 www 内容 apache、roundcube...
CentOS Linux release 7.5.1804
yum install sendmail sendmail-cf m4
yum install telnet
yum install mail
yum install mailx
yum install netstat
yum install apt-get
yum install net-tools
yum install dovecot squirrelmail
yum -y install epel-release
yum -y install --disablerepo-epel*
yum install httpd php php-common php-json php-xml php-mbstring php-imap php-pear-DB php-mysql mysql mariadb-server
yum install httpd mod_ssl
yum install dig
yum install bind-utils
yum install epel-release
yum install httpd mod_ssl python-certbot-apache
yum install cyrus-sasl-gssapi
yum install cyrus-sasl-md5
yum install cyrus-sasl
yum install cyrus-plain
yum install cyrus-sasl-plain
yum install cyrus-sasl-devel
yum install httpd mod_ssl
删除了未使用的行后的 sendmail.mc 文件:
divert(-1)dnl
include(`/usr/share/sendmail-cf/m4/cf.m4')dnl
VERSIONID(`setup for linux')dnl
OSTYPE(`linux')dnl
define(`confDEF_USER_ID', ``8:12'')dnl
define(`confTO_CONNECT', `1m')dnl
define(`confTRY_NULL_MX_LIST', `True')dnl
define(`confDONT_PROBE_INTERFACES', `True')dnl
define(`PROCMAIL_MAILER_PATH', `/usr/bin/procmail')dnl
define(`ALIAS_FILE', `/etc/aliases')dnl
define(`STATUS_FILE', `/var/log/mail/statistics')dnl
define(`UUCP_MAILER_MAX', `2000000')dnl
define(`confUSERDB_SPEC', `/etc/mail/userdb.db')dnl
define(`confPRIVACY_FLAGS', `authwarnings,novrfy,noexpn,restrictqrun')dnl
define(`confAUTH_OPTIONS', `A')dnl
TRUST_AUTH_MECH(`EXTERNAL DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl
define(`confAUTH_MECHANISMS', `EXTERNAL GSSAPI CRAM-MD5 LOGIN PLAIN')dnl
define(`confTO_IDENT', `0')dnl
FEATURE(`no_default_msa', `dnl')dnl
FEATURE(`smrsh', `/usr/sbin/smrsh')dnl
FEATURE(`mailertable', `hash -o /etc/mail/mailertable.db')dnl
FEATURE(`virtusertable', `hash -o /etc/mail/virtusertable.db')dnl
FEATURE(redirect)dnl
FEATURE(always_add_domain)dnl
FEATURE(use_cw_file)dnl
FEATURE(use_ct_file)dnl
FEATURE(local_procmail, `', `procmail -t -Y -a $h -d $u')dnl
FEATURE(`access_db', `hash -T<TMPF> -o /etc/mail/access.db')dnl
FEATURE(`blacklist_recipients')dnl
EXPOSED_USER(`root')dnl
FEATURE(`accept_unresolvable_domains')dnl
LOCAL_DOMAIN(`localhost.localdomain')dnl
define(`confCACERT_PATH', `/etc/letsencrypt/live/mail.domain.com')dnl
define(`confCACERT', `/etc/letsencrypt/live/mail.domain.com/fullchain.pem')dnl
define(`confSERVER_CERT', `/etc/letsencrypt/live/mail.domain.com/fullchain.pem')dnl
define(`confSERVER_KEY', `/etc/letsencrypt/live/mail.domain.com/privkey.pem')dnl
define(`confCLIENT_CERT', `/etc/letsencrypt/live/mail.domain.com/fullchain.pem')dnl
define(`confCLIENT_KEY', `/etc/letsencrypt/live/mail.domain.com/privkey.pem')dnl
DAEMON_OPTIONS(`Family=inet, Port=465, Name=MTA-SSL, M=s')dnl
define(`confDEF_CHAR_SET', `iso-8859-1')dnl
define(`confMAX_MESSAGE_SIZE', `15000000')dnl Denial of Service Attacks
define(`confMAX_DAEMON_CHILDREN', `30')dnl Denial of Service Attacks
define(`confCONNECTION_RATE_THROTTLE', `2')dnl Denial of Service Attacks
define(`confMAXRCPTSPERMESSAGE', `50')dnl Denial of service Attacks
define(`confSINGLE_LINE_FROM_HEADER', `True')dnl
define(`confSMTP_LOGIN_MSG', `$j')dnl
define(`confDONT_PROBE_INTERFACES', `True')dnl
define(`confTO_INITIAL', `6m')dnl
define(`confTO_CONNECT', `20s')dnl
define(`confTO_HELO', `5m')dnl
define(`confTO_HOSTSTATUS', `2m')dnl
define(`confTO_DATAINIT', `6m')dnl
define(`confTO_DATABLOCK', `35m')dnl
define(`confTO_DATAFINAL', `35m')dnl
define(`confDIAL_DELAY', `20s')dnl
define(`confNO_RCPT_ACTION', `add-apparently-to')dnl
define(`confALIAS_WAIT', `0')dnl
define(`confMAX_HOP', `35')dnl
define(`confQUEUE_LA', `5')dnl
define(`confREFUSE_LA', `12')dnl
define(`confSEPARATE_PROC', `False')dnl
define(`confCON_EXPENSIVE', `true')dnl
define(`confWORK_RECIPIENT_FACTOR', `1000')dnl
define(`confWORK_TIME_FACTOR', `3000')dnl
define(`confQUEUE_SORT_ORDER', `Time')dnl
define(`confPRIVACY_FLAGS', `authwarnings,goaway,restrictmailq,restrictqrun,needmailhelo')dnl
FEATURE(`delay_checks')dnl
FEATURE(`generics_entire_domain')dnl
FEATURE(`local_procmail')dnl
FEATURE(`masquerade_envelope')dnl
FEATURE(`nouucp',`reject')dnl
FEATURE(`redirect')dnl
FEATURE(`relay_entire_domain')dnl
FEATURE(`use_cw_file')dnl
FEATURE(`virtuser_entire_domain')dnl
FEATURE(dnsbl,`blackholes.mail-abuse.org',
` Mail from $&{client_addr} rejected; see http://mail-abuse.org/cgi-bin/lookup?$& {client_addr}')dnl
FEATURE(dnsbl,`dialups.mail-abuse.org',
` Mail from dial-up rejected; see http://mail-abuse.org/dul/enduser.htm')dnl
FEATURE(`virtusertable',`hash -o /etc/mail/virtusertable')dnl
FEATURE(access_db)dnl
FEATURE(lookupdotdomain)dnl
FEATURE(`blacklist_recipients')dnl
FEATURE(`no_default_msa')dnl
DAEMON_OPTIONS(`Port=smtp, Name=MTA')dnl
MAILER(local)dnl
MAILER(smtp)dnl
有些事情让我很烦,我不知道这是否正常,但是当我尝试手动验证或通过 roundcube 发送邮件时,sendmail 不会将任何消息写入 /var/log/maillog。正常吗?
编辑2
我正在使用以下命令生成身份验证纯字符串:
echo -ne "\0user\0password" | base64
...然后通过 telnet 复制并粘贴