Vesta Control Panel - Forum

Community Forum

Skip to content

Advanced search
  • Quick links
    • Main site
    • Github repo
    • Google Search
  • FAQ
  • Login
  • Register
  • Board index Main Section DNS Server
  • Search

Change default SOA

Questions regarding the DNS Server
BIND
Post Reply
  • Print view
Advanced search
4 posts • Page 1 of 1
ralbrightii
Posts: 11
Joined: Sat Nov 23, 2019 1:37 am

Os: Ubuntu 17x
Web: apache + nginx
Change default SOA
  • Quote

Post by ralbrightii » Sun Feb 09, 2020 6:10 am

So on my server, I have vanity nameservers for all domains (ie ns1.domainname.com, ns2.domainname.com), these have corresponding a records for ns1/ns2 to the IP address.

I figured out how to update the default by modifying the default.tpl file in /usr/local/vesta/data/templates/dns folder
Which now reads:
ID='1' RECORD='@' TYPE='NS' PRIORITY='' VALUE='ns1.%domain%.' SUSPENDED='no' TIME='%time%' DATE='%date%'
ID='2' RECORD='@' TYPE='NS' PRIORITY='' VALUE='ns2.%domain%.' SUSPENDED='no' TIME='%time%' DATE='%date%'
ID='3' RECORD='@' TYPE='NS' PRIORITY='' VALUE='%ns3%.' SUSPENDED='no' TIME='%time%' DATE='%date%'
ID='4' RECORD='@' TYPE='NS' PRIORITY='' VALUE='%ns4%.' SUSPENDED='no' TIME='%time%' DATE='%date%'
ID='5' RECORD='@' TYPE='NS' PRIORITY='' VALUE='%ns5%.' SUSPENDED='no' TIME='%time%' DATE='%date%'
ID='6' RECORD='@' TYPE='NS' PRIORITY='' VALUE='%ns6%.' SUSPENDED='no' TIME='%time%' DATE='%date%'
ID='7' RECORD='ns1' TYPE='A' PRIORITY='' VALUE='%ip%' SUSPENDED='no' TIME='%time%' DATE='%date%'
ID='8' RECORD='ns2' TYPE='A' PRIORITY='' VALUE='%ip%' SUSPENDED='no' TIME='%time%' DATE='%date%'
ID='9' RECORD='@' TYPE='A' PRIORITY='' VALUE='%ip%' SUSPENDED='no' TIME='%time%' DATE='%date%'
ID='10' RECORD='www' TYPE='A' PRIORITY='' VALUE='%ip%' SUSPENDED='no' TIME='%time%' DATE='%date%'
ID='11' RECORD='ftp' TYPE='A' PRIORITY='' VALUE='%ip%' SUSPENDED='no' TIME='%time%' DATE='%date%'
ID='12' RECORD='mail' TYPE='A' PRIORITY='' VALUE='%ip%' SUSPENDED='no' TIME='%time%' DATE='%date%'
ID='13' RECORD='smtp' TYPE='A' PRIORITY='' VALUE='%ip%' SUSPENDED='no' TIME='%time%' DATE='%date%'
ID='14' RECORD='pop' TYPE='A' PRIORITY='' VALUE='%ip%' SUSPENDED='no' TIME='%time%' DATE='%date%'
ID='15' RECORD='imap' TYPE='A' PRIORITY='' VALUE='%ip%' SUSPENDED='no' TIME='%time%' DATE='%date%'
ID='16' RECORD='@' TYPE='MX' PRIORITY='10' VALUE='mail.%domain%.' SUSPENDED='no' TIME='%time%' DATE='%date%'
ID='17' RECORD='@' TYPE='TXT' PRIORITY='' VALUE='"v=spf1 a mx ip4:%ip% ~all"' SUSPENDED='no' TIME='%time%' DATE='%date%'
ID='18' RECORD='_dmarc' TYPE='TXT' PRIORITY='' VALUE='"v=DMARC1; p=none"' SUSPENDED='no' TIME='%time%' DATE='%date%'
ID='19' RECORD='autoconfig' TYPE='A' PRIORITY='' VALUE='%ip%' SUSPENDED='no' TIME='%time%' DATE='%date%'
ID='20' RECORD='autodiscover' TYPE='A' PRIORITY='' VALUE='%ip%' SUSPENDED='no' TIME='%time%' DATE='%date%'
ID='21' RECORD='_autodiscover' TYPE='SRV' PRIORITY='0 0 443' VALUE='mail.%domain%.' SUSPENDED='no' TIME='%time%' DATE='%date%'


Notice the last 3 records are the autodiscover.xml that I am still working on creating from scratch when the domain is added. (Can set it up manually but, why not have Vesta do it automatically.) <-- another story for another topic though.

My question is, how do I change the default SOA record to match the first ns1 given. For example.com I have the records:
$TTL 14400
@ IN SOA ns1.vestaCPdomain.com. root.example.com. (
2020020803
7200
3600
1209600
180 )

