小编典典

Jenkins CLI:使用匿名权限代替用户定义的权限

jenkins

我对这个问题感到生气,不知道如何解决。

我们试图从Windows Central存储库上的钩子触发Jenkins构建。这实际上是在旧的Jenkins服务器(LTS 1.580.1)上工作的。

我们之前的操作方式是使用存储在文件中的SSH私钥调用Jenkins CLI。

这是奇怪的事情:

C:\ Users \ Username \ jenkins> java -jar jenkins-cli.jar -s
http://主机名:8080 -i ci.key list-jobs

hudson.security.AccessDeniedException2: jenkins_ci is missing the Overall/Read permission
         at hudson.security.ACL.checkPermission(ACL.java:58)
         at hudson.model.Node.checkPermission(Node.java:417)
         at hudson.cli.CLICommand.main(CLICommand.java:236)
         at hudson.cli.CliManagerImpl.main(CliManagerImpl.java:92)
         at sun.reflect.GeneratedMethodAccessor345.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
         at java.lang.reflect.Method.invoke(Method.java:483)
         at hudson.remoting.RemoteInvocationHandler$RPCRequest.perform(RemoteInvocationHandler.java:320)
         at hudson.remoting.RemoteInvocationHandler$RPCRequest.call(RemoteInvocationHandler.java:295)
         at hudson.remoting.RemoteInvocationHandler$RPCRequest.call(RemoteInvocationHandler.java:254)
         at hudson.remoting.UserRequest.perform(UserRequest.java:121)
         at hudson.remoting.UserRequest.perform(UserRequest.java:49)
         at hudson.remoting.Request$2.run(Request.java:324)
         at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:68)
         at hudson.cli.CliManagerImpl$1.call(CliManagerImpl.java:63)
         at hudson.remoting.CallableDecoratorAdapter.call(CallableDecoratorAdapter.java:18)
         at hudson.remoting.CallableDecoratorList$1.call(CallableDecoratorList.java:21)
         at jenkins.util.ContextResettingExecutorService$2.call(ContextResettingExecutorService.java:46)
         at java.util.concurrent.FutureTask.run(FutureTask.java:266)
         at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
         at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
         at java.lang.Thread.run(Thread.java:745)

jenkins_ci用户是一个Active Directory服务帐户,大多数情况下都可以使用。在Jenkins安全矩阵中,我具有与此服务帐户相同的权限。

当我使用ssh键并运行完全相同的命令时,它就像一个超级按钮一样起作用。

如果我运行Who-I-am,但如果我更改了匿名权限,则说“
jenkins_ci”,但jenkins_ci开始起作用。似乎它没有读取定义的用户权限,而是使用了匿名用户权限。

有什么想法使它起作用吗?这是我应该报告给詹金斯(Jenkins)的错误,还是我错过了任何东西?

谢谢!


阅读 359

收藏
2020-07-25

共1个答案

小编典典

好的,经过几个小时的努力,我有了一个“快乐的主意”,并且成功了。

我们的Jenkins正在使用LDAP针对Active Directory进行身份验证。

不知何故,Jenkins(及其用户文件夹)创建的用户为: “ jenkins_ci” (小写),而我们的Active Directory帐户为
“ JENKINS_CI” (大写)。

詹金斯的安全性似乎以某种方式 区分大小写

我停止了Jenkins,删除了主机上的用户文件夹,然后启动了Jenkins。现在,新文件夹名为JENKINS_CI,并且CLI正在运行。

2020-07-25