无法让 SASL auxprop/sasldb 与 postfix/Ubuntu 12.04 一起工作

Qua*_*nic 9 ubuntu smtp postfix smtp-auth sasl

我有一个运行 Postfix 2.5.1 的 Ubuntu 8.04LTS 系统。在该系统上 SMTP AUTH 运行良好。内容为 /etc/postfix/sasl/smtpd.conf

pwcheck_method: auxprop
auxprop_plugin: sasldb
mech_list: PLAIN
Run Code Online (Sandbox Code Playgroud)

SASL 相关的属性是:

smtpd_sasl_type = cyrus
smtpd_sasl_auth_enable = yes
smtpd_sasl_path = smtpd
smtpd_sasl_security_options = noanonymous
broken_sasl_auth_clients = yes
smtpd_sasl_local_domain = $myhostname
Run Code Online (Sandbox Code Playgroud)

当我这样做时sudo sasldblistusers2

authusername@mail.mydomain.com: userPassword
Run Code Online (Sandbox Code Playgroud)

就像我说的,在 8.04LTS 系统上一切正常。

但是,我正在尝试将其迁移到运行 Postfix 2.9.3 的 Ubuntu 12.04LTS 系统,但我无法让它工作。我做的一切都是一样的,但是 postfix 每次都会导致身份验证失败。

这不是/etc/sasldb2文件。我试过从旧系统带过来文件,但不起作用。我使用以下命令创建了一个新文件:

saslpasswd2 -c -u mail.mydomain.com authusername
Run Code Online (Sandbox Code Playgroud)

而不起作用,但它WILL老系统上工作,如果我把它复制到旧的系统,这是我怎么知道有没有错的文件。

同样,我知道 postfix 正在查看该smtpd.conf文件。如果我mech_list在文件行中添加更多机制,当我连接到 smtpd 守护程序时,我会看到这些额外的机制被通告。当我删除它们时,它们又消失了。所以/etc/postfix/sasl/smtpd.conf显然正在被使用。

我正在使用实际的邮件客户端进行测试,并在生成令牌后手动与服务器通信:

perl -MMIME::Base64 -e 'print encode_base64("\000authusername\000thePassword");'
Run Code Online (Sandbox Code Playgroud)

然后:

openssl s_client -quiet -starttls smtp -connect the.newsystem.com:587
Run Code Online (Sandbox Code Playgroud)

由此产生的对话是:

250 DSN
EHLO example.com
250-the.newsystem.com
250-PIPELINING
250-SIZE 20971520
250-ETRN
250-AUTH PLAIN
250-AUTH=PLAIN
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN
AUTH PLAIN theBase64EncodedToken
535 5.7.8 Error: authentication failed: authentication failure
Run Code Online (Sandbox Code Playgroud)

但是如果我改为连接the.oldsystem.com:587并做同样的事情,我会得到:

235 2.7.0 Authentication successful
Run Code Online (Sandbox Code Playgroud)

saslfinger在新机器上的输出为:

# sudoh saslfinger -s
saslfinger - postfix Cyrus sasl configuration Sat Jul 21 00:24:24 EDT 2012
version: 1.0.4
mode: server-side SMTP AUTH

-- basics --
Postfix: 2.9.3
System: Ubuntu 12.04 LTS \n \l

-- smtpd is linked to --
        libsasl2.so.2 => /usr/lib/i386-linux-gnu/libsasl2.so.2 (0xb76c5000)


-- active SMTP AUTH and TLS parameters for smtpd --
broken_sasl_auth_clients = yes
smtpd_sasl_auth_enable = yes
smtpd_sasl_local_domain = $myhostname
smtpd_sasl_path = smtpd
smtpd_sasl_security_options = noanonymous
smtpd_sasl_type = cyrus
smtpd_tls_CAfile = /etc/ssl/certs/MyCA.pem
smtpd_tls_auth_only = yes
smtpd_tls_cert_file = /etc/postfix/ssl/server.crt
smtpd_tls_key_file = /etc/postfix/ssl/server.key
smtpd_tls_loglevel = 1
smtpd_tls_security_level = may
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtpd_tls_session_cache_timeout = 3600s


-- listing of /usr/lib/sasl2 --
total 16
drwxr-xr-x  2 root root 4096 Jul 20 23:00 .
drwxr-xr-x 67 root root 8192 Jul 20 21:25 ..
-rw-r--r--  1 root root    1 May  4 00:17 berkeley_db.txt

-- listing of /etc/postfix/sasl --
total 20
drwxr-xr-x 2 root root 4096 Jul 20 21:29 .
drwxr-xr-x 5 root root 4096 Jul 20 23:58 ..
-rw-r--r-- 1 root root   64 Jul 20 21:29 smtpd.conf



-- content of /etc/postfix/sasl/smtpd.conf --
pwcheck_method: auxprop
auxprop_plugin: sasldb
mech_list: PLAIN

-- content of /etc/postfix/sasl/smtpd.conf --
pwcheck_method: auxprop
auxprop_plugin: sasldb
mech_list: PLAIN


-- active services in /etc/postfix/master.cf --
# service type  private unpriv  chroot  wakeup  maxproc command + args
#               (yes)   (yes)   (yes)   (never) (100)
smtp      inet  n       -       -       -       -       smtpd
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

[snipping the rest of the services]

-- mechanisms on localhost --

-- end of saslfinger output --
Run Code Online (Sandbox Code Playgroud)

我可能遗漏了什么/做错了什么?据我所知,所有配置都是相同的,但它不适用于新系统。

Qua*_*nic 15

赠品在这里:

-- active services in /etc/postfix/master.cf --
# service type  private unpriv  chroot  wakeup  maxproc command + args
#               (yes)   (yes)   (yes)   (never) (100)
smtp      inet  n       -       -       -       -       smtpd
submission inet n       -       -       -       -       smtpd
Run Code Online (Sandbox Code Playgroud)

smtpd该工艺submission端口在chroot环境模式下运行(因为有一个-在该列,这意味着默认(这是yes)适用,所以看不到/etc/sasldb2

当我复制/etc/sasldb2/var/spool/postfix/etc身份验证开始工作正常。

  • 这条评论结束了今晚的 postfix 疯狂。另请记住,使用此配置将要求身份验证用户为 user@$myhostname,而不仅仅是“user”。这与我用于经过身份验证的中继的类似 exim 配置不同。 (3认同)

小智 5

chroot 绝对是原因,但是就我而言,复制到/var/spool/postfix/etc不起作用。

所以我刚刚摆脱了 chroot,这对我有用。

为此,您需要编辑 /etc/postfix/master.cf 找到以下行:

smtp      inet  n       -       -       -       -       smtpd
Run Code Online (Sandbox Code Playgroud)

并修改如下:

smtp      inet  n       -       n       -       -       smtpd
Run Code Online (Sandbox Code Playgroud)