import sys
import os
+import os.path
import socket
import unbound
import re
"""Do a lookup of a name and a rrtype, returns a list of binary coded strings. Only queries for rr_class IN."""
global resolvconf
ctx = unbound.ub_ctx()
- ctx.add_ta_file('root.key')
- ctx.set_option("dlv-anchor-file:", "dlv.isc.org.key")
+ if os.path.exists("root.key"):
+ ctx.add_ta_file('root.key')
+ elif os.path.exists("/etc/swede/root.key"):
+ ctx.add_ta_file('/etc/swede/root.key')
+ else:
+ print "Cannot find root.key, please move it to /etc/swede"
+ sys.exit()
+
+ if os.path.exists("dlv.isc.org.key"):
+ ctx.set_option("dlv-anchor-file:", "dlv.isc.org.key")
+ elif os.path.exists("/etc/swede/dlv.isc.org.key"):
+ ctx.set_option("dlv-anchor-file:", "/etc/swede/dlv.isc.org.key")
+ else:
+ print "Cannot find dlv.isc.org.key, please move it to /etc/swede"
+ sys.exit()
+
# Use the local cache
if resolvconf and os.path.isfile(resolvconf):
ctx.resolvconf(resolvconf)