Renamed ssh.Display(Host|Port) to ssh.Advertised(Host|Port)
| | |
| | | # 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;
|
| | | import java.text.MessageFormat;
|
| | |
|
| | | import com.google.inject.Inject;
|
| | | import com.google.inject.Singleton;
|
| | | import javax.servlet.ServletException;
|
| | | import javax.servlet.http.HttpServlet;
|
| | | import javax.servlet.http.HttpServletRequest;
|
| | |
| | | import com.gitblit.models.RepositoryModel;
|
| | | import com.gitblit.models.UserModel;
|
| | | import com.gitblit.utils.StringUtils;
|
| | | import com.google.inject.Inject;
|
| | | import com.google.inject.Singleton;
|
| | |
|
| | | /**
|
| | | * Handles requests for Sparkleshare Invites
|
| | |
| | | response.getWriter().append("SSH is not active on this server!");
|
| | | return;
|
| | | }
|
| | | int sshDisplayPort = settings.getInteger(Keys.git.sshDisplayPort, sshPort);
|
| | | int sshDisplayPort = settings.getInteger(Keys.git.sshAdvertisedPort, sshPort);
|
| | |
|
| | | // extract repo name from request
|
| | | String repoUrl = request.getPathInfo().substring(1);
|
| | |
| | | if (!StringUtils.isEmpty(url) && url.indexOf("localhost") == -1) {
|
| | | host = new URL(url).getHost();
|
| | | }
|
| | | String sshDisplayHost = settings.getString(Keys.git.sshDisplayHost, "");
|
| | | String sshDisplayHost = settings.getString(Keys.git.sshAdvertisedHost, "");
|
| | | if(sshDisplayHost.isEmpty()) {
|
| | | sshDisplayHost = host;
|
| | | }
|
| | |
| | | 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; |
| | |
| | | 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); |