aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorDeterminant <[email protected]>2019-07-02 03:00:31 -0400
committerDeterminant <[email protected]>2019-07-02 03:00:31 -0400
commitc1bb07e65f550e043d9a387d3978e651a1b7a15d (patch)
tree610d501e893c1eead667e558fb58ee85109fd82f /scripts
parent7e91de67703a3a3eb292d1a2422acb15a10d4b95 (diff)
enable TLS for replica-replica connections
Diffstat (limited to 'scripts')
-rw-r--r--scripts/gen_conf.py17
1 files changed, 12 insertions, 5 deletions
diff --git a/scripts/gen_conf.py b/scripts/gen_conf.py
index 391e0d6..ca61ea1 100644
--- a/scripts/gen_conf.py
+++ b/scripts/gen_conf.py
@@ -11,6 +11,7 @@ if __name__ == "__main__":
parser.add_argument('--pport', type=int, default=10000)
parser.add_argument('--cport', type=int, default=20000)
parser.add_argument('--keygen', type=str, default='./hotstuff-keygen')
+ parser.add_argument('--tls-keygen', type=str, default='./hotstuff-tls-keygen')
parser.add_argument('--nodes', type=str, default='nodes.txt')
parser.add_argument('--block-size', type=int, default=1)
parser.add_argument('--pace-maker', type=str, default='dummy')
@@ -26,6 +27,7 @@ if __name__ == "__main__":
base_pport = args.pport
base_cport = args.cport
keygen_bin = args.keygen
+ tls_keygen_bin = args.tls_keygen
main_conf = open("{}.conf".format(prefix), 'w')
nodes = open(args.nodes, 'w')
@@ -35,14 +37,19 @@ if __name__ == "__main__":
p = subprocess.Popen([keygen_bin, '--num', str(len(replicas))],
stdout=subprocess.PIPE, stderr=open(os.devnull, 'w'))
keys = [[t[4:] for t in l.decode('ascii').split()] for l in p.stdout]
+ tls_p = subprocess.Popen([tls_keygen_bin, '--num', str(len(replicas))],
+ stdout=subprocess.PIPE, stderr=open(os.devnull, 'w'))
+ tls_keys = [[t[4:] for t in l.decode('ascii').split()] for l in tls_p.stdout]
if not (args.block_size is None):
main_conf.write("block-size = {}\n".format(args.block_size))
if not (args.pace_maker is None):
main_conf.write("pace-maker = {}\n".format(args.pace_maker))
- for r in zip(replicas, keys, itertools.count(0)):
- main_conf.write("replica = {}, {}\n".format(r[0], r[1][0]))
- r_conf_name = "{}-sec{}.conf".format(prefix, r[2])
- nodes.write("{}:{}\t{}\n".format(r[2], r[0], r_conf_name))
+ for r in zip(replicas, keys, tls_keys, itertools.count(0)):
+ main_conf.write("replica = {}, {}, {}\n".format(r[0], r[1][0], r[2][2]))
+ r_conf_name = "{}-sec{}.conf".format(prefix, r[3])
+ nodes.write("{}:{}\t{}\n".format(r[3], r[0], r_conf_name))
r_conf = open(r_conf_name, 'w')
r_conf.write("privkey = {}\n".format(r[1][1]))
- r_conf.write("idx = {}\n".format(r[2]))
+ r_conf.write("tls-privkey = {}\n".format(r[2][1]))
+ r_conf.write("tls-cert = {}\n".format(r[2][0]))
+ r_conf.write("idx = {}\n".format(r[3]))