首页 > 解决方案 > Artifactory jfrog cli无法进行身份验证

问题描述

当我收到此错误时,尝试使用 jfrog cli 与人工服务器集成

jfrog rt config example-company --url=$ARTIFACTORY_URL --user=$ARTIFACTORY_USER --password=$ARTIFACTORY_PASS
[Info] Encrypting password...
[Error] Get https://artifactory.example.com/api/security/encryptedPassword: x509: certificate signed by unknown authority

在浏览器中导航到https://artifactory.example.com/api/security/encryptedPassword显示 TLS 证书是有效的,但是我得到一个不同的错误:

{
  "errors": [
    {
      "status": 404,
      "message": "User not found: bill.gates"
    }
  ]
}

ping 命令也返回 TLS 错误

jfrog rt ping --url=https://artifactory.example.com
[Error] Get https://artifactory.example.com/artifactory/api/system/ping: x509: certificate signed by unknown authority

jfrog cli 是用 golang 编写的。运行版本:

go version
go version go1.12.5 darwin/amd64

查看jfrog github问题,其他人也报告了类似问题

https://github.com/jfrog/jfrog-cli/issues/277

如何让 jfrog cli 连接到 artifactory 服务器?

标签: sslgoartifactory

解决方案


这些错误是由错误配置的 apache vhost 引起的。由于证书链捆绑在证书中,因此不需要 SSLCertificateChainFile。Web 浏览器处理这种错误配置没有问题,但 golang 更注重链。

配置错误

  SSLCertificateFile      "/etc/ssl/certs/artifactory.example.com.crt.pem"
  SSLCertificateKeyFile   "/etc/ssl/private/artifactory.example.com.key.pem"
  SSLCertificateChainFile "/etc/ssl/certs/STAR.bad.example.com.pem"

工作配置

  SSLCertificateFile      "/etc/ssl/certs/artifactory.example.com.crt.pem"
  SSLCertificateKeyFile   "/etc/ssl/private/artifactory.example.com.key.pem"

推荐阅读