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

WARNING:websocket_server.websocket_server:SSL not available #99

Open
gasanaff opened this issue Jan 17, 2022 · 8 comments
Open

WARNING:websocket_server.websocket_server:SSL not available #99

gasanaff opened this issue Jan 17, 2022 · 8 comments

Comments

@gasanaff
Copy link

gasanaff commented Jan 17, 2022

I inserted the key.pem and cert.pem in the same directory with the py script and tried to specify the absolute path and relative path and got the same error. (777 permissions)

WARNING:websocket_server.websocket_server:SSL not available (are the paths key.pem and cert.pem correct for the key and cert?)

@pendrya
Copy link

pendrya commented Apr 4, 2022

I have same error when trying to connect via wss,
WARNING:websocket_server.websocket_server:SSL not available (are the paths key.pem and cert.pem correct for the key and cert?)

both cert and key pems are in same folder as the script and 777 permissions

@onmahadev
Copy link

i have same error when try start with SSL support

@jo24
Copy link

jo24 commented May 21, 2022

I also had this problem, but it came from my setup...

@tmsk0711
Copy link

me too.... :(

@cbureriu
Copy link

me too. same warning:
WARNING:websocket_server.websocket_server:SSL not available (are the paths privkey.pem and cert.pem correct for the key and cert?)

then the exception:
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xfc in position 8: invalid start byte

full exception output:
Exception occurred during processing of request from ('x.x.x.x', x) Traceback (most recent call last): File "/usr/lib/python3.9/socketserver.py", line 650, in process_request_thread self.finish_request(request, client_address) File "/usr/lib/python3.9/socketserver.py", line 360, in finish_request self.RequestHandlerClass(request, client_address, self) File "/usr/local/lib/python3.9/dist-packages/websocket_server/websocket_server.py", line 271, in __init__ StreamRequestHandler.__init__(self, socket, addr, server) File "/usr/lib/python3.9/socketserver.py", line 720, in __init__ self.handle() File "/usr/local/lib/python3.9/dist-packages/websocket_server/websocket_server.py", line 282, in handle self.handshake() File "/usr/local/lib/python3.9/dist-packages/websocket_server/websocket_server.py", line 430, in handshake headers = self.read_http_headers() File "/usr/local/lib/python3.9/dist-packages/websocket_server/websocket_server.py", line 418, in read_http_headers http_get = self.rfile.readline().decode().strip() UnicodeDecodeError: 'utf-8' codec can't decode byte 0xfc in position 8: invalid start byte

@cbureriu
Copy link

I figured it out. It wants the full chain.
cert='fullchain.pem' <--- instead of 'cert.pem'
key='privkey.pem'

@594zouying
Copy link

594zouying commented Feb 13, 2023

Generated SSL crt and key from the official website of one provider of cloud service, and configured them to the nginx .conf. The ws could be connected from client side.
If private key is used, using the command like openssl req -new -x509 -days 365 -nodes -out cert.pem -keyout cert.pem. Server: changed the parameter to " server = WebsocketServer(port = PORT,host = HOST,loglevel=logging.INFO,cert='cert.pem',key='cert.pem') ". Client: ws = websocket.WebSocket(sslopt={"cert_reqs": ssl.CERT_NONE}). The WS connection is also working by using this way.

@mgeilich
Copy link

I have not been able to get this to work (on a Mac). Same symptoms as above. Requests seem to be getting to the server but the server is not able to use the self-signed cert and key files. Has anyone figured this out?

INFO:websocket_server.websocket_server:Listening on port 4567 for clients..
INFO:websocket_server.websocket_server:Starting WebsocketServer on main thread.
WARNING:websocket_server.websocket_server:SSL not available (are the paths key.pem and cert.pem correct for the key and cert?)

Exception occurred during processing of request from ('127.0.0.1', 58033)
Traceback (most recent call last):
File "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/socketserver.py", line 683, in process_request_thread
self.finish_request(request, client_address)
File "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/socketserver.py", line 360, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "/Users/michael/Library/Python/3.9/lib/python/site-packages/websocket_server/websocket_server.py", line 271, in init
StreamRequestHandler.init(self, socket, addr, server)
File "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/socketserver.py", line 747, in init
self.handle()
File "/Users/michael/Library/Python/3.9/lib/python/site-packages/websocket_server/websocket_server.py", line 282, in handle
self.handshake()
File "/Users/michael/Library/Python/3.9/lib/python/site-packages/websocket_server/websocket_server.py", line 430, in handshake
headers = self.read_http_headers()
File "/Users/michael/Library/Python/3.9/lib/python/site-packages/websocket_server/websocket_server.py", line 418, in read_http_headers
http_get = self.rfile.readline().decode().strip()
File "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/socket.py", line 704, in readinto
return self._sock.recv_into(b)
OSError: [Errno 9] Bad file descriptor

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

8 participants