Skip to content

Instantly share code, notes, and snippets.

@dkrusky
Last active March 11, 2016 12:46
Show Gist options
  • Save dkrusky/03abc1ad71c6b7d692f3 to your computer and use it in GitHub Desktop.
Save dkrusky/03abc1ad71c6b7d692f3 to your computer and use it in GitHub Desktop.
Set dovecot to generate 2048 bit dhparams on a cPanel/WHM box.
#!/bin/sh
# if no local config for dovecot exists, make one
if[ ! -e /var/cpanel/templates/dovecot2.2/main.local ]; then
cp /var/cpanel/templates/dovecot2.2/main.default /var/cpanel/templates/dovecot2.2/main.local
fi
# check if ssl_dh_parameters exists already. if it doesn't exist, insert it
if [ -z "$(grep "ssl_dh_parameters_length" /var/cpanel/templates/dovecot2.2/main.local)" ]; then
sed -i '/ssl = \[% ssl %\]/,/\[%- ELSE %\]/ {/\[%- ELSE %\]/i ssl_dh_parameters_length = 2048}' /var/cpanel/templates/dovecot2.2/main.local
fi
# rebuild, and restart dovecot to apply changes
/usr/local/cpanel/scripts/builddovecotconf
/scripts/restartsrv_dovecot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment