そこで、次の問題が発生します。次のチュートリアルに従ってメール サーバーをセットアップしようとしています。https://workaround.org/ispmail/wheezy/
問題は、最初のテストメール(システム内)を送信しようとしたときに発生し、次のメッセージが表示されます。
postfix/pickup[15883]: F34B965841CF: uid=1000 from=<webmaster>
postfix/cleanup[15907]: F34B965841CF: [email protected]>
postfix/qmgr[15884]: F34B965841CF: from=<[email protected]>, size=398, nrcpt=1 (queue active)
dovecot: auth-worker(15911): Warning: mysql: Query failed, retrying: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '@example.org.' at line 1
dovecot: auth-worker(15911): Error: sql([email protected]): Password query failed: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '@example.org.' at line 1
dovecot: lda: Error: user [email protected]: Auth USER lookup failed
dovecot: lda: Fatal: Internal error occurred. Refer to server log for more information.
postfix/pipe[15909]: F34B965841CF: to=<[email protected]>, relay=dovecot, delay=0.02, delays=0.01/0/0/0.02, dsn=4.3.0, status=deferred (temporary failure)
問題は、チュートリアルの前半で、SQLクエリが動作するかどうかを手動で試す必要があることです。
postmap -q example.org mysql:/etc/postfix/mysql-virtual-mailbox-domains.cf
などなど。そして私の場合、それはうまくいきました。まったく問題ありません。
私のファイルはチュートリアルとほぼ同じです
mysql-仮想メールボックスドメイン.cf
user = mailuser
password = <pw>
hosts = mailserver
query = SELECT 1 FROM virtual_domains WHERE name='%s'
mysql-仮想エイリアスマップ.cf
user = mailuser
password = <pw>
hosts = mailserver
query = SELECT destination FROM virtual_aliases WHERE source='%s'
などなど。これまでにこれに遭遇した人はいますか?何か解決策やアイデアはありますか?
答え1
ログによると、失敗しているのはpassword_query
dovecot によって発行されたものです。
チュートリアルよりhttps://workaround.org/ispmail/wheezy/setting-up-dovecot
そのまま貼り付けたクエリは次のとおりです。
password_query = SELECT email as user, password FROM virtual_users WHERE email=’%u’;
引用符は、%u
通常の ASCII 引用符ではなく、Unicode の特殊引用符です。これは誤りであり、上記のようにクエリをコピーして貼り付けた場合にクエリが失敗する理由を説明しています。次のように、通常の単一引用符に置き換える必要があります。
password_query = SELECT email as user, password FROM virtual_users WHERE email='%u';
通常、これはチュートリアルで使用されている公開プラットフォームのせいで、フィルターを使用して通常の引用符を装飾的な引用符に自動的に置き換えます。これは、コードを公開するときには完全に間違っています。https://en.wikipedia.org/wiki/Quotation_markこの実践については一節があります。