summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorMagnus Ahltorp <map@kth.se>2015-03-27 17:33:35 +0100
committerMagnus Ahltorp <map@kth.se>2015-03-30 15:42:40 +0200
commit2d8d55bb9b6672ebe829b185beb05d4a399167f5 (patch)
treeb13113b172bca8c148a11141384d3274de16edf9 /tools
parent1481cc600aee9f8a8b9308fc5cb99bb93ec1898d (diff)
Allow local administrator to override IP address and port for web server
Closes CATLFISH-30
Diffstat (limited to 'tools')
-rw-r--r--tools/certkeys.py4
-rwxr-xr-xtools/compileconfig.py21
2 files changed, 19 insertions, 6 deletions
diff --git a/tools/certkeys.py b/tools/certkeys.py
index 3c459e9..52d61be 100644
--- a/tools/certkeys.py
+++ b/tools/certkeys.py
@@ -8,6 +8,10 @@ publickeys = {
"MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE4qWq6afhBUi0OdcWUYhyJLNXTkGqQ9"
"PMS5lqoCgkV2h1ZvpNjBH2u8UbgcOQwqDo66z6BWQJGolozZYmNHE2kQ==",
+ "https://localhost:8080/":
+ "MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE4qWq6afhBUi0OdcWUYhyJLNXTkGqQ9"
+ "PMS5lqoCgkV2h1ZvpNjBH2u8UbgcOQwqDo66z6BWQJGolozZYmNHE2kQ==",
+
"https://flimsy.ct.nordu.net/":
"MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE4qWq6afhBUi0OdcWUYhyJLNXTkGqQ9"
"PMS5lqoCgkV2h1ZvpNjBH2u8UbgcOQwqDo66z6BWQJGolozZYmNHE2kQ==",
diff --git a/tools/compileconfig.py b/tools/compileconfig.py
index 52f10e8..88d6b51 100755
--- a/tools/compileconfig.py
+++ b/tools/compileconfig.py
@@ -77,17 +77,24 @@ def get_node_config(nodename, config):
sys.exit(1)
return (nodetype, nodeconfig)
-def gen_https_servers(nodetype, nodeconfig):
+def gen_https_servers(nodetype, nodeconfig, bind_address, bind_publicaddress):
+ if bind_address:
+ (host, port) = parse_address(bind_address)
+ else:
+ (_, port) = parse_address(nodeconfig["address"])
+ host = "0.0.0.0"
if nodetype == "frontendnodes":
- (publichost, publicport) = parse_address(nodeconfig["publicaddress"])
- (host, port) = parse_address(nodeconfig["address"])
+ if bind_publicaddress:
+ (publichost, publicport) = parse_address(bind_publicaddress)
+ else:
+ (_, publicport) = parse_address(nodeconfig["publicaddress"])
+ publichost = "0.0.0.0"
+
return [(Symbol("external_https_api"), publichost, publicport, Symbol("v1")),
(Symbol("frontend_https_api"), host, port, Symbol("frontend"))]
elif nodetype == "storagenodes":
- (host, port) = parse_address(nodeconfig["address"])
return [(Symbol("storage_https_api"), host, port, Symbol("storage"))]
elif nodetype == "signingnodes":
- (host, port) = parse_address(nodeconfig["address"])
return [(Symbol("signing_https_api"), host, port, Symbol("signing"))]
def allowed_clients_frontend(mergenodenames):
@@ -136,13 +143,15 @@ def allowed_servers_frontend(signingnodenames, storagenodenames):
def gen_config(nodename, config, localconfig):
print "generating config for", nodename
paths = localconfig["paths"]
+ bind_address = localconfig.get("addresses", {}).get(nodename)
+ bind_publicaddress = localconfig.get("publicaddresses", {}).get(nodename)
options = localconfig.get("options", [])
configfile = open(paths["configdir"] + nodename + ".config", "w")
print >>configfile, "%% catlfish configuration file (-*- erlang -*-)"
(nodetype, nodeconfig) = get_node_config(nodename, config)
- https_servers = gen_https_servers(nodetype, nodeconfig)
+ https_servers = gen_https_servers(nodetype, nodeconfig, bind_address, bind_publicaddress)
catlfishconfig = []
plopconfig = []