Solve Git SSH Spring Cloud Config Server Configuration
3 September 2022 | 2 min read | spring git
Spring Cloud Config Server simplifies configuration management in distributed systems by centralizing and externalizing properties, enabling easy configuration for services and applications. It supports various backends such as Filesystem, Git, Vault, and JDBC, allowing flexible and combinable configuration approaches.
As I was making a Git backed configuration,
spring.cloud.config.server.git.uri=[email protected]:bishalx/spring-cloud-example-project01-configs.git
I encountered two issues:
-> RSA key with SHA-1, which is no longer allowed
-> invalid privatekey: [B@1324409e
issues.
While traversing the logs of the first issue RSA key with SHA-1, which is no longer allowed
I found this article Improving Git protocol security on GitHub and learn that, SHA-1 is weak, so Github has stopped allowing new RSA client keys to use SHA-1 signatures and require them to use SHA-2 signatures instead and it also highlights to use rsa-sha2-256
and rsa-sha2-512
which are supported by SHA-2 and for the second issue invalid privatekey: [B@1324409e
after googling I read this article JSch โ invalid privatekey exception found that JSch doesnโt support the RSA
private key.
To solve both the issues, I had to generate the ssh key and convert RSA
key to PEM
generate new ssh key
ssh-keygen -m pem -t ecdsa -b 521
After doing this, I added the new public key in the github and my spring-cloud-config project was able to fetch the properties from the git repository.
Cheers !!