[JIRA] (JENKINS-56007) Can't copy source files from slave to master if security is enabled

35 views
Skip to first unread message

ullrich.hafner@gmail.com (JIRA)

unread,
Feb 8, 2019, 3:26:01 AM2/8/19
to jenkinsc...@googlegroups.com
Ulli Hafner updated an issue
 
Jenkins / Bug JENKINS-56007
Can't copy source files from slave to master if security is enabled

See https://wiki.jenkins.io/display/JENKINS/Slave+To+Master+Access+Control.

Change By: Ulli Hafner
Summary: warnings-ng does not create file-with-issues folder when running on a Can't copy source files from slave to master if security is enabled
Add Comment Add Comment
 
This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d)

andreas.ringlstetter@gmail.com (JIRA)

unread,
Mar 19, 2019, 8:00:03 AM3/19/19
to jenkinsc...@googlegroups.com
Andreas Ringlstetter commented on Bug JENKINS-56007
 
Re: Can't copy source files from slave to master if security is enabled

"Slave to Master Access Control" only has an effect on creating the target directory, not on the copy. (And it should not have either. Please fix that.)

The logic around AffectedFilesResolver::copy is plain wrong, it always tries to perform a local copy. That only works under the assumption that the Jenkins archive is on a shared drive which both master and slave can see identically.

For the generalized case, where the slave does not have direct access to the archive, it still fails regardless. You must use `RemoteInputStream` or `RemoteWriter` to copy files from the workspace.

andreas.ringlstetter@gmail.com (JIRA)

unread,
Mar 19, 2019, 8:03:03 AM3/19/19
to jenkinsc...@googlegroups.com
"Slave to Master Access Control" only has an effect on *creating the target directory*, not on the copy. (And it should not have either. Please fix that.)

The logic around AffectedFilesResolver::copy is plain wrong, it *always* tries to perform a local copy. That only works under the assumption that the Jenkins archive is on a shared drive which both master and slave can see
and access identically. Specifically, this requires the slave to have *full write access* to the archive, which is not advisable in any setup.

For the generalized case, where the slave does *not* have direct access to the archive, it still fails regardless. You must use `RemoteInputStream` or `RemoteWriter` to copy files from the workspace.

ullrich.hafner@gmail.com (JIRA)

unread,
Mar 19, 2019, 8:42:02 AM3/19/19
to jenkinsc...@googlegroups.com

[~ext3] Your comment is wrong. AffectedFilesResolver::copy always does a remote copy. It works perfectly in a master-agent setup without security. The problem is that it copies from agent to master. It should be from master to slave. Otherwise we have the security problem.

andreas.ringlstetter@gmail.com (JIRA)

unread,
Mar 19, 2019, 1:22:06 PM3/19/19
to jenkinsc...@googlegroups.com
Andreas Ringlstetter updated an issue
 
Change By: Andreas Ringlstetter
Comment:
"Slave to Master Access Control" only has an effect on *creating the target directory*, not on the copy. (And it should not have either. Please fix that.)

The logic around AffectedFilesResolver::copy is plain wrong, it *always* tries to perform a local copy. That only works under the assumption that the Jenkins archive is on a shared drive which both master and slave can see and access identically. Specifically, this requires the slave to have *full write access* to the archive, which is not advisable in any setup.

For the generalized case, where the slave does *not* have direct access to the archive, it still fails regardless. You must use `RemoteInputStream` or `RemoteWriter` to copy files from the workspace.

ullrich.hafner@gmail.com (JIRA)

unread,
Mar 20, 2019, 4:33:03 AM3/20/19
to jenkinsc...@googlegroups.com
 
Re: Can't copy source files from slave to master if security is enabled

A temporary fix would be to add the following line to the whitelist whitelisted-callables.d, see wiki article.

io.jenkins.plugins.analysis.core.steps.IssuesScanner.ReportPostProcessor

roman@pickl.eu (JIRA)

unread,
Apr 26, 2019, 11:00:02 AM4/26/19
to jenkinsc...@googlegroups.com

Ulli Hafner thanks for pointing me to this ticket in gitter.

I tried to whitelist it, but it did not work for me.

I also tried io.jenkins.plugins.analysis.core.steps.IssuesScanner$ReportPostProcessor (note the $) but this did not work either.

ullrich.hafner@gmail.com (JIRA)

unread,
May 24, 2019, 5:48:02 PM5/24/19
to jenkinsc...@googlegroups.com

We created a test for this issue now: https://github.com/jenkinsci/warnings-ng-plugin/pull/90

Seems that we still miss something in your setup since the test passes. We currently enable the master-agent security and try to start a build on a slave.

Are we missing something obvious in the test? How do you connect master and agent? Which other kind of security settings did you enable? What Authorization did you enable?

roman@pickl.eu (JIRA)

unread,
May 28, 2019, 3:15:03 AM5/28/19
to jenkinsc...@googlegroups.com

Thanks for the update.
Not sure whether you address Mark or me but I guess we experience the same problem.

 

I'm nt sure what you are implying though. do you mean that everything should work out of the box (with master-agent security enabled) or it should only work if the command is whitelisted?

So I updated the plugin to the latest version 5.0.0 (from 4.0.0) and activated master-agent security again. i'll come back to you with the results.

roman@pickl.eu (JIRA)

