picgo 上传图片提示 "unable to verify the first certificate"

查看 9|回复 0
作者:wuhunyu   
环境描述
服务端
[ol]
  • minio + nginx
  • 域名证书生成来源 https://freessl.cn
    [/ol]
    客户端
  • picgo (使用 picgo-plugin-s3 插件)
    picgo 配置如下(部分配置做了脱敏)

    {
      "picBed": {
        "uploader": "aws-s3",
        "current": "aws-s3",
        "aws-s3": {
          "accessKeyID": "xxx",
          "secretAccessKey": "xxx",
          "bucketName": "images",
          "uploadPath": "{year}/{month}/{md5}.{extName}",
          "region": "home",
          "endpoint": "https://xxx.top:9000",
          "proxy": "",
          "urlPrefix": "https://xxx.top",
          "urlSuffix": "",
          "pathStyleAccess": true,
          "rejectUnauthorized": true,
          "acl": "public-read",
          "disableBucketPrefixToURL": false
        }
      },
      "picgoPlugins": {
        "picgo-plugin-s3": true
      }
    }
    问题描述
    使用 picgo 上传到使用 minio 搭建的图床提示了如下异常
    C:\Users\wuhun\Desktop>picgo -v
    1.5.7
    C:\Users\wuhun\Desktop>picgo upload 1.png
    [PicGo INFO]: Before transform
    [PicGo INFO]: Transforming... Current transformer is [path]
    [PicGo INFO]: Before upload
    [PicGo INFO]: Uploading... Current uploader is [aws-s3]
    [PicGo ERROR]: 上传到 S3 存储发生错误,请检查网络连接和配置是否正确
    [PicGo ERROR]: Error: unable to verify the first certificate
        at TLSSocket.onConnectSecure (node:_tls_wrap:1677:34)
        at TLSSocket.emit (node:events:519:28)
        at TLSSocket._finishInit (node:_tls_wrap:1076:8)
        at ssl.onhandshakedone (node:_tls_wrap:862:12) {
      code: 'UNABLE_TO_VERIFY_LEAF_SIGNATURE',
      '$metadata': { attempts: 1, totalRetryDelay: 0 }
    }
    [PicGo WARN]: failed
    [PicGo ERROR]: Error: unable to verify the first certificate
        at TLSSocket.onConnectSecure (node:_tls_wrap:1677:34)
        at TLSSocket.emit (node:events:519:28)
        at TLSSocket._finishInit (node:_tls_wrap:1076:8)
        at ssl.onhandshakedone (node:_tls_wrap:862:12) {
      code: 'UNABLE_TO_VERIFY_LEAF_SIGNATURE',
      '$metadata': { attempts: 1, totalRetryDelay: 0 }
    }
    处理过程与发现
    [ol]
  • 使用谷歌浏览器访问 minio ,浏览器正常信任证书,没有危险警告
  • 把证书来源换成 阿里云的测试证书 之后,其他配置不变,picgo 可以正常上传图片
  • 将证书添加到 受信任的根证书颁发机构 后,也还是提示 "UNABLE_TO_VERIFY_LEAF_SIGNATURE"
    [/ol]
    我的问题
    [ol]
  • 国内的免费证书现在都只有三个月,阿里云的证书虽然可以正常使用,但临期需要手动更换,之前 1 年有效期的时候还好,三个月有效期的话会比较麻烦。所以,不打算继续使用阿里云的免费证书
  • 目前使用的证书来源于 https://freessl.cn,这个网站也是我关注的一个技术博主推流的,正好我也有这方便需求,通过 acme.sh 脚本也支持自动更新证书,因此才开始使用它的证书。目前这个网站颁布的证书除了在 picgo 上传图片时出了问题以外,我手上的两台电脑( windows11 ,mac os )都能在谷歌浏览器上正常不报危险警告地访问 minio 的 web 端( minio 的 web 端和 api 端使用的同一个证书),包括我配置在阿里云 cdn 域名的证书也是用的这个网站生成的,但 cdn 是好好的
  • 想要请教一下各位,出现 "UNABLE_TO_VERIFY_LEAF_SIGNATURE" 的原因是什么以及解决方案
    [/ol]

    避免被攻击,就不暴露自己的域名了
  • 您需要登录后才可以回帖 登录 | 立即注册

    返回顶部