Saturday, February 26, 2022

[SOLVED] Error when running yum on Amazon Linux 2 - "SSL certificate problem: unable to get local issuer certificate"

Issue

I have a Docker container based on the latest amazonlinux image running on my work computer and I get this error when I attempt to run yum "anything" (e.g. yum update, yum install ____):

failure: repodata/repomd.xml from amzn2-core: [Errno 256] No more mirrors to try.
https://cdn.amazonlinux.com/2/core/2.0/x86_64/f915d0987d73328ab3992d03ddbce189bca8804de19d89f09b847dfcaa6bc1af/repodata/repomd.xml?instance_id=URLError&region=unknown: [Errno 14] curl#60 - "SSL certificate problem: unable to get local issuer certificate"

Solution

This issue is a result of being on a corporate proxy (work computer!!1!). An immediate solution would be to get off the corporate proxy or use another computer at home with you (we're all remote, right?) if you're really in a pinch.

I have found possible solutions like this one which says to add the proxy settings to the /etc/yum.conf file. This makes sense, but it isn't really practical for a stateless Docker container. Surely the answer isn't to build custom versions of vanilla docker images that have the proxy settings built in...

It looks like I can add the proxy settings to Docker and the proxy settings are automatically passed to containers. That's probably the way to go.

E: My IT department was able to whitelist the URL amazonlinux.com and that resolved the problem. I had a similar problem when trying to add EPEL and the solution to that was to add that URL (fedoraproject.org) to ssl bypass group of the corporate proxy. This was needed because fedoraproject.org is using SSL pinning to prevent man in the middle attacks (and a proxy is a man in the middle).



Answered By - jspinella
Answer Checked By - Senaida (WPSolving Volunteer)