Convert from str to bytes before writing https related files.#22
Open
HatsuMora wants to merge 1 commit intooffsecginger:masterfrom
Open
Convert from str to bytes before writing https related files.#22HatsuMora wants to merge 1 commit intooffsecginger:masterfrom
HatsuMora wants to merge 1 commit intooffsecginger:masterfrom
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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