#!/bin/sh ########################################################################### ## Copyright (C) Wizardry and Steamworks 2017 - License: GNU GPLv3 ## ########################################################################### # A script to rotate the Diffie-Hellman keys that can be called through # # crontab periodically. # # # # This script would require the following postfix configuration keys to # # be set: # # # # smtpd_tls_dh1024_param_file = ${config_directory}/dh_1024.pem # # smtpd_tls_dh512_param_file = ${config_directory}/dh_512.pem # ########################################################################### ########################################################################### # CONFIGURATION # ########################################################################### # Set this to the directory corresponding to the result of expanding the # Postfix ${config_directory} variable - commonly, /etc/postfix. POSTFIX_CONFIG_DIRECTORY=/etc/postfix ########################################################################### # INTERNALS # ########################################################################### if [ -d "$POSTFIX_CONFIG_DIRECTORY" ]; then # Re-create Diffie-Hellman parameters. openssl dhparam -out "$POSTFIX_CONFIG_DIRECTORY/dh_1024.pem" 1024 openssl dhparam -out "$POSTFIX_CONFIG_DIRECTORY/dh_512.pem" 512 # Reload Postfix to pick-up the newly generated keys. postfix reload fi