| | |
| | | |
| | | // 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"); |
| | |
| | | hostKeyPairProvider.setFiles(new String [] { rsaKeyStore.getPath(), dsaKeyStore.getPath(), dsaKeyStore.getPath() }); |
| | | |
| | | // Client public key authenticator |
| | | CachingPublicKeyAuthenticator keyAuthenticator = |
| | | new CachingPublicKeyAuthenticator(new FileBasedPubKeyAuth(gitblit.getPublicKeyManager(), gitblit)); |
| | | SshKeyAuthenticator keyAuthenticator = |
| | | new SshKeyAuthenticator(gitblit.getPublicKeyManager(), gitblit); |
| | | |
| | | // Configure the preferred SSHD backend |
| | | String sshBackendStr = settings.getString(Keys.git.sshBackend, |
| | |
| | | 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()); |