const char *msg, ...) ISC_FORMAT_PRINTF(4, 5);
static void notify_log(dns_zone_t *zone, int level, const char *fmt, ...)
ISC_FORMAT_PRINTF(3, 4);
+static void dnssec_log(dns_zone_t *zone, int level, const char *fmt, ...)
+ ISC_FORMAT_PRINTF(3, 4);
static void queue_xfrin(dns_zone_t *zone);
static isc_result_t update_one_rr(dns_db_t *db, dns_dbversion_t *ver,
dns_diff_t *diff, dns_diffop_t op,
algorithm = "RSASHA1";
}
if (logit) {
- dns_zone_log(zone, ISC_LOG_WARNING,
- "weak %s (%u) key found "
- "(exponent=3)", algorithm,
- dnskey.algorithm);
+ dnssec_log(zone, ISC_LOG_WARNING,
+ "weak %s (%u) key found "
+ "(exponent=3)", algorithm,
+ dnskey.algorithm);
}
}
dns_rdata_reset(&rdata);
(rdata.data[1] << 8) | rdata.data[2],
rdata.data[3]);
if (result != ISC_R_SUCCESS) {
- dns_zone_log(zone, ISC_LOG_ERROR,
- "zone_signwithkey failed: %s",
- dns_result_totext(result));
+ dnssec_log(zone, ISC_LOG_ERROR,
+ "zone_signwithkey failed: %s",
+ dns_result_totext(result));
}
dns_rdata_reset(&rdata);
}
result = dns_nsec3param_salttotext(nsec3param, saltbuf,
sizeof(saltbuf));
RUNTIME_CHECK(result == ISC_R_SUCCESS);
- dns_zone_log(zone, ISC_LOG_INFO,
- "zone_addnsec3chain(%u,%s,%u,%s)",
- nsec3param->hash, flags, nsec3param->iterations,
- saltbuf);
+ dnssec_log(zone, ISC_LOG_INFO, "zone_addnsec3chain(%u,%s,%u,%s)",
+ nsec3param->hash, flags, nsec3param->iterations, saltbuf);
/*
* If the NSEC3 chain defined by the supplied NSEC3PARAM RDATA is
*/
result = zone_addnsec3chain(zone, &nsec3param);
if (result != ISC_R_SUCCESS) {
- dns_zone_log(zone, ISC_LOG_ERROR,
- "zone_addnsec3chain failed: %s",
- dns_result_totext(result));
+ dnssec_log(zone, ISC_LOG_ERROR,
+ "zone_addnsec3chain failed: %s",
+ dns_result_totext(result));
}
}
}
if (trusted == 0 && pending != 0) {
char namebuf[DNS_NAME_FORMATSIZE];
dns_name_format(name, namebuf, sizeof namebuf);
- dns_zone_log(zone, ISC_LOG_ERROR,
- "No valid trust anchors for '%s'!", namebuf);
- dns_zone_log(zone, ISC_LOG_ERROR,
- "%d key(s) revoked, %d still pending",
+ dnssec_log(zone, ISC_LOG_ERROR,
+ "No valid trust anchors for '%s'!", namebuf);
+ dnssec_log(zone, ISC_LOG_ERROR,
+ "%d key(s) revoked, %d still pending",
revoked, pending);
- dns_zone_log(zone, ISC_LOG_ERROR,
- "All queries to '%s' will fail", namebuf);
+ dnssec_log(zone, ISC_LOG_ERROR,
+ "All queries to '%s' will fail", namebuf);
fail_secure(zone, name);
}
}
result = dns_db_newversion(db, &ver);
if (result != ISC_R_SUCCESS) {
- dns_zone_log(zone, ISC_LOG_ERROR,
- "sync_keyzone:dns_db_newversion -> %s",
- dns_result_totext(result));
+ dnssec_log(zone, ISC_LOG_ERROR,
+ "sync_keyzone:dns_db_newversion -> %s",
+ dns_result_totext(result));
goto failure;
}
if (result != ISC_R_SUCCESS &&
!DNS_ZONE_FLAG(zone, DNS_ZONEFLG_LOADED))
{
- dns_zone_log(zone, ISC_LOG_ERROR,
- "unable to synchronize managed keys: %s",
- dns_result_totext(result));
+ dnssec_log(zone, ISC_LOG_ERROR,
+ "unable to synchronize managed keys: %s",
+ dns_result_totext(result));
isc_time_settoepoch(&zone->refreshkeytime);
}
if (keynode != NULL) {
dns_name_format(name, namebuf, sizeof(namebuf));
dns_rdatatype_format(next.covers,
typebuf, sizeof(typebuf));
- dns_zone_logc(zone, DNS_LOGCATEGORY_ZONELOAD,
- ISC_LOG_DEBUG(3),
- "next resign: %s/%s "
- "in %d seconds", namebuf, typebuf,
- next.resign - timenow -
- zone->sigresigninginterval);
+ dnssec_log(zone, ISC_LOG_DEBUG(3),
+ "next resign: %s/%s "
+ "in %d seconds", namebuf, typebuf,
+ next.resign - timenow -
+ zone->sigresigninginterval);
dns_rdataset_disassociate(&next);
} else {
- dns_zone_logc(zone, DNS_LOGCATEGORY_ZONELOAD,
- ISC_LOG_WARNING,
- "signed dynamic zone has no "
- "resign event scheduled");
+ dnssec_log(zone, ISC_LOG_WARNING,
+ "signed dynamic zone has no "
+ "resign event scheduled");
}
}
cleanup:
if (zone->type == dns_zone_key && result != ISC_R_SUCCESS) {
- dns_zone_log(zone, ISC_LOG_ERROR,
- "failed to initialize managed-keys (%s): "
- "DNSSEC validation is at risk",
- isc_result_totext(result));
+ dnssec_log(zone, ISC_LOG_ERROR,
+ "failed to initialize managed-keys (%s): "
+ "DNSSEC validation is at risk",
+ isc_result_totext(result));
}
for (inc = ISC_LIST_HEAD(zone->newincludes);
result = dns_db_newversion(db, &version);
if (result != ISC_R_SUCCESS) {
- dns_zone_log(zone, ISC_LOG_ERROR,
- "zone_nsec3chain:dns_db_newversion -> %s",
- dns_result_totext(result));
+ dnssec_log(zone, ISC_LOG_ERROR,
+ "zone_nsec3chain:dns_db_newversion -> %s",
+ dns_result_totext(result));
goto failure;
}
result = dns__zone_findkeys(zone, db, version, now, zone->mctx,
DNS_MAXZONEKEYS, zone_keys, &nkeys);
if (result != ISC_R_SUCCESS) {
- dns_zone_log(zone, ISC_LOG_ERROR,
- "zone_nsec3chain:dns__zone_findkeys -> %s",
- dns_result_totext(result));
+ dnssec_log(zone, ISC_LOG_ERROR,
+ "zone_nsec3chain:dns__zone_findkeys -> %s",
+ dns_result_totext(result));
goto failure;
}
zone->minimum, unsecure,
&nsec3_diff);
if (result != ISC_R_SUCCESS) {
- dns_zone_log(zone, ISC_LOG_ERROR, "zone_nsec3chain:"
- "dns_nsec3_addnsec3 -> %s",
- dns_result_totext(result));
+ dnssec_log(zone, ISC_LOG_ERROR, "zone_nsec3chain:"
+ "dns_nsec3_addnsec3 -> %s",
+ dns_result_totext(result));
goto failure;
}
ISC_LIST_APPEND(cleanup, nsec3chain, link);
goto next_addchain;
} else if (result != ISC_R_SUCCESS) {
- dns_zone_log(zone, ISC_LOG_ERROR,
- "zone_nsec3chain:"
- "dns_dbiterator_next -> %s",
- dns_result_totext(result));
+ dnssec_log(zone, ISC_LOG_ERROR,
+ "zone_nsec3chain:"
+ "dns_dbiterator_next -> %s",
+ dns_result_totext(result));
goto failure;
} else if (delegation) {
dns_dbiterator_current(nsec3chain->dbiterator,
&nsec3chain->nsec3param,
&buildnsecchain);
if (result != ISC_R_SUCCESS) {
- dns_zone_log(zone, ISC_LOG_ERROR,
- "zone_nsec3chain:"
- "need_nsec_chain -> %s",
- dns_result_totext(result));
+ dnssec_log(zone, ISC_LOG_ERROR,
+ "zone_nsec3chain:"
+ "need_nsec_chain -> %s",
+ dns_result_totext(result));
goto failure;
}
}
if (first) {
- dns_zone_log(zone, ISC_LOG_DEBUG(3), "zone_nsec3chain:"
- "buildnsecchain = %u\n", buildnsecchain);
+ dnssec_log(zone, ISC_LOG_DEBUG(3),
+ "zone_nsec3chain:buildnsecchain = %u\n",
+ buildnsecchain);
}
dns_dbiterator_current(nsec3chain->dbiterator, &node, name);
true, privatetype,
¶m_diff);
if (result != ISC_R_SUCCESS) {
- dns_zone_log(zone, ISC_LOG_ERROR,
- "zone_nsec3chain:"
- "fixup_nsec3param -> %s",
- dns_result_totext(result));
+ dnssec_log(zone, ISC_LOG_ERROR,
+ "zone_nsec3chain:"
+ "fixup_nsec3param -> %s",
+ dns_result_totext(result));
goto failure;
}
}
&nsec3chain->nsec3param,
&nsec3_diff);
if (result != ISC_R_SUCCESS) {
- dns_zone_log(zone, ISC_LOG_ERROR,
- "zone_nsec3chain:"
- "deletematchingnsec3 -> %s",
- dns_result_totext(result));
+ dnssec_log(zone, ISC_LOG_ERROR,
+ "zone_nsec3chain:"
+ "deletematchingnsec3 -> %s",
+ dns_result_totext(result));
goto failure;
}
goto next_removenode;
privatetype,
¶m_diff);
if (result != ISC_R_SUCCESS) {
- dns_zone_log(zone, ISC_LOG_ERROR,
- "zone_nsec3chain:"
- "fixup_nsec3param -> %s",
- dns_result_totext(result));
+ dnssec_log(zone, ISC_LOG_ERROR,
+ "zone_nsec3chain:"
+ "fixup_nsec3param -> %s",
+ dns_result_totext(result));
goto failure;
}
goto next_removechain;
} else if (result != ISC_R_SUCCESS) {
- dns_zone_log(zone, ISC_LOG_ERROR,
- "zone_nsec3chain:"
- "dns_dbiterator_next -> %s",
- dns_result_totext(result));
+ dnssec_log(zone, ISC_LOG_ERROR,
+ "zone_nsec3chain:"
+ "dns_dbiterator_next -> %s",
+ dns_result_totext(result));
goto failure;
} else if (delegation) {
dns_dbiterator_current(nsec3chain->dbiterator,
&node, nextname);
dns_db_detachnode(db, &node);
- if (!dns_name_issubdomain(nextname, name))
- {
+ if (!dns_name_issubdomain(nextname, name)) {
break;
- }
+ }
} else {
break;
}
RUNTIME_CHECK(result == ISC_R_SUCCESS);
result = dns_db_allrdatasets(db, node, version, 0, &iterator);
if (result != ISC_R_SUCCESS) {
- dns_zone_log(zone, ISC_LOG_ERROR, "zone_nsec3chain:"
- "dns_db_allrdatasets -> %s",
- dns_result_totext(result));
+ dnssec_log(zone, ISC_LOG_ERROR,
+ "zone_nsec3chain:dns_db_allrdatasets -> %s",
+ dns_result_totext(result));
goto failure;
}
for (result = dns_rdatasetiter_first(iterator);
zone->minimum, true,
&nsec_diff);
if (result != ISC_R_SUCCESS) {
- dns_zone_log(zone, ISC_LOG_ERROR,
- "zone_nsec3chain:"
- "updatesecure -> %s",
- dns_result_totext(result));
+ dnssec_log(zone, ISC_LOG_ERROR,
+ "zone_nsec3chain:updatesecure -> %s",
+ dns_result_totext(result));
goto failure;
}
}
zone->minimum, false,
&nsec3_diff);
if (result != ISC_R_SUCCESS) {
- dns_zone_log(zone, ISC_LOG_ERROR,
- "zone_nsec3chain:"
- "dns_nsec3_addnsec3s -> %s",
- dns_result_totext(result));
+ dnssec_log(zone, ISC_LOG_ERROR,
+ "zone_nsec3chain:"
+ "dns_nsec3_addnsec3s -> %s",
+ dns_result_totext(result));
goto failure;
}
}
nkeys, zone, inception, expire, 0, now,
check_ksk, keyset_kskonly, &zonediff);
if (result != ISC_R_SUCCESS) {
- dns_zone_log(zone, ISC_LOG_ERROR, "zone_nsec3chain:"
- "dns__zone_updatesigs -> %s",
- dns_result_totext(result));
+ dnssec_log(zone, ISC_LOG_ERROR,
+ "zone_nsec3chain:dns__zone_updatesigs -> %s",
+ dns_result_totext(result));
goto failure;
}
nkeys, zone, inception, expire, 0, now,
check_ksk, keyset_kskonly, &zonediff);
if (result != ISC_R_SUCCESS) {
- dns_zone_log(zone, ISC_LOG_ERROR, "zone_nsec3chain:"
- "dns__zone_updatesigs -> %s",
- dns_result_totext(result));
+ dnssec_log(zone, ISC_LOG_ERROR,
+ "zone_nsec3chain:dns__zone_updatesigs -> %s",
+ dns_result_totext(result));
goto failure;
}
result = updatesecure(db, version, &zone->origin,
zone->minimum, false, &nsec_diff);
if (result != ISC_R_SUCCESS) {
- dns_zone_log(zone, ISC_LOG_ERROR, "zone_nsec3chain:"
- "updatesecure -> %s",
- dns_result_totext(result));
+ dnssec_log(zone, ISC_LOG_ERROR,
+ "zone_nsec3chain:updatesecure -> %s",
+ dns_result_totext(result));
goto failure;
}
}
nkeys, zone, inception, expire, 0, now,
check_ksk, keyset_kskonly, &zonediff);
if (result != ISC_R_SUCCESS) {
- dns_zone_log(zone, ISC_LOG_ERROR, "zone_nsec3chain:"
- "dns__zone_updatesigs -> %s",
- dns_result_totext(result));
+ dnssec_log(zone, ISC_LOG_ERROR,
+ "zone_nsec3chain:dns__zone_updatesigs -> %s",
+ dns_result_totext(result));
goto failure;
}
result = del_sigs(zone, db, version, &zone->origin, dns_rdatatype_soa,
&zonediff, zone_keys, nkeys, now, false);
if (result != ISC_R_SUCCESS) {
- dns_zone_log(zone, ISC_LOG_ERROR, "zone_nsec3chain:"
- "del_sigs -> %s", dns_result_totext(result));
+ dnssec_log(zone, ISC_LOG_ERROR,
+ "zone_nsec3chain:del_sigs -> %s",
+ dns_result_totext(result));
goto failure;
}
result = update_soa_serial(db, version, zonediff.diff, zone->mctx,
zone->updatemethod);
if (result != ISC_R_SUCCESS) {
- dns_zone_log(zone, ISC_LOG_ERROR, "zone_nsec3chain:"
- "update_soa_serial -> %s",
- dns_result_totext(result));
+ dnssec_log(zone, ISC_LOG_ERROR,
+ "zone_nsec3chain:update_soa_serial -> %s",
+ dns_result_totext(result));
goto failure;
}
zonediff.diff, zone_keys, nkeys, zone->mctx,
inception, soaexpire, check_ksk, keyset_kskonly);
if (result != ISC_R_SUCCESS) {
- dns_zone_log(zone, ISC_LOG_ERROR, "zone_nsec3chain:"
- "add_sigs -> %s", dns_result_totext(result));
+ dnssec_log(zone, ISC_LOG_ERROR,
+ "zone_nsec3chain:add_sigs -> %s",
+ dns_result_totext(result));
goto failure;
}
failure:
if (result != ISC_R_SUCCESS) {
- dns_zone_log(zone, ISC_LOG_ERROR, "zone_nsec3chain: %s",
- dns_result_totext(result));
+ dnssec_log(zone, ISC_LOG_ERROR, "zone_nsec3chain: %s",
+ dns_result_totext(result));
}
/*
result = dns_db_newversion(db, &version);
if (result != ISC_R_SUCCESS) {
- dns_zone_log(zone, ISC_LOG_ERROR,
- "zone_sign:dns_db_newversion -> %s",
- dns_result_totext(result));
+ dnssec_log(zone, ISC_LOG_ERROR,
+ "zone_sign:dns_db_newversion -> %s",
+ dns_result_totext(result));
goto cleanup;
}
result = dns__zone_findkeys(zone, db, version, now, zone->mctx,
DNS_MAXZONEKEYS, zone_keys, &nkeys);
if (result != ISC_R_SUCCESS) {
- dns_zone_log(zone, ISC_LOG_ERROR,
- "zone_sign:dns__zone_findkeys -> %s",
- dns_result_totext(result));
+ dnssec_log(zone, ISC_LOG_ERROR,
+ "zone_sign:dns__zone_findkeys -> %s",
+ dns_result_totext(result));
goto cleanup;
}
false,
&post_diff);
if (result != ISC_R_SUCCESS) {
- dns_zone_log(zone,
- ISC_LOG_ERROR,
- "updatesecure -> %s",
+ dnssec_log(zone, ISC_LOG_ERROR,
+ "updatesecure -> %s",
dns_result_totext(result));
goto cleanup;
}
zone->minimum,
&post_diff);
if (result != ISC_R_SUCCESS) {
- dns_zone_log(zone, ISC_LOG_ERROR,
- "updatesignwithkey -> %s",
- dns_result_totext(result));
+ dnssec_log(zone, ISC_LOG_ERROR,
+ "updatesignwithkey -> %s",
+ dns_result_totext(result));
goto cleanup;
}
build_nsec = false;
goto next_signing;
} else if (result != ISC_R_SUCCESS) {
- dns_zone_log(zone, ISC_LOG_ERROR,
- "zone_sign:dns_dbiterator_next -> %s",
- dns_result_totext(result));
+ dnssec_log(zone, ISC_LOG_ERROR,
+ "zone_sign:"
+ "dns_dbiterator_next -> %s",
+ dns_result_totext(result));
goto cleanup;
} else if (is_bottom_of_zone) {
dns_dbiterator_current(signing->dbiterator,
check_ksk, keyset_kskonly,
&zonediff);
if (result != ISC_R_SUCCESS) {
- dns_zone_log(zone, ISC_LOG_ERROR, "zone_sign:"
- "dns__zone_updatesigs -> %s",
- dns_result_totext(result));
+ dnssec_log(zone, ISC_LOG_ERROR,
+ "zone_sign:dns__zone_updatesigs -> %s",
+ dns_result_totext(result));
goto cleanup;
}
}
result = del_sigs(zone, db, version, &zone->origin, dns_rdatatype_soa,
&zonediff, zone_keys, nkeys, now, false);
if (result != ISC_R_SUCCESS) {
- dns_zone_log(zone, ISC_LOG_ERROR,
- "zone_sign:del_sigs -> %s",
- dns_result_totext(result));
+ dnssec_log(zone, ISC_LOG_ERROR, "zone_sign:del_sigs -> %s",
+ dns_result_totext(result));
goto cleanup;
}
result = update_soa_serial(db, version, zonediff.diff, zone->mctx,
zone->updatemethod);
if (result != ISC_R_SUCCESS) {
- dns_zone_log(zone, ISC_LOG_ERROR,
- "zone_sign:update_soa_serial -> %s",
- dns_result_totext(result));
+ dnssec_log(zone, ISC_LOG_ERROR,
+ "zone_sign:update_soa_serial -> %s",
+ dns_result_totext(result));
goto cleanup;
}
zonediff.diff, zone_keys, nkeys, zone->mctx,
inception, soaexpire, check_ksk, keyset_kskonly);
if (result != ISC_R_SUCCESS) {
- dns_zone_log(zone, ISC_LOG_ERROR,
- "zone_sign:add_sigs -> %s",
- dns_result_totext(result));
+ dnssec_log(zone, ISC_LOG_ERROR, "zone_sign:add_sigs -> %s",
+ dns_result_totext(result));
goto cleanup;
}
failure:
if (result != ISC_R_SUCCESS) {
- dns_zone_log(zone, ISC_LOG_ERROR, "zone_sign: failed: %s",
- dns_result_totext(result));
+ dnssec_log(zone, ISC_LOG_ERROR, "zone_sign: failed: %s",
+ dns_result_totext(result));
}
cleanup:
&sigrr,
dns_fixedname_name(&fixed));
- dns_zone_log(kfetch->zone, ISC_LOG_DEBUG(3),
- "Confirm revoked DNSKEY is self-signed: "
- "%s", dns_result_totext(result));
+ dnssec_log(kfetch->zone, ISC_LOG_DEBUG(3),
+ "Confirm revoked DNSKEY is self-signed: %s",
+ dns_result_totext(result));
if (result == ISC_R_SUCCESS) {
answer = true;
DNS_ZONE_CLRFLAG(zone, DNS_ZONEFLG_REFRESHING);
}
- dns_zone_log(zone, ISC_LOG_DEBUG(3),
- "Returned from key fetch in keyfetch_done() for "
- "'%s': %s", namebuf, dns_result_totext(eresult));
+ dnssec_log(zone, ISC_LOG_DEBUG(3),
+ "Returned from key fetch in keyfetch_done() for '%s': %s",
+ namebuf, dns_result_totext(eresult));
/* Fetch failed */
if (eresult != ISC_R_SUCCESS ||
!dns_rdataset_isassociated(&kfetch->dnskeyset))
{
- dns_zone_log(zone, ISC_LOG_WARNING,
- "Unable to fetch DNSKEY set "
- "'%s': %s", namebuf, dns_result_totext(eresult));
+ dnssec_log(zone, ISC_LOG_WARNING,
+ "Unable to fetch DNSKEY set '%s': %s",
+ namebuf, dns_result_totext(eresult));
CHECK(minimal_update(kfetch, ver, &diff));
goto done;
}
/* No RRSIGs found */
if (!dns_rdataset_isassociated(&kfetch->dnskeysigset)) {
- dns_zone_log(zone, ISC_LOG_WARNING,
- "No DNSKEY RRSIGs found for "
- "'%s': %s", namebuf, dns_result_totext(eresult));
+ dnssec_log(zone, ISC_LOG_WARNING,
+ "No DNSKEY RRSIGs found for '%s': %s",
+ namebuf, dns_result_totext(eresult));
CHECK(minimal_update(kfetch, ver, &diff));
goto done;
}
dns_fixedname_name(
&fixed));
- dns_zone_log(zone, ISC_LOG_DEBUG(3),
- "Verifying DNSKEY set for zone "
- "'%s' using key %d/%d: %s",
- namebuf, sig.keyid, sig.algorithm,
- dns_result_totext(result));
+ dnssec_log(zone, ISC_LOG_DEBUG(3),
+ "Verifying DNSKEY set for zone "
+ "'%s' using key %d/%d: %s",
+ namebuf, sig.keyid, sig.algorithm,
+ dns_result_totext(result));
if (result == ISC_R_SUCCESS) {
kfetch->dnskeyset.trust =
* trusted keys then all we can do is look at any revoked keys.
*/
if (!secure) {
- dns_zone_log(zone, ISC_LOG_DEBUG(3),
- "DNSKEY set for zone '%s' could not be verified "
- "with current keys", namebuf);
+ dnssec_log(zone, ISC_LOG_DEBUG(3),
+ "DNSKEY set for zone '%s' could not be verified "
+ "with current keys", namebuf);
}
/*
} else if (keydata.addhd == 0) {
deletekey = true;
} else if (keydata.addhd > now) {
- dns_zone_log(zone, ISC_LOG_DEBUG(3),
- "Pending key %d for zone %s "
- "unexpectedly missing "
- "restarting 30-day acceptance "
- "timer", keytag, namebuf);
+ dnssec_log(zone, ISC_LOG_DEBUG(3),
+ "Pending key %d for zone %s "
+ "unexpectedly missing "
+ "restarting 30-day acceptance "
+ "timer", keytag, namebuf);
if (keydata.addhd < now + dns_zone_mkey_month) {
keydata.addhd =
now + dns_zone_mkey_month;
}
keydata.refresh = refresh_time(kfetch, false);
} else if (keydata.removehd == 0) {
- dns_zone_log(zone, ISC_LOG_DEBUG(3),
- "Active key %d for zone %s "
- "unexpectedly missing",
- keytag, namebuf);
+ dnssec_log(zone, ISC_LOG_DEBUG(3),
+ "Active key %d for zone %s "
+ "unexpectedly missing",
+ keytag, namebuf);
keydata.refresh = now + dns_zone_mkey_hour;
} else if (keydata.removehd <= now) {
deletekey = true;
- dns_zone_log(zone, ISC_LOG_DEBUG(3),
- "Revoked key %d for zone %s "
- "missing: deleting from "
- "managed keys database",
- keytag, namebuf);
+ dnssec_log(zone, ISC_LOG_DEBUG(3),
+ "Revoked key %d for zone %s "
+ "missing: deleting from "
+ "managed keys database",
+ keytag, namebuf);
} else {
keydata.refresh = refresh_time(kfetch, false);
}
* it's been revoked? Just remove it
*/
deletekey = true;
- dns_zone_log(zone, ISC_LOG_DEBUG(3),
- "Pending key %d "
- "for zone %s is now "
- "revoked: "
- "deleting from the "
- "managed keys database",
- keytag, namebuf);
+ dnssec_log(zone, ISC_LOG_DEBUG(3),
+ "Pending key %d for "
+ "zone %s is now revoked: "
+ "deleting from the "
+ "managed keys database",
+ keytag, namebuf);
} else if (keydata.removehd == 0) {
/*
* Remove key from secroots.
DNS_KEYFLAG_REVOKE;
}
- dns_zone_log(zone, ISC_LOG_INFO,
- "Trusted key %d "
- "for zone %s is now "
- "revoked",
- keytag, namebuf);
+ dnssec_log(zone, ISC_LOG_INFO,
+ "Trusted key %d for "
+ "zone %s is now revoked",
+ keytag, namebuf);
} else if (keydata.removehd < now) {
/* Scheduled for removal */
deletekey = true;
- dns_zone_log(zone, ISC_LOG_INFO,
- "Revoked key %d "
- "for zone %s removal "
- "timer complete: "
- "deleting from the "
- "managed keys database",
- keytag, namebuf);
+ dnssec_log(zone, ISC_LOG_INFO,
+ "Revoked key %d for "
+ "zone %s removal timer "
+ "complete: deleting from "
+ "the managed keys database",
+ keytag, namebuf);
}
} else if (revoked && keydata.removehd == 0) {
- dns_zone_log(zone, ISC_LOG_WARNING,
- "Active key %d for zone "
- "%s is revoked but "
- "did not self-sign; "
- "ignoring", keytag, namebuf);
- continue;
+ dnssec_log(zone, ISC_LOG_WARNING,
+ "Active key %d for zone "
+ "%s is revoked but "
+ "did not self-sign; "
+ "ignoring", keytag, namebuf);
+ continue;
} else if (secure) {
if (keydata.removehd != 0) {
/*
keydata.addhd =
now + dns_zone_mkey_month;
- dns_zone_log(zone, ISC_LOG_DEBUG(3),
- "Revoked key %d "
- "for zone %s "
- "has returned: starting "
- "30-day acceptance timer",
- keytag, namebuf);
+ dnssec_log(zone, ISC_LOG_DEBUG(3),
+ "Revoked key %d for "
+ "zone %s has returned: "
+ "starting 30-day "
+ "acceptance timer",
+ keytag, namebuf);
} else if (keydata.addhd > now) {
pending++;
} else if (keydata.addhd == 0) {
if (keydata.addhd <= now) {
trustkey = true;
- dns_zone_log(zone, ISC_LOG_INFO,
- "Key %d for zone %s "
- "is now trusted (%s)",
- keytag, namebuf,
- initial
- ? "initializing key "
- "verified"
- : "acceptance timer "
- "complete");
+ dnssec_log(zone, ISC_LOG_INFO,
+ "Key %d for zone %s "
+ "is now trusted (%s)",
+ keytag, namebuf,
+ initial
+ ? "initializing key "
+ "verified"
+ : "acceptance timer "
+ "complete");
}
} else if (keydata.addhd > now) {
/*
*/
pending++;
keydata.addhd = now + dns_zone_mkey_month;
- dns_zone_log(zone, ISC_LOG_DEBUG(3),
- "Pending key %d "
- "for zone %s was "
- "not validated: restarting "
- "30-day acceptance timer",
- keytag, namebuf);
+ dnssec_log(zone, ISC_LOG_DEBUG(3),
+ "Pending key %d "
+ "for zone %s was "
+ "not validated: restarting "
+ "30-day acceptance timer",
+ keytag, namebuf);
}
if (!deletekey && !newkey) {
newkey = true;
if (initializing) {
- dns_zone_log(zone, ISC_LOG_WARNING,
- "Initializing automatic trust "
- "anchor management for zone '%s'; "
- "DNSKEY ID %d is now trusted, "
- "waiving the normal 30-day "
- "waiting period.",
- namebuf, keytag);
+ dnssec_log(zone, ISC_LOG_WARNING,
+ "Initializing automatic trust "
+ "anchor management for zone '%s'; "
+ "DNSKEY ID %d is now trusted, "
+ "waiving the normal 30-day "
+ "waiting period.",
+ namebuf, keytag);
trustkey = true;
} else {
- dns_zone_log(zone, ISC_LOG_INFO,
- "New key %d observed "
- "for zone '%s': "
- "starting 30-day "
- "acceptance timer",
- keytag, namebuf);
+ dnssec_log(zone, ISC_LOG_INFO,
+ "New key %d observed "
+ "for zone '%s': "
+ "starting 30-day "
+ "acceptance timer",
+ keytag, namebuf);
}
} else {
/*
failure:
if (result != ISC_R_SUCCESS) {
- dns_zone_log(zone, ISC_LOG_ERROR,
- "error during managed-keys processing (%s): "
- "DNSSEC validation may be at risk",
- isc_result_totext(result));
+ dnssec_log(zone, ISC_LOG_ERROR,
+ "error during managed-keys processing (%s): "
+ "DNSSEC validation may be at risk",
+ isc_result_totext(result));
}
dns_diff_clear(&diff);
if (ver != NULL) {
char namebuf[DNS_NAME_FORMATSIZE];
dns_name_format(kname, namebuf,
sizeof(namebuf));
- dns_zone_log(zone, ISC_LOG_DEBUG(3),
- "Creating key fetch in "
- "zone_refreshkeys() for '%s'",
- namebuf);
+ dnssec_log(zone, ISC_LOG_DEBUG(3),
+ "Creating key fetch in "
+ "zone_refreshkeys() for '%s'",
+ namebuf);
}
/*
dns_rdataset_disassociate(&kfetch->keydataset);
dns_name_free(kname, zone->mctx);
isc_mem_put(zone->mctx, kfetch, sizeof(dns_keyfetch_t));
- dns_zone_log(zone, ISC_LOG_WARNING,
- "Failed to create fetch for "
- "DNSKEY update");
+ dnssec_log(zone, ISC_LOG_WARNING,
+ "Failed to create fetch for DNSKEY update");
fetch_err = true;
}
}
zone_settimer(zone, &timenow);
isc_time_formattimestamp(&zone->refreshkeytime, timebuf, 80);
- dns_zone_log(zone, ISC_LOG_DEBUG(1), "retry key refresh: %s",
- timebuf);
+ dnssec_log(zone, ISC_LOG_DEBUG(1), "retry key refresh: %s",
+ timebuf);
} else if (!timerset) {
isc_time_settoepoch(&zone->refreshkeytime);
}
va_end(ap);
}
+static void
+dnssec_log(dns_zone_t *zone, int level, const char *fmt, ...) {
+ va_list ap;
+
+ va_start(ap, fmt);
+ dns_zone_logv(zone, DNS_LOGCATEGORY_DNSSEC, level, NULL, fmt, ap);
+ va_end(ap);
+}
+
static int
message_count(dns_message_t *msg, dns_section_t section, dns_rdatatype_t type)
{
isc_result_t result;
REQUIRE(DNS_ZONE_VALID(zone));
- dns_zone_log(zone, ISC_LOG_NOTICE,
- "dns_zone_signwithkey(algorithm=%u, keyid=%u)",
- algorithm, keyid);
+ dnssec_log(zone, ISC_LOG_NOTICE,
+ "dns_zone_signwithkey(algorithm=%u, keyid=%u)",
+ algorithm, keyid);
LOCK_ZONE(zone);
result = zone_signwithkey(zone, algorithm, keyid, deleteit);
UNLOCK_ZONE(zone);
result = dns_nsec3param_salttotext(nsec3param, salt, sizeof(salt));
RUNTIME_CHECK(result == ISC_R_SUCCESS);
- dns_zone_log(zone, ISC_LOG_NOTICE,
- "dns_zone_addnsec3chain(hash=%u, iterations=%u, salt=%s)",
- nsec3param->hash, nsec3param->iterations,
- salt);
+ dnssec_log(zone, ISC_LOG_NOTICE,
+ "dns_zone_addnsec3chain(hash=%u, iterations=%u, salt=%s)",
+ nsec3param->hash, nsec3param->iterations, salt);
LOCK_ZONE(zone);
result = zone_addnsec3chain(zone, nsec3param);
UNLOCK_ZONE(zone);
return (result);
}
-static void
-logmsg(const char *format, ...) {
- va_list args;
- va_start(args, format);
- isc_log_vwrite(dns_lctx, DNS_LOGCATEGORY_GENERAL, DNS_LOGMODULE_ZONE,
- ISC_LOG_DEBUG(1), format, args);
- va_end(args);
-}
-
static void
clear_keylist(dns_dnsseckeylist_t *list, isc_mem_t *mctx) {
dns_dnsseckey_t *key;
result = dns__zone_findkeys(zone, db, ver, now, zone->mctx,
DNS_MAXZONEKEYS, zone_keys, &nkeys);
if (result != ISC_R_SUCCESS) {
- dns_zone_log(zone, ISC_LOG_ERROR,
- "sign_apex:dns__zone_findkeys -> %s",
- dns_result_totext(result));
+ dnssec_log(zone, ISC_LOG_ERROR,
+ "sign_apex:dns__zone_findkeys -> %s",
+ dns_result_totext(result));
return (result);
}
dns_rdatatype_dnskey, zonediff,
zone_keys, nkeys, now, false);
if (result != ISC_R_SUCCESS) {
- dns_zone_log(zone, ISC_LOG_ERROR,
- "sign_apex:del_sigs -> %s",
- dns_result_totext(result));
+ dnssec_log(zone, ISC_LOG_ERROR,
+ "sign_apex:del_sigs -> %s",
+ dns_result_totext(result));
goto failure;
}
result = add_sigs(db, ver, &zone->origin, dns_rdatatype_dnskey,
inception, keyexpire, check_ksk,
keyset_kskonly);
if (result != ISC_R_SUCCESS) {
- dns_zone_log(zone, ISC_LOG_ERROR,
- "sign_apex:add_sigs -> %s",
- dns_result_totext(result));
+ dnssec_log(zone, ISC_LOG_ERROR,
+ "sign_apex:add_sigs -> %s",
+ dns_result_totext(result));
goto failure;
}
}
check_ksk, keyset_kskonly, zonediff);
if (result != ISC_R_SUCCESS) {
- dns_zone_log(zone, ISC_LOG_ERROR,
- "sign_apex:dns__zone_updatesigs -> %s",
- dns_result_totext(result));
+ dnssec_log(zone, ISC_LOG_ERROR,
+ "sign_apex:dns__zone_updatesigs -> %s",
+ dns_result_totext(result));
goto failure;
}
/* Refuse to allow NSEC3 with NSEC-only keys */
if (nseconly && nsec3) {
- dns_zone_log(zone, ISC_LOG_ERROR,
+ dnssec_log(zone, ISC_LOG_ERROR,
"NSEC only DNSKEYs and NSEC3 chains not allowed");
goto failure;
}
return (result);
}
+static void
+dnssec_report(const char *format, ...) {
+ va_list args;
+ va_start(args, format);
+ isc_log_vwrite(dns_lctx, DNS_LOGCATEGORY_DNSSEC, DNS_LOGMODULE_ZONE,
+ ISC_LOG_DEBUG(1), format, args);
+ va_end(args);
+}
+
static void
zone_rekey(dns_zone_t *zone) {
isc_result_t result;
TIME_NOW(&timenow);
now = isc_time_seconds(&timenow);
- dns_zone_log(zone, ISC_LOG_INFO, "reconfiguring zone keys");
+ dnssec_log(zone, ISC_LOG_INFO, "reconfiguring zone keys");
/* Get the SOA record's TTL */
CHECK(dns_db_findrdataset(db, node, ver, dns_rdatatype_soa,
result = dns_dnssec_updatekeys(&dnskeys, &keys, &rmkeys,
&zone->origin, ttl, &diff,
- !check_ksk,
- mctx, logmsg);
+ !check_ksk, mctx,
+ dnssec_report);
/*
* Keys couldn't be updated for some reason;
* try again later.
*/
if (result != ISC_R_SUCCESS) {
- dns_zone_log(zone, ISC_LOG_ERROR, "zone_rekey:"
- "couldn't update zone keys: %s",
- isc_result_totext(result));
+ dnssec_log(zone, ISC_LOG_ERROR,
+ "zone_rekey:couldn't update zone keys: %s",
+ isc_result_totext(result));
goto failure;
}
&cdnskeyset, now, ttl,
&diff, mctx);
if (result != ISC_R_SUCCESS) {
- dns_zone_log(zone, ISC_LOG_ERROR, "zone_rekey:"
- "couldn't update CDS/CDNSKEY: %s",
- isc_result_totext(result));
+ dnssec_log(zone, ISC_LOG_ERROR,
+ "zone_rekey:couldn't update CDS/CDNSKEY: %s",
+ isc_result_totext(result));
goto failure;
}
dst_key_id(key->key),
true);
if (result != ISC_R_SUCCESS) {
- dns_zone_log(zone, ISC_LOG_ERROR,
- "zone_signwithkey failed: %s",
- dns_result_totext(result));
+ dnssec_log(zone, ISC_LOG_ERROR,
+ "zone_signwithkey failed: %s",
+ dns_result_totext(result));
}
}
}
dst_key_id(key->key),
false);
if (result != ISC_R_SUCCESS) {
- dns_zone_log(zone, ISC_LOG_ERROR,
- "zone_signwithkey failed: %s",
- dns_result_totext(result));
+ dnssec_log(zone, ISC_LOG_ERROR,
+ "zone_signwithkey failed: %s",
+ dns_result_totext(result));
}
}
} else if (newalg) {
dst_key_id(key->key),
false);
if (result != ISC_R_SUCCESS) {
- dns_zone_log(zone, ISC_LOG_ERROR,
- "zone_signwithkey failed: %s",
- dns_result_totext(result));
+ dnssec_log(zone, ISC_LOG_ERROR,
+ "zone_signwithkey failed: %s",
+ dns_result_totext(result));
}
}
}
result = zone_addnsec3chain(zone, &nsec3param);
if (result != ISC_R_SUCCESS) {
- dns_zone_log(zone, ISC_LOG_ERROR,
- "zone_addnsec3chain failed: %s",
- dns_result_totext(result));
+ dnssec_log(zone, ISC_LOG_ERROR,
+ "zone_addnsec3chain failed: %s",
+ dns_result_totext(result));
}
}
zone_settimer(zone, &timenow);
isc_time_formattimestamp(&zone->refreshkeytime, timebuf, 80);
- dns_zone_log(zone, ISC_LOG_INFO, "next key event: %s", timebuf);
+ dnssec_log(zone, ISC_LOG_INFO, "next key event: %s", timebuf);
}
result = ISC_R_SUCCESS;
dns_db_currentversion(db, &oldver);
result = dns_db_newversion(db, &newver);
if (result != ISC_R_SUCCESS) {
- dns_zone_log(zone, ISC_LOG_ERROR,
- "keydone:dns_db_newversion -> %s",
- dns_result_totext(result));
+ dnssec_log(zone, ISC_LOG_ERROR,
+ "keydone:dns_db_newversion -> %s",
+ dns_result_totext(result));
goto failure;
}
result = dns_db_newversion(db, &newver);
if (result != ISC_R_SUCCESS) {
ZONEDB_UNLOCK(&zone->dblock, isc_rwlocktype_read);
- dns_zone_log(zone, ISC_LOG_ERROR,
- "setnsec3param:dns_db_newversion -> %s",
- dns_result_totext(result));
+ dnssec_log(zone, ISC_LOG_ERROR,
+ "setnsec3param:dns_db_newversion -> %s",
+ dns_result_totext(result));
goto failure;
}
}
if (result != ISC_R_SUCCESS) {
- dns_zone_logc(zone, DNS_LOGCATEGORY_ZONELOAD, ISC_LOG_ERROR,
- "zone verification failed: %s",
- isc_result_totext(result));
+ dnssec_log(zone, ISC_LOG_ERROR, "zone verification failed: %s",
+ isc_result_totext(result));
result = DNS_R_VERIFYFAILURE;
}