大网数据广告活动
服务器运维问答

Git called by AWX ignores manually installed root CA

· 52CE 我爱测

AWX is installed on CentOS machine. A separate machine ( gitlab.techraf ) serves GitLab's web interface over HTTPS with a certificate signed by a private CA. The storyline: On a "fresh" system I issue the command: /usr/bin/git cl…

问题原文

原帖链接 · techraf · CC BY-SA 3.0

AWX is installed on CentOS machine. A separate machine (gitlab.techraf) serves GitLab's web interface over HTTPS with a certificate signed by a private CA.

The storyline:

  1. On a "fresh" system I issue the command:

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

    and get (expected):

    fatal: unable to access 'https://gitlab.techraf/techraf/project.git/': Peer's Certificate issuer is not recognized.

  2. I install the root CA certificate on the AWX machine:

    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. I retry the above git clone, this time getting a correct response:

    Cloning into '/tmp/project'...
    remote: Counting objects: 3, done.
    remote: Total 3 (delta 0), reused 0 (delta 0)
    Unpacking objects: 100% (3/3), done.

    As a sanity check I ran git clone using different user accounts - no problem after root CA certificate installation in point 2 - the root CA seems to be installed system-wise. curl also accepts the gitlab.techraf's certificate.

  4. (problem) I define a project in AWX interface and try to synchronise it from the GitLab, however I get:

    TASK [update project using git]
    ************************************************
    fatal: [localhost]: FAILED! => {"changed": false, "cmd": "/usr/bin/git clone --origin origin https://gitlab.techraf/techraf/project.git /var/lib/awx/projects/_6__project", "failed": true, "msg": "fatal: unable to access 'https://gitlab.techraf/techraf/project.git/': Peer's Certificate issuer is not recognized.", "rc": 128, "stderr": "fatal: unable to access 'https://gitlab.techraf/techraf/project.git/': Peer's Certificate issuer is not recognized.\n", "stderr_lines": ["fatal: unable to access 'https://gitlab.techraf/techraf/project.git/': Peer's Certificate issuer is not recognized."], "stdout": "Cloning into '/var/lib/awx/projects/_6__project'...\n", "stdout_lines": ["Cloning into '/var/lib/awx/projects/_6__project'..."]}

    As a sanity check I tried with a project from GitHub and AWX fetches it correctly.

    As another sanity check I ran ansible localhost -m command -a "/usr/bin/git clone --origin origin https://gitlab.techraf/techraf/project.git /tmp/project2, as well as from a different machine to ensure non-interactive shell sessions work the same. In either case the certificate was accepted.


What can be the cause of git (called by AWX/Ansible) not using the installed techrafCA.pem certificate?

What is the next step I can take to troubleshoot the issue?

已采纳解答

原帖链接 · Abhishek Saurabh · CC BY-SA 3.0

If you do same inside awx_task container then it works!

Verified with my AWX setup.

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

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2017-10-09)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。