Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/tfs/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
更改openSSL生成的TFS SSL证书后克隆git repo失败_Git_Tfs_Openssl - Fatal编程技术网

更改openSSL生成的TFS SSL证书后克隆git repo失败

更改openSSL生成的TFS SSL证书后克隆git repo失败,git,tfs,openssl,Git,Tfs,Openssl,我们的TFS服务器最初使用自签名证书设置为使用https,首先我们只为TFS设置windows代理服务器以运行CI,所有这些都可以正常工作 最近,我们的团队计划尝试将linux代理添加到TFS中,以便在linux代理服务器上运行CI,但失败了,在做了一些研究后,我们发现这是由自签名证书引起的,并计划替换它。但是,更换证书后,我们无法在VS中克隆repo,也无法在代理windows计算机上运行CI 我们更换证书的步骤如下: 通过openssl生成根CA,然后基于根CA生成服务器证书 在TFS wi

我们的TFS服务器最初使用自签名证书设置为使用https,首先我们只为TFS设置windows代理服务器以运行CI,所有这些都可以正常工作

最近,我们的团队计划尝试将linux代理添加到TFS中,以便在linux代理服务器上运行CI,但失败了,在做了一些研究后,我们发现这是由自签名证书引起的,并计划替换它。但是,更换证书后,我们无法在VS中克隆repo,也无法在代理windows计算机上运行CI

