diff options
author | Magnus Ahltorp <map@kth.se> | 2015-01-28 13:42:06 +0100 |
---|---|---|
committer | Linus Nordberg <linus@nordberg.se> | 2015-02-20 14:12:47 +0100 |
commit | 832dba2e1cd4e6e6ff9e8ea7afa98eebb44595e5 (patch) | |
tree | 5ad6f45daf3a4fd66c5d3c576dda857e147210ff /tools/merge.py | |
parent | 7d9413dcea9645cfa0f8887ac7536682ff5777f0 (diff) |
Move hardcoded merge parameters to command line
Diffstat (limited to 'tools/merge.py')
-rwxr-xr-x | tools/merge.py | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/tools/merge.py b/tools/merge.py index 1cc75ef..2b83f54 100755 --- a/tools/merge.py +++ b/tools/merge.py @@ -4,20 +4,29 @@ # Copyright (c) 2014, NORDUnet A/S. # See LICENSE for licensing information. +import argparse import json import base64 import urllib import urllib2 import sys import time -from certtools import build_merkle_tree, create_sth_signature, check_sth_signature +from certtools import build_merkle_tree, create_sth_signature, check_sth_signature, get_eckey_from_file -ctbaseurl = "https://127.0.0.1:8080/" -frontendnodes = ["https://127.0.0.1:8082/"] -storagenodes = ["https://127.0.0.1:8081/"] +parser = argparse.ArgumentParser(description="") +parser.add_argument("--baseurl", metavar="url", help="Base URL for CT server", required=True) +parser.add_argument("--frontend", action="append", metavar="url", help="Base URL for frontend server", required=True) +parser.add_argument("--storage", action="append", metavar="url", help="Base URL for storage server", required=True) +parser.add_argument("--mergedb", metavar="dir", help="Merge database directory", required=True) +parser.add_argument("--keyfile", metavar="keyfile", help="File containing log key", required=True) +args = parser.parse_args() -chainsdir = "../rel/mergedb/chains" -logorderfile = "../rel/mergedb/logorder" +ctbaseurl = args.baseurl +frontendnodes = args.frontend +storagenodes = args.storage + +chainsdir = args.mergedb + "/chains" +logorderfile = args.mergedb + "/logorder" def parselogrow(row): return base64.b16decode(row) @@ -165,12 +174,7 @@ tree = build_merkle_tree(logorder) tree_size = len(logorder) root_hash = tree[-1][0] timestamp = int(time.time() * 1000) -privatekey = base64.decodestring( - "MHcCAQEEIMM/FjZ4FSzfENTTwGpTve6CP+IVr" - "Y7p8OKV634uJI/foAoGCCqGSM49AwEHoUQDQg" - "AE4qWq6afhBUi0OdcWUYhyJLNXTkGqQ9PMS5l" - "qoCgkV2h1ZvpNjBH2u8UbgcOQwqDo66z6BWQJ" - "GolozZYmNHE2kQ==") +privatekey = get_eckey_from_file(args.keyfile) tree_head_signature = create_sth_signature(tree_size, timestamp, root_hash, privatekey) |