mailcow / mailcow-dockerized

mailcow: dockerized - ๐Ÿฎ + ๐Ÿ‹ = ๐Ÿ’•
https://mailcow.email
GNU General Public License v3.0
8.96k stars 1.17k forks source link

JAN/2020 - Planned deactivation of TLS1.0 and TLS1.1 in Dovecot (affects POP3 and IMAP) #3127

Closed christianbur closed 4 years ago

christianbur commented 5 years ago

TLS1.0 and TLS1.1 is an obsolete encryption standard and should no longer be used . Currently only TLS 1.2 and TLS1.3 are recommended.

Dovecot: For Dovecot the change was already made but then reverted. The change was made on 3 March, if the corresponding programs (e.g. nextcloud user_external plugin) have not been updated until now, the programs are simply obsolete and should no longer be considered.

Therefore "ssl_min_protocol" (under data/conf/dovecot/dovecot.conf) should be set to "TLSv1.2" again. This also corresponds to the recommendations here: https://cipherli.st/

You can use the following tools for testing:

Nginx: For Nginx TLS1.0/1.1 have already been deactivated.

Postfix Even Postfix still uses TLS1.0/1.1, but here you have to be happy if smtp is encrypted at all. So a bad encryption is better than none at all.

andryyy commented 5 years ago

Yes, should be removed. I planned this for Windows 7 EOL.

christianbur commented 5 years ago

OK, that should be on 14 January 2020.

andryyy commented 5 years ago

Hope that's fine for you guys. :) I don't see any reason to keep it afterwards besides older devices, that poll via imap/pop3. It is quite easy to revert manually, so ... should work.

Braintelligence commented 5 years ago

@andryyy Up to which Microsoft Outlook version will we experience repercussions for not providing TLS 1.0/1.1 anymore? ๐Ÿ™ˆ I'm not against it, just wanting to assess possible problems with current clients. ๐Ÿ˜ญ

MAGICCC commented 5 years ago

Even Office 2010 will be EoL end of October 2020, so people who are still using this acient version should upgrade!

Braintelligence commented 5 years ago

@MAGICCC I know companies with four digit number of employees still running on Office 2010, so albeit I agree with you it's just reality that it still is being used.

Again, I don't disagree with this step, I'm just asking if anyone can tell for sure what the minimum compatible Outlook will be then.

andryyy commented 5 years ago

Do most of your clients use EAS or IMAP? For EAS TLS 1.2 is required since we pushed the changes to Nginx a while ago. If they didn't complain until today, they are probably fine.

Not sure about IMAP. I think you can patch Windows 7 to use TLS 1.2 anyway. There should be tutorials for that.

Can you check the compatibility online and report back, @Braintelligence ? I think we should at least mention it here.

christianbur commented 5 years ago

For Outoook (under Windows 7) TLS1.2 can be activated as well.

with Dovecot as example:

Braintelligence commented 5 years ago

None use EAS, only IMAP. Windows 7 is not really the problem; I know even one person using Office 2003 for some reasons on a Windows 10 machine ๐Ÿ™ˆ .

christianbur commented 4 years ago

Could we also upgrade the Postfix submission port (587 and 465) to min. TLS 1.2?

current: smtpd_tls_mandatory_protocols=!SSLv2,!SSLv3 future: smtpd_tls_mandatory_protocols=!SSLv2,!SSLv3,!TLSv1,!TLSv1.1

also "smtpd tls-wrapped (smtps) on 465/tcp"

andryyy commented 4 years ago

Oops, it is not. Deleted my previous post. We can and should.

Edit: yes, smtps and submission

christianbur commented 4 years ago

Another suggestion, currently there is an extra.cf to make custom changes to the postfix config (main.cf), but for the master.cf this doesn't work. I used to define my own variables in the main.cf and then use them in the master.cf.

main.cf
port_587_smtpd_tls_mandatory_protocols=!SSLv2,!SSLv3,!TLSv1,!TLSv1.1

master.cf
...
-o smtpd_tls_mandatory_protocols=$port_587_smtpd_tls_mandatory_protocols
...

like here in the example with $mua_client_restrictions, $mua_sender_restrictions, $mua_relay_restrictions

so you should be able to change the parameter port_587_smtpd_tls_mandatory_protocol s in extra.cf by yourself, right? This would be useful, since there may be some systems with old clients that need TLS1/1.1.

andryyy commented 4 years ago

That's a good idea, I will add it.

christianbur commented 4 years ago

