docker.image('ubuntu').inside ('-v /etc:/etc-host -u 0') {I could also have passed in the "--privileged" flag.
sh '''
whoami
# -> root
awk '{gsub(/[A-Z]/,"!"); print}' /etc-host/shadow
# -> slightly masked password hashes
'''
}
node {
sh 'docker run -v /etc:/etc-host ubuntu cat /etc-host/shadow'
}
Thanks in advance,
Thomas
> One option would be to write a shim for the docker command, that only
> allows a subset of commands, and sanitizes the options and parameters.
Even if you do that, the jenkins user, as part of the docker group, will
still have direct access to the unix socket that the Docker daemon uses.
As is quite often the case with a CI server, you most likely need to
either trust the users who can configure jobs (or edit Workflow scripts
(if in source control)), or lock down the Jenkins configuration to allow
only specific users.
The Docker security guide also says "only trusted users should be
allowed to control your Docker daemon":
https://docs.docker.com/engine/articles/security/
--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/aa632bac-58cb-4e3f-9238-ab1ad4424fe8%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/e20cbe1a-6da3-4e39-86cc-7055b5109995%40googlegroups.com.
Stephen,
thanks for the suggestions. I'm sure that with the two methods you described it's possible to divide roles into those who can control a docker host, and those who can't, and the second method is even safe against privilege escalation. The organization I work for is a Cloudbees customer, but unfortunately both methods you suggested don't support use cases where both groups in your "lock down" scenario must be allowed to configure Workflow scripts with `docker.image().inside{}` (and that's what I have in mind).
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/d7f707c4-b56b-4a3e-a09c-9af9a9b36644%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CA%2BnPnMx1j9hw%2B6mCzM%3D9EUjBfLzcX28M2w%3DQViji45kFX%2BSfig%40mail.gmail.com.
On 12 January 2016 at 06:14, Thomas Goeppel <thomas....@gmail.com> wrote:Stephen,
thanks for the suggestions. I'm sure that with the two methods you described it's possible to divide roles into those who can control a docker host, and those who can't, and the second method is even safe against privilege escalation. The organization I work for is a Cloudbees customer, but unfortunately both methods you suggested don't support use cases where both groups in your "lock down" scenario must be allowed to configure Workflow scripts with `docker.image().inside{}` (and that's what I have in mind).If you are using the Script Security plugin that should help vet what scripts can be executed... and by having the two teams in different Jenkins masters you can have different profiles of what they can run... but yeah I agree it would be better to be able to provide a "permission restricted" docker proxy to the build (not just workflow by the way) so that you can restrict what the build can do as this is a problem for any build (just think that somebody can add a unit test that uses System.exec to run docker