Commit 8d0a7c85 authored by Gaston Dombiak's avatar Gaston Dombiak Committed by gato

Start admin console and http binding even with invalid certificates. JM-968

git-svn-id: http://svn.igniterealtime.org/svn/repos/wildfire/trunk@7056 b35dd754-fafc-0310-a699-88a17e54d16e
parent f9a11dad
...@@ -278,7 +278,7 @@ public class CertificateManager { ...@@ -278,7 +278,7 @@ public class CertificateManager {
* Returns true if a certificate with the specifed configuration was found in the key store. * Returns true if a certificate with the specifed configuration was found in the key store.
* *
* @param ksKeys the keystore to use for searching the certificate. * @param ksKeys the keystore to use for searching the certificate.
* @param domain the domain present in the subjectAltName. * @param domain the domain present in the subjectAltName or "*" if anything is accepted.
* @param algorithm the DSA or RSA algorithm used by the certificate. * @param algorithm the DSA or RSA algorithm used by the certificate.
* @return true if a certificate with the specifed configuration was found in the key store. * @return true if a certificate with the specifed configuration was found in the key store.
* @throws KeyStoreException * @throws KeyStoreException
...@@ -286,11 +286,20 @@ public class CertificateManager { ...@@ -286,11 +286,20 @@ public class CertificateManager {
private static boolean isCertificate(KeyStore ksKeys, String domain, String algorithm) throws KeyStoreException { private static boolean isCertificate(KeyStore ksKeys, String domain, String algorithm) throws KeyStoreException {
for (Enumeration<String> aliases = ksKeys.aliases(); aliases.hasMoreElements();) { for (Enumeration<String> aliases = ksKeys.aliases(); aliases.hasMoreElements();) {
X509Certificate certificate = (X509Certificate) ksKeys.getCertificate(aliases.nextElement()); X509Certificate certificate = (X509Certificate) ksKeys.getCertificate(aliases.nextElement());
for (String identity : getPeerIdentities(certificate)) { if ("*".equals(domain)) {
if (identity.endsWith(domain) && certificate.getPublicKey().getAlgorithm().equals(algorithm)) { // Any domain certified by the certificate is accepted
if (certificate.getPublicKey().getAlgorithm().equals(algorithm)) {
return true; return true;
} }
} }
else {
// Only accept certified domains that match the specified domain
for (String identity : getPeerIdentities(certificate)) {
if (identity.endsWith(domain) && certificate.getPublicKey().getAlgorithm().equals(algorithm)) {
return true;
}
}
}
} }
return false; return false;
} }
......
...@@ -92,9 +92,13 @@ public class AdminConsolePlugin implements Plugin { ...@@ -92,9 +92,13 @@ public class AdminConsolePlugin implements Plugin {
// Create a connector for https traffic if it's enabled. // Create a connector for https traffic if it's enabled.
try { try {
if (adminSecurePort > 0 && CertificateManager.isRSACertificate(SSLConfig.getKeyStore(), if (adminSecurePort > 0 && CertificateManager.isRSACertificate(SSLConfig.getKeyStore(), "*"))
XMPPServer.getInstance().getServerInfo().getName()))
{ {
if (!CertificateManager.isRSACertificate(SSLConfig.getKeyStore(),
XMPPServer.getInstance().getServerInfo().getName())) {
Log.warn("Admin console: Using RSA certificates but they are not valid for the hosted domain");
}
JiveSslConnector httpsConnector = new JiveSslConnector(); JiveSslConnector httpsConnector = new JiveSslConnector();
String interfaceName = JiveGlobals.getXMLProperty("network.interface"); String interfaceName = JiveGlobals.getXMLProperty("network.interface");
String bindInterface = null; String bindInterface = null;
......
...@@ -129,8 +129,12 @@ public final class HttpBindManager { ...@@ -129,8 +129,12 @@ public final class HttpBindManager {
private Connector createSSLConnector(int securePort) { private Connector createSSLConnector(int securePort) {
try { try {
if (securePort > 0 && CertificateManager.isRSACertificate(SSLConfig.getKeyStore(), if (securePort > 0 && CertificateManager.isRSACertificate(SSLConfig.getKeyStore(), "*")) {
XMPPServer.getInstance().getServerInfo().getName())) { if (!CertificateManager.isRSACertificate(SSLConfig.getKeyStore(),
XMPPServer.getInstance().getServerInfo().getName())) {
Log.warn("HTTP binding: Using RSA certificates but they are not valid for the hosted domain");
}
SslSocketConnector sslConnector = new JiveSslConnector(); SslSocketConnector sslConnector = new JiveSslConnector();
sslConnector.setHost(getBindInterface()); sslConnector.setHost(getBindInterface());
sslConnector.setPort(securePort); sslConnector.setPort(securePort);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment