Commit 14fc54d6 authored by André Berenguel's avatar André Berenguel Committed by Guus der Kinderen

Reactivate self-signed certificates generation

parent e08055a5
...@@ -87,34 +87,27 @@ ...@@ -87,34 +87,27 @@
pageContext.setAttribute( "errors", errors ); pageContext.setAttribute( "errors", errors );
/**
if (generate) { if (generate) {
String domain = XMPPServer.getInstance().getServerInfo().getXMPPDomain(); String domain = XMPPServer.getInstance().getServerInfo().getXMPPDomain();
try { try {
if (errors.containsKey("ioerror") && keyStore == null) { if (errors.containsKey("ioerror") || !identityStore.containsDomainCertificate("DSA")) {
keyStore = sslConfig.initializeKeyStore(); identityStore.addSelfSignedDomainCertificate("DSA");
}
if (errors.containsKey("ioerror") || !CertificateManager.isDSACertificate(keyStore, domain)) {
CertificateManager
.createDSACert(keyStore, sslConfig.getKeyStorePassword(), domain + "_dsa", "cn=" + domain, "cn=" + domain, "*." + domain);
} }
if (errors.containsKey("ioerror") || !CertificateManager.isRSACertificate(keyStore, domain)) { if (errors.containsKey("ioerror") || !identityStore.containsDomainCertificate("RSA")) {
CertificateManager identityStore.addSelfSignedDomainCertificate("RSA");
.createRSACert(keyStore, sslConfig.getKeyStorePassword(), domain + "_rsa", "cn=" + domain, "cn=" + domain, "*." + domain);
} }
// Save new certificates into the key store // Save new certificates into the key store
sslConfig.saveStores(); identityStore.persist();
// Log the event // Log the event
webManager.logEvent("generated SSL self-signed certs", null); webManager.logEvent("generated SSL self-signed certs", null);
response.sendRedirect("security-keystore.jsp?connectivityType="+connectivityType); response.sendRedirect("security-keystore.jsp?connectionType="+connectionType);
return; return;
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
errors.put("generate", e.getMessage()); errors.put("generate", e.getMessage());
} }
} }
/*
if (importReply) { if (importReply) {
String reply = ParamUtils.getParameter(request, "reply"); String reply = ParamUtils.getParameter(request, "reply");
if (alias != null && reply != null && reply.trim().length() > 0) { if (alias != null && reply != null && reply.trim().length() > 0) {
...@@ -124,7 +117,7 @@ ...@@ -124,7 +117,7 @@
sslConfig.saveStores(); sslConfig.saveStores();
// Log the event // Log the event
webManager.logEvent( "imported SSL certificate with alias " + alias, null ); webManager.logEvent( "imported SSL certificate with alias " + alias, null );
response.sendRedirect("security-keystore.jsp?connectivityType="+connectivityType); response.sendRedirect("security-keystore.jsp?connectionType="+connectionType);
return; return;
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
......
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