Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dovecot 2.3 requires ssl_dh=</path/to/dh.pem #21

Closed
fgaz opened this issue Apr 9, 2018 · 4 comments · Fixed by NixOS/nixpkgs#39507
Closed

Dovecot 2.3 requires ssl_dh=</path/to/dh.pem #21

fgaz opened this issue Apr 9, 2018 · 4 comments · Fixed by NixOS/nixpkgs#39507
Assignees

Comments

@fgaz
Copy link
Collaborator

fgaz commented Apr 9, 2018

The 18.03 channel includes dovecot 2.3, which requires ssl_dh to be set.

If i generate it with # openssl dhparam -out /etc/dovecot/dh.pem 4096 and add ssl_dh = </etc/dovecot/dh.pem to /etc/dovecot.conf then everything works.

@uwap uwap self-assigned this Apr 9, 2018
@uwap
Copy link
Contributor

uwap commented Apr 17, 2018

Hey,
thank you for reporting this issue. You are right, the Diffie-Hellman parameters should be generated and given to dovecot. I think though, that this is more of a problem that should be integrated into nixpkgs. I am going to write a pull request to nixpkgs soon that will automatically set ssl_dh for dovecot using https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/security/dhparams.nix.

@qknight
Copy link
Member

qknight commented Apr 25, 2018

@uwap any news?

@qknight
Copy link
Member

qknight commented Apr 25, 2018

@fgaz i've implemented this now in 0d914ec

best solution would be to have this upstream, so i will create a PR for an upstream change (code below) and later we can revert this patch.

diff --git a/nixos/modules/services/mail/dovecot.nix b/nixos/modules/services/mail/dovecot.nix
index 543e732127a..92569693470 100644
--- a/nixos/modules/services/mail/dovecot.nix
+++ b/nixos/modules/services/mail/dovecot.nix
@@ -25,6 +25,7 @@ let
       ssl_cert = <${cfg.sslServerCert}
       ssl_key = <${cfg.sslServerKey}
       ${optionalString (!(isNull cfg.sslCACert)) ("ssl_ca = <" + cfg.sslCACert)}
+      ssl_dh = </var/lib/dhparams/dovecot2.pem
       disable_plaintext_auth = yes
     '')
 
@@ -297,10 +298,14 @@ in
 
 
   config = mkIf cfg.enable {
-
     security.pam.services.dovecot2 = mkIf cfg.enablePAM {};
-
-    services.dovecot2.protocols =
+    security.dhparams = {
+      enable = true;
+      params = {
+        dovecot2 = 4096;
+      };
+    };
+   services.dovecot2.protocols =
      optional cfg.enableImap "imap"
      ++ optional cfg.enablePop3 "pop3"
      ++ optional cfg.enableLmtp "lmtp";

@qknight
Copy link
Member

qknight commented Apr 25, 2018

NixOS/nixpkgs#39507

@fgaz thanks for the bug report!

@qknight qknight closed this as completed Apr 25, 2018
qknight added a commit to nixcloud/nixpkgs that referenced this issue Apr 30, 2018
The 18.03 channel includes dovecot 2.3, which requires ssl_dh to be set.
-> fixes nixcloud/nixcloud-webservices#21
abbradar pushed a commit to NixOS/nixpkgs that referenced this issue May 8, 2018
The 18.03 channel includes dovecot 2.3, which requires ssl_dh to be set.
-> fixes nixcloud/nixcloud-webservices#21
globin pushed a commit to mayflower/nixpkgs that referenced this issue May 24, 2018
The 18.03 channel includes dovecot 2.3, which requires ssl_dh to be set.
-> fixes nixcloud/nixcloud-webservices#21

(cherry picked from commit 851d5d7)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants