StackStorm / st2

StackStorm (aka "IFTTT for Ops") is event-driven automation for auto-remediation, incident responses, troubleshooting, deployments, and more for DevOps and SREs. Includes rules engine, workflow, 160 integration packs with 6000+ actions (see https://exchange.stackstorm.org) and ChatOps. Installer at https://docs.stackstorm.com/install/index.html
https://stackstorm.com/
Apache License 2.0
6.08k stars 747 forks source link

stack storm chatops hubot is not establishing the connection to the slack RTM client through proxy #4960

Closed ppooven closed 4 years ago

ppooven commented 4 years ago

SUMMARY

Provide a quick summary of your bug report. I am trying to connect to the slack from stack storm hubot through proxy settings (as there is no internet connection), the proxy is opened to connect to slack (through curl we are able to establish a connection for api.slack.com)

I have exported the proxy settings on the below files on Ubundu docker /etc/default/st2actionrunner /etc/default/st2api

cat /etc/release DISTRIB_ID=Ubuntu DISTRIB_RELEASE=14.04

STACKSTORM VERSION

Paste the output of st2 --version: st2 3.1.0, on Python 2.7.6

OS, environment, install method

Post what OS you are running this on, along with any other relevant information/ Ubuntu Docker cat /etc/release DISTRIB_ID=Ubuntu DISTRIB_RELEASE=14.04

Steps to reproduce the problem

Show how to reproduce the problem, using a minimal test-case. Make sure to include any content (pack content - workflows, actions, etc.) which are needed to reproduce the problem.

Expected Results

/opt/stackstorm/chatops/bin# ./hubot body-parser deprecated undefined extended: provide extended option ../node_modules/hubot/src/robot.js:445:21 [Wed May 27 2020 04:33:57 GMT+0000 (Coordinated Universal Time)] DEBUG Loading adapter slack [Wed May 27 2020 04:33:58 GMT+0000 (Coordinated Universal Time)] INFO hubot-slack adapter v4.5.5

[Wed May 27 2020 04:33:58 GMT+0000 (Coordinated Universal Time)] DEBUG RtmClient initialized with options: undefined [Wed May 27 2020 04:33:58 GMT+0000 (Coordinated Universal Time)] DEBUG RtmClient#start() with options: {} [Wed May 27 2020 04:34:01 GMT+0000 (Coordinated Universal Time)] DEBUG SlackBot#authenticated() Found self in RTM start data [Wed May 27 2020 04:34:01 GMT+0000 (Coordinated Universal Time)] INFO Logged in as @dev-bot in workspace stackstorm [Wed May 27 2020 04:34:02 GMT+0000 (Coordinated Universal Time)] INFO Connected to Slack RTM**** [Wed May 27 2020 04:34:02 GMT+0000 (Coordinated Universal Time)] DEBUG Loading scripts from /opt/stackstorm/chatops/bin/scripts What did you expect to happen when running the steps above?

Actual Results

'./hubot body-parser deprecated undefined extended: provide extended option ../node_modules/hubot/src/robot.js:445:21 [Wed May 27 2020 04:35:45 GMT+0000 (Coordinated Universal Time)] DEBUG Loading adapter slack [Wed May 27 2020 04:35:46 GMT+0000 (Coordinated Universal Time)] INFO hubot-slack adapter v4.5.5 [Wed May 27 2020 04:35:46 GMT+0000 (Coordinated Universal Time)] DEBUG RtmClient initialized with options: undefined [Wed May 27 2020 04:35:46 GMT+0000 (Coordinated Universal Time)] DEBUG RtmClient#start() with options: {}

What happened? What output did you get? When there is an internet it is connecting, but through a proxy which could able to connect the slack through curl is not able to connect from the st2 chatops hubot

Making sure to follow these steps will guarantee the quickest resolution possible.

Thanks!

arm4b commented 4 years ago

As you passed proxy settings like http_proxy ENV variables for st2api and st2actionrunner, you need to do the same for the st2chatops service.

ppooven commented 4 years ago

Hi Armab,

Thanks for responding, I have passed even to st2chatops as well the proxy hosts values and you can see wherever is possible I have added the proxy settings (ref is below) but still, the hubot is not connecting, is there a specific combination of the version of hubot-slack ,hubot-stack storm, slack client version would work behind the proxy.


And moreover as per this URL https://github.com/StackStorm/st2docs/issues/418

418 stack storm and chatops behind a proxy

Whether the below is still valid as of today?

adding this in because it never did get reported here: : slack - proxy require hubot-slack > 4.0 but the hubot-stack storm just support hubot-slack < 4.0 hubot slack using new slack-client that hubot-stack storm does not support


REF proxy settings config files one Ubuntu Docker client stack storm

root@ :/# cat ~/.npmrc proxy=http://xxxx_auth:xxx@xx.xx.com:8080/ https-proxy=http://xxxx_auth:xxx@xx.xx.com:8080/ registry=http://registry.npmjs.org/

root@ :/# cat /etc/default/st2actionrunner HTTP_PROXY=http://xxxx_auth:xxx@xx.xx.com:8080 HTTPS_PROXY=http://xxxx_auth:xxx@xx.xx.com:8080 NO_PROXY=localhost,127.0.0.1 http_proxy=http://xxxx_auth:xxx@xx.xx.com:8080 https_proxy=http://xxxx_auth:xxx@xx.xx.com:8080 no_proxy=localhost,127.0.0.1

root@ :/# cat /etc/default/st2api HTTP_PROXY=http://xxxx_auth:xxx@xx.xx.com:8080 HTTPS_PROXY=http://xxxx_auth:xxx@xx.xx.com:8080 NO_PROXY=localhost,127.0.0.1 http_proxy=http://xxxx_auth:xxx@xx.xx.com:8080 https_proxy=http://xxxx_auth:xxx@xx.xx.com:8080 no_proxy=localhost,127.0.0.1

root@ :/# cat /etc/default/st2chatops export HTTP_PROXY=http://xxxx_auth:xxx@xx.xx.com:8080 export HTTPS_PROXY=http://xxxx_auth:xxx@xx.xx.com:8080 export NO_PROXY=localhost,127.0.0.1, export http_proxy=http://xxxx_auth:xxx@xx.xx.com:8080 export https_proxy=http://xxxx_auth:xxx@xx.xx.com:8080 export no_proxy=localhost,127.0.0.1

root@:/# grep /opt/stackstorm/chatops/st2chatops.env | grep proxy export HTTP_PROXY=http://xxxx_auth:xxx@xx.xx.com:8080 export HTTPS_PROXY=http://xxxx_auth:xxx@xx.xx.com:8080 export NO_PROXY=localhost,127.0.0.1, export http_proxy=http://xxxx_auth:xxx@xx.xx.com:8080 export https_proxy=http://xxxx_auth:xxx@xx.xx.com:8080 export no_proxy=localhost,127.0.0.1

root@f6dd05c0427a:/# cat /etc/environment export HTTP_PROXY=http://xxxx_auth:xxx@xx.xx.com:8080 export HTTPS_PROXY=http://xxxx_auth:xxx@xx.xx.com:8080 export http_proxy=http://xxxx_auth:xxx@xx.xx.com:8080 export https_proxy=http://xxxx_auth:xxx@xx.xx.com:8080 export no_proxy=localhost,127.0.0.1

root@ :/# grep version /opt/stackstorm/chatops/node_modules/hubot/package.json "type": "version", "version": "3.1.1"

root@ :/# grep version /opt/stackstorm/chatops/node_modules/hubot-slack/package.json "type": "version", "version": "4.5.5"

root@:/# grep version /opt/stackstorm/chatops/node_modules/@slack/client/package.json "type": "version", "version": "3.16.1-sec.2"

root@:/# tail -2000 /var/log/st2/st2chatops.log

warn: SlackDataStore is deprecated and will be removed in the next major version. See the project documentation for a migration guide. warn: SlackDataStore is deprecated and will be removed in the next major version. See the project documentation for a migration guide. [Thu May 28 2020 07:46:54 GMT+0000 (Coordinated Universal Time)] DEBUG RtmClient initialized with options: undefined [Thu May 28 2020 07:46:54 GMT+0000 (Coordinated Universal Time)] DEBUG RtmClient#start() with options: {} Thu, 28 May 2020 07:50:45 GMT body-parser deprecated undefined extended: provide extended option at node_modules/hubot/src/robot.js:445:21 [Thu May 28 2020 07:50:45 GMT+0000 (Coordinated Universal Time)] DEBUG Loading adapter slack [Thu May 28 2020 07:50:46 GMT+0000 (Coordinated Universal Time)] INFO hubot-slack adapter v4.5.5 warn: SlackDataStore is deprecated and will be removed in the next major version. See the project documentation for a migration guide. warn: SlackDataStore is deprecated and will be removed in the next major version. See the project documentation for a migration guide. [Thu May 28 2020 07:50:46 GMT+0000 (Coordinated Universal Time)] DEBUG RtmClient initialized with options: undefined [Thu May 28 2020 07:50:46 GMT+0000 (Coordinated Universal Time)] DEBUG RtmClient#start() with options: {} root@ :/#

root@:/# /opt/stackstorm/chatops/bin/./hubot body-parser deprecated undefined extended: provide extended option opt/stackstorm/chatops/node_modules/hubot/src/robot.js:445:21 [Thu May 28 2020 15:41:41 GMT+0000 (Coordinated Universal Time)] DEBUG Loading adapter slack [Thu May 28 2020 15:41:41 GMT+0000 (Coordinated Universal Time)] INFO hubot-slack adapter v4.5.5 warn: SlackDataStore is deprecated and will be removed in the next major version. See project documentation for a migration guide. warn: SlackDataStore is deprecated and will be removed in the next major version. See project documentation for a migration guide. [Thu May 28 2020 15:41:41 GMT+0000 (Coordinated Universal Time)] DEBUG RtmClient initialized with options: undefined [Thu May 28 2020 15:41:41 GMT+0000 (Coordinated Universal Time)] DEBUG RtmClient#start() with options: {}

ppooven commented 4 years ago

Behind the proxy it is working, just proxy settings are to be updated on the below threee files. It is working. root@ :/etc/default# ls -lrt st2* st2api st2actionrunner st2chatops ref root@ :/etc/default# cat st2actionrunner HTTP_PROXY=http://username:password@proxy.com:80 HTTPS_PROXY=http://username:password@proxy.com:80 NO_PROXY=localhost,127.0.0.1 http_proxy=http://username:password@proxy.com:80 https_proxy=http://username:password@proxy.com:80 no_proxy=localhost,127.0.0.1

root@:/opt/stackstorm/chatops# npm ls | egrep '(hubot|slack|st2)' ├── @slack/client@3.16.1-sec.2
├──hubot@^2.19.0 ├── hubot-botframework@0.10.1
├── hubot-diagnostics@0.0.2
├── hubot-flowdock@0.7.8
├── hubot-help@0.2.2
├── hubot-hipchat@2.12.0-5 ├── hubot-irc@0.4.0
├── hubot-matteruser@5.2.0
├── hubot-redis-brain@0.0.4
├── hubot-rocketchat@2.0.0
├── hubot-scripts@2.17.2
├── hubot-slack@4.5.5
├── hubot-spark@2.0.0
├── hubot-stackstorm@0.10.0
└── hubot-xmpp@0.2.5

arm4b commented 4 years ago

Glad it worked! Thanks for confirming.

ppooven commented 4 years ago

Moreover, the following sites are to be exempted in the proxy setting in order to have a persistent RTM Client connection established with Slack from stack storm hubot bot.

hooks.slack.com slack.com app.slack.com *.lb.slack-msgs.com lb.slack-msgs.com wss-primary.slack.com wss-backup.slack.com wss-mobile.slack.com api.slack.com cerberus-xxxx.lb.slack-msgs.com