signature clock skew code.

git-svn-id: file:///svn/unbound/trunk@1590 be551aaa-1e26-0410-a405-d3ace91eadb9
This commit is contained in:
Wouter Wijngaards
2009-04-06 14:09:33 +00:00
parent 397985b2c8
commit 1e1ac9900a
13 changed files with 1300 additions and 1152 deletions
+21 -5
View File
@@ -1073,13 +1073,29 @@ check_dates(struct val_env* ve, uint32_t unow,
return 0;
}
if(incep - now > 0) {
sigdate_error("verify: signature bad, current time is"
" before inception date", expi, incep, now);
return 0;
/* within skew ? (calc here to avoid calculation normally) */
int32_t skew = (expi-incep)/10;
if(skew < ve->skew_min) skew = ve->skew_min;
if(skew > ve->skew_max) skew = ve->skew_max;
if(incep - now > skew) {
sigdate_error("verify: signature bad, current time is"
" before inception date", expi, incep, now);
return 0;
}
sigdate_error("verify warning suspicious signature inception "
" or bad local clock", expi, incep, now);
}
if(now - expi > 0) {
sigdate_error("verify: signature expired", expi, incep, now);
return 0;
int32_t skew = (expi-incep)/10;
if(skew < ve->skew_min) skew = ve->skew_min;
if(skew > ve->skew_max) skew = ve->skew_max;
if(now - expi > skew) {
sigdate_error("verify: signature expired", expi,
incep, now);
return 0;
}
sigdate_error("verify warning suspicious signature expiration "
" or bad local clock", expi, incep, now);
}
return 1;
+2
View File
@@ -122,6 +122,8 @@ val_apply_cfg(struct module_env* env, struct val_env* val_env,
return 0;
}
val_env->date_override = cfg->val_date_override;
val_env->skew_min = cfg->val_sig_skew_min;
val_env->skew_max = cfg->val_sig_skew_max;
c = cfg_count_numbers(cfg->val_nsec3_key_iterations);
if(c < 1 || (c&1)) {
log_err("validator: unparseable or odd nsec3 key "
+6
View File
@@ -71,6 +71,12 @@ struct val_env {
* if 0, current time is used for rrsig validation */
int32_t date_override;
/** clock skew min for signatures */
int32_t skew_min;
/** clock skew max for signatures */
int32_t skew_max;
/** TTL for bogus data; used instead of untrusted TTL from data.
* Bogus data will not be verified more often than this interval.
* seconds. */