[or-cvs] Clock skew fixes.

Nick Mathewson nickm at seul.org
Wed Oct 22 16:41:38 UTC 2003


Update of /home/or/cvsroot/src/or
In directory moria.mit.edu:/tmp/cvs-serv11427/src/or

Modified Files:
	dirserv.c 
Log Message:
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.



Index: dirserv.c
===================================================================
RCS file: /home/or/cvsroot/src/or/dirserv.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- dirserv.c	21 Oct 2003 09:48:17 -0000	1.13
+++ dirserv.c	22 Oct 2003 16:41:35 -0000	1.14
@@ -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 @@
   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? */



More information about the tor-commits mailing list