Created
April 19, 2020 00:48
-
-
Save Someguy123/de4dc9194122bded372941bdf559308a to your computer and use it in GitHub Desktop.
A dump of PowerDNS Lua scripting/configuration used for maintaining a DNS seed/pool domain (returns multiple A/AAAA records based on available servers), such as Privex's Chrony (time server) pool
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- | |
-- Name: configv4.chrony.privex.cc | |
-- Type: LUA | |
-- Value: LUA "include('g_a'); SEv4={g_a('se1', 1), g_a('se2', 1)} DEv4={g_a('de1', 1), g_a('de2', 1)} FIv4={g_a('fi1', 1)}" | |
-- | |
include('g_a'); | |
SEv4={g_a('se1', 1), g_a('se2', 1)} | |
DEv4={g_a('de1', 1), g_a('de2', 1)} | |
FIv4={g_a('fi1', 1)} | |
-- | |
-- Name: configv6.chrony.privex.cc | |
-- Type: LUA | |
-- Value: LUA "include('g_a'); SEv6={g_a('se1', 28), g_a('se2', 28)} DEv6={g_a('de1', 28), g_a('de2', 28)} FIv6={g_a('fi1', 28)}" | |
-- | |
include('g_a'); | |
SEv6={g_a('se1', 28), g_a('se2', 28)} | |
DEv6={g_a('de1', 28), g_a('de2', 28)} | |
FIv6={g_a('fi1', 28)} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- | |
-- Name: g_a.chrony.privex.cc | |
-- Type: LUA | |
-- Value: LUA "function g_a(domain, idx) local r=resolve(domain .. '.chrony.privex.cc', idx) local t={} for _,v in ipairs(r) do table.insert(t, v:toString()); end; return t[1]; end" | |
-- | |
-- Usage: | |
-- g_a('se1', 1) -- Get first A record for se1.chrony.privex.cc | |
-- g_a('de1', 28) -- Get first AAAA record for de1.chrony.privex.cc | |
-- | |
-- idx (qtype / record type) reference: https://github.com/PowerDNS/pdns/blob/68d8625d3c8a8dee878cfc686358e068664a2cd6/pdns/qtype.hh | |
-- | |
function g_a(domain, idx) | |
local r=resolve(domain .. '.chrony.privex.cc', idx) | |
local t={} | |
for _,v in ipairs(r) do | |
table.insert(t, v:toString()); | |
end; | |
return t[1]; | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Name: chrony.privex.cc | |
-- Type: LUA | |
-- Value: A ";include('configv4'); include('tableconcat'); return TableConcat( TableConcat(SEv4, DEv4), FIv4) ;" | |
include('configv4'); | |
include('tableconcat'); | |
return TableConcat( TableConcat(SEv4, DEv4), FIv4); | |
-- Name: chrony.privex.cc | |
-- Type: LUA | |
-- Value: AAAA ";include('configv6'); include('tableconcat'); return TableConcat( TableConcat(SEv6, DEv6), FIv6) ;" | |
include('configv6'); | |
include('tableconcat'); | |
return TableConcat( TableConcat(SEv6, DEv6), FIv6); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Name: se.chrony.privex.cc | |
-- Type: LUA | |
-- Value: A ";include('configv4'); return SEv4;" | |
include('configv4'); | |
return SEv4; | |
-- Name: se.chrony.privex.cc | |
-- Type: LUA | |
-- Value: AAAA ";include('configv6'); return SEv6;" | |
include('configv6'); | |
return SEv6; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- | |
-- Name: tableconcat.chrony.privex.cc | |
-- Type: LUA | |
-- Value: LUA "function TableConcat(t1,t2) for i=1,#t2 do t1[#t1+1] = t2[i]; end; return t1; end;" | |
-- | |
-- Usage: | |
-- a = {'a', 'b', 'c'} | |
-- b = {'d', 'e', 'f'} | |
-- c = TableConcat(a, b) | |
-- -- c is now: {'a', 'b', 'c', 'd', 'e', 'f'} | |
-- | |
function TableConcat(t1,t2) | |
for i=1,#t2 do | |
t1[#t1+1] = t2[i]; | |
end; | |
return t1; | |
end; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment