[英]Gitlab CI token - 403 with apache
我在我的服務器上運行gitlab。 我正在使用apache2(使用https)為網站服務。
最近我開始使用gitlab CI,但遇到了一個我無法自行解決的問題:我總是遇到403錯誤:
remote: Access denied
fatal: unable to access 'https://gitlab-ci-token:xxxxxxxxxxxxxxxxxxxx@git.mydomain.com/group/project.git/': The requested URL returned error: 403
SSH和HTTP(S)都啟用了克隆,ci適用於公共項目,檢查所有gitlab日志顯示跑步者未經過身份驗證,從而觸發403。
我最好的猜測是apache配置沒有將ci-token傳遞給gitlab,但我也不知道如何檢查它,我也不相信這是真正的原因。
我的vhost:
<VirtualHost *:80>
ServerName git.mydomain.com
ServerSignature Off
RewriteEngine on
RewriteCond %{HTTPS} !=on
RewriteRule .* https://%{SERVER_NAME}%{REQUEST_URI} [NE,R,L]
</VirtualHost>
<VirtualHost *:443>
SSLEngine on
SSLProtocol all -SSLv2
SSLHonorCipherOrder on
SSLCipherSuite "ECDH+AESGCM:DH+AESGCM:ECDH+AES256:DH+AES256:ECDH+AES128:DH+AES:ECDH+3DES:DH+3DES:RSA+AESGCM:RSA+AES:RSA+3DES:!aNULL:!MD5:!DSS"
Header add Strict-Transport-Security: "max-age=15768000;includeSubdomains"
SSLCompression Off
SSLCertificateFile /etc/letsencrypt/live/git.mydomain.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/git.mydomain.com/privkey.pem
SSLCACertificateFile /etc/letsencrypt/live/git.mydomain.com/chain.pem
ServerName git.mydomain.com
ServerSignature Off
ProxyPreserveHost On
AllowEncodedSlashes NoDecode
<Location />
Require all granted
ProxyPassReverse http://127.0.0.1:8181
ProxyPassReverse http://git.mydomain.com/
</Location>
RewriteEngine on
RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f [OR]
RewriteCond %{REQUEST_URI} ^/uploads/.*
RewriteRule .* http://127.0.0.1:8181%{REQUEST_URI} [P,QSA,NE]
RequestHeader set X_FORWARDED_PROTO 'https'
RequestHeader set X-Forwarded-Ssl on
DocumentRoot /opt/gitlab/embedded/service/gitlab-rails/public
ErrorDocument 404 /404.html
ErrorDocument 422 /422.html
ErrorDocument 500 /500.html
ErrorDocument 502 /502.html
ErrorDocument 503 /503.html
LogFormat "%{X-Forwarded-For}i %l %u %t \"%r\" %>s %b" common_forwarded
ErrorLog /var/log/apache2/gitlab_error.log
CustomLog /var/log/apache2/gitlab_forwarded.log common_forwarded
CustomLog /var/log/apache2/gitlab_access.log combined env=!dontlog
CustomLog /var/log/apache2/gitlab.log combined
</VirtualHost>
/etc/gitlab/gitlab.rb的相關部分
external_url 'https://git.mydomain.com'
nginx['enable'] = false
web_server['external_users'] = ['www-data']
gitlab_workhorse['listen_network'] = "tcp"
gitlab_workhorse['listen_addr'] = "127.0.0.1:8181"
gitlab_rails['gitlab_email_reply_to'] = 'webmaster@mydomain.com'
Runner配置:
[[runners]]
name = "Runner Name"
url = "https://git.mydomain.com/ci"
token = "Some generated token"
executor = "shell"
[runners.cache]
在/ etc /默認/ gitlab:
gitlab_workhorse_options="-listenUmask 0 -listenNetwork tcp -listenAddr 127.0.0.1:8181 -authBackend http://127.0.0.1:8080"
.gitlab-ci.yml:
stages:
- compile
compilei7:
stage: compile
script:
- /./home/public/folder/someScript.sh -f `$PWD`
tags:
- neededtag
所有的幫助表示贊賞,我在這里碰壁。 謝謝。
似乎這是我修復的一個更新,因為我發布了這個問題,因為它現在正在使用完全相同的服務器和配置。
當GitLab Runner嘗試從Git倉庫克隆項目時會發生這種情況。
為了解決這個問題,請將自己添加為項目的成員:
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.