example4.rst revision 302408
1.. _example_examine: 2 3============================== 4DNSSEC validator 5============================== 6 7This example program performs DNSSEC validation of a DNS lookup. 8 9:: 10 11 #!/usr/bin/python 12 import os 13 from unbound import ub_ctx,RR_TYPE_A,RR_CLASS_IN 14 15 ctx = ub_ctx() 16 ctx.resolvconf("/etc/resolv.conf") 17 if (os.path.isfile("keys")): 18 ctx.add_ta_file("keys") #read public keys for DNSSEC verification 19 20 status, result = ctx.resolve("www.nic.cz", RR_TYPE_A, RR_CLASS_IN) 21 if status == 0 and result.havedata: 22 23 print "Result:", result.data.address_list 24 25 if result.secure: 26 print "Result is secure" 27 elif result.bogus: 28 print "Result is bogus" 29 else: 30 print "Result is insecure" 31 32More detailed informations can be seen in libUnbound DNSSEC tutorial `here`_. 33 34.. _here: http://www.unbound.net/documentation/libunbound-tutorial-6.html 35