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

AttributeError: module 'ssl' has no attribute 'wrap_socket' #111

Open
FlorianFey opened this issue Sep 15, 2024 · 1 comment
Open

AttributeError: module 'ssl' has no attribute 'wrap_socket' #111

FlorianFey opened this issue Sep 15, 2024 · 1 comment

Comments

@FlorianFey
Copy link

Hi guys,

I get this error when I run the server with both if these commands:

python manage.py runsslserver  --certificate localhost.pem  --key localhost-key.pem   
python manage.py runsslserver

The certificate is available.

AttributeError: module 'ssl' has no attribute 'wrap_socket'

I found a issue for this here that it should ne fixe, but it's still not working.

I am using Python 3.12.1.

Any solution for that?

Thx!
Flo

@ahmedsafadii
Copy link

for now you can do the following

python3.12/site-packages/sslserver/management/commands/runsslserver.py

replace

self.socket = ssl.wrap_socket(self.socket, certfile=certificate, ...)

with

context = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER)
context.load_cert_chain(certfile=certificate, keyfile=key)
self.socket = context.wrap_socket(self.socket, server_side=True)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants