# This may be useful in complex forwarding setups.
#
# SINCE 1.7.0
-git.sshDisplayHost =
+git.sshAdvertisedHost =
# Manually specify the port to use in advertised SSH repository urls.
# This may be useful in complex forwarding setups.
#
# SINCE 1.7.0
-git.sshDisplayPort =
+git.sshAdvertisedPort =
# Specify the SSH key manager to use for retrieving, storing, and removing
# SSH keys.
import java.net.URL;\r
import java.text.MessageFormat;\r
\r
-import com.google.inject.Inject;\r
-import com.google.inject.Singleton;\r
import javax.servlet.ServletException;\r
import javax.servlet.http.HttpServlet;\r
import javax.servlet.http.HttpServletRequest;\r
import com.gitblit.models.RepositoryModel;\r
import com.gitblit.models.UserModel;\r
import com.gitblit.utils.StringUtils;\r
+import com.google.inject.Inject;\r
+import com.google.inject.Singleton;\r
\r
/**\r
* Handles requests for Sparkleshare Invites\r
response.getWriter().append("SSH is not active on this server!");\r
return;\r
}\r
- int sshDisplayPort = settings.getInteger(Keys.git.sshDisplayPort, sshPort);\r
+ int sshDisplayPort = settings.getInteger(Keys.git.sshAdvertisedPort, sshPort);\r
\r
// extract repo name from request\r
String repoUrl = request.getPathInfo().substring(1);\r
if (!StringUtils.isEmpty(url) && url.indexOf("localhost") == -1) {\r
host = new URL(url).getHost();\r
}\r
- String sshDisplayHost = settings.getString(Keys.git.sshDisplayHost, "");\r
+ String sshDisplayHost = settings.getString(Keys.git.sshAdvertisedHost, "");\r
if(sshDisplayHost.isEmpty()) {\r
sshDisplayHost = host;\r
}\r
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.apache.sshd.server.UserAuth;
+import org.apache.sshd.server.auth.CachingPublicKeyAuthenticator;
import org.apache.sshd.server.auth.UserAuthKeyboardInteractive;
import org.apache.sshd.server.auth.UserAuthPassword;
import org.apache.sshd.server.auth.UserAuthPublicKey;
} else {
addr = new InetSocketAddress(bindInterface, port);
}
-
+
//Will do GSS ?
GSSAuthenticator gssAuthenticator = null;
if(settings.getBoolean(Keys.git.sshWithKrb5, false)) {
"");
if(! servicePrincipalName.isEmpty()) {
gssAuthenticator.setServicePrincipalName(servicePrincipalName);
- }
+ }
}
-
+
//Sort the authenticators for sshd
List<NamedFactory<UserAuth>> userAuthFactories = new ArrayList<>();
String sshAuthenticatorsOrderString = settings.getString(Keys.git.sshAuthenticatorsOrder,
switch (authenticatorName) {
case "gssapi-with-mic":
if(gssAuthenticator != null) {
- userAuthFactories.add(new UserAuthGSS.Factory());
+ userAuthFactories.add(new UserAuthGSS.Factory());
}
break;
case "publickey":
log.error("Unknown ssh authenticator: '{}'", authenticatorName);
}
}
-
+
// Create the SSH server
sshd = SshServer.setUpDefaultServer();
sshd.setPort(addr.getPort());
IStoredSettings settings = gitblit.getSettings();
int port = sshd.getPort();
- int displayPort = settings.getInteger(Keys.git.sshDisplayPort, port);
- String displayServername = settings.getString(Keys.git.sshDisplayHost, "");
+ int displayPort = settings.getInteger(Keys.git.sshAdvertisedPort, port);
+ String displayServername = settings.getString(Keys.git.sshAdvertisedHost, "");
if(displayServername.isEmpty()) {
displayServername = servername;
}
}
private String formatUrl(String hostname, int port, String username) {
- int displayPort = settings.getInteger(Keys.git.sshDisplayPort, port);
- String displayHostname = settings.getString(Keys.git.sshDisplayHost, "");
+ int displayPort = settings.getInteger(Keys.git.sshAdvertisedPort, port);
+ String displayHostname = settings.getString(Keys.git.sshAdvertisedHost, "");
if(displayHostname.isEmpty()) {
displayHostname = hostname;
}
*/
package com.gitblit.transport.ssh.commands;
-import com.gitblit.IStoredSettings;
import java.io.IOException;
import java.io.PrintWriter;
import java.net.MalformedURLException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import com.gitblit.IStoredSettings;
import com.gitblit.Keys;
import com.gitblit.manager.IGitblit;
import com.gitblit.utils.StringUtils;
protected String getRepositoryUrl(String repository) {
String username = getContext().getClient().getUsername();
IStoredSettings settings = getContext().getGitblit().getSettings();
- String displayHostname = settings.getString(Keys.git.sshDisplayHost, "");
+ String displayHostname = settings.getString(Keys.git.sshAdvertisedHost, "");
if(displayHostname.isEmpty()) {
displayHostname = getHostname();
}
int port = settings.getInteger(Keys.git.sshPort, 0);
- int displayPort = settings.getInteger(Keys.git.sshDisplayPort, port);
+ int displayPort = settings.getInteger(Keys.git.sshAdvertisedPort, port);
if (displayPort == 22) {
// standard port
return MessageFormat.format("{0}@{1}/{2}.git", username, displayHostname, repository);