<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Hi,<br>
<br>
On 06/16/11 14:47, Brian Smith wrote:
<blockquote class=" cite" id="mid_4DF9FB60_3010300_gmail_com"
cite="mid:4DF9FB60.3010300@gmail.com" type="cite">
<br>
Can Unbound, out of the box, be configured to have a default
response? IE respond to a query for doesnotexist.com (this would
normally respond NXDomain) with some sort of answer?
<br>
<br>
</blockquote>
Just for the archive (and if you don't give a shit about the debian
way), you can easily achieve this with a python helper module:<br>
<tt>class unbound(): <br>
def init(self, id, cfg):<br>
return True<br>
<br>
def deinit(self, id):<br>
return True<br>
<br>
def inform_super(self, id, qstate, superqstate, qdata):<br>
return True<br>
<br>
def operate(self, id, event, qstate, qdata):<br>
if (event == MODULE_EVENT_PASS) or (event ==
MODULE_EVENT_NEW):<br>
qstate.ext_state[id] = MODULE_WAIT_MODULE<br>
return True<br>
<br>
if event == MODULE_EVENT_MODDONE:<br>
if (qstate.return_msg and
qstate.qinfo.qtype_str=='A'):<br>
flags = qstate.return_msg.rep.flags & 0xf<br>
if flags == RCODE_NXDOMAIN:<br>
msg = DNSMessage(qstate.qinfo.qname_str,
RR_TYPE_A, RR_CLASS_IN, PKT_QR | PKT_RA | PKT_AA)<br>
if (qstate.qinfo.qtype == RR_TYPE_A) or
(qstate.qinfo.qtype == RR_TYPE_ANY):<br>
msg.answer.append("%s 10 IN A 127.0.0.1" %
qstate.qinfo.qname_str)<br>
if not msg.set_return_msg(qstate):<br>
qstate.ext_state[id] = MODULE_ERROR <br>
return True<br>
<br>
#we don't need validation, result is valid<br>
qstate.return_msg.rep.security = 2 <br>
qstate.return_rcode = RCODE_NOERROR<br>
qstate.ext_state[id] = MODULE_FINISHED <br>
return True<br>
<br>
qstate.ext_state[id] = MODULE_FINISHED<br>
return True <br>
<br>
dnsObj = unbound()<br>
init = dnsObj.init<br>
deinit = dnsObj.deinit<br>
operate = dnsObj.operate<br>
inform_super = dnsObj.inform_super</tt><br>
<br>
This will give back 127.0.0.1 for every NXDOMAIN answers for A RR
type queries with a 10 seconds TTL.<br>
</body>
</html>