1 package com.verisign.cl;
5 import org.xbill.DNS.*;
6 import com.verisign.tat.dnssec.CaptiveValidator;
8 public class DNSSECReconciler {
11 * Invoke with java -jar dnssecreconciler.jar server=127.0.0.1 \
12 * query_file=queries.txt dnskey_query=net dnskey_query=edu
14 private CaptiveValidator validator;
19 public String queryFile;
20 public String dnskeyFile;
21 public List<String> dnskeyNames;
24 validator = new CaptiveValidator();
27 public void execute() {
31 private static void usage() {
32 System.err.println("usage: java -jar dnssecreconiler.jar [..options..]");
33 System.err.println(" server: the DNS server to query.");
34 System.err.println(" query: a name [type [flags]] string.");
35 System.err.println(" query_file: a list of queries, one query per line.");
36 System.err.println(" dnskey_file: a file containing DNSKEY RRs to trust.");
37 System.err.println(" dnskey_query: query 'server' for DNSKEY at given name to trust, may repeat");
40 public static int main(String[] argv) {
42 DNSSECReconciler dr = new DNSSECReconciler();
45 // Parse the command line options
46 for (String arg : argv) {
48 if (arg.indexOf('=') < 0) {
49 System.err.println("Unrecognized option: " + arg);
54 String[] split_arg = arg.split("[ \t]*=[ \t]*", 2);
55 String opt = split_arg[0];
56 String optarg = split_arg[1];
58 if (opt.equals("server")) {
60 } else if (opt.equals("query_file")) {
61 dr.queryFile = optarg;
62 } else if (opt.equals("dnskey_file")) {
63 dr.dnskeyFile = optarg;
64 } else if (opt.equals("dnskey_query")) {
65 if (dr.dnskeyNames == null) {
66 dr.dnskeyNames = new ArrayList<String>();
68 dr.dnskeyNames.add(optarg);
70 System.err.println("Unrecognized option: " + opt);
76 // Check for minimum usage
77 if (dr.server == null) {
78 System.err.println("'server' must be specified");
82 if (dr.query == null && dr.queryFile == null) {
83 System.err.println("Either 'query' or 'query_file' must be specified");
87 if (dr.dnskeyFile == null && dr.dnskeyNames == null) {
88 System.err.println("Either 'dnskey_file' or 'dnskey_query' must be specified");
97 } catch (Exception e) {