#!/bin/sh

# Update temporary RSA and DH keys
# Frederik Vermeulen 2004-05-31 GPL

umask 0077 || exit 0

export PATH="$PATH:/usr/local/bin/ssl:/usr/sbin"

openssl genrsa -out /etc/qmail/control/rsa512.new 512 &&
chmod 600 /etc/qmail/control/rsa512.new &&
chown qmaild:qmail /etc/qmail/control/rsa512.new &&
mv -f /etc/qmail/control/rsa512.new /etc/qmail/control/rsa512.pem
echo

openssl dhparam -2 -out /etc/qmail/control/dh512.new 512 &&
chmod 600 /etc/qmail/control/dh512.new &&
chown qmaild:qmail /etc/qmail/control/dh512.new &&
mv -f /etc/qmail/control/dh512.new /etc/qmail/control/dh512.pem
echo

openssl dhparam -2 -out /etc/qmail/control/dh1024.new 1024 &&
chmod 600 /etc/qmail/control/dh1024.new &&
chown qmaild:qmail /etc/qmail/control/dh1024.new &&
mv -f /etc/qmail/control/dh1024.new /etc/qmail/control/dh1024.pem
