Skip to content

Commit e17355e

Browse files
committed
fix: do not use SHA1 with azure repos
1 parent 08f342d commit e17355e

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/main/kotlin/io/meshcloud/dockerosb/config/CustomSshSessionFactory.kt

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,17 @@ class CustomSshSessionFactory(
1313
private val sshKey: String
1414
) : JschConfigSessionFactory() {
1515

16-
1716
override fun configure(hc: OpenSshConfig.Host, session: Session) {
1817
session.setConfig("StrictHostKeyChecking", "no")
18+
19+
/*
20+
Because of End of SSH-RSA support for Azure Repos (https://devblogs.microsoft.com/devops/ssh-rsa-deprecation/)
21+
we need to explicitly put "ssh-rsa" last in the list in server_host_key so that it is not picked up first.
22+
*/
23+
session.setConfig("server_host_key",
24+
session.getConfig("server_host_key").
25+
split(",").partition { it == "ssh-rsa" }
26+
.let { it.second + it.first }.joinToString(","))
1927
}
2028

2129
@Throws(JSchException::class)
@@ -31,4 +39,4 @@ class CustomSshSessionFactory(
3139
jsch.addIdentity(keyPath)
3240
return jsch
3341
}
34-
}
42+
}

0 commit comments

Comments
 (0)