-
Notifications
You must be signed in to change notification settings - Fork 7
SSL Connections
KitnIRC supports connections via SSL.
To use SSL when connecting, pass a boolean true value to the ssl
keyword parameter in your .connect()
call:
c = kitnirc.client.Client('irc.foobar.net', 6697)
c.connect('MyNick', ssl=True)
Most IRC networks that accept SSL connections do so on port 6697
rather than the regular 6667
port - make sure to specify the proper port for your IRC network's SSL listener. If you forget and try to connect to the regular port, you'll get an error that looks like this:
ssl.SSLError: [Errno 1] _ssl.c:504: error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol
If you want to customize the parameters used for the SSL connection, you can pass a dictionary as the value for the ssl
parameter. This dictionary will be expanded into keyword arguments that are passed to the ssl.wrap_socket()
call.
By default Python's SSL socket wrapper does not verify certificates - if you're serious about security, you'll probably want to provide the custom parameters necessary to verify the server's certificate.
You can also use custom parameters to provide a client certificate, if your network supports using this for authentication.