web-dev-qa-db-ja.com

PostfixSMTP認証が仮想メールボックスで機能しない+ SASL + Courier userdb

だから私はさまざまなチュートリアルとハウツーを読み、Postfixの仮想メールボックスでSMTP認証を機能させる方法を理解するのに苦労しています。私はこれを使用しました buntuチュートリアル セットアップしました。問題なく動作しているように見えるメールを読むためにCourier-IMAPとPOP3を使用しています。

ただし、メールボックスの読み取りに使用される資格情報はSMTPでは機能しません。 /var/log/auth.logから、PAMが使用されていることがわかりますが、これを機能させるにはUNIXユーザーアカウントが必要ですか?ユーザーアカウントの作成を避けるために仮想メールボックスを使用しているため。

li305-246 saslauthd[22856]: DEBUG: auth_pam: pam_authenticate failed: Authentication failure
li305-246 saslauthd[22856]: do_auth         : auth failure: [user=fred] [service=smtp] [realm=] [mech=pam] [reason=PAM auth error]

/var/log/mail.log

li305-246 postfix/smtpd[27091]: setting up TLS connection from mail-pb0-f43.google.com[209.85.160.43]
li305-246 postfix/smtpd[27091]: Anonymous TLS connection established from mail-pb0-f43.google.com[209.85.160.43]: TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)
li305-246 postfix/smtpd[27091]: warning: SASL authentication failure: Password verification failed
li305-246 postfix/smtpd[27091]: warning: mail-pb0-f43.google.com[209.85.160.43]: SASL PLAIN authentication failed: authentication failure

このチュートリアル に従ってuserdbにアカウントを作成しました。 Postfixもauthuserdbを使用しますか?

問題の診断に役立つデバッグ情報は何ですか?

main.cf:

# TLS parameters
smtpd_tls_cert_file = /etc/ssl/certs/smtpd.crt
smtpd_tls_key_file = /etc/ssl/private/smtpd.key
smtpd_use_tls=yes
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache

# SMTP parameters

smtpd_sasl_local_domain =
smtpd_sasl_auth_enable = yes
smtpd_sasl_security_options = noanonymous
broken_sasl_auth_clients = yes
smtpd_recipient_restrictions = permit_sasl_authenticated,permit_mynetworks,reject_unauth_destination
smtp_tls_security_level = may
smtpd_tls_security_level = may
smtpd_tls_auth_only = no
smtp_tls_note_starttls_offer = yes
smtpd_tls_CAfile = /etc/ssl/certs/cacert.pem
smtpd_tls_loglevel = 1
smtpd_tls_received_header = yes
smtpd_tls_session_cache_timeout = 3600s
tls_random_source = dev:/dev/urandom

/etc/postfix/sasl/smtpd.conf

pwcheck_method: saslauthd
mech_list: plain login

/etc/default/saslauthd

START=yes

PWDIR="/var/spool/postfix/var/run/saslauthd"
PARAMS="-m ${PWDIR}"
PIDFILE="${PWDIR}/saslauthd.pid"
DESC="SASL Authentication Daemon"
NAME="saslauthd"
MECHANISMS="pam"
MECH_OPTIONS=""
THREADS=5
OPTIONS="-c -m /var/spool/postfix/var/run/saslauthd"

/etc/courier/authdaemonrc

authmodulelist="authuserdb"

authdaemonrcの1行だけを変更し、 このチュートリアル に従ってサービスを再起動しました。 userdbuserdbpwを介して/etc/courier/userdbにアカウントを追加し、チュートリアルに従ってmakeuserdbを実行しました。

[〜#〜]解決済み[〜#〜]

ローカルホストIMAPサーバー(userdb資格情報を読み取る)に対して認証するためにrimapの使用を提案してくれたJennyDに感謝します。

/etc/default/saslauthdを更新してsaslauthdを正しく開始しました( このページ 役に立ちました)

MECHANISMS="rimap"
MECH_OPTIONS="localhost"
THREADS=0
OPTIONS="-c -m /var/spool/postfix/var/run/saslauthd -r"

これを行った後、/var/log/auth.logで次のエラーが発生しました。

li305-246 saslauthd[28093]: auth_rimap: unexpected response to auth request: * BYE [ALERT] Fatal error: Account's mailbox directory is not owned by the correct uid or gid: 
li305-246 saslauthd[28093]: do_auth         : auth failure: [user=fred] [service=smtp] [realm=] [mech=rimap] [reason=[ALERT] Unexpected response from remote authentication server]

このブログ投稿IMAP_MAILBOX_SANITY_CHECK=0/etc/courier/imapdを設定して解決策を詳しく説明しました。

次に、設定の変更を有効にするために、courierデーモンとsaslauthdデーモンを再起動します。

Sudo /etc/init.d/courier-imap restart
Sudo /etc/init.d/courier-authdaemon restart
Sudo /etc/init.d/saslauthd restart

メールを送信しようとしている間、/var/log/auth.logを監視します。うまくいけば、あなたは元気です!

2
Greg K

これは実際には、Postfixの質問というよりもsaslの質問です。 saslと通信するために接尾辞を設定しました-これまでのところ、とても良いです。次に、ユーザー名とパスワードの場所をsaslauthdに指示する必要があります。引数を指定しない場合、デフォルトでローカルユーザーとして扱われます。これは、auth.logに表示されているものです。

私の知る限り(SASLに関してはそれほど遠くないかもしれませんが)、pop3の仮想ユーザーと同じデータベースを使用していません。しかし、saslauthdが同じ資格情報でIMAPサーバーにログインしようとするオプションがあります-それはあなたが望むことをするはずだと私は思います。

これを行うには、次のようにsaslauthdを開始します。

saslauthd -a rimap -O myimap.server.com

Saslインストールに付属しているプログラムtestsaslauthdを使用して認証をテストできるはずです。幸運を!

3
Jenny D