key. No chasing is done. When \fBdrill\fR is doing a secure trace, this
key will be used as trust anchor. Can contain a DNSKEY or a DS record.
-Alternatively, if \fB-k\fR is not specified, and a default trust anchor
+Alternatively, when DNSSEC enabled tracing (\fB-TD\fR) or signature
+chasing (\fB-S\fR), if \fB-k\fR is not specified, and a default trust anchor
(@LDNS_TRUST_ANCHOR_FILE@) exists and contains a valid DNSKEY or DS record,
it will be used as the trust anchor.
fprintf(stream, "\t-b <bufsize>\tuse <bufsize> as the buffer size (defaults to 512 b)\n");
fprintf(stream, "\t-c <file>\tuse file for rescursive nameserver configuration"
"\n\t\t\t(/etc/resolv.conf)\n");
- fprintf(stream, "\t-k <file>\tspecify a file that contains a trusted DNSSEC key"
- "\n\t\t\t(DNSKEY|DS) [**]\n");
- fprintf(stream, "\t\t\tused to verify any signatures in the current answer\n");
- fprintf(stream, "\t\t\tIf DNSSEC is enabled and no key files are given, keys\n"
- "\t\t\tare read from %s\n",
+ fprintf(stream, "\t-k <file>\tspecify a file that contains a trusted DNSSEC key [**]\n");
+ fprintf(stream, "\t\t\tUsed to verify any signatures in the current answer.\n");
+ fprintf(stream, "\t\t\tWhen DNSSEC enabled tracing (-TD) or signature\n"
+ "\t\t\tchasing (-S) and no key files are given, keys are read\n"
+ "\t\t\tfrom: %s\n",
LDNS_TRUST_ANCHOR_FILE);
fprintf(stream, "\t-o <mnemonic>\tset flags to:"
"\n\t\t\t[QR|qr][AA|aa][TC|tc][RD|rd][CD|cd][RA|ra][AD|ad]\n");
argc -= optind;
argv += optind;
- if ((qdnssec || PURPOSE == DRILL_CHASE) &&
+ if ((PURPOSE == DRILL_CHASE || (PURPOSE == DRILL_TRACE && qdnssec)) &&
ldns_rr_list_rr_count(key_list) == 0) {
(void) read_key_file(LDNS_TRUST_ANCHOR_FILE, key_list, true);
return LDNS_STATUS_MEM_ERR;
}
*rrs = ldns_pkt_rr_list_by_type(p, t, LDNS_SECTION_ANSWER);
- if (ldns_rr_list_rr_count(*rrs) == 0 /* *rrs will actually be NULL then! */
- || ! ldns_resolver_dnssec(r)) {
+
+ if (! ldns_resolver_dnssec(r)) { /* DNSSEC explicitely disabled,
+ anything goes */
ldns_pkt_free(p);
return LDNS_STATUS_OK;
}
+ if (ldns_rr_list_rr_count(*rrs) == 0) { /* assert(*rrs == NULL) */
+
+ if (ldns_pkt_get_rcode(p) == LDNS_RCODE_SERVFAIL) {
+
+ ldns_pkt_free(p);
+ return LDNS_STATUS_DANE_BOGUS;
+ } else {
+ ldns_pkt_free(p);
+ return LDNS_STATUS_OK;
+ }
+ }
/* We have answers and we have dnssec. */
if (! ldns_pkt_cd(p)) { /* we act as stub resolver (no sigchase) */
+
if (! ldns_pkt_ad(p)) { /* Not secure */
- goto insecure;
+
+ ldns_pkt_free(p);
+ return LDNS_STATUS_DANE_INSECURE;
}
ldns_pkt_free(p);
return LDNS_STATUS_OK;
if (s == LDNS_STATUS_DANE_INSECURE &&
ldns_rr_list_rr_count(as) > 0) {
- fprintf(stderr, "Warning! Insecure IPv4 addresses\n");
+ fprintf(stderr, "Warning! Insecure IPv4 addresses. "
+ "Continuing with them...\n");
+
+ } else if (s == LDNS_STATUS_DANE_BOGUS ||
+ LDNS_STATUS_CRYPTO_BOGUS == s) {
+ fprintf(stderr, "Warning! Bogus IPv4 addresses. "
+ "Discarding...\n");
+ ldns_rr_list_deep_free(as);
+ as = ldns_rr_list_new();
} else if (s != LDNS_STATUS_OK) {
LDNS_ERR(s, "dane_query");
if (s == LDNS_STATUS_DANE_INSECURE &&
ldns_rr_list_rr_count(aaas) > 0) {
- fprintf(stderr, "Warning! Insecure IPv6 addresses\n");
+ fprintf(stderr, "Warning! Insecure IPv6 addresses. "
+ "Continuing with them...\n");
+
+ } else if (s == LDNS_STATUS_DANE_BOGUS ||
+ LDNS_STATUS_CRYPTO_BOGUS == s) {
+ fprintf(stderr, "Warning! Bogus IPv4 addresses. "
+ "Discarding...\n");
+ ldns_rr_list_deep_free(aaas);
+ aaas = ldns_rr_list_new();
} else if (s != LDNS_STATUS_OK) {
LDNS_ERR(s, "dane_query");
transport = LDNS_DANE_TRANSPORT_UDP;
break;
case 'v':
- printf("verify-zone version %s (ldns version %s)\n",
+ printf("ldns-dane version %s (ldns version %s)\n",
LDNS_VERSION, ldns_version());
exit(EXIT_SUCCESS);
break;