confdir=${ROOT}/var/qmail/control
umaskvalue="0077"
uid="qmaild"
gid="qmail"
umask ${umaskvalue}
keys="512 1024"
for bits in ${keys}
do
pemfile="${confdir}/rsa${bits}.pem"
tmpfile="${confdir}/rsa${bits}.pem.tmp"
/usr/bin/openssl genrsa -out ${tmpfile} ${bits} 2>/dev/null && \
/bin/chown ${uid}:${gid} ${tmpfile} && \
/bin/mv -f ${tmpfile} ${pemfile} || exit 1
dhfile="${confdir}/dh${bits}.pem"
dtmpfile="${confdir}/dh${bits}.pem.tmp"
/usr/bin/openssl dhparam -2 -out ${dtmpfile} ${bits} 2>/dev/null && \
/bin/chown ${uid}:${gid} ${dtmpfile} && \
/bin/mv -f ${dtmpfile} ${dhfile} || exit 1
done