IBM Support

Checking network connectivity when using Python and IBM Resilient Circuits

Troubleshooting


Problem

Customers often observe connectivity problems within IBM Resilient Circuits that are ultimately associated with misconfiguration of a proxy or the network. In many cases this misconfiguration is at a level underneath IBM Resilient Circuits and often it is Python, that IBM Resilient Circuits uses, where the problem lies.

Symptom

Errors relating to a misconfiguration of a proxy or the proxy itself manifest in errors such as.
Unable to lock C:\Users\Administrator\.resilient\resilient_circuits_lockfile: HTTPSConnectionPool(host='resilient.example.com', port=443): Max retries exceeded with url: /rest/session (Caused by ProxyError('Cannot connect to proxy.', OSError('Tunnel connection failed: 504 Unknown Host',)))
2020-03-12 10:48:44,357 INFO [xforce_query_collection] HTTPSConnectionPool(host='api.xforce.ibmcloud.com', port=443): Max retries exceeded with url: /casefiles/public/fulltext?q=127.0.0.1 (Caused by ProxyError('Cannot connect to proxy.', NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x7f0206871a50>: Failed to establish a new connection: [Errno -2] Name or service not known',)))
2020-03-11 08:55:46,543 INFO [xforce_query_collection] HTTPSConnectionPool(host='api.xforce.ibmcloud.com', port=443): Max retries exceeded with url: /casefiles/public/fulltext?q=https://example.com/ (Caused by ProxyError('Cannot connect to proxy.', ConnectionResetError(10054, 'An existing connection was forcibly closed by the remote host', None, 10054, None)))
These errors were taken from a Microsoft Windows-based instance of IBM Resilient Circuits but the errors are similar to Linux instances.

Diagnosing The Problem

A simple script can be run to test whether Python can connect to a host. Replace https://soar.example.com:443 with the host that IBM Resilient Circuits needs to connect to.
import urllib

def connect(host='https://soar.example.com:443'):
       try:
           urllib.urlopen(host) #Python 3.x
           return True
       except:
           return False
   # test
print("connected" if connect() else "no internet!")
Create a file with a .py extension, setting permissions as required, and then execute with a command such as python xxx.py.
If "connected" is returned, then Python can connect to the host. If "no internet!" is returned then Python cannot connect to the host.
Another example script tested on a Windows server is as follows.
To run this script, you need to ensure the requests package is installed. It can be installed by using pip install requests or by using an equivalent command for your server.
import requests

timeout = 1

try:
    requests.head("https://soar.example.com:443", timeout=timeout)
    # Do something
    print('The internet connection is active')
except requests.ConnectionError:
    # Do something
    print("The internet connection is down")
Replace https://soar.example.com:443 with an internal server that you know you can connect to ensure the script works.
There are many other example scripts available that you can use as replacements to the two examples given here.

Resolving The Problem

Work with your internal teams to identify and resolve the connectivity problem.
Does the application support the use of a proxy? The application from the IBM App Exchange states if it supports a proxy and might provide the configuration options available to you.
If the app supports a proxy, consider adding the proxy information under the app's heading in the app.config.
[my_app_function]
http_proxy=<PROXY URL>
https_proxy=<PROXY URL>
timeout=120

Document Location

Worldwide

[{"Line of Business":{"code":"LOB24","label":"Security Software"},"Business Unit":{"code":"BU059","label":"IBM Software w\/o TPS"},"Product":{"code":"SSIP9Q","label":"IBM Security SOAR"},"ARM Category":[{"code":"a8m0z0000008ZtGAAU","label":"Integrations-\u003EResilient Circuits"}],"ARM Case Number":"","Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"All Version(s)"},{"Type":"MASTER","Line of Business":{"code":"LOB24","label":"Security Software"},"Business Unit":{"code":"BU059","label":"IBM Software w\/o TPS"},"Product":{"code":"SSEGM63","label":"IBM Security QRadar SOAR on Cloud"},"ARM Category":[{"code":"a8m0z0000008ZtGAAU","label":"Integrations-\u003EResilient Circuits"}],"Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"All Versions"}]

Document Information

Modified date:
22 July 2022

UID

ibm16373260