feat(pdns): Add new file dynupdate.lua
dynamic updates to dns
This commit is contained in:
parent
b3f6921d88
commit
0911e09858
1 changed files with 36 additions and 0 deletions
36
pdns/dynupdate.lua
Normal file
36
pdns/dynupdate.lua
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
function removeExclamationMark(input)
|
||||||
|
if input:find('%!$')
|
||||||
|
then
|
||||||
|
return input(bar:sub(1, -1))
|
||||||
|
else
|
||||||
|
return input
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function updatepolicy(input)
|
||||||
|
|
||||||
|
-- target zone where the CNAMEs point to
|
||||||
|
myzone = "dhcp.domain.com"
|
||||||
|
|
||||||
|
-- allowed networks to accept updates from
|
||||||
|
mynetworks = newNMG()
|
||||||
|
mynetworks:addMasks({"1.2.3.4", "127.0.0.1"})
|
||||||
|
|
||||||
|
-- ignore non-authorized networks
|
||||||
|
if not mynetworks:match(input:getRemote())
|
||||||
|
then
|
||||||
|
pdnslog("dynupdate: network check failed from " .. input:getRemote():toString(), pdns.loglevels.Info)
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
pdnslog("dynupdate: incoming request for " .. input:getZoneName():toString(), pdns.loglevels.Info)
|
||||||
|
|
||||||
|
if (input:getQType() == pdns.A and input:getZoneName():toString() == myzone)
|
||||||
|
then
|
||||||
|
if input:getQName():toString() == hostname .. "." or input:getQName():toString() == hostname .. "." .. input:getZoneName():toString()
|
||||||
|
then
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return false
|
||||||
|
end
|
Loading…
Add table
Add a link
Reference in a new issue