Пример #1
0
 def invalid_cert(self, pem_cert):
     der_cert = ssl.PEM_cert_to_DER_cert(pem_cert)
     try:
         cert.verify('talk.google.com', der_cert)
         logging.debug("CERT: Found GTalk certificate")
     except cert.CertificateError as err:
         log.error(err.message)
         self.disconnect(send_close=False)
Пример #2
0
 def invalid_cert(self, pem_cert):
     der_cert = ssl.PEM_cert_to_DER_cert(pem_cert)
     try:
         cert.verify('talk.google.com', der_cert)
         print "CERT: Found GTalk certificate"
     except cert.CertificateError as err:
         print err.message, " : ", traceback.format_exc()
         self.disconnect(send_close=False)
Пример #3
0
 def invalid_cert(self, pem_cert):
     der_cert = ssl.PEM_cert_to_DER_cert(pem_cert)
     try:
         cert.verify('talk.google.com', der_cert)
         print "CERT: Found GTalk certificate"
     except cert.CertificateError as err:
         print err.message, " : ", traceback.format_exc()
         self.disconnect(send_close=False)
Пример #4
0
 def invalid_cert(self, pem_cert):
     der_cert = ssl.PEM_cert_to_DER_cert(pem_cert)
     try:
         cert.verify('talk.google.com', der_cert)
         logging.debug("CERT: Found GTalk certificate")
     except cert.CertificateError as err:
         log.error(err.message)
         self.disconnect(send_close=False)
Пример #5
0
 def verify_cert(self, pem_cert):
     """Verify that certificate originates from Google."""
     der_cert = ssl.PEM_cert_to_DER_cert(pem_cert)
     try:
         cert.verify('talk.google.com', der_cert)
         logging.debug('Found Hangouts certificate.')
     except cert.CertificateError as err:
         logging.error(err)
         self.disconnect(send_close=False)
Пример #6
0
    def ssl_invalid_cert(self, pem_cert):
        # Source: https://github.com/poezio/slixmpp/blob/master/examples/gtalk_custom_domain.py

        der_cert = ssl.PEM_cert_to_DER_cert(pem_cert)
        try:
            cert.verify('talk.google.com', der_cert)
            self.logger.info("found GTalk certificate")
        except cert.CertificateError as err:
            self.logger.error(err.message)
            self.disconnect(send_close=False)
Пример #7
0
    def ssl_invalid_cert(self, pem_cert):
        # Source: https://github.com/poezio/slixmpp/blob/master/examples/gtalk_custom_domain.py

        der_cert = ssl.PEM_cert_to_DER_cert(pem_cert)
        try:
            cert.verify('talk.google.com', der_cert)
            self.logger.info("found GTalk certificate")
        except cert.CertificateError as err:
            self.logger.error(err.message)
            self.disconnect(send_close=False)
Пример #8
0
 def invalid_cert(self, pem_cert):
     """ PEM certification is used to verify the identity of a web site to avoid certain kinds of
     network hacking attacks.  
     For this to work you may need to install extra non-standard Python modules.
     """
     print "Got invalid certificate error"
     der_cert = ssl.PEM_cert_to_DER_cert(pem_cert)
     try:
         print "Try using talk.google.com certificate"
         cert.verify('talk.google.com', der_cert)
         logging.debug("CERT: Found GTalk certificate")
     except cert.CertificateError as err:
         log.error(err.message)
         self.disconnect(send_close=False)
Пример #9
0
 def invalid_cert(self, pem_cert):
     """ PEM certification is used to verify the identity of a web site to avoid certain kinds of
     network hacking attacks.  
     For this to work you may need to install extra non-standard Python modules.
     """
     print "Got invalid certificate error"
     der_cert = ssl.PEM_cert_to_DER_cert(pem_cert)
     try:
         print "Try using talk.google.com certificate"
         cert.verify('talk.google.com', der_cert)
         logging.debug("CERT: Found GTalk certificate")
     except cert.CertificateError as err:
         log.error(err.message)
         self.disconnect(send_close=False)
Пример #10
0
 def invalid_cert(self, pem_cert):
     """ PEM certification is used to verify the identity of a web site to avoid certain kinds of
     network hacking attacks.  This kind of network security is not required for the COMP 206 assignment, but we
     support it just in case you want to use this code in the future.  For this to work 
     you may need to install extra non-standard Python modules.
     """
     print "Got invalid certificate error"
     der_cert = ssl.PEM_cert_to_DER_cert(pem_cert)
     try:
         print "Try using talk.google.com certificate"
         cert.verify('talk.google.com', der_cert)
         logging.debug("CERT: Found GTalk certificate")
     except cert.CertificateError as err:
         log.error(err.message)
         self.disconnect(send_close=False)
Пример #11
0
 def invalid_cert(self, pem_cert):
     """ PEM certification is used to verify the identity of a web site to avoid certain kinds of
         network hacking attacks.  This kind of network security is not required for the COMP 206 assignment, but we
         support it just in case you want to use this code in the future.  For this to work
         you may need to install extra non-standard Python modules.
         """
     print "Got invalid certificate error"
     der_cert = ssl.PEM_cert_to_DER_cert(pem_cert)
     try:
         print "Try using talk.google.com certificate"
         cert.verify('talk.google.com', der_cert)
         logging.debug("CERT: Found GTalk certificate")
     except cert.CertificateError as err:
         log.error(err.message)
         self.disconnect(send_close=False)
Пример #12
0
def verify_gtalk_cert(xmpp_client):
    """
        Hack specific for google apps domains with SRV entries.
        It needs to fid the SSL certificate of google and not the one for your domain
    """

    hosts = resolver.get_SRV(xmpp_client.boundjid.server,
                             5222,
                             xmpp_client.dns_service,
                             resolver=resolver.default_resolver())
    it_is_google = False
    for host, _ in hosts:
        if host.lower().find('google.com') > -1:
            it_is_google = True

    if it_is_google:
        raw_cert = xmpp_client.socket.getpeercert(binary_form=True)
        try:
            if cert.verify('talk.google.com', raw_cert):
                logging.info('google cert found for %s',
                             xmpp_client.boundjid.server)
                return
        except cert.CertificateError:
            pass

    logging.error("invalid cert received for %s", xmpp_client.boundjid.server)
Пример #13
0
    def ssl_invalid_cert(self, raw_cert):
        """Handle an invalid certificate from the Jabber server
           This may happen if the domain is using Google Apps
           for their XMPP server and the XMPP server."""
        hosts = resolver.get_SRV(self.boundjid.server,
                                 5222,
                                 'xmpp-client',
                                 resolver=resolver.default_resolver())

        domain_uses_google = False
        for host, _ in hosts:
            if host.lower()[-10:] == 'google.com':
                domain_uses_google = True

        if domain_uses_google:
            try:
                if cert.verify('talk.google.com',
                               ssl.PEM_cert_to_DER_cert(raw_cert)):
                    logging.debug('Google certificate found for %s',
                                  self.boundjid.server)
                    return
            except cert.CertificateError:
                pass

        logging.error("Invalid certificate received for %s",
                      self.boundjid.server)
        self.disconnect()
Пример #14
0
    def verify_gtalk_cert(self, raw_cert):
        hosts = resolver.get_SRV(self.boundjid.server, 5222,
                                 self.dns_service,
                                 resolver=resolver.default_resolver())
        it_is_google = False
        for host, _ in hosts:
            if host.lower().find('google.com') > -1:
                it_is_google = True

        if it_is_google:
            try:
                if cert.verify('talk.google.com', ssl.PEM_cert_to_DER_cert(raw_cert)):
                    logging.info('google cert found for %s',
                                self.boundjid.server)
                    return
            except cert.CertificateError:
                pass

        logging.error("invalid cert received for %s",
                      self.boundjid.server)
Пример #15
0
    def verify_gtalk_cert(self, raw_cert):
        hosts = resolver.get_SRV(self.boundjid.server,
                                 5222,
                                 self.dns_service,
                                 resolver=resolver.default_resolver())
        it_is_google = False
        for host, _ in hosts:
            if host.lower().find('google.com') > -1:
                it_is_google = True

        if it_is_google:
            try:
                if cert.verify('talk.google.com',
                               ssl.PEM_cert_to_DER_cert(raw_cert)):
                    logging.info('google cert found for %s',
                                 self.boundjid.server)
                    return
            except cert.CertificateError:
                pass

        logging.error("invalid cert received for %s", self.boundjid.server)
Пример #16
0
    def ssl_invalid_cert(self, raw_cert):
        """Handle an invalid certificate from the Jabber server
           This may happen if the domain is using Google Apps
           for their XMPP server and the XMPP server."""
        hosts = resolver.get_SRV(self.boundjid.server, 5222,
                                 'xmpp-client',
                                 resolver=resolver.default_resolver())

        domain_uses_google = False
        for host, _ in hosts:
            if host.lower()[-10:] == 'google.com':
                domain_uses_google = True

        if domain_uses_google:
            try:
                if cert.verify('talk.google.com', ssl.PEM_cert_to_DER_cert(raw_cert)):
                    logging.debug('Google certificate found for %s', self.boundjid.server)
                    return
            except cert.CertificateError:
                pass

        logging.error("Invalid certificate received for %s", self.boundjid.server)
        self.disconnect()
Пример #17
0
def verify_gtalk_cert(xmpp_client):
    """
        Hack specific for google apps domains with SRV entries.
        It needs to fid the SSL certificate of google and not the one for your domain
    """

    hosts = resolver.get_SRV(xmpp_client.boundjid.server, 5222,
                             xmpp_client.dns_service,
                             resolver=resolver.default_resolver())
    it_is_google = False
    for host, _ in hosts:
        if host.lower().find('google.com') > -1:
            it_is_google = True

    if it_is_google:
        raw_cert = xmpp_client.socket.getpeercert(binary_form=True)
        try:
            if cert.verify('talk.google.com', raw_cert):
                log.info('google cert found for %s', xmpp_client.boundjid.server)
                return
        except cert.CertificateError:
            pass

    log.error("invalid cert received for %s", xmpp_client.boundjid.server)