jenkins jack: job.config: forbidden jenkins:job.get:service unavailable

Jenkins Jack使用过程中报错

“jenkins jack: job.config: forbidden”
或则“jenkins:job.get:service unavailable”

解决方案

需要关闭jenkins的CSRF。

官方issue:https://github.com/tabeyti/jenkins-jack/issues/38
如下:

Jenkins 2.222.1 :
Always enabled CSRF Protection
Jenkins will automatically enable CSRF protection with the default crumb issuer if it was disabled before. The ability to not have CSRF protection enabled has been deprecated and removed from the UI.
API clients should authenticate using API tokens, which doesn’t require CSRF crumbs since 2.96.

老版本(2.204.6以下)

在Jenkins界面“Manage Jenkins”->Security “Configure Global Security”->CSRF 中关闭

新版本

linux

修改文件vim /etc/sysconfig/jenkins,搜索JENKINS_JAVA_OPTIONS

JENKINS_JAVA_OPTIONS="-Djava.awt.headless=true -Dhudson.security.csrf.GlobalCrumbIssuerConfiguration.DISABLE_CSRF_PROTECTION=true"

windows

在Jenkins安装目录,修改文件jenkins.xml,在41排左右

<arguments>-Xrs -Xmx256m -Dhudson.lifecycle=hudson.lifecycle.WindowsServiceLifecycle -Dhudson.security.csrf.GlobalCrumbIssuerConfiguration.DISABLE_CSRF_PROTECTION=true -jar "%BASE%\jenkins.war" --httpPort=8080 --webroot="%BASE%\war"</arguments>

再运行就能看到成功的消息了
在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值