Hi Guys,
I am not a script guru but I try my best..
I have created a very simple script that generate the DKIM file for me on the mail server..
This script work but I would like to be able to pass the domain name as part of the command like:
Could anyone please advise on how I would need to update the script to achive this?
Aslo can i pass a file with multiple domain?
Thank you
I am not a script guru but I try my best..
I have created a very simple script that generate the DKIM file for me on the mail server..
Code:
#!/bin/sh
#
# sophimail DKIM keys generation
# - Create domain directory
# - Generate DKIM keys
# - add entry to KeyTable
# - add entry to SigningTable
#
echo "================================="
echo "| DKIM Keys Generator Script |"
echo "================================="
read -p 'Enter Domain name: ' domain
clear
echo "================================="
echo "| Proceed with the following? |"
echo "================================="
echo ""
echo "DKIM keys Directory: /usr/local/etc/opendkim/keys/$domain"
echo "KeyTable entry: default._domainkey.$domain $domain:default:/usr/local/etc/opendkim/keys/$domain/default"
echo "SigningTable entry: *@$domain default._domainkey.$domain"
echo ""
read -p "run install? [y/n]" REPLY
if [ "$REPLY" == n ] ; then
echo "Exiting..."
exit 1
else
# create key directory
mkdir /usr/local/etc/opendkim/keys/$domain
# generate key file
opendkim-genkey -D /usr/local/etc/opendkim/keys/$domain/ -d $domain -s default
# set ownership
chown -R opendkim: /usr/local/etc/opendkim/keys/$domain
# rename file
mv /usr/local/etc/opendkim/keys/$domain/default.private /usr/local/etc/opendkim/keys/$domain/default
# add entry to tables
echo "default._domainkey.$domain $domain:default:/usr/local/etc/opendkim/keys/$domain/default" >> /usr/local/etc/opendkim/KeyTable
echo "*@$domain default._domainkey.$domain" >> /usr/local/etc/opendkim/SigningTable
fi
dkimgen mydomain.com
Could anyone please advise on how I would need to update the script to achive this?
Aslo can i pass a file with multiple domain?
Thank you