From d49ab99ef5820e511fd3edbd5e96de96b804fad2 Mon Sep 17 00:00:00 2001
From: James Moger <james.moger@gitblit.com>
Date: Thu, 12 Mar 2015 17:59:46 -0400
Subject: [PATCH] Update Jetty to 9.2.10
---
src/main/java/com/gitblit/transport/ssh/SshDaemon.java | 19 ++++++++++++-------
1 files changed, 12 insertions(+), 7 deletions(-)
diff --git a/src/main/java/com/gitblit/transport/ssh/SshDaemon.java b/src/main/java/com/gitblit/transport/ssh/SshDaemon.java
index 4d64cfb..9667154 100644
--- a/src/main/java/com/gitblit/transport/ssh/SshDaemon.java
+++ b/src/main/java/com/gitblit/transport/ssh/SshDaemon.java
@@ -31,6 +31,7 @@
import org.apache.sshd.common.io.nio2.Nio2ServiceFactoryFactory;
import org.apache.sshd.common.keyprovider.FileKeyPairProvider;
import org.apache.sshd.common.util.SecurityUtils;
+import org.apache.sshd.server.auth.CachingPublicKeyAuthenticator;
import org.bouncycastle.openssl.PEMWriter;
import org.eclipse.jgit.internal.JGitText;
import org.slf4j.Logger;
@@ -41,9 +42,9 @@
import com.gitblit.Keys;
import com.gitblit.manager.IGitblit;
import com.gitblit.transport.ssh.commands.SshCommandFactory;
-import com.gitblit.utils.IdGenerator;
import com.gitblit.utils.JnaUtils;
import com.gitblit.utils.StringUtils;
+import com.gitblit.utils.WorkQueue;
import com.google.common.io.Files;
/**
@@ -76,14 +77,18 @@
* Construct the Gitblit SSH daemon.
*
* @param gitblit
+ * @param workQueue
*/
- public SshDaemon(IGitblit gitblit, IdGenerator idGenerator) {
+ public SshDaemon(IGitblit gitblit, WorkQueue workQueue) {
this.gitblit = gitblit;
IStoredSettings settings = gitblit.getSettings();
// Ensure that Bouncy Castle is our JCE provider
SecurityUtils.setRegisterBouncyCastle(true);
+ if (SecurityUtils.isBouncyCastleRegistered()) {
+ log.debug("BouncyCastle is registered as a JCE provider");
+ }
// Generate host RSA and DSA keypairs and create the host keypair provider
File rsaKeyStore = new File(gitblit.getBaseFolder(), "ssh-rsa-hostkey.pem");
@@ -94,8 +99,8 @@
hostKeyPairProvider.setFiles(new String [] { rsaKeyStore.getPath(), dsaKeyStore.getPath(), dsaKeyStore.getPath() });
// Client public key authenticator
- CachingPublicKeyAuthenticator keyAuthenticator =
- new CachingPublicKeyAuthenticator(gitblit.getPublicKeyManager(), gitblit);
+ SshKeyAuthenticator keyAuthenticator =
+ new SshKeyAuthenticator(gitblit.getPublicKeyManager(), gitblit);
// Configure the preferred SSHD backend
String sshBackendStr = settings.getString(Keys.git.sshBackend,
@@ -121,12 +126,12 @@
sshd.setPort(addr.getPort());
sshd.setHost(addr.getHostName());
sshd.setKeyPairProvider(hostKeyPairProvider);
- sshd.setPublickeyAuthenticator(keyAuthenticator);
+ sshd.setPublickeyAuthenticator(new CachingPublicKeyAuthenticator(keyAuthenticator));
sshd.setPasswordAuthenticator(new UsernamePasswordAuthenticator(gitblit));
sshd.setSessionFactory(new SshServerSessionFactory());
sshd.setFileSystemFactory(new DisabledFilesystemFactory());
sshd.setTcpipForwardingFilter(new NonForwardingFilter());
- sshd.setCommandFactory(new SshCommandFactory(gitblit, idGenerator));
+ sshd.setCommandFactory(new SshCommandFactory(gitblit, workQueue));
sshd.setShellFactory(new WelcomeShell(settings));
// Set the server id. This can be queried with:
@@ -141,7 +146,7 @@
public String formatUrl(String gituser, String servername, String repository) {
if (sshd.getPort() == DEFAULT_PORT) {
// standard port
- return MessageFormat.format("{0}@{1}/{2}", gituser, servername,
+ return MessageFormat.format("ssh://{0}@{1}/{2}", gituser, servername,
repository);
} else {
// non-standard port
--
Gitblit v1.9.1