| | |
| | | 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; |
| | | } |