由AWX调用的Git将忽略手动安装的根CA.

AWX安装在CentOS机器上。 单独的机器( gitlab.techraf )通过HTTPS为GitLab的Web界面提供由专用CA签名的证书。

故事情节:

  1. 在“新鲜”系统上,我发出命令:

     /usr/bin/git clone --origin origin https://gitlab.techraf/techraf/project.git /tmp/project 

    并得到(预期):

    致命的:无法访问“ https://gitlab.techraf/techraf/project.git/ ”: https://gitlab.techraf/techraf/project.git/的证书颁发者不被识别。

  2. 我在AWX机器上安装根CA证书:

     update-ca-trust force-enable curl https://certificate.source/certificates/techrafCA.pem > /etc/pki/ca-trust/source/anchors/techrafCA.pem update-ca-trust extract 
  3. 我重试上面的git clone ,这次得到一个正确的回应:

    克隆到“/ tmp / project”中
    远程:计数对象:3,完成。
    远程:总计3(delta 0),重用0(delta 0)
    开箱对象:100%(3/3),完成。

    作为完整性检查,我使用不同的用户帐户运行git clone – 在第2点安装根CA证书后没有问题 – 根CA似乎以系统方式安装。 curl也接受gitlab.techraf的证书。

  4. (问题)我在AWX界面中定义一个项目,并尝试从GitLab同步它,但是我得到:

    任务[使用git更新项目]
    ************************************************
    致命的:[localhost]:失败! => {“changed”:false,“cmd”:“ /usr/bin/git clone --origin origin https://gitlab.techraf/techraf/project.git /var/lib/awx/projects/_6__project ”, “失败”:真,“msg”:“致命:无法访问” https://gitlab.techraf/techraf/project.git/ “:无法识别https://gitlab.techraf/techraf/project.git/的证书颁发者”,“rc”:128,“stderr “:”致命:无法访问' https://gitlab.techraf/techraf/project.git/ ':无法识别https://gitlab.techraf/techraf/project.git/的证书颁发者。\ n“,”stderr_lines“:[”致命:无法访问' https://gitlab.techraf/techraf/project.git/ ':无法识别https://gitlab.techraf/techraf/project.git/的证书颁发者。“],”stdout“:”克隆到/var/lib/awx/projects/_6__project'…n“, “stdout_lines”:[“克隆到'/ var / lib / awx / projects / _6__project'…]]}

    作为一个完整性检查,我尝试了一个来自GitHub的项目,AWX正确地获取它。

    作为另一个完整的检查,我运行了一个ansible localhost -m command -a "/usr/bin/git clone --origin origin https://gitlab.techraf/techraf/project.git /tmp/project2 ,以及从另一台机器以确保非交互式shell会话的工作是一样的。在任何一种情况下,证书都被接受。


git (由AWX / Ansible调用)不使用已安装的techrafCA.pem证书的原因是什么?

我可以采取什么措施来解决问题?

如果你在awx_task容器内做同样的事情,那么它的工作原理!

使用我的AWX设置进行validation。

 update-ca-trust force-enable curl https://certificate.source/certificates/techrafCA.pem > /etc/pki/ca-trust/source/anchors/techrafCA.pem update-ca-trust extract