-
-
Notifications
You must be signed in to change notification settings - Fork 643
fix(ssh): add support for modern SSH key algorithms #608
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
4af2be1
fix(ssh): add support for modern SSH key algorithms
alexlukic 4f682c9
Fix indentation in pom.xml by running autoformat with VS Code Extensi…
alexlukic b59f00e
Revert "Fix indentation in pom.xml by running autoformat with VS Code…
alexlukic ba73c99
Fix indent in pom.xml
alexlukic 6594433
Revert .dockerignore to origin/main state
alexlukic 296dfd1
Remove Dockerfile from PR
alexlukic File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,2 @@ | ||
| target | ||
| #target | ||
| node_modules | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| FROM eclipse-temurin:11-jre-focal | ||
| VOLUME /tmp | ||
| COPY target/*.jar app.jar | ||
| ENTRYPOINT ["java","-jar","/app.jar"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| <dependency> | ||
| <groupId>org.eclipse.jgit</groupId> | ||
| <artifactId>org.eclipse.jgit</artifactId> | ||
| <version>5.13.1.202206130422-r</version> | ||
| <scope>runtime</scope> | ||
| </dependency> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
src/main/java/tech/jhipster/registry/config/JGitSshConfiguration.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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(); | ||
| } | ||
| } |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be reverted?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi,
About the Dockerfile and .dockerignore adjustments:
The change in .dockerignore was needed only so the newly created Dockerfile could successfully build the test Docker image. I used that image in my own ECS development cluster to verify the new JHipster Registry version.
If this extra Dockerfile is not required in your official build process, then both the .dockerignore change can be reverted and the Dockerfile itself can be removed, since you will anyway be building and publishing the official image to DockerHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reverted .dockerignore and removed Dockerfile form commit. Like it was before...