62 lines
2.0 KiB
ReStructuredText
62 lines
2.0 KiB
ReStructuredText
DOMAIN=gitu.be
|
||
SELECTOR=mail
|
||
IP=127.0.0.1
|
||
|
||
cd /etc/dkimkeys
|
||
mkdir $DOMAIN
|
||
opendkim-genkey --domain=$DOMAIN --selector=$SELECTOR --directory=./$DOMAIN
|
||
chown -R opendkim: ./$DOMAIN
|
||
|
||
service opendkim restart
|
||
|
||
# Avoir un fichier ".ini" avec les details de l'accès API
|
||
mkdir /etc/lexicon
|
||
echo "dns_gandi_api_key = xxXXXxxx" > /etc/lexicon/gandi.ini
|
||
TOKEN=`awk '{ print $3 }' /etc/lexicon/gandi-freepoteries.ini`
|
||
lexicon gandi --auth-token $TOKEN --api-protocol rest --name $SELECTOR._domainkey list $DOMAIN TXT
|
||
|
||
# If it returns something, delete it
|
||
lexicon gandi --auth-token $TOKEN --api-protocol rest --name $SELECTOR._domainkey delete $DOMAIN TXT
|
||
|
||
# Get dkim txt content in variable
|
||
CONTENT=`cat gitu.be/mail.txt | tr -d '\n' | sed -E 's/^.*\(([^\)]*)\).*$/\1/;s/"([[:space:]])*"//g;s/ //g'`
|
||
|
||
# Check the content :
|
||
echo $CONTENT
|
||
|
||
# Set the TXT row
|
||
lexicon gandi --auth-token $TOKEN --api-protocol rest --name $SELECTOR._domainkey --content $CONTENT create $DOMAIN TXT
|
||
|
||
# DMARC
|
||
lexicon gandi --auth-token $TOKEN --api-protocol rest --name _dmarc --content "v=DMARC1; p=quarantine; adkim=r; aspf=r;" create gitu.be TXT
|
||
|
||
# SPF
|
||
lexicon gandi --auth-token $TOKEN --api-protocol rest --name '@' --content "v=spf1 mx a:mail.usinette.net ip4:91.121.171.218 ?all" create gitu.be TXT
|
||
|
||
# Create the domain on modoboa
|
||
|
||
# Set the password for domain administrator account
|
||
|
||
# Connect to your account using a mail client
|
||
|
||
# Use https://www.mail-tester.com/ to test your configuration
|
||
|
||
### DNS RECORDS ###
|
||
|
||
@ 86400 IN SOA ns1.gandi.net. hostmaster.gandi.net. 1645632008 10800 3600 604800
|
||
10800
|
||
@ 10800 IN A $IP
|
||
@ 10800 IN AAAA $IPv6
|
||
@ 10800 IN MX 10 $DOMAIN.
|
||
@ 10800 IN MX 20 SECONDAY.MAIL.SERVER.
|
||
@ 10800 IN TXT "v=spf1 mx a:$DOMAIN ip4:$IP ipv6:$IPv6 ?all"
|
||
|
||
_imap._tcp 10800 IN SRV 0 0 0 .
|
||
_imaps._tcp 10800 IN SRV 0 1 993 listonmail.fr.
|
||
_pop3._tcp 10800 IN SRV 0 0 0 .
|
||
_pop3s._tcp 10800 IN SRV 10 1 995 listonmail.fr.
|
||
_submission._tcp 10800 IN SRV 0 1 465 listonmail.fr.
|
||
|
||
webmail 10800 IN A $IP
|
||
webmail 10800 IN AAAA $IPv6
|