read ca_certs from config
parent
5ded3dcd24
commit
eb2119309d
|
@ -39,7 +39,8 @@ def run_phenny(config):
|
||||||
def connect(config):
|
def connect(config):
|
||||||
import bot
|
import bot
|
||||||
p = bot.Phenny(config)
|
p = bot.Phenny(config)
|
||||||
p.run(config.host, config.port, config.ssl, config.ipv6)
|
p.run(config.host, config.port, config.ssl, config.ipv6,
|
||||||
|
config.ca_certs)
|
||||||
|
|
||||||
try: Watcher()
|
try: Watcher()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|
7
irc.py
7
irc.py
|
@ -114,8 +114,13 @@ class Bot(asynchat.async_chat):
|
||||||
cafile=self.ca_certs)
|
cafile=self.ca_certs)
|
||||||
sock = context.wrap_socket(sock, server_hostname=hostname)
|
sock = context.wrap_socket(sock, server_hostname=hostname)
|
||||||
except:
|
except:
|
||||||
|
if self.ca_certs is None:
|
||||||
|
# default to standard path on most non-EL distros
|
||||||
|
ca_certs = "/etc/ssl/certs/ca-certificates.crt"
|
||||||
|
else:
|
||||||
|
ca_certs = self.ca_certs
|
||||||
sock = ssl.wrap_socket(sock, ssl_version=ssl.PROTOCOL_TLSv1,
|
sock = ssl.wrap_socket(sock, ssl_version=ssl.PROTOCOL_TLSv1,
|
||||||
cert_reqs=ssl.CERT_OPTIONAL, ca_certs=self.ca_certs)
|
cert_reqs=ssl.CERT_OPTIONAL, ca_certs=ca_certs)
|
||||||
# FIXME: this doesn't work with SSL enabled
|
# FIXME: this doesn't work with SSL enabled
|
||||||
#sock.setblocking(False)
|
#sock.setblocking(False)
|
||||||
self.set_socket(sock)
|
self.set_socket(sock)
|
||||||
|
|
3
phenny
3
phenny
|
@ -157,6 +157,9 @@ def main(argv=None):
|
||||||
if not hasattr(module, 'ssl'):
|
if not hasattr(module, 'ssl'):
|
||||||
module.ssl = False
|
module.ssl = False
|
||||||
|
|
||||||
|
if not hasattr(module, 'ca_certs'):
|
||||||
|
module.ca_certs = None
|
||||||
|
|
||||||
if not hasattr(module, 'ipv6'):
|
if not hasattr(module, 'ipv6'):
|
||||||
module.ipv6 = False
|
module.ipv6 = False
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue