Closed franciscojnneto closed 1 year ago
Hey @franciscojnneto. I have implemented a fix that will solve this SSL issue. Now, when you utilize the IGNORE_SSL_ERRORS=True
definition, the library will properly ignore the SSL errors and initialize the API connection. This causes the library to A) suppress the SSL verification warning messages, and B) allow the API transaction to be successful. If you ever require more verbosity, you can also use the --verbose
flag which will show you the raised exception. Note: the --verbose
flag is new and will be further implemented throughout the library when possible
This is not a bug, but i need help to bypass this error.
where i can change hostname(IP) to match machinename/hostname
/home/francisco/Netbox-Device-Type-Library-Import/venv/lib/python3.9/site-packages/urllib3/connection.py:455: SubjectAltNameWarning: Certificate for 192.168.1.82 has no
subjectAltName
, falling back to check for acommonName
for now. This feature is being removed by major browsers and deprecated by RFC 2818. (See https://github.com/urllib3/urllib3/issues/497 for details.) warnings.warn( Traceback (most recent call last): File "/home/francisco/Netbox-Device-Type-Library-Import/venv/lib/python3.9/site-packages/urllib3/connectionpool.py", line 699, in urlopen httplib_response = self._make_request( File "/home/francisco/Netbox-Device-Type-Library-Import/venv/lib/python3.9/site-packages/urllib3/connectionpool.py", line 382, in _make_request self._validate_conn(conn) File "/home/francisco/Netbox-Device-Type-Library-Import/venv/lib/python3.9/site-packages/urllib3/connectionpool.py", line 1010, in _validate_conn conn.connect() File "/home/francisco/Netbox-Device-Type-Library-Import/venv/lib/python3.9/site-packages/urllib3/connection.py", line 464, in connect _match_hostname(cert, self.assert_hostname or server_hostname) File "/home/francisco/Netbox-Device-Type-Library-Import/venv/lib/python3.9/site-packages/urllib3/connection.py", line 512, in _match_hostname match_hostname(cert, asserted_hostname) File "/usr/lib/python3.9/ssl.py", line 420, in match_hostname raise CertificateError("hostname %r " ssl.SSLCertVerificationError: ("hostname '192.168.1.82' doesn't match 'backupserver02'",)During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "/home/francisco/Netbox-Device-Type-Library-Import/venv/lib/python3.9/site-packages/requests/adapters.py", line 439, in send resp = conn.urlopen( File "/home/francisco/Netbox-Device-Type-Library-Import/venv/lib/python3.9/site-packages/urllib3/connectionpool.py", line 755, in urlopen retries = retries.increment( File "/home/francisco/Netbox-Device-Type-Library-Import/venv/lib/python3.9/site-packages/urllib3/util/retry.py", line 574, in increment raise MaxRetryError(_pool, url, error or ResponseError(cause)) urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='192.168.1.82', port=443): Max retries exceeded with url: /api/ (Caused by SSLError(SSLCertVerificationError("hostname '192.168.1.82' doesn't match 'backupserver02'")))
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "/home/francisco/Netbox-Device-Type-Library-Import/./nb-dt-import.py", line 856, in
main()
File "/home/francisco/Netbox-Device-Type-Library-Import/./nb-dt-import.py", line 779, in main
determine_features(nb)
File "/home/francisco/Netbox-Device-Type-Library-Import/./nb-dt-import.py", line 42, in determine_features
nb_ver = [int(x) for x in nb.version.split('.')]
File "/home/francisco/Netbox-Device-Type-Library-Import/venv/lib/python3.9/site-packages/pynetbox/api.py", line 212, in version
version = Request(
File "/home/francisco/Netbox-Device-Type-Library-Import/venv/lib/python3.9/site-packages/pynetbox/core/query.py", line 181, in get_version
req = requests.get(
File "/home/francisco/Netbox-Device-Type-Library-Import/venv/lib/python3.9/site-packages/requests/api.py", line 76, in get
return request('get', url, params=params, kwargs)
File "/home/francisco/Netbox-Device-Type-Library-Import/venv/lib/python3.9/site-packages/requests/api.py", line 61, in request
return session.request(method=method, url=url, kwargs)
File "/home/francisco/Netbox-Device-Type-Library-Import/venv/lib/python3.9/site-packages/requests/sessions.py", line 542, in request
resp = self.send(prep, send_kwargs)
File "/home/francisco/Netbox-Device-Type-Library-Import/venv/lib/python3.9/site-packages/requests/sessions.py", line 655, in send
r = adapter.send(request, kwargs)
File "/home/francisco/Netbox-Device-Type-Library-Import/venv/lib/python3.9/site-packages/requests/adapters.py", line 514, in send
raise SSLError(e, request=request)
requests.exceptions.SSLError: HTTPSConnectionPool(host='192.168.1.82', port=443): Max retries exceeded with url: /api/ (Caused by SSLError(SSLCertVerificationError("hostname '192.168.1.82' doesn't match 'backupserver02'")))