Пример #1
0
def ctff_rp_check():
    client = ctff_functions.create_client()
    nginx_rp_check = 0
    nginx_rp_letsencrypt_check = 0
    container_list = client.containers.list(all)
    for container in container_list:
        if "nginx-proxy" in container.name:
            if "jwilder/nginx-proxy" in (container.image.attrs.get("RepoTags", "str")[0]):
                x = str(container.image.attrs.get("RepoTags"))
                nginx_rp_check = 1
                # if "ctff-deployed" in container.exec_run(cmd="echo $"):
                #    nginx_rp_check = 1
        if "nginx-proxy-letsencrypt" in container.name:
            if "jrcs/letsencrypt-nginx-proxy-companion" in (container.image.attrs.get("RepoTags", "str")[0]):
                nginx_rp_letsencrypt_check = 1
                # if "ctff-deployed" in container.exec_run("env"):
                #    nginx_rp_letsencrypt_check = 1
    if nginx_rp_check == 1 and nginx_rp_letsencrypt_check == 1:
        ctff_rp_deployed = 1
    else:
        ctff_rp_deployed = 0
    client.close()
    return ctff_rp_deployed
Пример #2
0
    use_reverse_proxy = yes_no_input(
        "Would you like to use the reverse proxy for this deployment?")
    if use_reverse_proxy == 1:
        print("")
        container_rp_email = input(
            "What email address would you like to use for the certificate?: ")
        print("")
        container_domain = input(
            "What domain name would you like this container to have?: ")
if use_reverse_proxy == 0:
    print("")
    container_port = input(
        "What port number would you like this container published on?: ")

# Clone CTFd Repo into a Docker Volume
docker_client = ctff_functions.create_client()
if os.path.exists(ctfd_volume_path):
    shutil.rmtree(ctfd_volume_path)
git.Git().clone(ctfd_git_url, ctfd_volume_path)

# Modify the Docker Compose as needed
yaml_data = open(ctfd_dockercompose, "r").read()
yaml_data = yaml.safe_load(yaml_data)

if use_reverse_proxy == 1:
    # Replace "ports" with "expose"
    del (yaml_data['services']['ctfd']['ports'])
    yaml_data['services']['ctfd']['expose'] = [8000]

    # Add in the RP needed env vars
    yaml_data['services']['ctfd']['environment'].append(