def do_show(self, arguments): """show SSL configuration information""" provider = Provider() if provider.key_material_exists(): print "SSL has been provisioned:" print " SSL Key:", provider.key_exists() and "EXISTS" or "MISSING" print " SSL Certificate:", provider.certificate_exists() and "EXISTS" or "MISSING" print " Key Pair:", provider.key_material_valid() and "VALID" or "INVALID" else: print "SSL has not been provisioned."
def do_create(self, arguments): """create some new key material""" provider = Provider() if arguments.type == "ca": self.__create_ca(provider, arguments) elif arguments.type == "keypair": self.__create_keypair(provider, arguments) elif arguments.type == "truststore": provider.make_bks_trust_store() provider.make_jks_trust_store() else: print "Unexpected type:", arguments.type
def get_socket(arguments): sock = socket() if arguments.ssl: provider = Provider() sock = ssl.wrap_socket(sock, cert_reqs=ssl.CERT_REQUIRED, ca_certs=provider.ca_certificate_path()) sock.settimeout(5.0) if hasattr(arguments, 'push_server') and arguments.push_server != None: sock.connect(arguments.push_server) else: sock.connect(arguments.server) return sock