小编典典

Gitlab-CI运行程序:忽略自签名证书

go

gitlab-ci-multi-runner register

给我

couldn't execute POST against https://xxxx/ci/api/v1/runners/register.json:
Post https://xxxx/ci/api/v1/runners/register.json: 
x509: cannot validate certificate for xxxx because it doesn't contain any IP SANs

有没有办法禁用认证验证?

我正在使用Gitlab 8.13.1和gitlab-ci-multi-runner 1.11.2。


阅读 895

收藏
2020-07-02

共1个答案

小编典典

根据Wassim的答案以及有关tls-
自签名和自定义CA签名证书的gitlab文档
,如果您不是gitlab服务器的管理员,而是运行者(以及运行者)的管理员,则可以节省一些时间以root身份运行):

SERVER=gitlab.example.com
PORT=443
CERTIFICATE=/etc/gitlab-runner/certs/${SERVER}.crt

# Create the certificates hierarchy expected by gitlab
sudo mkdir -p $(dirname "$CERTIFICATE")

# Get the certificate in PEM format and store it
openssl s_client -connect ${SERVER}:${PORT} -showcerts </dev/null 2>/dev/null | sed -e '/-----BEGIN/,/-----END/!d' | sudo tee "$CERTIFICATE" >/dev/null

# Register your runner
gitlab-runner register --tls-ca-file="$CERTIFICATE" [your other options]

更新1: 证书必须是正确位置的绝对路径。

更新2 :由于gitlab-runner错误#2675,使用自定义CA签名仍可能失败

2020-07-02