Author: ammulder Date: Sat Aug 13 07:31:24 2005 New Revision: 232499 URL: http://svn.apache.org/viewcvs?rev=232499&view=rev Log: Add SSL properties for HTTPS connector configuration Make the Jetty HTTPS connector implement the SecureConnector management API - update the Jetty plan to adjust a couple property names accordingly Make the portlets aware of Tomcat (though the Tomcat container/connectors still don't implement the management API) Added: geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/view/webmanager/connector/editHTTPS.jsp (with props) geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/JettySecureConnector.java (with props) Modified: geronimo/trunk/applications/console-standard/project.xml geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/webmanager/ConnectorPortlet.java geronimo/trunk/modules/assembly/src/plan/jetty-config.xml geronimo/trunk/modules/j2ee/src/java/org/apache/geronimo/j2ee/management/geronimo/SecureConnector.java geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/connector/HTTPSConnector.java Modified: geronimo/trunk/applications/console-standard/project.xml URL: http://svn.apache.org/viewcvs/geronimo/trunk/applications/console-standard/project.xml?rev=232499&r1=232498&r2=232499&view=diff ============================================================================== --- geronimo/trunk/applications/console-standard/project.xml (original) +++ geronimo/trunk/applications/console-standard/project.xml Sat Aug 13 07:31:24 2005 @@ -35,6 +35,16 @@ geronimo-jetty ${pom.currentVersion} + + geronimo + geronimo-tomcat + ${pom.currentVersion} + + + geronimo + geronimo-webservices + ${pom.currentVersion} + geronimo geronimo-j2ee Modified: geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/webmanager/ConnectorPortlet.java URL: http://svn.apache.org/viewcvs/geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/webmanager/ConnectorPortlet.java?rev=232499&r1=232498&r2=232499&view=diff ============================================================================== --- geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/webmanager/ConnectorPortlet.java (original) +++ geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/webmanager/ConnectorPortlet.java Sat Aug 13 07:31:24 2005 @@ -36,9 +36,12 @@ import org.apache.geronimo.console.util.PortletManager; import org.apache.geronimo.j2ee.management.geronimo.WebContainer; import org.apache.geronimo.j2ee.management.geronimo.WebConnector; +import org.apache.geronimo.j2ee.management.geronimo.SecureConnector; import org.apache.geronimo.jetty.JettyContainer; import org.apache.geronimo.jetty.JettyWebConnector; +import org.apache.geronimo.jetty.JettySecureConnector; import org.apache.geronimo.kernel.proxy.GeronimoManagedBean; +import org.apache.geronimo.tomcat.TomcatContainer; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -61,6 +64,8 @@ String server = "generic"; if(container instanceof JettyContainer) { server = "jetty"; + } else if (container instanceof TomcatContainer) { + server = "tomcat"; } actionResponse.setRenderParameter("server", server); if(mode.equals("new")) { @@ -87,7 +92,23 @@ } } if(protocol.equals(WebContainer.PROTOCOL_HTTPS)) { - //todo: HTTPS values + String keystoreType = actionRequest.getParameter("keystoreType"); + String keystoreFile = actionRequest.getParameter("keystoreFile"); + String privateKeyPass = actionRequest.getParameter("privateKeyPassword"); + String keystorePass = actionRequest.getParameter("keystorePassword"); + String secureProtocol = actionRequest.getParameter("secureProtocol"); + String algorithm = actionRequest.getParameter("algorithm"); + boolean clientAuth = isValid(actionRequest.getParameter("clientAuth")); + SecureConnector secure = (SecureConnector) connector; + if(isValid(keystoreType)) {secure.setKeystoreType(keystoreType);} + if(isValid(keystoreFile)) {secure.setKeystoreFileName(keystoreFile);} + if(isValid(keystorePass)) {secure.setKeystorePassword(keystorePass);} + if(isValid(secureProtocol)) {secure.setSecureProtocol(secureProtocol);} + if(isValid(algorithm)) {secure.setAlgorithm(algorithm);} + secure.setClientAuthRequired(clientAuth); + if(secure instanceof JettySecureConnector) { + if(isValid(privateKeyPass)) {((JettySecureConnector)secure).setKeyPassword(privateKeyPass);} + } } // Start the connector try { @@ -123,6 +144,25 @@ ((JettyWebConnector)connector).setMinThreads(minThreads.intValue()); } } + if(connector instanceof SecureConnector) { + String keystoreType = actionRequest.getParameter("keystoreType"); + String keystoreFile = actionRequest.getParameter("keystoreFile"); + String privateKeyPass = actionRequest.getParameter("privateKeyPassword"); + String keystorePass = actionRequest.getParameter("keystorePassword"); + String secureProtocol = actionRequest.getParameter("secureProtocol"); + String algorithm = actionRequest.getParameter("algorithm"); + boolean clientAuth = isValid(actionRequest.getParameter("clientAuth")); + SecureConnector secure = (SecureConnector) connector; + if(isValid(keystoreType)) {secure.setKeystoreType(keystoreType);} + if(isValid(keystoreFile)) {secure.setKeystoreFileName(keystoreFile);} + if(isValid(keystorePass)) {secure.setKeystorePassword(keystorePass);} + if(isValid(secureProtocol)) {secure.setSecureProtocol(secureProtocol);} + if(isValid(algorithm)) {secure.setAlgorithm(algorithm);} + secure.setClientAuthRequired(clientAuth); + if(secure instanceof JettySecureConnector) { + if(isValid(privateKeyPass)) {((JettySecureConnector)secure).setKeyPassword(privateKeyPass);} + } + } } actionResponse.setRenderParameter("mode", "list"); } else if(mode.equals("start")) { @@ -243,6 +283,18 @@ renderRequest.setAttribute("minThreads", String.valueOf(minThreads)); } renderRequest.setAttribute("mode", "save"); + + if(connector instanceof SecureConnector) { + SecureConnector secure = (SecureConnector) connector; + renderRequest.setAttribute("keystoreFile",secure.getKeystoreFileName()); + renderRequest.setAttribute("keystoreType",secure.getKeystoreType()); + renderRequest.setAttribute("algorithm",secure.getAlgorithm()); + renderRequest.setAttribute("secureProtocol",secure.getSecureProtocol()); + if(secure.isClientAuthRequired()) { + renderRequest.setAttribute("clientAuth", Boolean.TRUE); + } + } + if(connector.getProtocol().equals(WebContainer.PROTOCOL_HTTPS)) { editHttpsView.include(renderRequest, renderResponse); } else { @@ -301,12 +353,16 @@ maximizedView = pc.getRequestDispatcher("/WEB-INF/view/webmanager/connector/maximized.jsp"); helpView = pc.getRequestDispatcher("/WEB-INF/view/webmanager/connector/help.jsp"); editHttpView = pc.getRequestDispatcher("/WEB-INF/view/webmanager/connector/editHTTP.jsp"); - editHttpsView = pc.getRequestDispatcher("/WEB-INF/view/webmanager/connector/editHTTP.jsp"); //todo: HTTPS args + editHttpsView = pc.getRequestDispatcher("/WEB-INF/view/webmanager/connector/editHTTPS.jsp"); } public void destroy() { normalView = null; maximizedView = null; super.destroy(); + } + + public final static boolean isValid(String s) { + return s != null && !s.equals(""); } } Added: geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/view/webmanager/connector/editHTTPS.jsp URL: http://svn.apache.org/viewcvs/geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/view/webmanager/connector/editHTTPS.jsp?rev=232499&view=auto ============================================================================== --- geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/view/webmanager/connector/editHTTPS.jsp (added) +++ geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/view/webmanager/connector/editHTTPS.jsp Sat Aug 13 07:31:24 2005 @@ -0,0 +1,197 @@ +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> +<%@ taglib prefix="portlet" uri="http://java.sun.com/portlet" %> + + +
+ + + + + + + +<%-- THIS PART SHOULD BE THE SAME AS THE HTTP CONNECTOR --%> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +<%-- END OF PART THAT SHOULD BE THE SAME AS THE HTTP CONNECTOR --%> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Unique Name:
A name that is different than the name for any other web connectors in the server (no spaces in the name please)
Host:
+ +
The host name or IP to bind to. The normal values are 0.0.0.0 (all interfaces) or localhost (local connections only)
Port:
+ +
The network port to bind to.
Min Threads:
+ +
The minimum number of threads this connector should use to handle incoming requests
Max Threads:
+ +
The maximum number of threads this connector should use to handle incoming requests
SSL Settings
Keystore File:
+ +
The file that holds the keystore (relative to the Geronimo install dir)
Change Keystore Password:
+ +
ChangeSet + the password used to access the keystore file. This is also the + password used to access the server private key within the keystore (so the two passwords must be + set to be the same on the keystore). Leave + this empty if you don't want to change the current password.
Change Server Key Password:
+ +
ChangeSet + the password used to access the private key in the keystore. Leave + this empty if you don't want to change the current password.
Keystore Type:
+ +
ChangeSet + the keystore type. There is normally no reason not to use the default (JKS).
HTTPS Algorithm:
+ +
ChangeSet + the HTTPS algorithm. This should normally be set to match the JVM vendor.
HTTPS Protocol:
+ +
ChangeSet + the HTTPS protocol. This should normally be set to TLS, though some (IBM) JVMs don't work properly + with popular browsers unless it is changed to SSL.
Client Auth Required:
+ CHECKED /> +
If set, then clients connecting through this connector must supply a valid client certificate. By default, the + validity is based on the CA certificates in the server keystore (need to confirm not the JVM default + trust keystore).
+
+List connectors \ No newline at end of file Propchange: geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/view/webmanager/connector/editHTTPS.jsp ------------------------------------------------------------------------------ svn:eol-style = native Modified: geronimo/trunk/modules/assembly/src/plan/jetty-config.xml URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/assembly/src/plan/jetty-config.xml?rev=232499&r1=232498&r2=232499&view=diff ============================================================================== --- geronimo/trunk/modules/assembly/src/plan/jetty-config.xml (original) +++ geronimo/trunk/modules/assembly/src/plan/jetty-config.xml Sat Aug 13 07:31:24 2005 @@ -51,11 +51,11 @@ ${PlanHTTPSPort} - var/security/keystore + var/security/keystore JKS - secret + secret secret - false + false TLS 50 10 Modified: geronimo/trunk/modules/j2ee/src/java/org/apache/geronimo/j2ee/management/geronimo/SecureConnector.java URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/j2ee/src/java/org/apache/geronimo/j2ee/management/geronimo/SecureConnector.java?rev=232499&r1=232498&r2=232499&view=diff ============================================================================== --- geronimo/trunk/modules/j2ee/src/java/org/apache/geronimo/j2ee/management/geronimo/SecureConnector.java (original) +++ geronimo/trunk/modules/j2ee/src/java/org/apache/geronimo/j2ee/management/geronimo/SecureConnector.java Sat Aug 13 07:31:24 2005 @@ -46,11 +46,6 @@ */ public void setKeystoreFileName(String name); /** - * Gets the password used to access the keystore, and by default, used to - * access the server private key inside the keystore. - */ - public String getKeystorePassword(); - /** * Sets the password used to access the keystore, and by default, used to * access the server private key inside the keystore. Not all connectors * support configuring different passwords for those two features; if so, @@ -119,6 +114,6 @@ */ public void setClientAuthRequired(boolean clientCert); - // Jetty: key password, integral/confidential separation + // Jetty: integral/confidential separation // Tomcat: trust keystore, trust password, trust keystore type, ciphers } Added: geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/JettySecureConnector.java URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/JettySecureConnector.java?rev=232499&view=auto ============================================================================== --- geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/JettySecureConnector.java (added) +++ geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/JettySecureConnector.java Sat Aug 13 07:31:24 2005 @@ -0,0 +1,30 @@ +/** + * + * Copyright 2003-2004 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.geronimo.jetty; + +import org.apache.geronimo.j2ee.management.geronimo.SecureConnector; + +/** + * @version $Rev: 46019 $ $Date: 2004-09-14 05:56:06 -0400 (Tue, 14 Sep 2004) $ + */ +public interface JettySecureConnector extends SecureConnector { + /** + * Sets the password used to access the server private key inside the + * keystore. + */ + public void setKeyPassword(String password); +} Propchange: geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/JettySecureConnector.java ------------------------------------------------------------------------------ svn:eol-style = native Modified: geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/connector/HTTPSConnector.java URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/connector/HTTPSConnector.java?rev=232499&r1=232498&r2=232499&view=diff ============================================================================== --- geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/connector/HTTPSConnector.java (original) +++ geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/connector/HTTPSConnector.java Sat Aug 13 07:31:24 2005 @@ -26,6 +26,7 @@ import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory; import org.apache.geronimo.j2ee.management.geronimo.WebContainer; import org.apache.geronimo.jetty.JettyContainer; +import org.apache.geronimo.jetty.JettySecureConnector; import org.apache.geronimo.system.serverinfo.ServerInfo; /** @@ -33,7 +34,7 @@ * * @version $Rev$ $Date$ */ -public class HTTPSConnector extends JettyConnector { +public class HTTPSConnector extends JettyConnector implements JettySecureConnector { private final SslListener https; private final ServerInfo serverInfo; private String keystore; @@ -49,12 +50,12 @@ return WebContainer.PROTOCOL_HTTPS; } - public String getKeystore() { + public String getKeystoreFileName() { // this does not delegate to https as it needs to be resolved against ServerInfo return keystore; } - public void setKeystore(String keystore) { + public void setKeystoreFileName(String keystore) { // this does not delegate to https as it needs to be resolved against ServerInfo this.keystore = keystore; } @@ -79,7 +80,7 @@ https.setAlgorithm(algorithm); } - public void setPassword(String password) { + public void setKeystorePassword(String password) { https.setPassword(password); } @@ -103,11 +104,11 @@ https.setKeystoreType(keystoreType); } - public void setNeedClientAuth(boolean needClientAuth) { + public void setClientAuthRequired(boolean needClientAuth) { https.setNeedClientAuth(needClientAuth); } - public boolean getNeedClientAuth() { + public boolean isClientAuthRequired() { return https.getNeedClientAuth(); } @@ -120,14 +121,15 @@ static { GBeanInfoBuilder infoFactory = new GBeanInfoBuilder("Jetty Connector HTTPS", HTTPSConnector.class, JettyConnector.GBEAN_INFO); - infoFactory.addAttribute("keystore", String.class, true); + infoFactory.addAttribute("keystoreFileName", String.class, true); infoFactory.addAttribute("algorithm", String.class, true); + infoFactory.addAttribute("keystorePassword", String.class, true); infoFactory.addAttribute("keyPassword", String.class, true); - infoFactory.addAttribute("keystoreType", String.class, true); - infoFactory.addAttribute("needClientAuth", boolean.class, true); - infoFactory.addAttribute("password", String.class, true); infoFactory.addAttribute("secureProtocol", String.class, true); + infoFactory.addAttribute("keystoreType", String.class, true); + infoFactory.addAttribute("clientAuthRequired", boolean.class, true); infoFactory.addReference("ServerInfo", ServerInfo.class, NameFactory.GERONIMO_SERVICE); + infoFactory.addInterface(JettySecureConnector.class); infoFactory.setConstructor(new String[]{"JettyContainer", "ServerInfo"}); GBEAN_INFO = infoFactory.getBeanInfo(); }