errbotio / errbot

Errbot is a chatbot, a daemon that connects to your favorite chat service and bring your tools and some fun into the conversation.
http://errbot.io
GNU General Public License v3.0
3.13k stars 616 forks source link

Trouble connecting to HipChat #1144

Closed mfin closed 5 years ago

mfin commented 6 years ago

In order to let us help you better, please fill out the following fields as best you can:

I am...

I am running...

Issue description

I have trouble connecting to HipChat. Below is my configuration file and an error I get.

Steps to reproduce

BOT_ADMINS = ('11111_2222222@chat.hipchat.com')  

BOT_IDENTITY = {
    'username': '11111_3333333@chat.hipchat.com',
    'password': 'thisismypassword',
    'token':'herecomesatoken',
    'server': ('chat.hipchat.com', 5222)
}

CHATROOM_PRESENCE = ('11111_spam_room',)
CHATROOM_FN = 'Errbot'

Additional info

13:57:17 DEBUG    errbot.plugins.Trola      Logger for plugin initialized...
13:57:17 DEBUG    errbot.plugins.Bitcoin    Logger for plugin initialized...
13:57:17 DEBUG    errbot.plugins.ACLs       Logger for plugin initialized...
13:57:17 DEBUG    errbot.plugins.Backup     Logger for plugin initialized...
13:57:17 DEBUG    errbot.plugins.ChatRoom   Logger for plugin initialized...
13:57:17 DEBUG    errbot.plugins.CommandNot Logger for plugin initialized...
13:57:17 DEBUG    errbot.plugins.Flows      Logger for plugin initialized...
13:57:17 DEBUG    errbot.plugins.Health     Logger for plugin initialized...
13:57:17 DEBUG    errbot.plugins.Help       Logger for plugin initialized...
13:57:17 DEBUG    errbot.plugins.Plugins    Logger for plugin initialized...
13:57:17 DEBUG    errbot.plugins.Utils      Logger for plugin initialized...
13:57:17 DEBUG    errbot.plugins.VersionChe Logger for plugin initialized...
13:57:17 INFO     errbot                    webhooks:  Flag to bind /echo to                           echo
13:57:17 DEBUG    errbot.plugins.Webserver  Logger for plugin initialized...
13:57:17 DEBUG    errbot.bootstrap          Start serving commands from the hipchat backend
13:57:17 DEBUG    sleekxmpp.xmlstream.xmlst Waiting 1.915218741814067 seconds before connecting.
13:57:19 DEBUG    sleekxmpp.xmlstream.resol DNS: Querying chat.hipchat.com for AAAA records.
13:57:19 DEBUG    sleekxmpp.xmlstream.resol DNS: No AAAA records for chat.hipchat.com
13:57:19 DEBUG    sleekxmpp.xmlstream.resol DNS: Querying chat.hipchat.com for A records.
13:57:19 DEBUG    sleekxmpp.xmlstream.xmlst Connecting to 52.55.198.252:5222
13:57:19 DEBUG    sleekxmpp.xmlstream.xmlst Event triggered: connected
13:57:19 DEBUG    sleekxmpp.thirdparty.stat  ==== TRANSITION disconnected -> connected
13:57:19 DEBUG    sleekxmpp.xmlstream.xmlst Starting HANDLER THREAD
13:57:19 DEBUG    sleekxmpp.xmlstream.xmlst Loading event runner
13:57:19 DEBUG    sleekxmpp.xmlstream.xmlst SEND (IMMED): <stream:stream to='chat.hipchat.com' xmlns:stream='http://etherx.jabber.org/streams' xmlns='jabber:client' xml:lang='en' version='1.0'>
13:57:19 DEBUG    sleekxmpp.xmlstream.xmlst RECV: <stream:stream version="1.0" from="chat.hipchat.com" id="43ba97e9e7229328">
13:57:19 DEBUG    sleekxmpp.xmlstream.xmlst RECV: <stream:features xmlns="http://etherx.jabber.org/streams"><starttls xmlns="urn:ietf:params:xml:ns:xmpp-tls"><required /></starttls></stream:features>
13:57:19 DEBUG    sleekxmpp.xmlstream.xmlst SEND (IMMED): <starttls xmlns="urn:ietf:params:xml:ns:xmpp-tls"><required /></starttls>
13:57:19 DEBUG    sleekxmpp.xmlstream.xmlst RECV: <proceed xmlns="urn:ietf:params:xml:ns:xmpp-tls" />
13:57:19 DEBUG    sleekxmpp.features.featur Starting TLS
13:57:19 INFO     sleekxmpp.xmlstream.xmlst Negotiating TLS
13:57:19 INFO     sleekxmpp.xmlstream.xmlst Using SSL version: TLSv1
13:57:20 DEBUG    sleekxmpp.xmlstream.xmlst CERT: -----BEGIN CERTIFICATE-----
MIIFQTCCBCmgAwIBAgIQAiPgwGQ6wwaieYWXAri85TANBgkqhkiG9w0BAQsFADBw
MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQL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CCsGAQUFBwIBFhxodHRwczovL3d3dy5kaWdpY2VydC5jb20v
Q1BTMAgGBmeBDAECAjCBgwYIKwYBBQUHAQEEdzB1MCQGCCsGAQUFBzABhhhodHRw
Oi8vb2NzcC5kaWdpY2VydC5jb20wTQYIKwYBBQUHMAKGQWh0dHA6Ly9jYWNlcnRz
LmRpZ2ljZXJ0LmNvbS9EaWdpQ2VydFNIQTJIaWdoQXNzdXJhbmNlU2VydmVyQ0Eu
Y3J0MAwGA1UdEwEB/wQCMAAwDQYJKoZIhvcNAQELBQADggEBAJsoT8M3gUEwDw4x
jGbFDu3iKLkNREII0QZrVU8qmavywYmh+ghS7yGIPv03F2Tlp1OmuvQPCd4EKkgc
zqmCmvr7nsH5ZJJB1FvUoU2bhUJgN2TPvTpZQjPbunNM/4+M2DFxUGuefAH1Bp0S
kWo3tWH+oUoiMxqlEcySGw7QOhVSYhf8sXHihkkxSERHsPVAEZIGtyrSiM0PxLzR
e7L1OS7ejhKcXLbUT4FFg2z5+6BQVROO0jHB5WJxIBPq5nwHPoyefldhu9LrOnM5
Y7CS3+IABN4LfH4mwJ38pVbRJ8qYRlJcmCAd5vngtc/l1EHtxJTEGwdAIxeXx8pc
ETjO8PI=
-----END CERTIFICATE-----

13:57:20 DEBUG    sleekxmpp.xmlstream.xmlst Event triggered: ssl_cert
13:57:20 ERROR    sleekxmpp.basexmpp        time data '171109000000Z' does not match format '%Y%m%d%H%M%SZ'
Traceback (most recent call last):
  File "/home/matjaz/Play/hipchat-bot/env/lib/python3.6/site-packages/sleekxmpp/xmlstream/xmlstream.py", line 1492, in _process
    if not self.__read_xml():
  File "/home/matjaz/Play/hipchat-bot/env/lib/python3.6/site-packages/sleekxmpp/xmlstream/xmlstream.py", line 1564, in __read_xml
    self.__spawn_event(xml)
  File "/home/matjaz/Play/hipchat-bot/env/lib/python3.6/site-packages/sleekxmpp/xmlstream/xmlstream.py", line 1632, in __spawn_event
    handler.prerun(stanza_copy)
  File "/home/matjaz/Play/hipchat-bot/env/lib/python3.6/site-packages/sleekxmpp/xmlstream/handler/callback.py", line 64, in prerun
    self.run(payload, True)
  File "/home/matjaz/Play/hipchat-bot/env/lib/python3.6/site-packages/sleekxmpp/xmlstream/handler/callback.py", line 76, in run
    self._pointer(payload)
  File "/home/matjaz/Play/hipchat-bot/env/lib/python3.6/site-packages/sleekxmpp/features/feature_starttls/starttls.py", line 64, in _handle_starttls_proceed
    if self.xmpp.start_tls():
  File "/home/matjaz/Play/hipchat-bot/env/lib/python3.6/site-packages/sleekxmpp/xmlstream/xmlstream.py", line 889, in start_tls
    cert.verify(self._expected_server_name, self._der_cert)
  File "/home/matjaz/Play/hipchat-bot/env/lib/python3.6/site-packages/sleekxmpp/xmlstream/cert.py", line 133, in verify
    not_before, not_after = extract_dates(raw_cert)
  File "/home/matjaz/Play/hipchat-bot/env/lib/python3.6/site-packages/sleekxmpp/xmlstream/cert.py", line 111, in extract_dates
    not_before = datetime.strptime(not_before, '%Y%m%d%H%M%SZ')
  File "/usr/lib/python3.6/_strptime.py", line 565, in _strptime_datetime
    tt, fraction = _strptime(data_string, format)
  File "/usr/lib/python3.6/_strptime.py", line 362, in _strptime
    (data_string, format))
