AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / server / 问题 / 780329
Accepted
maddo7
maddo7
Asked: 2016-06-02 08:03:54 +0800 CST2016-06-02 08:03:54 +0800 CST 2016-06-02 08:03:54 +0800 CST

Postfix + SASL 使用错误的查询进行身份验证

  • 772

我最近按照本指南在 aws ec2 实例上设置了 postfix + dovecot:http: //flurdy.com/docs/postfix/#config-secure-auth

目前我坚持使用 SASL。

SQL 查询似乎不是已配置的内容。以下是配置:

/etc/postfix/sasl/smtpd.conf

节目

pwcheck_method: saslauthd
mech_list: plain login
log_level: 7
allow_plaintext: true
auxprop_plugin: sql
sql_engine: mysql
sql_hostnames: 127.0.0.1
sql_user: mail
sql_passwd: passwd
sql_database: maildb
sql_select: select crypt from users where id='%u@%r' and enabled = 1

和

/etc/sasl2/smtpd.conf

节目

pwcheck_method: saslauthd
mech_list: plain login
log_level: 7
allow_plaintext: true
auxprop_plugin: sql
sql_engine: mysql
sql_hostnames: 127.0.0.1
sql_user: mail
sql_passwd: password
sql_database: maildb
sql_select: select crypt from users where id='%u@%r' and enabled = 1

和

/etc/pam.d/smtp

#%PAM-1.0
auth required pam_mysql.so user=mail passwd=password host=127.0.0.1 db=maildb table=users usercolumn=id passwdcolumn=crypt crypt=1 debug
account sufficient pam_mysql.so user=mail passwd=password host=127.0.0.1 db=maildb table=users usercolumn=id passwdcolumn=crypt crypt=1 debug

现在配置文件定义select crypt from users where id='%u@%r' and enabled = 1为密码的选择查询。

当身份验证失败并检查/var/log/secure时,我发现使用了错误的选择查询:

Jun  1 15:50:13 ip-172-31-23-97 saslauthd[19892]: pam_mysql - SELECT crypt FROM users WHERE id = 'admin'
Jun  1 15:50:13 ip-172-31-23-97 saslauthd[19892]: pam_mysql - SELECT returned no result.
Jun  1 15:50:13 ip-172-31-23-97 saslauthd[19892]: pam_mysql - pam_mysql_check_passwd() returning 1.
Jun  1 15:50:13 ip-172-31-23-97 saslauthd[19892]: pam_mysql - pam_mysql_sql_log() called.
Jun  1 15:50:13 ip-172-31-23-97 saslauthd[19892]: pam_mysql - pam_mysql_sql_log() returning 0.
Jun  1 15:50:13 ip-172-31-23-97 saslauthd[19892]: pam_mysql - pam_sm_authenticate() returning 10.
Jun  1 15:50:13 ip-172-31-23-97 saslauthd[19892]: pam_mysql - pam_mysql_release_ctx() called.
Jun  1 15:50:13 ip-172-31-23-97 saslauthd[19892]: pam_mysql - pam_mysql_destroy_ctx() called.
Jun  1 15:50:13 ip-172-31-23-97 saslauthd[19892]: pam_mysql - pam_mysql_close_db() called.

这可能是什么原因?

mysql postfix saslauthd sasl
  • 1 1 个回答
  • 1718 Views

1 个回答

  • Voted
  1. Best Answer
    masegaloeh
    2016-06-03T10:42:42+08:002016-06-03T10:42:42+08:00

    在MySQL中使用postfix SASL有两种常用方法:

    • 使用 saslauthd 服务结合 pam_mysql
    • 将 sasl auxprop 与 sql 插件一起使用

    不幸的是,第二种方法有严重的安全缺陷:您必须以明文格式存储密码。因此,在您的情况下,您需要使用 saslauthd 和 pam_mysql。

    在上面的配置中,您混合了这两种方法:在pwcheck_method您放置 saslauthd 但您将 sasl 配置为auxprop_plugin与 sql 一起使用。将pwcheck_method覆盖它,因此参数 auxprop_plugin (以及您的所有sql_*参数)变得无用。这就解释了为什么你得到错误的查询。相反,SASL 将执行提供的查询/etc/pam.d/smtp。为了满足您的要求,请where在 pam 配置中添加其他参数

    ... passwdcolumn=crypt crypt=1 debug where=enabled=1
    ... passwdcolumn=crypt crypt=1 debug where=enabled=1
    

    对于您缺少领域 ( %r) 的问题,请尝试设置smtpd_sasl_local_domain为您的默认域。

    • 2

相关问题

  • 开源与专有关系 db mgt 系统的优缺点是什么?

  • 在 solaris 10 上为 mysql 设置 max_allowed_pa​​cket

  • 如何移动 MySQL 的数据目录?

  • 通过 VPN 连接什么是远程服务器 IP?

  • mysql崩溃

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve