This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: SSL example script fails mysteriously on MacOS
Type: behavior Stage:
Components: Extension Modules Versions: Python 2.6
process
Status: closed Resolution: wont fix
Dependencies: Superseder:
Assigned To: janssen Nosy List: akuchling, janssen
Priority: high Keywords:

Created on 2008-04-25 01:50 by akuchling, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
ssl-example.tgz akuchling, 2008-04-25 01:50 SSL example client, server, and keys
Messages (2)
msg65770 - (view) Author: A.M. Kuchling (akuchling) * (Python committer) Date: 2008-04-25 01:50
On my MacOS 10.4.11 machine, the example SSL server and client in the
documentation don't work, and they fail with a mysterious error 0.  The
attached tarball contains my slightly-modified version of the scripts
and the test key/cert I'm using.  

When I run the server, and then the client, the output of the server is:

amk@amk:~/source/p/python$ ./python.exe server.py
Waiting for connection...
Connection received from ('127.0.0.1', 61915)
Traceback (most recent call last):
  File "server.py", line 16, in <module>
    certfile='cert.pem')
  File "/Users/amk/source/p/python/Lib/ssl.py", line 466, in wrap_socket
    ssl_version=ssl_version, ca_certs=ca_certs)
  File "/Users/amk/source/p/python/Lib/ssl.py", line 103, in __init__
    cert_reqs, ssl_version, ca_certs)
ssl.SSLError: [Errno 8] _ssl.c:429: EOF occurred in violation of protocol

And the client is:
amk@amk:~/source/p/python$ ./python.exe client.py
Traceback (most recent call last):
  File "client.py", line 10, in <module>
    ssl_sock.connect(('', 9000))
  File "/Users/amk/source/p/python/Lib/ssl.py", line 204, in connect
    self.ca_certs)
ssl.SSLError: [Errno 0] _ssl.c:327: error:00000000:lib(0):func(0):reason(0)
amk@amk:~/source/p/python$ 

The error 0 is very puzzling.

Perhaps I generated the key and cert incorrectly, and parsing them is
failing in this strange way?
msg65797 - (view) Author: Bill Janssen (janssen) * (Python committer) Date: 2008-04-25 17:23
No, the problem is with your "ca_certs" argument on the client side. 
You can't use a directory.  You must use a file containing a number of
concatenated certificates.  I'll beef up the documentation to make that
clearer.
History
Date User Action Args
2022-04-11 14:56:33adminsetgithub: 46939
2008-04-25 17:23:26janssensetstatus: open -> closed
resolution: wont fix
messages: + msg65797
2008-04-25 01:50:42akuchlingcreate