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.09k stars 746 forks source link

Stackstorm commands via HuBot - Operation not Permitted #5815

Closed rdevries-capland closed 1 year ago

rdevries-capland commented 1 year ago

Hi Guys,

I'm trying to start with the basics on StackStorm, and got stuck with the basic Ping command. I have Hubot integrated into Slack, and communications here work as intended.

When I post "ping google.com", or "ping localhost", or anything for that matter, i get a response as follows:

Here's the results of your ping: status: failed output:

ping: socket: Operation not permitted

Typing "help ping" returns the following: ping {{ host }} - Ping an IP address / Hostname ping {{ host }} count {{ count }} - Ping an IP address / Hostname

Here is the stack trace:

{ "stdout": "", "stderr": "st2.actions.python.PostResultAction: INFO {\"channel\": \"D04BGG90656\", \"message\": \"Action networking_utils.ping completed.\ status : failed\ execution: 637e21394df057ec8f7887fa\ \ result :\ --------\ stderr : ping: socket: Operation not permitted\ return_code : 2\", \"user\": \"testuser\"} Traceback (most recent call last): File \"/opt/stackstorm/virtualenvs/hubot/lib/python3.8/site-packages/urllib3/connection.py\", line 174, in _new_conn conn = connection.create_connection( File \"/opt/stackstorm/virtualenvs/hubot/lib/python3.8/site-packages/urllib3/util/connection.py\", line 95, in create_connection raise err File \"/opt/stackstorm/virtualenvs/hubot/lib/python3.8/site-packages/urllib3/util/connection.py\", line 85, in create_connection sock.connect(sa) ConnectionRefusedError: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File \"/opt/stackstorm/virtualenvs/hubot/lib/python3.8/site-packages/urllib3/connectionpool.py\", line 703, in urlopen httplib_response = self._make_request( File \"/opt/stackstorm/virtualenvs/hubot/lib/python3.8/site-packages/urllib3/connectionpool.py\", line 398, in _make_request conn.request(method, url, **httplib_request_kw) File \"/opt/stackstorm/virtualenvs/hubot/lib/python3.8/site-packages/urllib3/connection.py\", line 239, in request super(HTTPConnection, self).request(method, url, body=body, headers=headers) File \"/usr/lib/python3.8/http/client.py\", line 1256, in request self._send_request(method, url, body, headers, encode_chunked) File \"/usr/lib/python3.8/http/client.py\", line 1302, in _send_request self.endheaders(body, encode_chunked=encode_chunked) File \"/usr/lib/python3.8/http/client.py\", line 1251, in endheaders self._send_output(message_body, encode_chunked=encode_chunked) File \"/usr/lib/python3.8/http/client.py\", line 1011, in _send_output self.send(msg) File \"/usr/lib/python3.8/http/client.py\", line 951, in send self.connect() File \"/opt/stackstorm/virtualenvs/hubot/lib/python3.8/site-packages/urllib3/connection.py\", line 205, in connect conn = self._new_conn() File \"/opt/stackstorm/virtualenvs/hubot/lib/python3.8/site-packages/urllib3/connection.py\", line 186, in _new_conn raise NewConnectionError( urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x7fd81dd864c0>: Failed to establish a new connection: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File \"/opt/stackstorm/virtualenvs/hubot/lib/python3.8/site-packages/requests/adapters.py\", line 489, in send resp = conn.urlopen( File \"/opt/stackstorm/virtualenvs/hubot/lib/python3.8/site-packages/urllib3/connectionpool.py\", line 787, in urlopen retries = retries.increment( File \"/opt/stackstorm/virtualenvs/hubot/lib/python3.8/site-packages/urllib3/util/retry.py\", line 592, in increment raise MaxRetryError(_pool, url, error or ResponseError(cause)) urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='127.0.0.1', port=8181): Max retries exceeded with url: /hubot/st2 (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7fd81dd864c0>: Failed to establish a new connection: [Errno 111] Connection refused'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File \"/opt/stackstorm/st2/lib/python3.8/site-packages/python_runner/python_action_wrapper.py\", line 395, in obj.run() File \"/opt/stackstorm/st2/lib/python3.8/site-packages/python_runner/python_action_wrapper.py\", line 214, in run output = action.run(self._parameters) File \"/opt/stackstorm/packs/hubot/actions/post_result.py\", line 169, in run response = requests.post(url=url, headers=headers, data=data) File \"/opt/stackstorm/virtualenvs/hubot/lib/python3.8/site-packages/requests/api.py\", line 115, in post return request(\"post\", url, data=data, json=json, kwargs) File \"/opt/stackstorm/virtualenvs/hubot/lib/python3.8/site-packages/requests/api.py\", line 59, in request return session.request(method=method, url=url, kwargs) File \"/opt/stackstorm/virtualenvs/hubot/lib/python3.8/site-packages/requests/sessions.py\", line 587, in request resp = self.send(prep, send_kwargs) File \"/opt/stackstorm/virtualenvs/hubot/lib/python3.8/site-packages/requests/sessions.py\", line 701, in send r = adapter.send(request, **kwargs) File \"/opt/stackstorm/virtualenvs/hubot/lib/python3.8/site-packages/requests/adapters.py\", line 565, in send raise ConnectionError(e, request=request) requests.exceptions.ConnectionError: HTTPConnectionPool(host='127.0.0.1', port=8181): Max retries exceeded with url: /hubot/st2 (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7fd81dd864c0>: Failed to establish a new connection: [Errno 111] Connection refused')) ", "exit_code": 1, "result": "None" }

What exactly am I missing here? What permissions needs to be given, and to who/what?

arm4b commented 1 year ago

I'm transferring it into a Discussion in the stackstorm/st2 repository, as that's the ideal place to ask questions.