Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

solarwinds: ability to turn off ssl verification #30

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions Solarwinds/scripts/actionExecutor.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
parser.add_argument('-password', '--password', help='Password for Solarwinds user that can acknowledge alerts',
required=False)
parser.add_argument('-timeout', '--timeout', help='Timeout', required=False)
parser.add_argument('-verifySsl', '--verifySsl', help='Verify SSL certificate returned by server?', required=False)

args = vars(parser.parse_args())

Expand Down Expand Up @@ -48,7 +49,7 @@ def acknowledge_solarwinds_alert(url, auth_token, object_id, comment):
logging.warning("Acknowledgement details: " + content)

response = requests.post(endpoint, data=content, headers={"Content-Type": "application/json"}, auth=auth_token,
timeout=timeout)
timeout=timeout, verify=verifySsl)

if response.status_code < 299:
logging.info(LOG_PREFIX + " Successfully executed at Solarwinds.")
Expand All @@ -67,7 +68,7 @@ def close_solarwinds_alert(url, auth_token, object_id, comment):
logging.warning("Close details: " + content)

response = requests.post(endpoint, data=content, headers={"Content-Type": "application/json"}, auth=auth_token,
timeout=timeout)
timeout=timeout, verify=verifySsl)

if response.status_code < 299:
logging.info(LOG_PREFIX + " Successfully executed at Solarwinds.")
Expand All @@ -88,7 +89,7 @@ def add_note_solarwinds_alert(url, auth_token, object_id, comment):
logging.warning("Close details: " + content)

response = requests.post(endpoint, data=content, headers={"Content-Type": "application/json"}, auth=auth_token,
timeout=timeout)
timeout=timeout, verify=verifySsl)

if response.status_code < 299:
logging.info(LOG_PREFIX + " Successfully executed at Solarwinds.")
Expand All @@ -114,14 +115,21 @@ def main():
password = parse_field('password', True)
url = parse_field('url', True)
timeout = args['timeout']
verifySsl = args['verifySsl']

if not timeout:
timeout = 30000
else:
timeout = int(timeout)

if not verifySsl:
verifySsl = True
else:
verifySsl = False if verifySsl.lower() == "false" else True

logging.debug("Username: " + username)
logging.debug("Password: " + password)
logging.debug("VerifySSL: " + str(verifySsl))

auth_token = HTTPBasicAuth(username, password)

Expand Down