Skip to content
Snippets Groups Projects
Commit 240d71dc authored by Bob Mottram's avatar Bob Mottram
Browse files

Randomize cron timings for freedns updates

This avoids creating a fingerprint for freedombone installs
parent fde8e856
No related branches found
No related tags found
No related merge requests found
......@@ -129,8 +129,19 @@ function freedns_update_cron {
ddns_code=$(grep 'DEFAULT_DOMAIN_CODE=' "$CONFIGURATION_FILE" | awk -F '=' '{print $2}')
if [ "$ddns_code" ]; then
if [ ${#ddns_code} -gt 10 ]; then
# TODO randomise these timings
echo "3,8,13,18,23,28,33,38,43,48,53,58 * * * * root sleep 46 ; wget --no-check-certificate -O - https://freedns.afraid.org/dynamic/update.php?${ddns_code}= >> /var/log/freedns_@_update.log 2>&1 &" >> /etc/crontab
dns_update1=$(shuf -i 1-7 -n 1)
dns_update2=$(shuf -i 8-12 -n 1)
dns_update3=$(shuf -i 13-17 -n 1)
dns_update4=$(shuf -i 18-22 -n 1)
dns_update5=$(shuf -i 23-27 -n 1)
dns_update6=$(shuf -i 28-32 -n 1)
dns_update7=$(shuf -i 33-37 -n 1)
dns_update8=$(shuf -i 38-42 -n 1)
dns_update9=$(shuf -i 43-47 -n 1)
dns_update10=$(shuf -i 48-52 -n 1)
dns_update11=$(shuf -i 53-56 -n 1)
dns_update12=$(shuf -i 57-59 -n 1)
echo "${dns_update1},${dns_update2},${dns_update3},${dns_update4},${dns_update5},${dns_update6},${dns_update7},${dns_update8},${dns_update9},${dns_update10},${dns_update11},${dns_update12} * * * * root sleep 46 ; wget --no-check-certificate -O - https://freedns.afraid.org/dynamic/update.php?${ddns_code}= >> /var/log/freedns_@_update.log 2>&1 &" >> /etc/crontab
fi
fi
fi
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment