jaraco / irc

Full-featured Python IRC library for Python.
MIT License
390 stars 84 forks source link

Add support for ignoring ssl validation in the examples #194

Open d3xt3r01 opened 2 years ago

d3xt3r01 commented 2 years ago

Hi,

I tried various ways of getting cert_reqs=ssl.CERT_NONE to connect to a server with self-signed/expired certificate with no luck. Help ?

Thanks.

d3xt3r01 commented 2 years ago

Also, the testbot example should support ssl too...

jaraco commented 2 years ago

You need to create a socket wrapper with the relevant parameters. See the connection module for explanations on how to create a factory with the relevant SSL wrapper and pass that factory to the client. Probably you need something like:

wrapper = functools.partial(ssl.wrap_socket, cert_reqs=ssl.CERT_NONE)
factory = Factory(wrapper=wrapper)
bot = SingleServerIRCBot(connect_factory=factory)