1
0
mirror of https://github.com/mail-in-a-box/mailinabox.git synced 2024-11-23 02:27:05 +00:00

change handling of pkcs key format

This commit is contained in:
KiekerJan 2023-05-13 17:32:08 +02:00
parent d64f749e9a
commit dc6d66cc47

View File

@ -63,9 +63,13 @@ if [ ! -f "$STORAGE_ROOT/mail/dkim/mail.key" ]; then
# Change format from pkcs#8 to pkcs#1, dkimpy seemingly is not able to handle the #8 format
# See bug https://bugs.launchpad.net/dkimpy/+bug/1978835
openssl pkey -in $STORAGE_ROOT/mail/dkim/mail.key -traditional -out $STORAGE_ROOT/mail/dkim/mail.key.1
mv -f $STORAGE_ROOT/mail/dkim/mail.key $STORAGE_ROOT/mail/dkim/mail.key.8
cp -f $STORAGE_ROOT/mail/dkim/mail.key.1 $STORAGE_ROOT/mail/dkim/mail.key
line=$(head -n 1 mail.key)
if [ ! "$line" = "-----BEGIN RSA PRIVATE KEY-----" ]; then
# Generate pkcs#1 key from the pkcs#8 key
openssl pkey -in $STORAGE_ROOT/mail/dkim/mail.key -traditional -out $STORAGE_ROOT/mail/dkim/mail.key.1
mv -f $STORAGE_ROOT/mail/dkim/mail.key $STORAGE_ROOT/mail/dkim/mail.key.8
cp -f $STORAGE_ROOT/mail/dkim/mail.key.1 $STORAGE_ROOT/mail/dkim/mail.key
fi
fi
if [ ! -f "$STORAGE_ROOT/mail/dkim/box-ed25519.key" ]; then