X-Git-Url: https://git.svenne.dk/?p=public%2Fdnssec-swede-utility.git;a=blobdiff_plain;f=swede;fp=swede;h=cd212a4c38b5595c387f9b4e7f9d89e25898f34c;hp=bcf4d40c6905e892891968c0a0081a9d5ce1bf16;hb=d72cfd587834bff75f852e761a8581b5149f03fa;hpb=9d9206ec2436b7f489c1ee543bafa4628f702efe diff --git a/swede b/swede index bcf4d40..cd212a4 100755 --- a/swede +++ b/swede @@ -17,6 +17,7 @@ import sys import os +import os.path import socket import unbound import re @@ -132,8 +133,22 @@ def getRecords(hostname, rrtype='A', secure=True): """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)