Failure to contact dovecot on port 993
Imapfilter is failing to login with port 993. I had this same issue with a previous version, but I updated to 2.8.1 (on NixOS 23.05) for this test:
$ imapfilter -V
IMAPFilter 2.8.1 Copyright (c) 2001-2023 Eleftherios Chatzimparmpas
I can replicate the issue an a local dovecot serving both 143 and 993:
Here is the dovecot log for imapfilter contacting port 143 (all good):
Jul 10 12:02:55 silver dovecot[1173]: imap-login: Login: user=<acarrico@...>, method=PLAIN, rip=::1, lip=::1, mpid=102462, TLS, session=<Wx...>
Jul 10 12:02:55 silver dovecot[1173]: imap(acarrico@...)<102462><Wx...>: Disconnected: Logged out in=98 out=1105 deleted=0 expunged=0 trashed=0 hdr_count=0 hdr_bytes=0 body_count=0 body_bytes=0
Here is the dovecot log for imapfilter contacting port 993 (imapfilter fails to login):
Jul 10 12:04:16 silver dovecot[1173]: imap-login: Disconnected: Connection closed (no auth attempts in 60 secs): user=<>, rip=::1, lip=::1, TLS handshaking: Connection closed, session=<Hw...>
Thunderbird has no problem with port 993 (all good):
Jul 10 12:10:34 silver dovecot[1173]: imap-login: Login: user=<[email protected]>, method=PLAIN, rip=::1, lip=::1, mpid=102631, TLS, session=<gR...>
Jul 10 12:10:35 silver dovecot[1173]: imap-login: Login: user=<[email protected]>, method=PLAIN, rip=::1, lip=::1, mpid=102634, TLS, session=<3yj...>
Jul 10 12:10:54 silver dovecot[1173]: imap([email protected])<102631><gR...>: Disconnected: Logged out in=146 out=1027 deleted=0 expunged=0 trashed=0 hdr_count=0 hdr_bytes=0 body_count=0 body_bytes=0
Jul 10 12:10:54 silver dovecot[1173]: imap([email protected])<102634><3y...>: Disconnected: Logged out in=204 out=1299 deleted=0 expunged=0 trashed=0 hdr_count=0 hdr_bytes=0 body_count=0 body_bytes=0
Here is the imapfilter command line:
[acarrico@silver:~/tmp/mailtest]$ imapfilter -c imapfilter_test.lua -l log.txt -d debug.txt
imapfilter: timeout period expired while waiting to read data
imapfilter: login request to [email protected]@silver.memebeam.org failed
stack traceback:
[C]: in ?
[C]: in function 'error'
...ipk6366bc5-imapfilter-2.8.1/share/imapfilter/account.lua:75: in function '_check_result'
...ipk6366bc5-imapfilter-2.8.1/share/imapfilter/account.lua:93: in function '_login_user'
...ipk6366bc5-imapfilter-2.8.1/share/imapfilter/mailbox.lua:32: in function '_check_connection'
...ipk6366bc5-imapfilter-2.8.1/share/imapfilter/mailbox.lua:501: in function 'check_status'
imapfilter_test.lua:94: in function 'test_server'
imapfilter_test.lua:103: in main chunk
log.txt:
Mon Jul 10 12:16:36 2023: timeout period expired while waiting to read data
Mon Jul 10 12:16:36 2023: login request to [email protected]@silver.memebeam.org failed
stack traceback:
[C]: in ?
[C]: in function 'error'
...ipk6366bc5-imapfilter-2.8.1/share/imapfilter/account.lua:75: in function '_check_result'
...ipk6366bc5-imapfilter-2.8.1/share/imapfilter/account.lua:93: in function '_login_user'
...ipk6366bc5-imapfilter-2.8.1/share/imapfilter/mailbox.lua:32: in function '_check_connection'
...ipk6366bc5-imapfilter-2.8.1/share/imapfilter/mailbox.lua:501: in function 'check_status'
imapfilter_test.lua:94: in function 'test_server'
imapfilter_test.lua:103: in main chunk
debug.txt:
log file: 'log.txt'
The test is just doing account["INBOX"]:check_status()
The failing account looks like:
account = IMAP {
server = "...",
username = "...",
password = "...",
port = 993,
ssl = auto
}
The successful account is the same, except port = 143.
It seems to work by hand. Although I don't know how to login exactly, the server does engage in dialog over the tls connection:
$ openssl s_client -connect blah:993 -CAfile /etc/ssl/certs/ca-certificates.crt
CONNECTED(00000003)
depth=1 CN = minica root ca 47261f
verify return:1
... etc. etc. ....
---
read R BLOCK
* OK [CAPABILITY IMAP4rev1 SASL-IR LOGIN-REFERRALS ID ENABLE IDLE LITERAL+ AUTH=PLAIN AUTH=LOGIN] Dovecot ready.
a001 login acarrico@blah wrongly_encoded_password
a001 NO [AUTHENTICATIONFAILED] Authentication failed.
C-c C-c
So it doesn't seem to be timing out as imapfilter is doing.
Thank you
The problem is that you're using ssl = auto. As the variable auto is nil this means that you basically set ssl = nil, which disables SSL. Then you're configure it to connect to port 993, but without SSL, which can't work.
First you don't need the port = 993, as by default that's used when SSL is enabled. Then try with ssl = "auto", a string value.
As documented in the imapfilter_config(5) page for ssl:
It takes a string as a value, specifically one of: “auto”, “tls1.2”, “tls1.1”, “tls1”, “ssl3”.
Got it--a syntax error! Thank you.