Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert from str to bytes before writing https related files. #22

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Commits on Oct 24, 2022

  1. Convert from str to bytes before writing https related files.

    Hi, 
    
    I was setting up CTFd with docker over HTTPS, and I found errors when trying to connect over https. 
    
    The stack trace: 
    ctfd-ctfd-1   | /usr/local/lib/python3.9/site-packages/urllib3/connectionpool.py:981: InsecureRequestWarning: Unverified HTTPS request is being made to host 'my-docker-https'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
    ctfd-ctfd-1   |   warnings.warn(
    ctfd-ctfd-1   | /usr/local/lib/python3.9/site-packages/urllib3/connectionpool.py:981: InsecureRequestWarning: Unverified HTTPS request is being made to host 'my-docker-https'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
    ctfd-ctfd-1   |   warnings.warn(
    ctfd-ctfd-1   | Traceback (most recent call last):
    ctfd-ctfd-1   |   File "/opt/CTFd/CTFd/plugins/docker_challenges/__init__.py", line 302, in create_container
    ctfd-ctfd-1   |     ca_file.write(ca)
    ctfd-ctfd-1   |   File "/usr/local/lib/python3.9/tempfile.py", line 478, in func_wrapper
    ctfd-ctfd-1   |     return func(*args, **kwargs)
    ctfd-ctfd-1   | TypeError: a bytes-like object is required, not 'str'
    
    To translate from str to bytes I am using the .encode(), I don't know if this is due a change on the Python API. I am running with python 3.9
    HatsuMora authored Oct 24, 2022
    Configuration menu
    Copy the full SHA
    87d12c0 View commit details
    Browse the repository at this point in the history