curl: (60) server certificate verification failed

Codeup 流水线 Ubuntu 16.04.6 LTS 环境下使用 curl 命令报错如下:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
[12:07:54] curl https://shell.zlorn.com/test.sh
[12:07:54] % Total % Received % Xferd Average Speed Time Time Time Current
[12:07:54] Dload Upload Total Spent Left Speed
[12:07:54]
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
[12:07:54] curl: (60) server certificate verification failed. CAfile: /etc/ssl/certs/ca-certificates.crt CRLfile: none
[12:07:54] More details here: http://curl.haxx.se/docs/sslcerts.html
[12:07:54]
[12:07:54] curl performs SSL certificate verification by default, using a "bundle"
[12:07:54] of Certificate Authority (CA) public keys (CA certs). If the default
[12:07:54] bundle file isn't adequate, you can specify an alternate file
[12:07:54] using the --cacert option.
[12:07:54] If this HTTPS server uses a certificate signed by a CA represented in
[12:07:54] the bundle, the certificate verification probably failed due to a
[12:07:54] problem with the certificate (it might be expired, or the name might
[12:07:54] not match the domain name in the URL).
[12:07:54] If you'd like to turn off curl's verification of the certificate, use
[12:07:54] the -k (or --insecure) option.

解决方法:
使用 curl -k 参数即可

1
curl -k https://shell.zlorn.com/test.sh