Maybe you could already make the changes now with "port_587_smtpd_tls_mandatory_protocols=!SSLv2,!SSLv3" (No change of the system behavior), so it would be possible to change the TLS setting now as a custom change in extra.cf.

andryyy commented 4 years ago

Yes, I added it for smtps and submission. I also added a filter for syslog-ng to not be annoying with overrides.

Testing it now.

andryyy commented 4 years ago

Looks good. Can you also run a test?

christianbur commented 4 years ago

So the two new variables work for me (test with testssl.sh).

Question:

andryyy commented 4 years ago

The smtputf8 option was a mistake.

I added your options, that's a good idea, thanks. Will push in a bit.

mkuron commented 4 years ago

The smtputf8 option was a mistake.

Itโ€˜s actually still there:

https://github.com/mailcow/mailcow-dockerized/blob/d57e2b58c19645a9b12489a76df4cce470fbf46e/data/conf/postfix/main.cf#L190

I thought Dovecot LMTP didnโ€˜t support UTF8 and we thus actually need to disable this option?

andryyy commented 4 years ago

Yes, it's difficult. Setting it to no will completely disable Umlaut domains. Even the rewritten domains were rejected. I have no glue so far. We could switch to LDA.

christianbur commented 4 years ago

But LDA is outdated, nowadays you should use LMTP. same problem: https://gehirn-mag.net/das-xn-mrchen-bua-vom-punycode/ https://www.virtualmin.com/node/59765

andryyy commented 4 years ago

Yes, indeed. But without full UTF8 support, it is a bit tricky. They are working on it... :/

andryyy commented 4 years ago

We should create a blame list. ๐Ÿ˜„

I just found out Acronis True Image 2020 is not able to initiate a TLS 1.2 connection.

lucianlazar1983 commented 4 years ago

Also some Pop-collector software for exchange servers will simply cease to work but hey, they might just start ditching exchange for mail cow ๐Ÿ˜Š Jokes aside, everyone should support new, safer standards

ghost commented 4 years ago

@andryyy The Windows 7 EOL date is today.

technophobia commented 4 years ago

i have lots of issues with SMTPUTF8 set to yes. I disabled it and all the mails are going through. Is it needed for anything else beside the umlaut domains feature?

andryyy commented 4 years ago

That's really strange. We need to keep an eye on it. I have seen it the other way round, too. If someone wants to dig deeper into it, go ahead. :) It would be very welcome!

TLS 1.0 and 1.1 will be deactivated shortly.

andryyy commented 4 years ago

Aaaand it's gone.

marrco commented 4 years ago

sorry to ask. Does it mean that anyone using Windows 7 (default configuration) is now not able to use the mail server (webmail, pop3 and imap) anymore?

I know Windows 7 is EOL, But Google first result suggests that in 2020 it's market share is about 30% among desktop OS

christianbur commented 4 years ago

And whatโ€™s about Postfix (submission) and an info in the blog and in the documentation how to reactivate Tls 1.0 and Tls 1.1 via the custom files?

andryyy commented 4 years ago

That info is about to come.

andryyy commented 4 years ago

https://mailcow.email/2020/02/12/tls-1-0-and-1-1-is-now-disabled-for-pop3-s-imap-s-smtps-and-submission/

andryyy commented 4 years ago

And https://mailcow.github.io/mailcow-dockerized-docs/u_e-reeanble-weak-protocols/

Thank you guys. I will close this issue, which does not mean it is closed for discussion. :)

Conan179 commented 4 years ago

