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

Use the system certificate store instead of certifi #19305

Open
elygre opened this issue Aug 23, 2021 · 4 comments
Open

Use the system certificate store instead of certifi #19305

elygre opened this issue Aug 23, 2021 · 4 comments
Assignees
Labels
customer-reported Issues that are reported by GitHub users external to the Azure organization. Feature Candidate feature-request Upgrade az upgrade
Milestone

Comments

@elygre
Copy link

elygre commented Aug 23, 2021

I'm trying to run "az upgrade", which fails beautifully presumably due to the corporate proxy we have. #17938 (comment) gives some information on how to solve it, including a link to https://docs.microsoft.com/en-us/cli/azure/use-cli-effectively#work-behind-a-proxy.

The outlined mechanism seems ... convoluted. It suggests that I should edit C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\Lib\site-packages\certifi\cacert.pem. This requires that I acquire the corporate MITM certificate (it's probably easy, but I don't know how), and that I'm comfortable with the file format. Also, every user would have to do this on every computer.

  • Would it be possible to bypass all of this, using the system certificate store instead?
> az upgrade
This command is in preview and under development. Reference and support levels: https://aka.ms/CLI_refstatus
You already have the latest azure-cli version: 2.27.1
Upgrading extensions
Checking update for azure-devops
An error occurred whilst updating.
Please ensure you have network connection. Error detail: HTTPSConnectionPool(host='github.com', port=443): Max retries exceeded with url: /Azure/azure-devops-cli-extension/releases/download/20210805.1/azure_devops-0.20.0-py2.py3-none-any.whl (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1125)')))
Failed to update. Rolled azure-devops back to 0.18.0.
Checking update for resource-graph
No updates available for 'resource-graph'. Use --debug for more information.
Upgrade finished.

Environment Summary

Windows-10-10.0.18362-SP0
Python 3.8.9
Installer: MSI

azure-cli 2.27.1

Extensions:
azure-devops 0.18.0
resource-graph 2.1.0
@ghost ghost added needs-triage This is a new issue that needs to be triaged to the appropriate team. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that customer-reported Issues that are reported by GitHub users external to the Azure organization. labels Aug 23, 2021
@yonzhan yonzhan added the Upgrade az upgrade label Aug 23, 2021
@ghost ghost removed the needs-triage This is a new issue that needs to be triaged to the appropriate team. label Aug 23, 2021
@yonzhan yonzhan removed the question The issue doesn't require a change to the product in order to be resolved. Most issues start as that label Aug 23, 2021
@yonzhan yonzhan added this to the Backlog milestone Aug 23, 2021
@yonzhan
Copy link
Collaborator

yonzhan commented Aug 23, 2021

@jiasli for awareness

@elygre
Copy link
Author

elygre commented Feb 10, 2022

This problem is resurfacing in 2.33; I believe it was gone in 2.32:

PS > az upgrade
This command is in preview and under development. Reference and support levels: https://aka.ms/CLI_refstatus
You already have the latest azure-cli version: 2.33.0
Upgrading extensions
Checking update for account
No updates available for 'account'. Use --debug for more information.
Checking update for azure-devops
An error occurred whilst updating.
Please ensure you have network connection. Error detail: HTTPSConnectionPool(host='github.com', port=443): Max retries exceeded with url: /Azure/azure-devops-cli-extension/releases/download/20220131.1/azure_devops-0.23.0-py2.py3-none-any.whl (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1125)')))
Failed to update. Rolled azure-devops back to 0.22.0.
Checking update for resource-graph
No updates available for 'resource-graph'. Use --debug for more information.
Upgrade finished.```

See also #20842 and probably others mentioning CERTIFICATE_VERIFY_FAILED.

@jiasli jiasli changed the title Simplify process for working with corporate MITM-proxies Use the system certificate store instead of certifi Aug 25, 2022
@jiasli
Copy link
Member

jiasli commented Aug 25, 2022

@elygre, this problem is not related to different Azure CLI versions, but your proxy's configuration which intercepts traffic to github.com.

Would it be possible to bypass all of this, using the system certificate store instead?

This is definitely a good idea. There are already lots of discussions regarding this topic in the Python community:

I found some projects which do this:

However, pypa/pip#2510 (comment) says doing this is difficult on Windows. I am not sure if pip-system-certs works as expected.

Additional information:

@hkelley
Copy link

hkelley commented Jan 29, 2024

This worked for me,

PUSHD "C:\Program Files\Microsoft SDKs\Azure\CLI2"
python -m pip install pip_system_certs --trusted-host pypi.org  --trusted-host files.pythonhosted.org

I had been getting the Python error when adding extensions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
customer-reported Issues that are reported by GitHub users external to the Azure organization. Feature Candidate feature-request Upgrade az upgrade
Projects
None yet
Development

No branches or pull requests

5 participants