Hi Kostya,
Thanks a lot for this comprehensive answer. I have to admit, though, that it frightens me considerably.
1 - The default "SSL (strict)" and "STARTTLS (strict)" only allow trusted CA.
That's grand.
2 - For self-signed certs, the user has to enable "SSL (accept any)" or "STARTTLS (accept any)" when configuring the account.
That's also reasonable.
A connection configured with "strict" will fail if the certificate changes to a self-signed one (even if it happens at a later point, not during setup).
That's also grand.
There is no domain name validation, because it's very, very uncommon for hosted domain accounts to use a certificate matching the custom domain (e.g. imap.bikinicarwash.com is actually imap.mailservice.com, whose SSL certificate has "*.mailservice.com" at best).
This is what really worries me.
If I understand correctly, AM will accept _any_ cert as long as it has been issued by a trusted CA? That means a MITM could present a random cert to intercept my communication with my mail server if the malicious cert is from a CA? In other words, anyone who has control over a network node along the way to my email server could perform an MITM attack and AM would accept the cert? That could be e.g. the owner or operator of the WiFi access point in any airport, hotel, cafe, etc. This sounds like a nightmare scenario.
I do understand your point about the certs not neccessarily matching the servers' fully qualified names. However, I'd like to propose two features which should significantly mitigate the problems described above:-
1: To add an option to AM to show the cert used. Even if the cert doesn't match the server's name perfectly, it should very often give you a good hint as to whether or not to trust it. E.g. if the server's name is mail.company.com and the cert is issued to *.company-inc.com there is a reasonable likelihood that the cert is not forged or tampered with.
2: To _remember_ the cert used and its fingerprint. Whenever this cert/fingerprint changes, AM should show a warning. While there are legitimate reasons why a cert changes (e.g. old one expired, etc.), this shouldn't happen too often. Moreover, if one connects from an untrusted public network and the cert suddenly changes from *.company.com to *.iwanttohackyou.biz or any other unexpected, illogical cert, this should set off all alarm bells in the user.
Any feedback, also from others here on the forum, is much appreciated.
I believe that these two features would be very valuable and I would love to see them implemented in AM, especially as I think that AM generally is a great app.
Best regards,
Johnny