I have a problem with reeanble the TLS 1.0 and TLS 1.1. I use Opera Mail on Win10 (Didn't find a mail client that works like this old one.) The files: /opt/mailcow-dockerized/data/conf/postfix/extra.cf and /opt/mailcow-dockerized/data/conf/dovecot/extra.cf make it, with the content submission_smtpd_tls_mandatory_protocols = !SSLv2, !SSLv3 smtps_smtpd_tls_mandatory_protocols = !SSLv2, !SSLv3 and ssl_min_protocol = TLSv1 after restarting, i cand connect with oepra mail.

andryyy commented 4 years ago

extra.conf for Dovecot

Conan179 commented 4 years ago

-.- I'm sorry...

i found a another error on my settings.

I'm starting to feel like I'm being kidnapped by my system.

my secnd error was ssl_min_protocol = TLSv1ssl_min_protocol = TLSv1 in the /opt/mailcow-dockerized/data/conf/dovecot/extra.conf

But I still get a connection.

andryyy commented 4 years ago

What about git diff origin/master data/conf/dovecot/ data/conf/postfix/? Did you restart the services?

Conan179 commented 4 years ago

No problem:

diff --git a/data/conf/dovecot/dovecot.conf b/data/conf/dovecot/dovecot.conf
index b1aea4de..7ac64cca 100644
--- a/data/conf/dovecot/dovecot.conf
+++ b/data/conf/dovecot/dovecot.conf
@@ -272,7 +272,7 @@ service pop3-login {
 service imap {
   executable = imap imap-postlogin
   user = vmail
-  vsz_limit = 1G
+  vsz_limit = 3G
 }
 service managesieve {
   process_limit = 256
@@ -315,6 +315,7 @@ plugin {
   acl = vfile
   fts = solr
   fts_autoindex = yes
+  fts_autoindex_exclude = \fail2ban
   fts_solr = url=http://solr:8983/solr/dovecot-fts/
   quota = dict:Userquota::proxy::sqlquota
   quota_rule2 = Trash:storage=+100%%
diff --git a/data/conf/postfix/main.cf b/data/conf/postfix/main.cf
index d31702e7..30b884ef 100644
--- a/data/conf/postfix/main.cf
+++ b/data/conf/postfix/main.cf
@@ -200,3 +200,5 @@ smtpd_client_recipient_rate_limit = 50
 # DO NOT EDIT ANYTHING BELOW #
 # User overrides #

+submission_smtpd_tls_mandatory_protocols = !SSLv2, !SSLv3
+smtps_smtpd_tls_mandatory_protocols = !SSLv2, !SSLv3

I have restaret with docker-compose restart postfix-mailcow dovecot-mailcow and try it witch docker-compose down && docker-compose up -d

andryyy commented 4 years ago

What's the output for docker-compose exec dovecot-mailcow doveconf ssl_min_protocol?

And what does dovecot-mailcow log, when you try to connect with Opera Mail?

I'm installing it myself right now. You can also send me the server name to info@servercow.de, please, so I can check wether 1.0 is available.

andryyy commented 4 years ago

Try this in data/conf/dovecot/extra.conf and restart dovecot-mailcow afterwards:

ssl_min_protocol = TLSv1
ssl_cipher_list = ALL:!kRSA:!SRP:!kDHd:!DSS:!aNULL:!eNULL:!EXPORT:!DES:!3DES:!MD5:!PSK:!RC4:!ADH:!LOW@STRENGTH

I installed Opera Mail for this to test. :-D

Conan179 commented 4 years ago

root@hostname:/opt/mailcow-dockerized# docker-compose exec dovecot-mailcow doveconf ssl_min_protocol ssl_min_protocol = TLSv1 I have send a mail to you.

i know, opera mail is old, unsecured. but unfortunately I have not found any other mail client that is like the opera mail client...

christianbur commented 4 years ago

For all those who want to get rid of even more weak crypto, you can also disable the CBC Cipher Suites. For Dovecote this is very easy:

# cat ../mailcow-dockerized/data/conf/dovecot/extra.conf 
ssl_cipher_list = HIGH:!RSA:!PSK:!LOW:!aNULL:!eNULL:!SHA1:!SHA256:!SHA384

You could check it with testssl.sh: (https://github.com/drwetter/testssl.sh/issues/1157) "Obsolete: SEED + 128+256 Bit CBC cipher -------- not offered"

https://www.ssllabs.com also classifies CBC as weak (only HTTPS test, no imaps).

UPDATE:

To disable CBCs also in Postfix, changes to mailcow would be necessary.

# docker exec mailcowdockerized_postfix-mailcow_1 postconf |grep tls_high_cipherlist
tls_high_cipherlist = aNULL:-aNULL:HIGH:@STRENGTH

data/conf/postfix/master.cf

  #-o smtpd_tls_mandatory_protocols=$smtps_smtpd_tls_mandatory_protocols
  -o tls_high_cipherlist=$submission_tls_high_cipherlist

  #-o smtpd_tls_mandatory_protocols=$submission_smtpd_tls_mandatory_protocols
  -o tls_high_cipherlist=$smtps_tls_high_cipherlist

data/conf/postfix/main.cf

submission_tls_high_cipherlist = aNULL:-aNULL:HIGH:@STRENGTH
smtps_tls_high_cipherlist = aNULL:-aNULL:HIGH:@STRENGTH

#INFO: "smtps_tls_high_cipherlist = $tls_high_cipherlist" is not working. 

data/conf/postfix/extra.cf

submission_tls_high_cipherlist = HIGH:!RSA:!PSK:!LOW:!aNULL:!eNULL:!SHA1:!SHA256:!SHA384
smtps_tls_high_cipherlist = HIGH:!RSA:!PSK:!LOW:!aNULL:!eNULL:!SHA1:!SHA256:!SHA384
christianbur commented 2 years ago

@andryyy

In the current c't (2/2022), the cipher-suites for TLS are explained and recommendations are given. Maybe we should adapt Mailcow to the recommendations.

Nginx: https://ssl-config.mozilla.org/#server=nginx&version=1.17.7&config=intermediate&openssl=1.1.1k&guideline=5.6

Dovecot: https://ssl-config.mozilla.org/#server=dovecot&version=2.3.9&config=intermediate&openssl=1.1.1k&guideline=5.6

Postfix (only submission): https://ssl-config.mozilla.org/#server=postfix&version=3.4.8&config=intermediate&openssl=1.1.1k&guideline=5.6


I have checked port 587 (Postrix submission), the cipher used does not match the recommendations (e.g. SHA -> SHA1).

Test-command: testssl --starttls smtp mx1.example.de:587

...
 Cipher order
    TLSv1.2:   ECDHE-RSA-AES256-GCM-SHA384 DHE-RSA-AES256-GCM-SHA384 ECDHE-RSA-CHACHA20-POLY1305 DHE-RSA-CHACHA20-POLY1305 DHE-RSA-AES256-CCM8 DHE-RSA-AES256-CCM ECDHE-ARIA256-GCM-SHA384 DHE-RSA-ARIA256-GCM-SHA384
               ECDHE-RSA-AES256-SHA384 DHE-RSA-AES256-SHA256 ECDHE-RSA-CAMELLIA256-SHA384 DHE-RSA-CAMELLIA256-SHA256 ECDHE-RSA-AES256-SHA DHE-RSA-AES256-SHA DHE-RSA-CAMELLIA256-SHA AES256-GCM-SHA384 AES256-CCM8 AES256-CCM
               ARIA256-GCM-SHA384 AES256-SHA256 CAMELLIA256-SHA256 AES256-SHA CAMELLIA256-SHA ECDHE-RSA-AES128-GCM-SHA256 DHE-RSA-AES128-GCM-SHA256 DHE-RSA-AES128-CCM8 DHE-RSA-AES128-CCM ECDHE-ARIA128-GCM-SHA256
               DHE-RSA-ARIA128-GCM-SHA256 ECDHE-RSA-AES128-SHA256 DHE-RSA-AES128-SHA256 ECDHE-RSA-CAMELLIA128-SHA256 DHE-RSA-CAMELLIA128-SHA256 ECDHE-RSA-AES128-SHA DHE-RSA-AES128-SHA DHE-RSA-CAMELLIA128-SHA AES128-GCM-SHA256
               AES128-CCM8 AES128-CCM ARIA128-GCM-SHA256 AES128-SHA256 CAMELLIA128-SHA256 AES128-SHA CAMELLIA128-SHA 
    TLSv1.3:   TLS_AES_256_GCM_SHA384 TLS_CHACHA20_POLY1305_SHA256 TLS_AES_128_GCM_SHA256 
...
andryyy commented 2 years ago

I agree. Would you like to create a tested PR? I can review it. Currently in hospital.

Am 02.01.2022 um 16:15 schrieb Christian Burmeister @.***>:

๏ปฟ @andryyy

In the current c't (2/2022), the cipher-suites for TLS are explained and recommendations are given. Maybe we should adapt Mailcow to the recommendations.

Nginx: https://ssl-config.mozilla.org/#server=nginx&version=1.17.7&config=intermediate&openssl=1.1.1k&guideline=5.6

Dovecot: https://ssl-config.mozilla.org/#server=dovecot&version=2.3.9&config=intermediate&openssl=1.1.1k&guideline=5.6

Postfix (only submission): https://ssl-config.mozilla.org/#server=postfix&version=3.4.8&config=intermediate&openssl=1.1.1k&guideline=5.6

โ€” Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.

christianbur commented 2 years ago

I'll take care of it the next few days. Get well soon.

andryyy commented 2 years ago

That would be amazing. Thank you!

Am 02.01.2022 um 18:12 schrieb Christian Burmeister @.***>:

๏ปฟ I'll take care of it the next few days. Get well soon.

โ€” Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.