2015-09-18 11:41:31 +00:00
#!/bin/bash -eux
source /etc/environment
function provision_dkim () {
docker exec mailindiehost_postfix_1 /add_domain.sh ${arg_u}
}
function configure_dns () {
2016-07-04 19:34:51 +00:00
domain_key=`cat /data/domains/mail.indie.host/opendkim/keys/${arg_u}/mail.txt | cut -d\" -f2 | sed 'N;s/\n//g' | sed 's/ //g' | sed 's/+/%2B/g' | sed 's/\//%2F/g'`
2015-09-18 11:41:31 +00:00
info "Configuring DNS."
arguments="&Command=namecheap.domains.dns.setHosts\
&DomainName=${arg_u}\
&SLD=$(SLD)\
&TLD=$(TLD)\
&HostName1=@\
&RecordType1=A\
&Address1=${IP}\
&HostName2=www\
&RecordType2=CNAME\
&Address2=${arg_u}\
2016-01-28 16:30:24 +00:00
&HostName3=@\
&RecordType3=MX\
2015-09-18 11:41:31 +00:00
&Address3=${mail_hostname}\
2016-01-28 16:30:24 +00:00
&MXPref3=10\
2015-09-18 11:41:31 +00:00
&HostName4=@\
2016-01-28 16:30:24 +00:00
&RecordType4=TXT\
&Address4=v=spf1%20include:${mail_hostname}\
&Hostname5=_dmarc\
2015-09-18 11:41:31 +00:00
&RecordType5=TXT\
2016-01-28 16:30:24 +00:00
&Address5=v=DMARC1;%20p=none;%20rua=mailto:support@indie.host\
2015-09-18 11:41:31 +00:00
&HostName6=mail._domainkey\
&RecordType6=TXT\
&Address6=${domain_key}\
&HostName7=autoconfig\
&RecordType7=CNAME\
&Address7=autoconfig.`echo $mail_hostname | cut -d. -f2,3`\
&EmailType=mx"
call_API ${arguments}
}