Tomato USB 上的 curl - SSL CA 问题

Tomato USB 上的 curl - SSL CA 问题

我安装了 optware,并且可以使用 curl。我试图让它在路由器重启时通知我(通过 pushover)。

curl \
-F "token=<token goes here>" \
-F "user=<user key goes here>" \
-F "message=ASUS Router WAN Up" \
https://api.pushover.net/1/messages

这是使用 Tomato 固件 1.28.0000 MIPSR2-097 K26 USB Mega-VPN 的华硕 RT-N16 路由器

错误消息表明安装的 CA 存在问题:

url: (60) SSL certificate problem, verify that the CA cert is OK. Details:
error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed
More details here: http://curl.haxx.se/docs/sslcerts.html

curl performs SSL certificate verification by default, using a "bundle"
 of Certificate Authority (CA) public keys (CA certs). If the default
 bundle file isn't adequate, you can specify an alternate file
 using the --cacert option.
If this HTTPS server uses a certificate signed by a CA represented in
 the bundle, the certificate verification probably failed due to a
 problem with the certificate (it might be expired, or the name might
 not match the domain name in the URL).
If you'd like to turn off curl's verification of the certificate, use
 the -k (or --insecure) option.

那么,推荐的安装 CA 软件包的方法是什么?或者我应该选择不安全的方式(-k 有效)?

答案1

如果你真的读过错误消息中的 URL它将解释为什么会发生这种情况以及您的选择是什么。总结来说,您有两个选择:

  1. 禁用证书验证,这意味着 cURL 不会检查您是否连接到正确的服务器,并且您可能会受到 MITM 攻击。在这种情况下,这可能没问题,因此请指定--insecure禁用检查的选项。
  2. 安装一组供 cURL 信任的 CA 证书。如果 Tomato 没有提供软件包,您可以下载来自 cURL 网站的 CA 包(它们只是从 Mozilla 集转换而来)。存储cacert.pem在系统上的某个位置,然后使用选项将 cURL 指向该位置--cacert

相关内容