summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsand <daniel@spatof.org>2013-05-16 17:35:33 (GMT)
committer sand <daniel@spatof.org>2013-05-16 17:35:33 (GMT)
commit064d300477ab7f93c0daa6b71693bd49a688fd96 (patch)
tree2625adff22bef6c6aad87698ef694c04592611b7
parentc801306406594ed401b0af3fffcc21a806f7ca8b (diff)
verifica SSL (su linux, su osx BOH)
-rw-r--r--pinolo/irc.py19
1 files changed, 13 insertions, 6 deletions
diff --git a/pinolo/irc.py b/pinolo/irc.py
index 8eb4f3a..f69f3c7 100644
--- a/pinolo/irc.py
+++ b/pinolo/irc.py
@@ -161,16 +161,23 @@ class IRCConnection(object):
return "<IRCConnection(%s)>" % self.name
def wrap_ssl(self):
- if not self.config["ssl"]:
- return
+ old_socket = self.socket
try:
- self.socket = ssl.wrap_socket(self.socket,
- cert_reqs=ssl.CERT_NONE,
- do_handshake_on_connect=False)
+ if self.config["ssl_verify"]:
+ self.socket = ssl.wrap_socket(self.socket,
+ cert_reqs=ssl.CERT_REQUIRED,
+ ca_certs=self.ssl_ca_path,
+ do_handshake_on_connect=False)
+ else:
+ self.socket = ssl.wrap_socket(self.socket,
+ cert_reqs=ssl.CERT_NONE,
+ do_handshake_on_connect=False)
self.ssl_must_handshake = True
except ssl.SSLError:
- raise
+ raise
+
+ return (old_socket, self.socket)
def connect(self):
"""Create a socket and connect to the remote server; at the moment