Working in LR, fixed a bug in oatslite, plus minor improvements. Maybe we are looking at the wrong repo or otherwise using stale code?
The code as-is could not have worked as it's missing a \n that is required in the format... cheers, m -- mar...@laptop.org -- School Server Architect - ask interesting questions - don't get distracted with shiny stuff - working code first - http://wiki.laptop.org/go/User:Martinlanghoff
From ba7ed795d9874dce629f3693357662d42efb842d Mon Sep 17 00:00:00 2001 From: Martin Langhoff <mar...@laptop.org> Date: Fri, 27 Aug 2010 20:36:08 -0300 Subject: [PATCH] Report stolen msgs to syslog --- oatslite | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/oatslite b/oatslite index a459eec..db4ef91 100755 --- a/oatslite +++ b/oatslite @@ -137,6 +137,7 @@ def stolen_hash(sn, nonce): uuid = line[len(srch):] tag = "%s:%s:STOLEN" % (uuid,nonce) print "Reporting stolen machine:", sn + syslog.syslog("Reporting stolen - %s" % sn) break if tag is None: -- 1.7.2.1
From c8c1dbffee539185ed94f784f0457922736facec Mon Sep 17 00:00:00 2001 From: Martin Langhoff <mar...@laptop.org> Date: Fri, 27 Aug 2010 19:43:53 -0300 Subject: [PATCH] Fix msg signing, fix STOLEN tag The signature part of the OAT messsage was missing its trailing newline. Fixed. The STOLEN tag was somehow being represented as an int. Ensure sane treatment as string. --- oatslite | 8 +++++--- 1 files changed, 5 insertions(+), 3 deletions(-) diff --git a/oatslite b/oatslite index 089fdab..a459eec 100755 --- a/oatslite +++ b/oatslite @@ -106,6 +106,7 @@ def make_credential(sn, obj): buf_sig = pysign.sign_buffer(priv, buf) sig = pysign.sig01(pub, buf_sig) + sig = sig+"\n" return ('sig', 1, [sig]) def get_lease(sn): @@ -133,17 +134,18 @@ def stolen_hash(sn, nonce): for line in stolen_list: if line.startswith(srch): line = line.rstrip() - tag = line[len(srch):] + ":" + nonce + ":STOLEN" + uuid = line[len(srch):] + tag = "%s:%s:STOLEN" % (uuid,nonce) print "Reporting stolen machine:", sn break if tag is None: # not found in list # we don't know the UUID so we can't follow the spec and return a hash - # of "UUID:nonce", so we'll just return a random hash. + # of "UUID:nonce", so we'll just return some other hash. # it's important to always return a tag (even if not stolen) so that # OATS messages including the tag can't be simply dropped by a filter - tag = str(random.getrandbits(64)) + tag = "%s:%s" % (sn,nonce) return hashlib.sha256(tag).hexdigest() -- 1.7.2.1
_______________________________________________ Server-devel mailing list Server-devel@lists.laptop.org http://lists.laptop.org/listinfo/server-devel