def tls(cls, args):
"""
Set up TLS connection and start listening for first PDU.
NB: This uses OpenSSL's "s_client" command, which does not
check server certificates properly, so this is not suitable for
production use. Fixing this would be a trivial change, it just
requires using a client program which does check certificates
properly (eg, gnutls-cli, or stunnel's client mode if that works
for such purposes this week).
"""
argv = ("openssl", "s_client", "-tls1", "-quiet", "-connect", "%s:%s" % (args.host, args.port))
logging.debug("[Running: %s]", " ".join(argv))
s = socket.socketpair()
return cls(sock = s[1],
proc = subprocess.Popen(argv, stdin = s[0], stdout = s[0], close_fds = True),
killsig = signal.SIGKILL, args = args)
评论列表
文章目录