clear echo "Domain without www or e-mail:" read domain domonly=${domain} domain=mail.${domain} dhparam=1024 apt install opendkim opendkim-tools -y gpasswd -a postfix opendkim sed -i -e 's/#Canonicalization simple/Canonicalization relaxed/simple/' -e 's/#Mode sv/Mode sv/' -e 's/#SubDomains no/SubDomains no/' /etc/opendkim.conf echo "" >> /etc/opendkim.conf echo "AutoRestart yes" >> /etc/opendkim.conf echo "AutoRestartRate 10/1M" >> /etc/opendkim.conf echo "Background yes" >> /etc/opendkim.conf echo "DNSTimeout 5" >> /etc/opendkim.conf echo "SignatureAlgorithm rsa-sha256" >> /etc/opendkim.conf echo "" >> /etc/opendkim.conf echo "# Map domains in From addresses to keys used to sign messages" >> /etc/opendkim.conf echo "KeyTable refile:/etc/opendkim/key.table" >> /etc/opendkim.conf echo "SigningTable refile:/etc/opendkim/signing.table" >> /etc/opendkim.conf echo "" >> /etc/opendkim.conf echo "# Hosts to ignore when verifying signatures" >> /etc/opendkim.conf echo "ExternalIgnoreList /etc/opendkim/trusted.hosts" >> /etc/opendkim.conf echo "" >> /etc/opendkim.conf echo "# A set of internal hosts whose mail should be signed" >> /etc/opendkim.conf echo "InternalHosts /etc/opendkim/trusted.hosts" >> /etc/opendkim.conf mkdir -p /etc/opendkim mkdir -p /etc/opendkim/keys chown -R opendkim:opendkim /etc/opendkim chmod go-rw /etc/opendkim/keys echo "*@$domonly default._domainkey.$domonly" >> /etc/opendkim/signing.table echo "default._domainkey.$domonly $domonly:default:/etc/opendkim/keys/$domonly/default.private" >> /etc/opendkim/key.table echo "127.0.0.1" >> /etc/opendkim/trusted.hosts echo "localhost" >> /etc/opendkim/trusted.hosts echo "" >> /etc/opendkim/trusted.hosts echo "*.$domonly" >> /etc/opendkim/trusted.hosts mkdir -p /etc/opendkim/keys/$domonly opendkim-genkey -b $dhparam -d $domonly -D /etc/opendkim/keys/$domonly -s default -v chown opendkim:opendkim /etc/opendkim/keys/$domonly/default.private clear cat /etc/opendkim/keys/$domonly/default.txt