Skip to content

Commit

Permalink
Fix tests hostkeys (go-gitea#17786)
Browse files Browse the repository at this point in the history
allow ssh-rsa as hostkey algorithm for integration tests
source: https://gitlab.alpinelinux.org/alpine/aports/-/merge_requests/26273
  • Loading branch information
6543 committed Jul 19, 2022
1 parent e930d66 commit 3e446f3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions integrations/git_helper_for_declarative_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@ func withKeyFile(t *testing.T, keyname string, callback func(string)) {
assert.NoError(t, err)

err = os.WriteFile(path.Join(tmpDir, "ssh"), []byte("#!/bin/bash\n"+
"ssh -o \"UserKnownHostsFile=/dev/null\" -o \"StrictHostKeyChecking=no\" -o \"IdentitiesOnly=yes\" -i \""+keyFile+"\" \"$@\""), 0o700)
"ssh -o \"UserKnownHostsFile=/dev/null\" -o \"StrictHostKeyChecking=no\" -o \"HostkeyAlgorithms=+ssh-rsa\" -o \"PubkeyAcceptedAlgorithms=+ssh-rsa\" -o \"IdentitiesOnly=yes\" -i \""+keyFile+"\" \"$@\""), 0o700)
assert.NoError(t, err)

// Setup ssh wrapper
os.Setenv("GIT_SSH", path.Join(tmpDir, "ssh"))
os.Setenv("GIT_SSH_COMMAND",
"ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o IdentitiesOnly=yes -i \""+keyFile+"\"")
"ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o IdentitiesOnly=yes -o HostkeyAlgorithms=+ssh-rsa -o PubkeyAcceptedAlgorithms=+ssh-rsa -i \""+keyFile+"\"")
os.Setenv("GIT_SSH_VARIANT", "ssh")

callback(keyFile)
Expand Down

0 comments on commit 3e446f3

Please sign in to comment.