问题:
在搭建openstack 第三方ci的过程中,需要从pypi.python.org下载安装包,下载速度非常慢,经常掉线,严重阻碍了进度。
遂决定搭建本地pypi源,加快速度,但是在下载https链接的包时,报认证错误。
解决方法:
1、生成证书,参考 http://curl.haxx.se/docs/sslcerts.html
openssl s_client -connect xxxxx.com:443 |tee logfile
从logfile中复制证书并保存到/etc/ssl/certs/cacert.pem文件中。
-----BEGIN CERTIFICATE-----
MIIC/jCCAmegAwIBAgIJAJEI3C/TMmeuMA0GCSqGSIb3DQEBBQUAMIGXMQswCQYD
VQQGEwJDTjEQMA4GA1UECAwHc2hhbmd4aTENMAsGA1UEBwwEWElBTjEYMBYGA1UE
CgwPcHlwaS5weXRob24ub3JnMQ4wDAYDVQQLDAVDTE9VRDEYMBYGA1UEAwwPcHlw
aS5weXRob24ub3JnMSMwIQYJKoZIhvcNAQkBFhRxaWFubGluMTk4N0BnbWFpbC5v
bTAeFw0xMzEyMjkxMDQ0NTZaFw0xNDEyMjkxMDQ0NTZaMIGXMQswCQYDVQQGEwJD
TjEQMA4GA1UECAwHc2hhbmd4aTENMAsGA1UEBwwEWElBTjEYMBYGA1UECgwPcHlw
aS5weXRob24ub3JnMQ4wDAYDVQQLDAVDTE9VRDEYMBYGA1UEAwwPcHlwaS5weXRo
b24ub3JnMSMwIQYJKoZIhvcNAQkBFhRxaWFubGluMTk4N0BnbWFpbC5vbTCBnzAN
BgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEA2ZC1wR5ylhNlZNPb2FHYSUPlrStie1So
THNmCTkGRa3kP4nv5iJk+BAVC8LRORH0mfkEqWWPCum6+C+RNpBYu1gpW7b0pUcG
e3vxOcjZ8jsN4MyKDYY9Wgs+OCt7gMDFDWvzGieX826H98Hvw1dUe2XfHDzcjbJl
u6xiiQ5scWkCAwEAAaNQME4wHQYDVR0OBBYEFG+YgMssKCx8CebWCHvIdfSjxDF/
MB8GA1UdIwQYMBaAFG+YgMssKCx8CebWCHvIdfSjxDF/MAwGA1UdEwQFMAMBAf8w
DQYJKoZIhvcNAQEFBQADgYEAynmOmLW5iq+YAWsLhk7ih243A/FGd1/Vc8q5Omqy
VI1t+8jNkek2rpf8BFWDmFWQxriUG3DmCmztLza5nDBuIvf9nA+h4kyp2j3XfdDN
Bq3VqVOBAPis5k5xFKBLgaVFnZVTHgshqRtjWkQa+MNcKrECEgsE8aoHnAx7o+eh
UVg=
-----END CERTIFICATE-----
2、设置环境变量export CURL_CA_BUNDLE=/etc/ssl/certs/cacert.pem
这样就可以使用curl -O https://10.250.10.150/packages/xxx 下载你需要的文件了。