ValueError: time data '171109000000Z' does not match format '%Y%m%d%H%M%SZ'
13:57:20 DEBUG    sleekxmpp.xmlstream.xmlst reconnecting...
13:57:20 DEBUG    sleekxmpp.xmlstream.xmlst Event triggered: session_end
13:57:20 DEBUG    sleekxmpp.xmlstream.xmlst SEND (IMMED): </stream:stream>
13:57:20 INFO     sleekxmpp.xmlstream.xmlst Waiting for </stream:stream> from server
13:57:24 DEBUG    sleekxmpp.xmlstream.xmlst Event triggered: socket_error
13:57:24 DEBUG    sleekxmpp.xmlstream.xmlst Event triggered: disconnected
mfin commented 6 years ago

I've been digging deeper and I've come to the conclusion that sleekxmpp==1.3.3 breaks Hipchat support, their certificate reports dates in two digit format. So, I've installed sleekxmpp==1.3.2 and I've come to this.

14:02:36 ERROR    sleekxmpp.basexmpp        <TagSet object at 0x7fca147e4ba8 tags 0:32:16> not in asn1Spec: <OctetString schema object at 0x7fca1478ab38 tagSet <TagSet object at 0x7fca38f3a320 tags 0:0:4> encoding iso-8859-1>
Traceback (most recent call last):
  File "/home/matjaz/Play/hipchat-bot/env/lib/python3.6/site-packages/sleekxmpp/xmlstream/xmlstream.py", line 1490, in _process
    if not self.__read_xml():
  File "/home/matjaz/Play/hipchat-bot/env/lib/python3.6/site-packages/sleekxmpp/xmlstream/xmlstream.py", line 1562, in __read_xml
    self.__spawn_event(xml)
  File "/home/matjaz/Play/hipchat-bot/env/lib/python3.6/site-packages/sleekxmpp/xmlstream/xmlstream.py", line 1630, in __spawn_event
    handler.prerun(stanza_copy)
  File "/home/matjaz/Play/hipchat-bot/env/lib/python3.6/site-packages/sleekxmpp/xmlstream/handler/callback.py", line 64, in prerun
    self.run(payload, True)
  File "/home/matjaz/Play/hipchat-bot/env/lib/python3.6/site-packages/sleekxmpp/xmlstream/handler/callback.py", line 76, in run
    self._pointer(payload)
  File "/home/matjaz/Play/hipchat-bot/env/lib/python3.6/site-packages/sleekxmpp/features/feature_starttls/starttls.py", line 64, in _handle_starttls_proceed
    if self.xmpp.start_tls():
  File "/home/matjaz/Play/hipchat-bot/env/lib/python3.6/site-packages/sleekxmpp/xmlstream/xmlstream.py", line 887, in start_tls
    cert.verify(self._expected_server_name, self._der_cert)
  File "/home/matjaz/Play/hipchat-bot/env/lib/python3.6/site-packages/sleekxmpp/xmlstream/cert.py", line 142, in verify
    cert_names = extract_names(raw_cert)
  File "/home/matjaz/Play/hipchat-bot/env/lib/python3.6/site-packages/sleekxmpp/xmlstream/cert.py", line 73, in extract_names
    asn1Spec=OctetString())[0]
  File "/home/matjaz/Play/hipchat-bot/env/lib/python3.6/site-packages/pyasn1/codec/ber/decoder.py", line 1318, in __call__
    '%s not in asn1Spec: %r' % (tagSet, asn1Spec)
pyasn1.error.PyAsn1Error: <TagSet object at 0x7fca147e4ba8 tags 0:32:16> not in asn1Spec: <OctetString schema object at 0x7fca1478ab38 tagSet <TagSet object at 0x7fca38f3a320 tags 0:0:4> encoding iso-8859-1>
zoni commented 6 years ago

That looks like https://github.com/etingof/pyasn1/issues/112. Unfortunately these are bugs in the underlying libraries we use and so not something we can directly fix.

rah003 commented 6 years ago

I can confirm that downgrading sleekxmpp==1.3.2, pyasn1==0.3.7 and pyasn1-modules==0.1.5 makes everything work again.

andrewthetechie commented 5 years ago

https://www.theverge.com/2018/7/26/17619482/slack-hipchat-acquisition-stride-atlassian-partnership-microsoft-teams-competition

Hipchat is going away here very soon.

closeit

sijis commented 5 years ago

A solution seems present, however, the hipchat service is being shutdown in about 5 weeks.

Atlassian is providing instructions (https://www.atlassian.com/partnerships/slack/migration) how migrate to Slack.

We do have a functional Slack backend to support those organizations migrating.