I have a virtual server running on virtualmin with dovecot as IMAP and the only port open is 143. I have let’s encrypt certificate and everything has been running fine on this server for email with Dovecot and Postfix
root@web:~# postconf mail_version
mail_version = 3.4.23
root@web:~# dovecot --version
2.3.4.1 (f79e8e7e4)
Debian Linux 10
Webmin version 2.111
Virtualmin version 7.10.0
I am using PHP 8.2 with brew on a macbook. I use the following start of script to connect to the server
$imap = imap_open('{domain.ca:143/tls}INBOX', 'username', 'password');
var_dump(imap_last_error());exit;
I keep getting a SSL negotiation failed
regardless of /tls, /ssl or ssl/novalidate-cert. I have tried every combination and setting from the php manual. I have tried every solution on stack or online without any success.
It will only work if I do imap_open('{domain.ca:143/notls}INBOX', 'username', 'password');
Making this an unsecure connection. I would really like to know how I can make this a secure connection. What could I be doing wrong?
I also tried directly by the public IP. Postfix and dovecot are on domain.ca, not imap.domain.ca is that matters.
Warning: imap_open(): Couldn't open stream {domain.ca:143/tls}INBOX in /usr/local/var/www/index.php on line 5
string(58) "TLS/SSL failure for domain.ca: SSL negotiation failed"
Notice: PHP Request Shutdown: TLS/SSL failure for domain.ca: SSL negotiation failed (errflg=2) in Unknown on line 0
server journalctl says
ay 10 11:34:57 web.domain.ca dovecot[828]: imap-login: Disconnected (no auth attempts in 0 secs): user=<>, rip=x.x.x.x, lip=x.x.x.x, session=<qg0rRxsY/IVGNc6I>
so from what this log says, am I using this wrong? Should have have the auth. inside the ‘{domain.ca:143/notls}’ string? Or is this php extension configured not to check secure connect on 143?
Any help would be appriciated.
Thank you