[fix] ask cron to flush bind cache on key migration situation

This commit is contained in:
Laurent Peuch 2017-09-21 05:58:49 +02:00
parent 48fe53d437
commit 0c40a0275e
2 changed files with 13 additions and 6 deletions

View file

@ -119,3 +119,9 @@ else:
os.system('/usr/sbin/rndc reload')
print("An error occured ! Please check daemon.log and your conf.bad")
exit(1)
# mein got this is so awful
if os.path.exists('/tmp/dynette_flush_bind_cache'):
os.system('/usr/sbin/rndc flush')
os.system('/usr/sbin/rndc reload')
os.system('rm /tmp/dynette_flush_bind_cache')

View file

@ -228,12 +228,13 @@ put '/migrate_key_to_sha512/' do
halt 412, { :error => "A problem occured during key algo migration" }.to_json
end
# need to regenerate bind9 stuff
# yes this is awful
`python /root/dynette/dynette.cron.py`
# flush this idiotic bind cache because he doesn't know how to do that
# himself
`/usr/sbin/rndc flush`
# I don't have any other way of communicating with this dynette.cron.py
# this is awful
File.open("/tmp/dynette_flush_bind_cache", "w").close
# assume that the dynette.cron.py runs every minute like on prod and add a
# bit of security margin. I hate that.
sleep(90)
halt 201, { :public_key => entry.public_key, :subdomain => entry.subdomain, :current_ip => entry.current_ip }.to_json
end