Created
February 14, 2016 04:00
-
-
Save takkaria/8b87405a27dee024b083 to your computer and use it in GitHub Desktop.
Create a DKIM keypair
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
if [ $# -eq 0 ]; then | |
echo "Use: $0 <domain name>" | |
exit 1 | |
fi | |
DOMAIN=$1 | |
openssl genrsa -out dkim/$DOMAIN-private.pem 1024 -outform PEM | |
openssl rsa -in dkim/$DOMAIN-private.pem -out dkim/$DOMAIN.pem -pubout -outform PEM | |
chown -R Debian-exim:Debian-exim /etc/exim4/dkim | |
chmod 640 /etc/exim4/dkim/* | |
chmod 750 /etc/exim4/dkim | |
PUBLICKEY=`sudo cat dkim/$DOMAIN.pem | tail -n +2 | head -n -1 | tr -d '\n'`; | |
echo "DKIM key pair created for $DOMAIN" | |
echo | |
echo "Cut and paste the following into your TXT DNS record:" | |
echo "k=rsa; p=$PUBLICKEY" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment