docker-ansible icon indicating copy to clipboard operation
docker-ansible copied to clipboard

SSH Keys to open

Open ankycooper opened this issue 3 years ago • 1 comments

I'm running this on a GitLab pipeline and works like a charm when using cytopia/ansible:latest image. However when I switch to cytopia/ansible:latest-tools I start getting the SSH key to open error.

SSH key is passed as a file via GitLab variables

UNREACHABLE! => {"changed": false, "msg": "Failed to connect to the host via ssh: @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\r\n@ WARNING: UNPROTECTED PRIVATE KEY FILE! @\r\n@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\r\nPermissions 0666 for '/builds/<project-path>/SSH_PRIVATE_KEY' are too open.\r\nIt is required that your private key files are NOT accessible by others.\r\nThis private key will be ignored.\r\nLoad key \"/builds/<project-path>/SSH_PRIVATE_KEY\": bad permissions\r\[email protected]: Permission denied (publickey,password).", "unreachable": true}

I have tried setting 400 permissions on the file but no luck. Even verified but the perms as below.

' $ chmod -v 400 "${SSH_PRIVATE_KEY}" mode of '/builds//SSH_PRIVATE_KEY' changed to 0400 (r--------)

$ ls -al "${SSH_PRIVATE_KEY}" -r-------- 1 root root 2609 Jun 22 05:57 /builds//SSH_PRIVATE_KEY

NREACHABLE! => {"changed": false, "msg": "Failed to connect to the host via ssh: @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\r\n@ WARNING: UNPROTECTED PRIVATE KEY FILE! @\r\n@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\r\nPermissions 0666 for '/builds//SSH_PRIVATE_KEY' are too open.\r\nIt is required that your private key files are NOT accessible by others.\r\nThis private key will be ignored.\r\nLoad key "/builds//SSH_PRIVATE_KEY": bad permissions\r\[email protected]: Permission denied (publickey,password).", "unreachable": true} '

ankycooper avatar Jun 22 '21 12:06 ankycooper

Can you specify how you've started the docker container. Also can you reproduce this locally?

cytopia avatar Oct 24 '21 11:10 cytopia

Closing due to inactivity

cytopia avatar Nov 12 '22 17:11 cytopia