1

I have tried to run this code with Python 3.8.10 in Ubuntu 20.04

import socket
import ssl

sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.settimeout(10)
socket = ssl.wrap_socket(sock)

socket.connect(('192.168.1.111', 8080))

But I got an error:

Traceback (most recent call last):                                    
  File "error.py", line 8, in <module>                                
    socket.connect(('192.168.1.111', 8080))                           
  File "/usr/lib/python3.8/ssl.py", line 1342, in connect             
    self._real_connect(addr, False)                                   
  File "/usr/lib/python3.8/ssl.py", line 1333, in _real_connect   
    self.do_handshake()                                           
  File "/usr/lib/python3.8/ssl.py", line 1309, in do_handshake    
    self._sslobj.do_handshake()                                       
ssl.SSLEOFError: EOF occurred in violation of protocol (_ssl.c:1131)

I have tried all the solutions in that post but no answer was help me

I run:

from urllib.request import urlopen
urlopen('https://www.howsmyssl.com/a/check').read()

and got tls_version":"TLS 1.3

How can I fix that?

vtable
  • 184
  • 10
  • The problem is the server on 192.168.1.111 port 8080 which is not properly speaking TLS. Unfortunately nothing is known about the server. Checking with howsmyssl.com only shows what your Python client is capable of but says nothing about what the problematic server can do. – Steffen Ullrich Dec 16 '21 at 11:38
  • @SteffenUllrich How can I find out ? I saw a valid communication to this post that replay contains `OpenSSL Generated Certificate` – vtable Dec 16 '21 at 12:30
  • How to find out what? - The server is not speaking proper TLS, there is nothing to find out about it. If you want help to find out why the server is not properly speaking TLS then you have to provide the necessary details about the server. – Steffen Ullrich Dec 16 '21 at 13:58

0 Answers0