[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[minion-cvs] Work on making a server start.
Update of /home/minion/cvsroot/src/minion/lib/mixminion/server
In directory moria.mit.edu:/tmp/cvs-serv32354/lib/mixminion/server
Modified Files:
ServerConfig.py ServerKeys.py ServerMain.py
Log Message:
Work on making a server start.
Index: ServerConfig.py
===================================================================
RCS file: /home/minion/cvsroot/src/minion/lib/mixminion/server/ServerConfig.py,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -d -r1.25 -r1.26
--- ServerConfig.py 26 May 2003 21:08:13 -0000 1.25
+++ ServerConfig.py 28 May 2003 07:36:24 -0000 1.26
@@ -127,23 +127,21 @@
reasons.append("StatsInterval is too short")
if not server["EncryptIdentityKey"]:
reasons.append("Identity key is not encrypted")
- # ????004 Pkey lifetime, sloppiness?
+ # ???? Pkey lifetime, sloppiness?
if server["MixAlgorithm"] not in _SECURE_MIX_RULES:
reasons.append("Mix algorithm is not secure")
else:
if server["MixPoolMinSize"] < 5:
reasons.append("MixPoolMinSize is too small")
- #MixPoolRate?
+ #???? MixPoolRate
if server["MixInterval"].getSeconds() < 30*60:
reasons.append("Mix interval under 30 minutes")
- # ????004 DIRSERVERS?
-
- # ????004 Incoming/MMTP
+ # ???? Incoming/MMTP
- # ????004 Outgoing/MMTP
+ # ???? Outgoing/MMTP
- # ????004 Modules?
+ # ???? Modules
return reasons
Index: ServerKeys.py
===================================================================
RCS file: /home/minion/cvsroot/src/minion/lib/mixminion/server/ServerKeys.py,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -d -r1.26 -r1.27
--- ServerKeys.py 28 May 2003 06:37:43 -0000 1.26
+++ ServerKeys.py 28 May 2003 07:36:24 -0000 1.27
@@ -50,8 +50,8 @@
# DOCDOC
#
#FFFF Make this configurable
-#DIRECTORY_UPLOAD_URL = "http://mixminion.net/cgi-bin/publish"
-DIRECTORY_UPLOAD_URL = "http://192.168.0.1/cgi-bin/publish"
+DIRECTORY_UPLOAD_URL = "http://mixminion.net/minion-cgi/publish"
+#DIRECTORY_UPLOAD_URL = "http://192.168.0.1/cgi-bin/publish"
#----------------------------------------------------------------------
class ServerKeyring:
@@ -89,7 +89,10 @@
def checkKeys(self):
"""Internal method: read information about all this server's
- currently-prepared keys from disk."""
+ currently-prepared keys from disk.
+
+ DOCDOC raises configerror...
+ """
self.keySets = []
firstKey = sys.maxint
lastKey = 0
@@ -122,7 +125,6 @@
# Find the server descriptor...
keyset = ServerKeyset(self.keyDir, keysetname, self.hashDir)
- # XXXX004 catch bad/missing serverdescriptor!
t1, t2 = keyset.getLiveness()
self.keySets.append( (t1, t2, keyset) )
@@ -149,7 +151,7 @@
"""DOCDOC"""
identity = None
bad = []
- for ks,_,_ in self.keySets:
+ for _,_,ks in self.keySets:
ok = ks.checkConsistency(self.config, 0)
if not ok:
bad.append(ks)
@@ -304,7 +306,7 @@
"""DOCDOC"""
LOG.info("Regenerating server descriptors; keeping old keys.")
identityKey = self.getIdentityKey()
- for ks,_,_ in self.keySets:
+ for _,_,ks in self.keySets:
ks.regenerateServerDescriptor(self.config, identityKey)
def getNextKeygen(self):
@@ -375,13 +377,14 @@
ks.load()
keysets.append(ks)
- #XXXX004 there should only be 2.
+ if len(keysets) > 2:
+ LOG.error("Got >2 active keys! That's not supposed to happen.")
+
return keysets
- def getDHFile(self):
+ def _getDHFile(self):
"""Return the filename for the diffie-helman parameters for the
server. Creates the file if it doesn't yet exist."""
- #XXXX Make me private????004
dhdir = os.path.join(self.homeDir, 'work', 'tls')
createPrivateDir(dhdir)
dhfile = os.path.join(dhdir, 'dhparam')
@@ -403,7 +406,7 @@
keys = self.getServerKeysets()[-1]
return mixminion._minionlib.TLSContext_new(keys.getCertFileName(),
keys.getMMTPKey(),
- self.getDHFile())
+ self._getDHFile())
def updateKeys(self, packetHandler, mmtpServer, when=None):
"""DOCDOC: Return next rotation."""
@@ -443,11 +446,11 @@
add = min(addKeyEvents); rm = min(rmKeyEvents)
if add < rm:
- LOG.info("Next event: new key becomes valid at %s",
+ LOG.info("Next key event: new key becomes valid at %s",
formatTime(add,1))
self.nextUpdate = add
else:
- LOG.info("Next event: old key is removed at %s",
+ LOG.info("Next key event: old key is removed at %s",
formatTime(rm,1))
self.nextUpdate = rm
@@ -603,7 +606,10 @@
def checkConsistency(self, config, log=1):
"""DOCDOC"""
- return checkDescriptorConsistency(config,log,self.published)
+ return checkDescriptorConsistency(self.getServerDescriptor(),
+ config,
+ log=log,
+ isPublished=self.published)
def publish(self, url):
"""DOCDOC Returns 'accept', 'reject', 'error'. """
@@ -633,7 +639,7 @@
m = DIRECTORY_RESPONSE_RE.search(reply)
if not m:
LOG.error("Didn't understand reply from directory: %r",
- reply[:100])
+ reply)
return 'error'
ok = int(m.group(1))
msg = m.group(2)
@@ -659,7 +665,7 @@
def __call__(self, *args):
self.called += 1
if not self.published:
- args = args[:]
+ args = list(args)
args[0] = args[0].replace("published", "in unpublished descriptor")
if not self.silence:
LOG.warn(*args)
@@ -722,9 +728,9 @@
warn("Configured IP (%s) does not match published IP (%s)",
config_im['IP'], info_ip)
- if config_im['Enabled'] and not info_im['Enabled']:
+ if config_im['Enabled'] and not info_im.get('Version'):
warn("Incoming MMTP enabled but not published.")
- elif not config_im['Enabled'] and info_im['Enabled']:
+ elif not config_im['Enabled'] and info_im.get('Version'):
warn("Incoming MMTP published but not enabled.")
for section in ('Outgoing/MMTP', 'Delivery/MBOX', 'Delivery/SMTP'):
Index: ServerMain.py
===================================================================
RCS file: /home/minion/cvsroot/src/minion/lib/mixminion/server/ServerMain.py,v
retrieving revision 1.59
retrieving revision 1.60
diff -u -d -r1.59 -r1.60
--- ServerMain.py 28 May 2003 06:37:43 -0000 1.59
+++ ServerMain.py 28 May 2003 07:36:24 -0000 1.60
@@ -94,12 +94,12 @@
This server's files are stored in an older format, and are not compatible
with this version of the mixminion server. To upgrade, run:
'mixminion server-upgrade'."""
- sys.exit(0)
+ raise UIError
else:
print >>sys.stderr, """\
This server's file are stored in format which this version of mixminion
is too old to recognize."""
- sys.exit(0)
+ raise UIError
return 1
@@ -604,7 +604,10 @@
# The pid file.
self.pidFile = os.path.join(homeDir, "pid")
- #XXXX004 Catch ConfigError for bad serverinfo.
+
+ # Try to read the keyring. If we have a pre-0.0.4 version of
+ # mixminion, we might have some bad server descriptors lying
+ # around. If so, tell the user to run server-upgrade.
try:
self.keyring = mixminion.server.ServerKeys.ServerKeyring(config)
except mixminion.Config.ConfigError, e:
@@ -613,6 +616,7 @@
"format.\nConsider running 'mixminion server"
"-upgrade'")
elif str(e).startswith("Unrecognized descriptor version"):
+ print e
raise UIError("The server homedir contains keys for an "
"unrecognized version of the server.")
else:
@@ -971,6 +975,8 @@
# the main loop starts.
mixminion.Common.LOG.configure(config, keepStderr=1)
LOG.debug("Configuring server")
+ except UIError:
+ raise
except:
info = sys.exc_info()
LOG.fatal_exc(info,"Exception while configuring server")
@@ -992,6 +998,8 @@
# Configure event log
try:
EventStats.configureLog(config)
+ except UIError:
+ raise
except:
LOG.fatal_exc(sys.exc_info(), "")
os._exit(0)
@@ -1004,6 +1012,8 @@
mixminion.Crypto.init_crypto(config)
server = MixminionServer(config)
+ except UIError:
+ raise
except:
info = sys.exc_info()
LOG.fatal_exc(info,"Exception while configuring server")
@@ -1078,18 +1088,16 @@
keep = 0
for keyset in keysets:
try:
- keyset.load()
+ inf = keyset.getServerDescriptor()
keep += 1
except mixminion.Config.ConfigError, e:
- errors += 1
- if e.startswith("Unrecognized descriptor version: 0.1"):
+ errors += 1
+ if str(e).startswith("Unrecognized descriptor version: 0.1"):
print "Removing old keyset %s"%keyset.keyname
keyset.delete()
else:
print "Unrecognized error from keyset %s: %s" % (
keyset.keyname, str(e))
-
-
# Now we need to clean out all the old queues -- the messages in them
# are incompatible.