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

Support for Self signed certificate #9

Open
thejockel opened this issue Jan 11, 2022 · 0 comments
Open

Support for Self signed certificate #9

thejockel opened this issue Jan 11, 2022 · 0 comments

Comments

@thejockel
Copy link

thejockel commented Jan 11, 2022

Hey,
I am not able to receive data from my registry. The registry uses a Self signed certificate.
Please add support to disable SSL Cert Verification.

THX Jockel

$ gitlab-registry-usage -r ***************** -g ************** -u *********
Password: 

Traceback (most recent call last):
  File "/Users/<my_username>/Library/Python/3.8/lib/python/site-packages/urllib3/connectionpool.py", line 699, in urlopen
    httplib_response = self._make_request(
  File "/Users/<my_username>/Library/Python/3.8/lib/python/site-packages/urllib3/connectionpool.py", line 382, in _make_request
    self._validate_conn(conn)
  File "/Users/<my_username>/Library/Python/3.8/lib/python/site-packages/urllib3/connectionpool.py", line 1010, in _validate_conn
    conn.connect()
  File "/Users/<my_username>/Library/Python/3.8/lib/python/site-packages/urllib3/connection.py", line 416, in connect
    self.sock = ssl_wrap_socket(
  File "/Users/<my_username>/Library/Python/3.8/lib/python/site-packages/urllib3/util/ssl_.py", line 449, in ssl_wrap_socket
    ssl_sock = _ssl_wrap_socket_impl(
  File "/Users/<my_username>/Library/Python/3.8/lib/python/site-packages/urllib3/util/ssl_.py", line 493, in _ssl_wrap_socket_impl
    return ssl_context.wrap_socket(sock, server_hostname=server_hostname)
  File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/ssl.py", line 500, in wrap_socket
    return self.sslsocket_class._create(
  File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/ssl.py", line 1040, in _create
    self.do_handshake()
  File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/ssl.py", line 1309, in do_handshake
    self._sslobj.do_handshake()
ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate (_ssl.c:1125)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/<my_username>/Library/Python/3.8/lib/python/site-packages/requests/adapters.py", line 439, in send
    resp = conn.urlopen(
  File "/Users/<my_username>/Library/Python/3.8/lib/python/site-packages/urllib3/connectionpool.py", line 755, in urlopen
    retries = retries.increment(
  File "/Users/<my_username>/Library/Python/3.8/lib/python/site-packages/urllib3/util/retry.py", line 574, in increment
    raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='', port=9444): Max retries exceeded with url: /v2/_catalog?n=16384 (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate (_ssl.c:1125)')))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/<my_username>/Library/Python/3.8/bin/gitlab-registry-usage", line 8, in <module>
    sys.exit(main())
  File "/Users/<my_username>/Library/Python/3.8/lib/python/site-packages/gitlab_registry_usage/cli.py", line 308, in main
    query_gitlab_registry(
  File "/Users/<my_username>/Library/Python/3.8/lib/python/site-packages/gitlab_registry_usage/cli.py", line 180, in query_gitlab_registry
    [len(repository) for repository in gitlab_registry.registry_catalog]
  File "/Users/<my_username>/Library/Python/3.8/lib/python/site-packages/gitlab_registry_usage/registry/high_level_api.py", line 122, in registry_catalog
    self._registry_catalog = get_registry_catalog(self._registry_url, catalog_auth_token)
  File "/Users/<my_username>/Library/Python/3.8/lib/python/site-packages/gitlab_registry_usage/registry/low_level_api.py", line 65, in get_registry_catalog
    response = requests.get(catalog_url, headers={"Authorization": "Bearer " + auth_token})
  File "/Users/<my_username>/Library/Python/3.8/lib/python/site-packages/requests/api.py", line 75, in get
    return request('get', url, params=params, **kwargs)
  File "/Users/<my_username>/Library/Python/3.8/lib/python/site-packages/requests/api.py", line 61, in request
    return session.request(method=method, url=url, **kwargs)
  File "/Users/<my_username>/Library/Python/3.8/lib/python/site-packages/requests/sessions.py", line 542, in request
    resp = self.send(prep, **send_kwargs)
  File "/Users/<my_username>/Library/Python/3.8/lib/python/site-packages/requests/sessions.py", line 655, in send
    r = adapter.send(request, **kwargs)
  File "/Users/<my_username>/Library/Python/3.8/lib/python/site-packages/requests/adapters.py", line 514, in send
    raise SSLError(e, request=request)
requests.exceptions.SSLError: HTTPSConnectionPool(host='<internal URL>', port=9444): Max retries exceeded with url: /v2/_catalog?n=16384 (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate (_ssl.c:1125)')))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant