Skip to content

Commit

Permalink
fix: do not use SHA1 with azure repos
Browse files Browse the repository at this point in the history
  • Loading branch information
malhussan committed Jun 18, 2024
1 parent 08f342d commit e17355e
Showing 1 changed file with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,17 @@ class CustomSshSessionFactory(
private val sshKey: String
) : JschConfigSessionFactory() {


override fun configure(hc: OpenSshConfig.Host, session: Session) {
session.setConfig("StrictHostKeyChecking", "no")

/*
Because of End of SSH-RSA support for Azure Repos (https://devblogs.microsoft.com/devops/ssh-rsa-deprecation/)
we need to explicitly put "ssh-rsa" last in the list in server_host_key so that it is not picked up first.
*/
session.setConfig("server_host_key",
session.getConfig("server_host_key").
split(",").partition { it == "ssh-rsa" }
.let { it.second + it.first }.joinToString(","))
}

@Throws(JSchException::class)
Expand All @@ -31,4 +39,4 @@ class CustomSshSessionFactory(
jsch.addIdentity(keyPath)
return jsch
}
}
}

0 comments on commit e17355e

Please sign in to comment.