DNS stop working after 99 DNS record change per day
Posted: Tue Oct 22, 2019 6:50 pm
(sory for bad english, not my first language, and a long day at work !)
Hello,
I leave this post because i found a 'bug'. I pose here the problem, the analysis, and the resolution. If a VestaCP developer could incorporate the modification in the source code, it would be useful for many of us!
The problem:
During massive transfer of some of my servers, I have a script that modify DNS configuration record by record on the fly. After a while, the DNS server was falling down, and I had to completely remove the DNS from the domain to recreate it.
Origin of the bug :
After analysis, I concluded that it is the 'serial' attached to the DNS record that was involved. Serial format is YYYMMDDXX where XX is a number incremented each time the DNS configuration is changed. In conclusion, you can not make more than 99 DNS change in one day on a domain.
Solution:
In order to overcome this, I made the following changes:
in file /usr/local/vesta/func/domain.sh :
in function update_domain_zone()
Replace :
By :
and replace function update_domain_serial() by this one :
You will be abe to make up to 9999 DNS change per day and per domain
Hoping it will help !
----------------------
Having issues with your server ? contact me !
Pierre-Guillaume - MathsiMo
Hello,
I leave this post because i found a 'bug'. I pose here the problem, the analysis, and the resolution. If a VestaCP developer could incorporate the modification in the source code, it would be useful for many of us!
The problem:
During massive transfer of some of my servers, I have a script that modify DNS configuration record by record on the fly. After a while, the DNS server was falling down, and I had to completely remove the DNS from the domain to recreate it.
Origin of the bug :
After analysis, I concluded that it is the 'serial' attached to the DNS record that was involved. Serial format is YYYMMDDXX where XX is a number incremented each time the DNS configuration is changed. In conclusion, you can not make more than 99 DNS change in one day on a domain.
Solution:
In order to overcome this, I made the following changes:
in file /usr/local/vesta/func/domain.sh :
in function update_domain_zone()
Replace :
Code: Select all
if [ -z "$SERIAL" ]; then
SERIAL=$(date +'%Y%m%d01')
fi
Code: Select all
if [ -z "$SERIAL" ]; then
SERIAL=$(date +'%y%m%d0001')
fi
Code: Select all
update_domain_serial() {
zn_conf="$HOMEDIR/$user/conf/dns/$domain.db"
if [ -e $zn_conf ]; then
zn_serial=$(head $zn_conf |grep 'SOA' -A1 |tail -n 1 |sed "s/ //g")
s_date=$(echo ${zn_serial:0:6})
c_date=$(date +'%y%m%d')
if [ "$s_date" == "$c_date" ]; then
cur_value=$(echo ${zn_serial:6} )
new_value=$(expr $cur_value + 1 )
len_value=$(expr length $new_value)
if [ 1 -eq "$len_value" ]; then
new_value='000'$new_value
fi
if [ 2 -eq "$len_value" ]; then
new_value='00'$new_value
fi
if [ 3 -eq "$len_value" ]; then
new_value='0'$new_value
fi
serial="$c_date""$new_value"
else
serial="$(date +'%y%m%d0001')"
fi
else
serial="$(date +'%y%m%d0001')"
fi
add_object_key "dns" 'DOMAIN' "$domain" 'SERIAL' 'RECORDS'
update_object_value 'dns' 'DOMAIN' "$domain" '$SERIAL' "$serial"
}
Hoping it will help !
----------------------
Having issues with your server ? contact me !
Pierre-Guillaume - MathsiMo