r-raymond / nixos-mailserver

A complete and Simple Nixos Mailserver
GNU General Public License v3.0
181 stars 27 forks source link

postfix: also create the dh.pem if it is empty #124

Closed nlewo closed 6 years ago

nlewo commented 6 years ago

The dh.pem file is currently created by the postfix prestart script. If the entropy of the system is to low, the postfix prestart can timeout. In this case, an empty file is created. If the user restarts the postfix service, the dh.pem is not created because the file already exists (but is empty). When a ssl is established with dovecot, it fails with this message: imap-login: Error:Failed to initialize SSL server context: Couldn't parse DH parameters: error:0906D06C:PEM routines:PEM_read_bio:no start line: Expecting: DH PARAMETERS

With this patch, the postfix service creates the dh.pem if the dh.pem doesn't exist or if it is empty. It doesn't fix the entropy or timeout issue but at least, the user knows something is failing:/

nlewo commented 6 years ago

I think it is posible to reproduce by setting the length to 4096 or by decreasing the postfix timeout.

r-raymond commented 6 years ago

Thanks!