我们更换证书的步骤如下:

  • 通过openssl生成根CA,然后基于根CA生成服务器证书
  • 在TFS windows代理服务器上,删除代理
  • 在TFS服务器上,安装根CA证书和服务器证书
  • 在TFS服务器上,打开IIS,导入服务器证书,并在TFS web的绑定设置中,将https的自签名证书替换为新的服务器证书
  • 尝试通过https访问web,我们可以确保它使用新的证书
  • 在windows代理服务器上,安装根CA证书和服务器证书
  • 在windows代理服务器上,通过
    config.cmd--gituseschannel
    配置代理,代理版本为2.134.0,身份验证类型为PAT或协商
  • 尝试运行CI测试,但在“获取资源”集中失败,错误如下:
  • 在Visual Studio中,尝试克隆回购,出现类似错误:

    Error encountered while cloning the remote repository: Git failed with a fatal error.
    unable to access 'https://***/DefaultCollection/Banyan/_git/ControlCenterHome/': schannel: CertGetCertificateChain trust error CERT_TRUST_IS_PARTIAL_CHAIN
    
    我们在使用Github桌面的Github上发现了类似的问题:

    在此线程中,我们已尝试删除

    [http]
    sslCAinfo = /ssl/certs/ca-bundle.crt
    
    但问题仍然存在

    运行
    git config-l--show origin
    的结果是

    file:"C:\ProgramData/Git/config" core.symlinks=false
    file:"C:\ProgramData/Git/config" core.autocrlf=true
    file:"C:\ProgramData/Git/config" core.fscache=true
    file:"C:\ProgramData/Git/config" color.diff=auto
    file:"C:\ProgramData/Git/config" color.status=auto
    file:"C:\ProgramData/Git/config" color.branch=auto
    file:"C:\ProgramData/Git/config" color.interactive=true
    file:"C:\ProgramData/Git/config" help.format=html
    file:"C:\ProgramData/Git/config" rebase.autosquash=true
    file:"C:\vsts-agent-win-x64-2.134.0\externals\git\mingw64/etc/gitconfig" core.symlinks=false
    file:"C:\vsts-agent-win-x64-2.134.0\externals\git\mingw64/etc/gitconfig" core.autocrlf=true
    file:"C:\vsts-agent-win-x64-2.134.0\externals\git\mingw64/etc/gitconfig" color.diff=auto
    file:"C:\vsts-agent-win-x64-2.134.0\externals\git\mingw64/etc/gitconfig" color.status=auto
    file:"C:\vsts-agent-win-x64-2.134.0\externals\git\mingw64/etc/gitconfig" color.branch=auto
    file:"C:\vsts-agent-win-x64-2.134.0\externals\git\mingw64/etc/gitconfig" color.interactive=true
    file:"C:\vsts-agent-win-x64-2.134.0\externals\git\mingw64/etc/gitconfig" pack.packsizelimit=2g
    file:"C:\vsts-agent-win-x64-2.134.0\externals\git\mingw64/etc/gitconfig" help.format=html
    file:"C:\vsts-agent-win-x64-2.134.0\externals\git\mingw64/etc/gitconfig" diff.astextplain.textconv=astextplain
    file:"C:\vsts-agent-win-x64-2.134.0\externals\git\mingw64/etc/gitconfig" rebase.autosquash=true
    file:C:/Users/Administrator/.gitconfig http.sslbackend=schannel
    
    我们的TFS环境是:

    • TFS 2018更新1
    • TFS代理版本为2.134.0。Git版本2.14.3.windows.1
    • 身份验证类型为PAT或协商
    问题是:

    我们可以在gitconfig中添加
    sslVerify=false
    ,作为一种变通方法,但这并不满足我们的要求。我们需要ssl证书才能使用TFS

    尝试解决克隆远程存储库时遇到的VS:
    错误中提到的错误:Git失败,出现致命错误。无法访问“https://***/DefaultCollection/Banyan/\u git/ControlCenterHome/”:schannel:CertGetCertificateChain信任错误证书信任链不完整

    更新

    我们做到了,以下是简要信息:

  • 在linux上,使用openssl创建根CA:
  • openssl genrsa-out ca-dev.key 2048

    openssl req-new-out ca.csr-key ca.key-keyform PEM/公共名称与服务器证书不同/

    openssl x509-req-in-ca.csr-out-ca.crt-signkey-ca.key-CAcreateserial-days 3650

    openssl pkcs12-export-clcerts-in ca.crt-inkey ca.key-out ca-dev.p12

  • 基于以上根CA,使用openssl创建服务器证书(类似步骤,但使用服务器FQDN作为通用名称)
  • 在TFS服务器上:安装ca.crt,选择“受信任的根证书颁发机构”作为存储位置。然后使用默认位置安装server.crt(最终存储在“中间证书颁发机构”下)
  • 在TFS windows代理服务器上,类似于#3的步骤,但是当使用“config.cmd--gituseschannel”配置TFS代理时,它将无法使用https连接TFS服务器,然后我通过再次安装server.crt来修复它,但将存储位置更改为“trusted root certification authority”

  • CERT\u TRUST\u IS\u PARTIAL\u CHAIN
    提示您缺少该链的根证书或某些中间证书。 在第三步你说

    在TFS服务器上,安装根CA证书和服务器证书


    这是正确的,但您需要在所有客户端上安装根CA

    Thanks@Giulio,我已经更新了上面的描述,很高兴看到,但是你应该回答你自己的问题,而不是更新答案:-)这将有助于人们在将来登录此页面。
    file:"C:\ProgramData/Git/config" core.symlinks=false
    file:"C:\ProgramData/Git/config" core.autocrlf=true
    file:"C:\ProgramData/Git/config" core.fscache=true
    file:"C:\ProgramData/Git/config" color.diff=auto
    file:"C:\ProgramData/Git/config" color.status=auto
    file:"C:\ProgramData/Git/config" color.branch=auto
    file:"C:\ProgramData/Git/config" color.interactive=true
    file:"C:\ProgramData/Git/config" help.format=html
    file:"C:\ProgramData/Git/config" rebase.autosquash=true
    file:"C:\vsts-agent-win-x64-2.134.0\externals\git\mingw64/etc/gitconfig" core.symlinks=false
    file:"C:\vsts-agent-win-x64-2.134.0\externals\git\mingw64/etc/gitconfig" core.autocrlf=true
    file:"C:\vsts-agent-win-x64-2.134.0\externals\git\mingw64/etc/gitconfig" color.diff=auto
    file:"C:\vsts-agent-win-x64-2.134.0\externals\git\mingw64/etc/gitconfig" color.status=auto
    file:"C:\vsts-agent-win-x64-2.134.0\externals\git\mingw64/etc/gitconfig" color.branch=auto
    file:"C:\vsts-agent-win-x64-2.134.0\externals\git\mingw64/etc/gitconfig" color.interactive=true
    file:"C:\vsts-agent-win-x64-2.134.0\externals\git\mingw64/etc/gitconfig" pack.packsizelimit=2g
    file:"C:\vsts-agent-win-x64-2.134.0\externals\git\mingw64/etc/gitconfig" help.format=html
    file:"C:\vsts-agent-win-x64-2.134.0\externals\git\mingw64/etc/gitconfig" diff.astextplain.textconv=astextplain
    file:"C:\vsts-agent-win-x64-2.134.0\externals\git\mingw64/etc/gitconfig" rebase.autosquash=true
    file:C:/Users/Administrator/.gitconfig http.sslbackend=schannel