@ 14400 IN NS ns1.example.com.
@ 14400 IN NS ns2.example.com.
ns1 14400 IN A redacted
ns2 14400 IN A redacted
@ 14400 IN A redacted
www 14400 IN A redacted
ftp 14400 IN A redacted
mail 14400 IN A redacted
smtp 14400 IN A redacted
pop 14400 IN A redacted
imap 14400 IN A redacted
@ 14400 IN MX 10 mail.example.com.
@ 14400 IN TXT "v=spf1 a mx ip4:redacted ~all"
_dmarc 14400 IN TXT "v=DMARC1; p=none"
autoconfig 14400 IN A redacted
autodiscover 14400 IN A redacted
_autodiscover 14400 IN SRV 0 0 443 mail.example.com.
_domainkey 14400 IN TXT "t=y; o=~;"
mail._domainkey 14400 IN TXT "v=DKIM1; k=rsa; p=MIGDDAyFanNfPjBAWSpiAfMA0GCSqGSIb3DQEBAQUAA4GNADBM9hYNCBiQKBgQhYo1VOLDEQzUEKJxOVXKnTDOvCzRQ2MqrcCEQW9lNrr19Zm+riOVNRH$ <-- mixed up for security

notice this is a completely freshly made domain in VestaCP. I just would like the SOA to be ns1.example.com vs ns1.vestacpdomain.com

Is there a way to update that?
Top

ralbrightii
Posts: 11
Joined: Sat Nov 23, 2019 1:37 am

Os: Ubuntu 17x
Web: apache + nginx
Re: Change default SOA
  • Quote

Post by ralbrightii » Sun Feb 09, 2020 7:14 am

So piggy backing....

I got the change to happen and not happen. I changed some lines in #Update domain zone to the following:

Code: Select all

# Update domain zone
update_domain_zone() {
    domain_param=$(grep "DOMAIN='$domain'" $USER_DATA/dns.conf)
    eval $domain_param
    SOA=$(idn --quiet -a -t "$SOA")
    if [ -z "$SERIAL" ]; then
        SERIAL=$(date +'%Y%m%d01')
    fi
    if [[ "$domain" = *[![:ascii:]]* ]]; then
        domain_idn=$(idn -t --quiet -a $domain)
    else
        domain_idn=$domain
    fi
    zn_conf="$HOMEDIR/$user/conf/dns/$domain.db"
    echo "\$TTL $TTL
@    IN    SOA    [i][b]ns1.$domain.[/b][/i]    [i][b]root.$domain.[/b][/i] (
                                            $SERIAL
                                            7200
                                            3600
                                            1209600
                                            [i][b]3600[/b][/i] )
" > $zn_conf
    fields='$RECORD\t$TTL\tIN\t$TYPE\t$PRIORITY\t$VALUE'
    while read line ; do
        IFS=$'\n'
        for key in $(echo $line|sed "s/' /'\n/g"); do
            eval ${key%%=*}="${key#*=}"
        done

        RECORD=$(idn --quiet -a -t "$RECORD")
        if [ "$TYPE" = 'CNAME' ] || [ "$TYPE" = 'MX' ]; then
            VALUE=$(idn --quiet -a -t "$VALUE")
        fi

        if [ "$SUSPENDED" != 'yes' ]; then
            eval echo -e "\"$fields\""|sed "s/%quote%/'/g" >> $zn_conf
        fi
    done < $USER_DATA/dns/$domain.conf
}
1) the first change was change $SOA. to ns1.$domain.
2) the second change was change root.$domain_idn to ns1.$domain.
3) the third change was change the 180 to 3600 <-- this is the Minimum TTL, which DNSInspect.com was always complaining about.

So I make these changes and then DNSInspect.com shows everything correctly, however, VestaCP shows the SOA as the still old field of ns1.VestaCPdomain
Now to figure out how to update that one.... if anyone has any ideas, I am all ears.
Last edited by ralbrightii on Sun Feb 23, 2020 3:39 pm, edited 1 time in total.
Top

caustino
Posts: 4
Joined: Fri Feb 21, 2020 6:23 am

Os: Debian 8x
Web: apache + nginx
Re: Change default SOA
  • Quote

Post by caustino » Sun Feb 23, 2020 7:43 am

simple .... there has been a section for several years
viewtopic.php?t=9957

I hope to help you
Top

ralbrightii
Posts: 11
Joined: Sat Nov 23, 2019 1:37 am

Os: Ubuntu 17x
Web: apache + nginx
Re: Change default SOA
  • Quote

Post by ralbrightii » Sun Feb 23, 2020 3:41 pm

caustino wrote: ↑
Sun Feb 23, 2020 7:43 am
simple .... there has been a section for several years
viewtopic.php?t=9957

I hope to help you
I appreciate the comment, but I saw that post and tried to make those changes. In the linked post he wants all domains to have the same root.domain.com, I however want to do the opposite, I want to set the SOA RNAME to the given domain name. (not the root)
Top


Post Reply
  • Print view

4 posts • Page 1 of 1

Return to “DNS Server”



  • Board index
  • All times are UTC
  • Delete all board cookies
  • The team
Powered by phpBB® Forum Software © phpBB Limited
*Original Author: Brad Veryard
*Updated to 3.2 by MannixMD
 

 

cron

Login  •  Register

I forgot my password