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

SSH Keys #46

Open
puppeteer701vungle opened this issue Feb 20, 2019 · 5 comments
Open

SSH Keys #46

puppeteer701vungle opened this issue Feb 20, 2019 · 5 comments

Comments

@puppeteer701vungle
Copy link

It would be beneficial to add a flag for ssh keys, because a pipeline could be installing a private package.

@Brewal
Copy link

Brewal commented Jan 28, 2020

Is there any plan / workaroud for this ?

@bestit-ewieser
Copy link

I added the following volume to line 53 of the docker.js file:
-v ~/.ssh:/root/.ssh:ro

: `run --rm -P -v ${pwd()}:${workDir} -v ~/.ssh:/root/.ssh:ro -w ${workDir} ${image} bash ${BUILD_SCRIPT}`;

Thus your local SSH-keys are mapped into the docker container.

@holylander
Copy link

do you know if such config would work on a windows machine? thanks

@bestit-ewieser
Copy link

do you know if such config would work on a windows machine? thanks

Unfortunately I have no experience on windows machines. It might just be necessary to swap the placeholder for the user-folder (https://stackoverflow.com/questions/20226147/where-does-github-for-windows-keep-its-ssh-key)?

@holylander
Copy link

@bestit-ewieser thanks mate! :) If windows filesystem, all you need to is
-v C:\\Users\\[username]\\.ssh:/root/.ssh:ro
However, I got another error after trying to use the ssh keys:

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@         WARNING: UNPROTECTED PRIVATE KEY FILE!          @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Permissions 0755 for '/root/.ssh/id_rsa' are too open.
It is required that your private key files are NOT accessible by others.
This private key will be ignored.

Therefore, I ended in creating a docker image, based on the following docker file, within a folder, with my windows generated ssh key:

FROM node:10.15.3
RUN mkdir /root/.ssh/
COPY ./id_rsa.pub /root/.ssh/id_rsa.pub
COPY ./id_rsa /root/.ssh/id_rsa
RUN chmod 600 /root/.ssh/id_rsa

docker build . -t node:10.15.3-custom
And then, update the bitbucket pipeline so it uses my new docker image
image: node:10.15.3:custom

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants