microsoft / microsoft/azure-devops-python-api

[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get issuer certificate (_ssl.c:1007)

Đang mở
#507 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Ngôn ngữ chính
Python
Star
684
Fork
218
Merge trung bình
8 ngày 10 giờ
Pull request đã merge (30 ngày)
1

Mô tả

Running a pipeline on one of our ADO server I try to run the same script but it is connecting to another server

I tried using the local certificate and I tried disabling SSL check at all

Getting a connection works fine, but trying to get projects :

project_client = self.connection.clients_v7_1.get_core_client()

I always get this error

Error occurred in request., SSLError: HTTPSConnectionPool(host='**********', port=443): Max retries exceeded with url: /companyname/_apis (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get issuer certificate (_ssl.c:1007)')))

I tried using the CA path
I tried disabling SSL at all
I tried to run the pipeline on different pools too

I am out of ideas, any help appreciated

class Ado:
   def init_ssl_env(self):
        if not os.path.exists(Ado.certificate_path):
            return

        try:
            if self.verify_ssl:
                # Option 1: Set CA bundle to custom certificate
                os.environ['REQUESTS_CA_BUNDLE'] = Ado.certificate_path
                self.logger.info(f"Enable SSL check - REQUESTS_CA_BUNDLE = {Ado.certificate_path}")
            else:
                # Option 2: Disable SSL verification globally (not recommended for production)
                os.environ['PYTHONHTTPSVERIFY'] = '0'
                self.logger.info(f"Disable SSL check - PYTHONHTTPSVERIFY = 0")

        except Exception as e:
            self.logger.error(f"Error setting SSL: {str(e)}")
            sys.exit(1)

Here is how I get my connection:

def get_api_connection(self,url):
        '''
        Sets up a connection with the Azure Devops API via the Azure Devops python API
        (https://github.com/microsoft/azure-devops-python-api/tree/dev)

        Parameters:
            org_url (string): url of the organization

        Returns:
            <class 'azure.devops.connection.Connection'>: connection with the Azure Devops API
        '''
        _url = f"https://{url}"
        self.url = url
        try:
            credentials = BasicAuthentication('', f"{Ado.servers[url]}")
            self.connection = Connection(base_url = _url, creds = credentials)
            self.logger.info(f'Azure Devops Connection established successfully with {_url}.')
            return True
        except Exception:
            self.logger.exception(f'Error setting up Azure DevOps connection with {_url}.')
            return False

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Hướng nghiên cứu

Bắt đầu với điểm vào Connection(base_url, creds) và lệnh gọi get_core_client() được mô tả trong báo cáo, sau đó lần theo cách cấu hình xác minh chứng chỉ HTTPS. Tái hiện yêu cầu liệt kê dự án với các thiết lập CA được báo cáo và xác định xem yêu cầu có thành công trên máy chủ ADO mà không vô hiệu hóa việc xác minh hay không.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
azure, python
Lĩnh vực
api, security
Loại issue
Lỗi
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Cần làm rõ
Mức phù hợp với người mới
25/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.