From 1778663d7c842b93c117438da56f827c73a2c56f Mon Sep 17 00:00:00 2001 From: Arek Rus <57007917+r-arek@users.noreply.github.com> Date: Fri, 24 Mar 2023 10:18:07 +0100 Subject: [PATCH 1/4] Update ssh_key.rb --- lib/travis/vcs/git/ssh_key.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/travis/vcs/git/ssh_key.rb b/lib/travis/vcs/git/ssh_key.rb index 1941f962bc..144557aba0 100644 --- a/lib/travis/vcs/git/ssh_key.rb +++ b/lib/travis/vcs/git/ssh_key.rb @@ -12,6 +12,7 @@ def apply sh.chmod 600, '~/.ssh/id_rsa', echo: false sh.raw 'eval `ssh-agent` &> /dev/null' sh.raw 'ssh-add ~/.ssh/id_rsa &> /dev/null' + sh.raw 'ssh-keygen -R github.com' # BatchMode - If set to 'yes', passphrase/password querying will be disabled. # TODO ... how to solve StrictHostKeyChecking correctly? deploy a known_hosts file? From 5590e8bf8ed546bbc0ce7f109f3568e73e6d48c6 Mon Sep 17 00:00:00 2001 From: Arek Rus <57007917+r-arek@users.noreply.github.com> Date: Fri, 24 Mar 2023 10:28:19 +0100 Subject: [PATCH 2/4] Update ssh_key.rb --- lib/travis/vcs/git/ssh_key.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/travis/vcs/git/ssh_key.rb b/lib/travis/vcs/git/ssh_key.rb index 144557aba0..69e3d3ebbf 100644 --- a/lib/travis/vcs/git/ssh_key.rb +++ b/lib/travis/vcs/git/ssh_key.rb @@ -13,6 +13,7 @@ def apply sh.raw 'eval `ssh-agent` &> /dev/null' sh.raw 'ssh-add ~/.ssh/id_rsa &> /dev/null' sh.raw 'ssh-keygen -R github.com' + sh.raw 'curl -L https://api.github.com/meta | jq -r ".ssh_keys | .[]" | sed -e "s/^/github.com /" >> ~/.ssh/known_hosts' # BatchMode - If set to 'yes', passphrase/password querying will be disabled. # TODO ... how to solve StrictHostKeyChecking correctly? deploy a known_hosts file? From 241491a181e8c5ba97787e688bacccd28640a3d2 Mon Sep 17 00:00:00 2001 From: Arek Rus <57007917+r-arek@users.noreply.github.com> Date: Fri, 24 Mar 2023 10:47:09 +0100 Subject: [PATCH 3/4] Update ssh_key.rb --- lib/travis/vcs/git/ssh_key.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/travis/vcs/git/ssh_key.rb b/lib/travis/vcs/git/ssh_key.rb index 69e3d3ebbf..227bd77b74 100644 --- a/lib/travis/vcs/git/ssh_key.rb +++ b/lib/travis/vcs/git/ssh_key.rb @@ -17,7 +17,7 @@ def apply # BatchMode - If set to 'yes', passphrase/password querying will be disabled. # TODO ... how to solve StrictHostKeyChecking correctly? deploy a known_hosts file? - sh.file '~/.ssh/config', "Host #{data.source_host}\n\tBatchMode yes\n\tStrictHostKeyChecking no\n", append: true + sh.file '~/.ssh/config', "Host #{data.source_host}\n\tBatchMode yes\n", append: true end private From cd395c7c5c088ef060b6d6511133e1b345adb7c0 Mon Sep 17 00:00:00 2001 From: Arek Rus <57007917+r-arek@users.noreply.github.com> Date: Fri, 24 Mar 2023 11:07:08 +0100 Subject: [PATCH 4/4] Update travis_disable_ssh_roaming.bash --- lib/travis/build/bash/travis_disable_ssh_roaming.bash | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/travis/build/bash/travis_disable_ssh_roaming.bash b/lib/travis/build/bash/travis_disable_ssh_roaming.bash index af1c5c8ffd..30bf91579d 100644 --- a/lib/travis/build/bash/travis_disable_ssh_roaming.bash +++ b/lib/travis/build/bash/travis_disable_ssh_roaming.bash @@ -2,6 +2,8 @@ travis_disable_ssh_roaming() { mkdir -p "${TRAVIS_HOME}/.ssh" chmod 0700 "${TRAVIS_HOME}/.ssh" touch "${TRAVIS_HOME}/.ssh/config" + ssh-keygen -R github.com + curl -L https://api.github.com/meta | jq -r ".ssh_keys | .[]" | sed -e "s/^/github.com /" >> ~/.ssh/known_hosts echo -e "Host *\\n UseRoaming no\\n" | cat - "${TRAVIS_HOME}/.ssh/config" >"${TRAVIS_HOME}/.ssh/config.tmp" && mv "${TRAVIS_HOME}/.ssh/config.tmp" "${TRAVIS_HOME}/.ssh/config"