unread,
May 28, 2019, 3:15:05 AM5/28/19
to jenkinsc...@googlegroups.com
Roman Pickl edited a comment on Bug JENKINS-56007
Thanks for the update.
Not sure whether you address Mark or me but I guess we experience the same problem.

 

I'm nt not sure what you are implying though. do you mean that everything should work out of the box (with master-agent security enabled) or it should only work if the command is whitelisted?

So I
've updated the plugin to the latest version 5.0.0 (from 4.0.0) and activated master-agent security again. i'll come back to you with the results.

ullrich.hafner@gmail.com (JIRA)

unread,
May 28, 2019, 3:35:03 AM5/28/19
to jenkinsc...@googlegroups.com
Ulli Hafner edited a comment on Bug JENKINS-56007
Before writing a fix I wanted to expose the bug via a test. So I can see afterwards if a fix is successfully or not. But the problem is that I cannot expose the bug (neither in a test or nor in a running Jenkins instance).

ullrich.hafner@gmail.com (JIRA)

unread,
May 28, 2019, 3:35:04 AM5/28/19
to jenkinsc...@googlegroups.com

Before writing a fix I wanted to expose the bug via a test. So I can see afterwards if a fix is successfully or not. But the problem is that I cannot expose the bug (neither in a test or in a running Jenkins instance).

roman@pickl.eu (JIRA)

unread,
May 28, 2019, 4:10:02 AM5/28/19
to jenkinsc...@googlegroups.com

I'm still running into
09:49:28 [Clang-Tidy] [-ERROR-] Can't copy some affected workspace files to Jenkins build folder:

roman@pickl.eu (JIRA)

unread,
May 28, 2019, 4:26:02 AM5/28/19
to jenkinsc...@googlegroups.com

we are using the https://wiki.jenkins.io/display/JENKINS/Swarm+Plugin to run slaves and run some builds inside docker on a separate machine then the one the jenkins master runs on (windows 7)

security settings

  • Security is enabled
  • Access Control works via LDAP
  • Logged-in users can do everything, anonymous read access is permitted
  • tcp port for jnlp agents is set to 7777

roman@pickl.eu (JIRA)

unread,
May 28, 2019, 4:31:02 AM5/28/19
to jenkinsc...@googlegroups.com

i thought the issue is that copying files from the slave to master does not work (as mentioned in https://issues.jenkins-ci.org/browse/JENKINS-56007?focusedCommentId=363080&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-363080) , to me it seems as if the test does the opposite (copying a file to the slave).

roman@pickl.eu (JIRA)

unread,
May 28, 2019, 4:47:02 AM5/28/19
to jenkinsc...@googlegroups.com
Roman Pickl edited a comment on Bug JENKINS-56007
i thought the issue is that copying files from the slave to master does not work (as mentioned in https://issues.jenkins-ci.org/browse/JENKINS-56007?focusedCommentId=363080&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-363080) , to me it seems as if the test does the opposite (copying a file to the slave) , but of course I'm lacking context .

ullrich.hafner@gmail.com (JIRA)

unread,
May 28, 2019, 7:12:01 AM5/28/19
to jenkinsc...@googlegroups.com

Which Jenkins version are you using? Is it possible, that you did deny Jenkins to create the default permissions file `secrets/filepath-filters.d/30-default.conf` in the folder

ullrich.hafner@gmail.com (JIRA)

unread,
May 28, 2019, 7:13:02 AM5/28/19
to jenkinsc...@googlegroups.com
Ulli Hafner edited a comment on Bug JENKINS-56007
Which Jenkins version are you using? Is it possible, that you did deny Jenkins to create the default permissions file `secrets/filepath-filters.d/30-default.conf` in the folder ?

roman@pickl.eu (JIRA)

unread,
May 28, 2019, 2:51:02 PM5/28/19
to jenkinsc...@googlegroups.com

we are using Jenkins ver. 2.164.3 (latest lts release)

\secrets\filepath-filters.d\30-default.conf exists and has a timestamp from the last restart of jenkins yesterday (i think)

i have added a warningsng.conf file in \secrets\whitelisted-callables.d with one line:
io.jenkins.plugins.analysis.core.steps.IssuesScanner$ReportPostProcessor

 

ullrich.hafner@gmail.com (JIRA)

unread,
May 28, 2019, 4:25:04 PM5/28/19
to jenkinsc...@googlegroups.com

ullrich.hafner@gmail.com (JIRA)

unread,
May 28, 2019, 4:25:05 PM5/28/19
to jenkinsc...@googlegroups.com

roman@pickl.eu (JIRA)

unread,
May 30, 2019, 2:28:02 PM5/30/19
to jenkinsc...@googlegroups.com
Roman Pickl commented on Bug JENKINS-56007
 
Re: Can't copy source files from slave to master if security is enabled

Great! Thanks for the update.
Is whitelisting still needed after this change?

ullrich.hafner@gmail.com (JIRA)

unread,
May 30, 2019, 2:53:02 PM5/30/19
to jenkinsc...@googlegroups.com

No, it is not required anymore. (I thought, whitelisting did not work as advertised?)

roman@pickl.eu (JIRA)

unread,
May 30, 2019, 3:28:02 PM5/30/19
to jenkinsc...@googlegroups.com

ullrich.hafner@gmail.com (JIRA)

unread,
Jun 27, 2019, 5:03:04 PM6/27/19
to jenkinsc...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages