詹金斯:403 请求中没有包含有效的面包屑 [英] Jenkins: 403 No valid crumb was included in the request
问题描述
我在 spinnaker 中按如下方式配置了 jenkins 并设置了 spinnaker 管道.
I configured jenkins in spinnaker as follows and setup spinnaker pipeline.
jenkins:
# If you are integrating Jenkins, set its location here using the baseUrl
# field and provide the username/password credentials.
# You must also enable the "igor" service listed separately.
#
# If you have multiple jenkins servers, you will need to list
# them in an igor-local.yml. See jenkins.masters in config/igor.yml.
#
# Note that jenkins is not installed with Spinnaker so you must obtain this
# on your own if you are interested.
enabled: ${services.igor.enabled:false}
defaultMaster:
name: default
baseUrl: http://server:8080
username: spinnaker
password: password
但是我在尝试运行 Spinnaker 管道时看到以下错误.
But I am seeing following error when trying to run spinnaker pipeline.
异常(开始詹金斯工作)403 请求中没有包含有效的面包屑
Exception ( Start Jenkins Job ) 403 No valid crumb was included in the request
推荐答案
最后,这篇文章帮助我解决了 crumb 问题,但仍然保护 Jenkins 免受 CSRF 攻击.
Finally, this post helped me to do away with the crumb problem but still securing Jenkins from CSRF attack.
基本上,我们需要首先请求带有身份验证的 crumb,然后再次发出带有 crumb 作为标头以及身份验证的 POST api 调用.
Basically, we need to first request for crumb with authentication and then issue POST api calls with crumb as a header along with authentication again.
我就是这样做的,
curl -v -X GET http://jenkins-url:8080/crumbIssuer/api/json --user <username>:<password>
回应是,
{
"_class":"hudson.security.csrf.DefaultCrumbIssuer",
"crumb":"0db38413bd7ec9e98974f5213f7ead8b",
"crumbRequestField":"Jenkins-Crumb"
}
然后是包含上述面包屑信息的 POST api.
Then the POST api with above crumb information in it.
curl -X POST http://jenkins-url:8080/job/<job-name>/build --user <username>:<password> -H 'Jenkins-Crumb: 0db38413bd7ec9e98974f5213f7ead8b'
这篇关于詹金斯:403 请求中没有包含有效的面包屑的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!