Created
February 14, 2018 11:55
-
-
Save benhartwich/98a15a4060f4aea6f2f5dce4ec02a8ff to your computer and use it in GitHub Desktop.
opendKIM autocreate new domain
This file contains hidden or 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 | |
# Gib die Namen der OpenDKIM Config Dateien an | |
Key_Table="KeyTable" | |
Signing_Table="SigningTable" | |
Trusted_Hosts="TrustedHosts" | |
# Gib deine Mail Adresse an | |
MAIL="[email protected]" | |
read -p "Enter hostname: " HOSTNAME | |
HOME=/etc/opendkim/keys/$HOSTNAME | |
if [ -n "$HOSTNAME" ] | |
then | |
echo "mail._domainkey.${HOSTNAME} ${HOSTNAME}:mail:/etc/opendkim/keys/${HOSTNAME}/mail.private">> /etc/opendkim/$Key_Table | |
echo "*@${HOSTNAME} mail._domainkey.${HOSTNAME}">> /etc/opendkim/$Signing_Table | |
echo "*.${HOSTNAME}">> /etc/opendkim/$Trusted_Hosts | |
mkdir -p $HOME | |
cd $HOME | |
opendkim-genkey --bits=4096 -s mail -d $HOSTNAME | |
chown opendkim:opendkim mail.private | |
sendmail $MAIL < mail.txt | |
service opendkim restart | |
else | |
echo "No or wrong hostname" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment