ambikanair
ambikanair

Reputation: 4560

Authentication errors while using go test

I am using go test command after setting export GO111MODULE=on to update go.mod and run a test suite.

I see so many authentication errors like below

The authenticity of host 'gitlab.com (35.231.145.151)' can't be established.
ECDSA key fingerprint is SHA256:HbW3g8zUjNSksFbqTiUWPWg2Bq1x8xdGUrliXFzSnUw.
Are you sure you want to continue connecting (yes/no)? The authenticity of host 'gitlab.com (35.231.145.151)' can't be established.
ECDSA key fingerprint is SHA256:HbW3g8zUjNSksFbqTiUWPWg2Bq1x8xdGUrliXFzSnUw.
Are you sure you want to continue connecting (yes/no)? The authenticity of host 'gitlab.com (35.231.145.151)' can't be established.
ECDSA key fingerprint is SHA256:HbW3g8zUjNSksFbqTiUWPWg2Bq1x8xdGUrliXFzSnUw.
Are you sure you want to continue connecting (yes/no)? The authenticity of host 'gitlab.com (35.231.145.151)' can't be established.
ECDSA key fingerprint is SHA256:HbW3g8zUjNSksFbqTiUWPWg2Bq1x8xdGUrliXFzSnUw.
Are you sure you want to continue connecting (yes/no)? go: modernc.org/[email protected]: unknown revision v1.0.0
go: modernc.org/[email protected]: unknown revision v1.0.0
The authenticity of host 'gitlab.com (35.231.145.151)' can't be established.
ECDSA key fingerprint is SHA256:HbW3g8zUjNSksFbqTiUWPWg2Bq1x8xdGUrliXFzSnUw.
Are you sure you want to continue connecting (yes/no)? go: modernc.org/[email protected]: unknown revision v1.0.0
go: modernc.org/[email protected]: unknown revision v1.0.0

go version is go1.12.1 linux/amd64

Upvotes: 3

Views: 282

Answers (1)

Marc
Marc

Reputation: 21035

This is normal SSH behavior when it does not know the host keys. The go tooling does not surface the prompt asking you to accept (or reject) the host keys.

You can add them yourself by running:

# Fetch keys for gitlab.com, save them to a temporary file.
$ ssh-keyscan -H gitlab.com > tmpkeys
# Print the checksums
$ ssh-keygen -l -f tmpkeys
2048 SHA256:ROQFvPThGrW4RuWLoL9tq9I9zJ42fK4XywyRtbOz/EQ |1|acl3SWCVoYBF6aZrd2FSWIafzT8=|fu8Ivfg6HIGVxsFSx5u3aZwY6CQ= (RSA)
256 SHA256:HbW3g8zUjNSksFbqTiUWPWg2Bq1x8xdGUrliXFzSnUw |1|LMWC/o9XJxW3EtS0hN8/WBBkPrk=|JocpRioPZiOte6ek33XOO6JljQY= (ECDSA)
256 SHA256:eUXGGm1YGsMAS7vkcx6JOJdOGHPem5gQp4taiCfCLB8 |1|BAhrVESJhSsdsGsXHXzY1bvW3P0=|p4KuzvnpUqZA/PGKGkjN0sXKsuk= (ED25519)
# If satisfied with the checksums, append the keys to the known hosts file.
$ cat tmpkeys >> ~/.ssh/known_hosts 

The host key checksums can be verified on gitlab's site.

Once you've done this: try the command again, it should stop prompting you for host keys as they will be known.

Upvotes: 1

Related Questions