Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker SSH agent has incorrect environment when dynamic provisioned by the docker-slaves plugin #166

Closed
bjacobs1 opened this issue Feb 2, 2021 · 2 comments
Labels

Comments

@bjacobs1
Copy link

bjacobs1 commented Feb 2, 2021

Issue:
The /etc/environment file on the agent is writable only by root, while the script /usr/local/bin/setup-sshd is run as the user the container is started with. This results in the image not being correctly provisioned. Both Jenkins and the agent are run as docker containers (jenkins/jenkins:lts and jenkins/ssh-agent, both pulled today). This is an issue because the agent does not get the correct environment, and therefore cannot find java and then the Gremlins attack.

To reproduce the following, start both containers, docker attach to the master and ssh to the slave. Then:
jenkins@127:$ ls -al /usr/local/bin/ | grep sshd
-rwxr-xr-x. 1 root root 2365 Dec 21 16:40 setup-sshd
jenkins@127:
$ ls -al /etc | grep envi
-rw-r--r--. 1 root root 0 Dec 9 23:22 environment

For this particular issue I don't think that entire environment dumps are necessary, but if someone disagrees and provides me with an easy way to do it, I'll include the necessary system dumps.

@bjacobs1
Copy link
Author

bjacobs1 commented Feb 3, 2021

After a lot more digging, this seems to be a duplicate, and has been documented here:
jenkinsci/docker-ssh-agent#62

and solved here:
jenkinsci/docker-ssh-agent#63

Impressive work

@timja
Copy link
Member

timja commented Aug 3, 2021

as above belongs in a different repo ^^

@timja timja closed this as completed Aug 3, 2021
lemeurherve pushed a commit to lemeurherve/docker-agent that referenced this issue Nov 27, 2023
Fix the jenkins/inbound-agent DockerHub link in README
lemeurherve pushed a commit to lemeurherve/docker-agent that referenced this issue Jan 11, 2024
Fix the jenkins/inbound-agent DockerHub link in README
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants