From d72cfd587834bff75f852e761a8581b5149f03fa Mon Sep 17 00:00:00 2001 From: Svenne Krap Date: Sun, 29 Jul 2012 20:48:05 +0200 Subject: [PATCH] search for root.key and dlv.isc.org.key in /etc/swede --- swede | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) 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) -- 2.36.1