Exemple #1
0
def setup_keyserver(ops: Operations) -> None:
    config = configuration.get_config()
    for node in config.nodes:
        if node.kind != "supervisor":
            continue
        ops.ssh_mkdir("create directories on @HOST", node, AUTHORITY_DIR,
                      STATICS_DIR, CONFIG_DIR)
        for name, data in authority.iterate_keys_decrypted():
            # TODO: keep these keys in memory
            if "/" in name:
                command.fail("found key in upload list with invalid filename")
            # TODO: avoid keeping these keys in memory for this long
            ops.ssh_upload_bytes("upload authority %s to @HOST" % name, node,
                                 data, os.path.join(AUTHORITY_DIR, name))
        ops.ssh_upload_bytes("upload cluster config to @HOST", node,
                             configuration.get_cluster_conf().encode(),
                             STATICS_DIR + "/cluster.conf")
        ops.ssh_upload_bytes("upload machine list to @HOST", node,
                             configuration.get_machine_list_file().encode(),
                             STATICS_DIR + "/machine.list")
        ops.ssh_upload_bytes("upload keyserver config to @HOST", node,
                             configuration.get_keyserver_yaml().encode(),
                             CONFIG_DIR + "/keyserver.yaml")
        ops.ssh("enable keyserver on @HOST", node, "systemctl", "enable",
                "keyserver.service")
        ops.ssh("start keyserver on @HOST", node, "systemctl", "restart",
                "keyserver.service")
Exemple #2
0
def setup_keyserver(ops: command.Operations) -> None:
    "deploy keys and configuration for keyserver; start keyserver"

    config = configuration.get_config()
    for node in config.nodes:
        if node.kind != "supervisor":
            continue
        ssh_mkdir(ops, "create directories on @HOST", node, AUTHORITY_DIR, STATICS_DIR, CONFIG_DIR)
        for name, data in authority.iterate_keys_decrypted():
            # TODO: keep these keys in memory
            if "/" in name:
                command.fail("found key in upload list with invalid filename")
            # TODO: avoid keeping these keys in memory for this long
            ssh_upload_bytes(ops, "upload authority %s to @HOST" % name, node, data, os.path.join(AUTHORITY_DIR, name))
        ssh_upload_bytes(ops, "upload cluster config to @HOST", node,
                         configuration.get_cluster_conf().encode(), STATICS_DIR + "/cluster.conf")
        ssh_upload_path(ops, "upload cluster setup to @HOST", node,
                        configuration.Config.get_setup_path(), CONFIG_DIR + "/setup.yaml")
        ssh_cmd(ops, "enable keyserver on @HOST", node, "systemctl", "enable", "keyserver.service")
        ssh_cmd(ops, "start keyserver on @HOST", node, "systemctl", "restart", "keyserver.service")