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

ignore ssl validation #749

Closed
wants to merge 1 commit into from
Closed
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
10 changes: 9 additions & 1 deletion agents/plugins/nginx_status.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import os
import re
import sys
import ssl
from urllib.error import HTTPError, URLError
from urllib.request import Request, urlopen

Expand Down Expand Up @@ -156,9 +157,16 @@ def main(): # pylint: disable=too-many-branches

url = "%s://%s:%s/%s" % (proto, address, port, page)
# Try to fetch the status page for each server

# set ssl context
ssl_context = ssl.create_default_context();
# ignore ssl-cert validation
ssl_context.check_hostname = False;
ssl_context.verify_mode = ssl.CERT_NONE;

try:
request = Request(url, headers={"Accept": "text/plain", "User-Agent": USER_AGENT})
fd = urlopen(request) # nosec B310 # BNS:6b61d9
fd = fd = urlopen(request, context=ssl_context) # nosec B310 # BNS:6b61d9 and set ssl_context
except URLError as e:
if "SSL23_GET_SERVER_HELLO:unknown protocol" in str(e):
# HACK: workaround misconfigurations where port 443 is used for
Expand Down
Loading