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

Host key verification failed #27

Open
gopurx opened this issue Dec 2, 2021 · 0 comments
Open

Host key verification failed #27

gopurx opened this issue Dec 2, 2021 · 0 comments

Comments

@gopurx
Copy link

gopurx commented Dec 2, 2021

Receiving error "Host key verification failed" while running docker stack deployment. Validated "ssh_public_key" and it is the string from known_hosts file for the target deployment machine. Below is the traces of error

Registering SSH keys...
Agent pid 10
Identity added: /github/home/.ssh/id_rsa (/github/home/.ssh/id_rsa)
Add known hosts
Connecting to ***... Command: docker --log-level debug --host ssh://***:22 stack deploy --compose-file docker-compose.yml application_name
time="2021-12-01T21:34:48Z" level=debug msg="commandconn: starting ssh with [-l username -p 22 -- host_name docker system dial-stdio]"
time="2021-12-01T21:34:48Z" level=debug msg="commandconn (ssh):Host key verification failed.\r\n"
time="2021-12-01T21:34:48Z" level=debug msg="commandconn: starting ssh with [-l username -p 22 -- host_name docker system dial-stdio]"
time="2021-12-01T21:34:48Z" level=debug msg="commandconn (ssh):Host key verification failed.\r\n"
time="2021-12-01T21:34:48Z" level=debug msg="commandconn: starting ssh with [-l username -p 22 -- host_name docker system dial-stdio]"
time="2021-12-01T21:34:48Z" level=debug msg="commandconn (ssh):Host key verification failed.\r\n"
time="2021-12-01T21:34:48Z" level=debug msg="FIXME: Got an status-code for which error does not match any expected type!!!: -1" module=api status_code=-1
error during connect: Get http://docker/v1.40/info: command [ssh -l username -p 22 -- host_name docker system dial-stdio] has exited with exit status 255, please make sure the URL is valid, and Docker 18.09 or later is installed on the remote host: stderr=Host key verification failed.

After running the docker_deployment-action container manually and then reviewing file "/etc/ssh/ssh_known_hosts" observed a space between host_name and the public key that was fed, no sure if this is causing the issue. Upon reviewing the docker-entrypoint.sh below snippet of code seems is causing this space (instead of a comma).

echo "Add known hosts"
printf '%s %s\n' "$SSH_HOST" "$INPUT_SSH_PUBLIC_KEY" > /etc/ssh/ssh_known_hosts

Removed "$SSH_HOST" from the above line and then feeding hostname part of ssh_public_key is working, means i can see ssh connection made.

Please review and suggest in resolving this error

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

1 participant