메일을 보낼 때 Dovecot, MySQL 오류로 Postfix 설정

메일을 보낼 때 Dovecot, MySQL 오류로 Postfix 설정

그래서 다음 문제. 여기 이 튜토리얼을 따라 느슨하게 메일 서버를 설정하려고 합니다.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-가상-별칭-maps.cf

user = mailuser
password = <pw>
hosts = mailserver
query = SELECT destination FROM virtual_aliases WHERE source='%s'

등등. 누구든지 전에 이런 일을 겪은 적이 있습니까? 어떤 해결책이나 아이디어가 있습니까?

답변1

로그에 따르면 실패한 것은 password_query비둘기장에서 발행한 것입니다.

튜토리얼에서https://workaround.org/ispmail/wheezy/setting-up-dovecot
그대로 붙여넣은 쿼리는 다음과 같습니다.

password_query = SELECT email as user, password FROM virtual_users WHERE email=’%u’;

주변의 따옴표는 %u일반 ASCII 따옴표와 달리 유니코드 멋진 따옴표입니다. 그것은 잘못된 것이며 위에서 했던 것처럼 해당 쿼리를 복사하여 붙여넣은 경우 쿼리가 실패하는 이유를 설명합니다. 다음과 같이 일반 작은따옴표로 바꿔야 합니다.

password_query = SELECT email as user, password FROM virtual_users WHERE email='%u';

일반적으로 필터를 사용하여 일반 따옴표를 멋진 따옴표로 자동 교체하는 것은 튜토리얼에서 사용하는 게시 플랫폼의 잘못입니다. 코드를 게시할 때 이는 완전히 잘못된 것입니다.https://en.wikipedia.org/wiki/Quotation_mark이 관행에 대한 단락이 있습니다.

관련 정보