diff options
author | Nick Mathewson <nickm@torproject.org> | 2003-10-22 16:41:35 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2003-10-22 16:41:35 +0000 |
commit | 7604cfe61b7ae997c850bdc175b9e4e9684d020c (patch) | |
tree | ef955719e52cfc4357f0a7bed792d251f694d7ea /src/or/dirserv.c | |
parent | cf2fe9d1da0b91302355542d60050ae720ceaf5d (diff) | |
download | tor-7604cfe61b7ae997c850bdc175b9e4e9684d020c.tar tor-7604cfe61b7ae997c850bdc175b9e4e9684d020c.tar.gz |
Clock skew fixes.
Allow some slop (currently 3 minutes) when checking certificate validity.
Change certificate lifetime from 1 year to 2 days. Since we
regenerate regularly (we regenerate regularly, right??), this
shouldn't be a problem.
Have directories reject descriptors published too far in the future
(currently 30 minutes). If dirservs don't do this:
0) Today is January 1, 2000.
1) A very skewed server publishes descriptor X with a declared
publication time of August 1, 2000.
2) The directory includes X.
3) Because of certificate lifetime issues, nobody can use the
skewed server.
4) The server fixes its skew, and goes to republish a new descriptor Y
with publication time of January 1, 2000.
5) But because the directory already has a "more recent" descriptor X,
it rejects descriptor "Y" as superseded!
This patch should make step 2 go away.
svn:r658
Diffstat (limited to 'src/or/dirserv.c')
-rw-r--r-- | src/or/dirserv.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/or/dirserv.c b/src/or/dirserv.c index cd6b02e0e..c5f170a6a 100644 --- a/src/or/dirserv.c +++ b/src/or/dirserv.c @@ -4,6 +4,9 @@ #include "or.h" +/* How far in the future do we allow a router to get? (seconds) */ +#define ROUTER_ALLOW_SKEW (30*60) + extern or_options_t options; /* command-line and config-file options */ static int the_directory_is_dirty = 1; @@ -219,7 +222,12 @@ dirserv_add_descriptor(const char **desc) tor_free(desc_tmp); /* Okay. Now check whether the fingerprint is recognized. */ if (!dirserv_router_fingerprint_is_known(ri)) { - log(LOG_WARN, "Identity is unrecognized for descriptor"); + log_fn(LOG_WARN, "Identity is unrecognized for descriptor"); + goto err; + } + /* Is there too much clock skew? */ + if (ri->published_on > time(NULL)+ROUTER_ALLOW_SKEW) { + log_fn(LOG_WARN, "Publication time for nickname %s is too far in the future; possible clock skew.", ri->nickname); goto err; } /* Do we already have an entry for this router? */ |