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

Fingerprint error when accessing private repos through SSH deploy keys #79

Closed
fcs-ts opened this issue Jul 4, 2024 · 2 comments
Closed
Labels
question Further information is requested

Comments

@fcs-ts
Copy link

fcs-ts commented Jul 4, 2024

In my company we use this action to build internal tools for the employees to use the binaries. Recently we started to use a private repo as a dependency and access it through deploy SSH keys on CI. This has worked well for lints/test/etc, but this action gives the following error:

Caused by:
  error: SSH host key has changed for `github.com`
  *********************************
  * WARNING: HOST KEY HAS CHANGED *
  *********************************
  This may be caused by a man-in-the-middle attack, or the server may have changed its host key.

  The RSA fingerprint for the key from the remote host is:
  SHA256:uNiVztksCsDhcc0u9e8BujQXVUpKZIDTMczCvj3tD2s

  You are strongly encouraged to contact the server administrator for `github.com` to verify that this new key is correct.

  If you can verify that the server has a new key, you can resolve this error by removing the old ssh-rsa key for `github.com` located at C:\Users\runneradmin\.ssh\known_hosts line 6, and adding the new key to the `net.ssh.known-hosts` array in your Cargo configuration (such as C:\Users\runneradmin\.cargo\config.toml) or in your OpenSSH known_hosts file at C:\Users\runneradmin\.ssh\known_hosts

  The key provided by the remote host is:

I am not sure how the known_hosts file is populated and I am wondering if this has to do with Github key rotation from last year: https://github.blog/2023-03-23-we-updated-our-rsa-ssh-host-key/

Thanks a lot for your work and thanks in advance for any help on this :)

@taiki-e
Copy link
Owner

taiki-e commented Jul 5, 2024

This action itself does not use SSH directly at all, so I suspect this is an issue with the cargo that is called to build your code. Could you check which version of cargo is being used in your workflow? If it is old, I suspect you need to update to a version that includes a patch for this issue (rust-lang/cargo#11883).

@taiki-e taiki-e added the question Further information is requested label Jul 5, 2024
@fcs-ts
Copy link
Author

fcs-ts commented Jul 27, 2024

We fixed it by adding

        env:
          CARGO_NET_GIT_FETCH_WITH_CLI: true

to the step

@fcs-ts fcs-ts closed this as completed Jul 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants