Merge branch 'stable-2.14'

* stable-2.14:
  Use account cache instead of ReviewDb in MailProcessor
  Change log message to reflect IMAP RFC
  Get rid of calls to SecurityUtils.isBouncyCastleRegistered()
  SshDaemon: Improve log message when formatting ssh host key fails

Change-Id: Ibbc3a1d32c7127335840233d66324fca7f664e12
This commit is contained in:
David Pursehouse
2017-05-08 23:09:23 +09:00
5 changed files with 100 additions and 154 deletions

View File

@@ -25,7 +25,6 @@ import java.util.ArrayList;
import java.util.List;
import org.apache.sshd.common.keyprovider.FileKeyPairProvider;
import org.apache.sshd.common.keyprovider.KeyPairProvider;
import org.apache.sshd.common.util.security.SecurityUtils;
import org.apache.sshd.server.keyprovider.SimpleGeneratorHostKeyProvider;
class HostKeyProvider implements Provider<KeyPairProvider> {
@@ -73,13 +72,6 @@ class HostKeyProvider implements Provider<KeyPairProvider> {
if (stdKeys.isEmpty()) {
throw new ProvisionException("No SSH keys under " + site.etc_dir);
}
if (!SecurityUtils.isBouncyCastleRegistered()) {
throw new ProvisionException(
"Bouncy Castle Crypto not installed;"
+ " needed to read server host keys: "
+ stdKeys
+ "");
}
FileKeyPairProvider kp = new FileKeyPairProvider();
kp.setFiles(stdKeys);
return kp;

View File

@@ -84,7 +84,6 @@ import org.apache.sshd.common.io.nio2.Nio2ServiceFactoryFactory;
import org.apache.sshd.common.kex.KeyExchange;
import org.apache.sshd.common.keyprovider.KeyPairProvider;
import org.apache.sshd.common.mac.Mac;
import org.apache.sshd.common.random.JceRandomFactory;
import org.apache.sshd.common.random.Random;
import org.apache.sshd.common.random.SingletonRandomFactory;
import org.apache.sshd.common.session.ConnectionService;
@@ -217,11 +216,7 @@ public class SshDaemon extends SshServer implements SshInfo, LifecycleListener {
? MinaServiceFactoryFactory.class.getName()
: Nio2ServiceFactoryFactory.class.getName());
if (SecurityUtils.isBouncyCastleRegistered()) {
initProviderBouncyCastle(cfg);
} else {
initProviderJce();
}
initProviderBouncyCastle(cfg);
initCiphers(cfg);
initKeyExchanges(cfg);
initMacs(cfg);
@@ -405,7 +400,9 @@ public class SshDaemon extends SshServer implements SshInfo, LifecycleListener {
try {
r.add(new HostKey(addr, keyBin));
} catch (JSchException e) {
sshDaemonLog.warn("Cannot format SSHD host key", e);
sshDaemonLog.warn(
String.format(
"Cannot format SSHD host key [%s]: %s", pub.getAlgorithm(), e.getMessage()));
}
}
}
@@ -524,10 +521,6 @@ public class SshDaemon extends SshServer implements SshInfo, LifecycleListener {
}
}
private void initProviderJce() {
setRandomFactory(new SingletonRandomFactory(JceRandomFactory.INSTANCE));
}
@SuppressWarnings("unchecked")
private void initCiphers(final Config cfg) {
final List<NamedFactory<Cipher>> a = BaseBuilder.setUpDefaultCiphers(true);