diff --git a/jgit-dependency.xml b/jgit-dependency.xml
new file mode 100644
index 00000000..fec5c57e
--- /dev/null
+++ b/jgit-dependency.xml
@@ -0,0 +1,6 @@
+
+ org.eclipse.jgit
+ org.eclipse.jgit
+ 5.13.1.202206130422-r
+ runtime
+
diff --git a/pom.xml b/pom.xml
index 1183c1fe..db53114e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -50,6 +50,7 @@
2.7.3
0.22.0
1.5.2.Final
+ 5.13.1.202206130422-r
3.2.0
3.12.1
@@ -79,6 +80,7 @@
1.1.0
3.9.1.2184
+ 2021.0.8
@@ -90,6 +92,21 @@
pom
import
+
+ org.springframework.cloud
+ spring-cloud-context
+ 3.1.8
+
+
+ org.springframework.cloud
+ spring-cloud-config-server
+ 3.1.8
+
+
+ org.springframework.cloud
+ spring-cloud-starter-config
+ 3.1.8
+
@@ -253,6 +270,21 @@
org.springframework.cloud
spring-cloud-config-server
+
+ org.eclipse.jgit
+ org.eclipse.jgit
+ ${jgit.version}
+
+
+ org.eclipse.jgit
+ org.eclipse.jgit.http.apache
+ ${jgit.version}
+
+
+ org.eclipse.jgit
+ org.eclipse.jgit.ssh.apache
+ ${jgit.version}
+
io.micrometer
micrometer-registry-prometheus
diff --git a/src/main/java/tech/jhipster/registry/config/JGitSshConfiguration.java b/src/main/java/tech/jhipster/registry/config/JGitSshConfiguration.java
new file mode 100644
index 00000000..c9bef78f
--- /dev/null
+++ b/src/main/java/tech/jhipster/registry/config/JGitSshConfiguration.java
@@ -0,0 +1,45 @@
+package tech.jhipster.registry.config;
+
+import javax.annotation.PostConstruct;
+import javax.annotation.PreDestroy;
+import org.eclipse.jgit.transport.SshSessionFactory;
+import org.eclipse.jgit.transport.sshd.DefaultProxyDataFactory;
+import org.eclipse.jgit.transport.sshd.JGitKeyCache;
+import org.eclipse.jgit.transport.sshd.KeyCache;
+import org.eclipse.jgit.transport.sshd.SshdSessionFactory;
+import org.eclipse.jgit.transport.sshd.SshdSessionFactoryBuilder;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.context.annotation.Configuration;
+
+/**
+ * Configures JGit to use the Apache MINA based SSH implementation so modern key algorithms are supported.
+ */
+@Configuration
+public class JGitSshConfiguration {
+
+ private static final Logger log = LoggerFactory.getLogger(JGitSshConfiguration.class);
+
+ private final KeyCache keyCache = new JGitKeyCache();
+
+ @PostConstruct
+ void configureSshClient() {
+ SshSessionFactory currentFactory = SshSessionFactory.getInstance();
+ if (currentFactory instanceof SshdSessionFactory) {
+ log.debug("JGit already uses Apache MINA SSHD session factory");
+ return;
+ }
+
+ SshdSessionFactory sshdSessionFactory = new SshdSessionFactoryBuilder()
+ .setProxyDataFactory(new DefaultProxyDataFactory())
+ .build(keyCache);
+
+ SshSessionFactory.setInstance(sshdSessionFactory);
+ log.info("Configured JGit to use Apache MINA SSHD for SSH connections");
+ }
+
+ @PreDestroy
+ void shutdownSshClient() {
+ keyCache.close();
+ }
+}