Skip to content

Commit

Permalink
Setup maven profiles so we can switch between versions of tomcat.
Browse files Browse the repository at this point in the history
  • Loading branch information
bbockelm committed Oct 23, 2012
1 parent 597e3ac commit 0b32a26
Show file tree
Hide file tree
Showing 4 changed files with 271 additions and 25 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ target
test-output
*.iml
*.rej
*.patch
*.diff
*.orig
.idea
Expand Down
150 changes: 126 additions & 24 deletions ssl-proxies-tomcat/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,31 +8,133 @@
<modelVersion>4.0.0</modelVersion>
<artifactId>ssl-proxies-tomcat</artifactId>
<name>SSL and proxy certificate support for Tomcat</name>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
<profiles>
<profile>
<id>tomcat7</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-patch-plugin</artifactId>
<version>1.1.1</version>
<configuration>
<patches>
<patch>jglobus-tomcat7.patch</patch>
</patches>
<strip>5</strip>
</configuration>
<executions>
<execution>
<id>patch</id>
<phase>process-sources</phase>
<goals>
<goal>apply</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-catalina</artifactId>
<version>7.0.32</version>
</dependency>
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-coyote</artifactId>
<version>7.0.32</version>
</dependency>
</dependencies>
</profile>
<profile>
<id>tomcat6</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-catalina</artifactId>
<version>6.0.24</version>
</dependency>
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-coyote</artifactId>
<version>6.0.24</version>
</dependency>
</dependencies>
</profile>
<profile>
<id>tomcat5</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-patch-plugin</artifactId>
<version>1.1.1</version>
<configuration>
<patches>
<patch>jglobus-tomcat5.patch</patch>
</patches>
<strip>5</strip>
</configuration>
<executions>
<execution>
<id>patch</id>
<phase>process-sources</phase>
<goals>
<goal>apply</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>tomcat</groupId>
<artifactId>catalina</artifactId>
<version>5.5.23</version>
</dependency>
<dependency>
<groupId>tomcat</groupId>
<artifactId>tomcat-coyote</artifactId>
<version>5.5.23</version>
</dependency>
</dependencies>
</profile>
</profiles>
<dependencies>
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-catalina</artifactId>
<version>6.0.24</version>
</dependency>
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-coyote</artifactId>
<version>6.0.24</version>
</dependency>
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcprov-jdk16</artifactId>
Expand Down
64 changes: 64 additions & 0 deletions ssl-proxies-tomcat/src/main/patches/jglobus-tomcat5.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
diff -ur jglobus-2.0.4.orig/ssl-proxies-tomcat/src/main/java/org/globus/gsi/tomcat/GlobusSSLSocketFactory.java jglobus-2.0.4/ssl-proxies-tomcat/src/main/java/org/globus/gsi/tomcat/GlobusSSLSocketFactory.java
--- jglobus-2.0.4.orig/ssl-proxies-tomcat/src/main/java/org/globus/gsi/tomcat/GlobusSSLSocketFactory.java 2011-07-29 04:41:20.000000000 +0200
+++ jglobus-2.0.4/ssl-proxies-tomcat/src/main/java/org/globus/gsi/tomcat/GlobusSSLSocketFactory.java 2012-09-30 06:47:06.452646206 +0200
@@ -15,7 +15,7 @@

package org.globus.gsi.tomcat;

-import org.apache.tomcat.util.net.jsse.JSSESocketFactory;
+import org.apache.tomcat.util.net.jsse.JSSE14SocketFactory;
import org.globus.gsi.X509ProxyCertPathParameters;
import org.globus.gsi.jsse.GlobusSSLHelper;
import org.globus.gsi.provider.GlobusProvider;
@@ -39,50 +39,13 @@
* @version 1.0
* @since 1.0
*/
-public class GlobusSSLSocketFactory extends JSSESocketFactory {
+public class GlobusSSLSocketFactory extends JSSE14SocketFactory {

static {
Security.addProvider(new GlobusProvider());
}


-
- /**
- * Create a Globus trust manager which supports proxy certificates. This requires that the CRL store, and
- * signing policy store be configured.
- *
- * @param keystoreType The type of keystore to create.
- * @param keystoreProvider The keystore provider to use.
- * @param algorithm The keystore algorithm.
- * @return A set of configured TrustManagers.
- * @throws Exception If we cannot create the trust managers.
- */
- @Override
- protected TrustManager[] getTrustManagers(String keystoreType, String keystoreProvider, String algorithm)
- throws Exception {
- KeyStore trustStore = getTrustStore(keystoreType, keystoreProvider);
- CertStore crlStore = null;
- Object crlLocation = attributes.get("crlLocation");
- if (crlLocation != null) {
- crlStore = GlobusSSLHelper.findCRLStore((String) attributes.get("crlLocation"));
- }
- Object signingPolicyLocation = attributes.get("signingPolicyLocation");
- ResourceSigningPolicyStore policyStore = null;
- if (signingPolicyLocation != null) {
- policyStore = new ResourceSigningPolicyStore(
- new ResourceSigningPolicyStoreParameters(attributes.get("signingPolicyLocation").toString()));
- }
- Object rejectLimitedProxyEntry = attributes.get("rejectLimitedProxy");
-
- boolean rejectLimitedProxy = rejectLimitedProxyEntry != null &&
- Boolean.parseBoolean(attributes.get("rejectLimitedProxy").toString());
- X509ProxyCertPathParameters parameters = new X509ProxyCertPathParameters(trustStore, crlStore, policyStore,
- rejectLimitedProxy);
- TrustManager trustManager = new PKITrustManager(new X509ProxyCertPathValidator(), parameters);
- return new TrustManager[]{trustManager};
- }
-
-
@Override
protected Object clone() throws CloneNotSupportedException {
// TODO Auto-generated method stub
81 changes: 81 additions & 0 deletions ssl-proxies-tomcat/src/main/patches/jglobus-tomcat7.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
diff -ur jglobus-2.0.4.orig/ssl-proxies-tomcat/src/main/java/org/globus/gsi/tomcat/GlobusSSLImplementation.java jglobus-2.0.4/ssl-proxies-tomcat/src/main/java/org/globus/gsi/tomcat/GlobusSSLImplementation.java
--- jglobus-2.0.4.orig/ssl-proxies-tomcat/src/main/java/org/globus/gsi/tomcat/GlobusSSLImplementation.java 2011-07-29 04:41:20.000000000 +0200
+++ jglobus-2.0.4/ssl-proxies-tomcat/src/main/java/org/globus/gsi/tomcat/GlobusSSLImplementation.java 2012-06-08 17:22:01.140977362 +0200
@@ -1,6 +1,7 @@
package org.globus.gsi.tomcat;


+import org.apache.tomcat.util.net.AbstractEndpoint;
import org.apache.tomcat.util.net.ServerSocketFactory;
import org.apache.tomcat.util.net.jsse.JSSEImplementation;

@@ -14,8 +15,8 @@
return "GlobusSSLImplementation";
}

- public ServerSocketFactory getServerSocketFactory() {
- return new GlobusSSLSocketFactory();
+ public ServerSocketFactory getServerSocketFactory(AbstractEndpoint endpoint) {
+ return new GlobusSSLSocketFactory(endpoint);
}

}
diff -ur jglobus-2.0.4.orig/ssl-proxies-tomcat/src/main/java/org/globus/gsi/tomcat/GlobusSSLSocketFactory.java jglobus-2.0.4/ssl-proxies-tomcat/src/main/java/org/globus/gsi/tomcat/GlobusSSLSocketFactory.java
--- jglobus-2.0.4.orig/ssl-proxies-tomcat/src/main/java/org/globus/gsi/tomcat/GlobusSSLSocketFactory.java 2011-07-29 04:41:20.000000000 +0200
+++ jglobus-2.0.4/ssl-proxies-tomcat/src/main/java/org/globus/gsi/tomcat/GlobusSSLSocketFactory.java 2012-06-08 18:13:34.293762214 +0200
@@ -15,6 +15,7 @@

package org.globus.gsi.tomcat;

+import org.apache.tomcat.util.net.AbstractEndpoint;
import org.apache.tomcat.util.net.jsse.JSSESocketFactory;
import org.globus.gsi.X509ProxyCertPathParameters;
import org.globus.gsi.jsse.GlobusSSLHelper;
@@ -44,8 +45,17 @@
static {
Security.addProvider(new GlobusProvider());
}
-
-
+
+ protected Object crlLocation;
+ protected Object signingPolicyLocation;
+ protected Object rejectLimitedProxyEntry;
+
+ public GlobusSSLSocketFactory(AbstractEndpoint endpoint) {
+ super(endpoint);
+ crlLocation = endpoint.getAttribute("crlLocation");
+ signingPolicyLocation = endpoint.getAttribute("signingPolicyLocation");
+ rejectLimitedProxyEntry = endpoint.getAttribute("rejectLimitedProxy");
+ }

/**
* Create a Globus trust manager which supports proxy certificates. This requires that the CRL store, and
@@ -61,21 +71,21 @@
protected TrustManager[] getTrustManagers(String keystoreType, String keystoreProvider, String algorithm)
throws Exception {
KeyStore trustStore = getTrustStore(keystoreType, keystoreProvider);
+
CertStore crlStore = null;
- Object crlLocation = attributes.get("crlLocation");
if (crlLocation != null) {
- crlStore = GlobusSSLHelper.findCRLStore((String) attributes.get("crlLocation"));
+ crlStore = GlobusSSLHelper.findCRLStore((String) crlLocation);
}
- Object signingPolicyLocation = attributes.get("signingPolicyLocation");
+
ResourceSigningPolicyStore policyStore = null;
if (signingPolicyLocation != null) {
policyStore = new ResourceSigningPolicyStore(
- new ResourceSigningPolicyStoreParameters(attributes.get("signingPolicyLocation").toString()));
+ new ResourceSigningPolicyStoreParameters((String) signingPolicyLocation));
}
- Object rejectLimitedProxyEntry = attributes.get("rejectLimitedProxy");

boolean rejectLimitedProxy = rejectLimitedProxyEntry != null &&
- Boolean.parseBoolean(attributes.get("rejectLimitedProxy").toString());
+ Boolean.parseBoolean((String) rejectLimitedProxyEntry);
+
X509ProxyCertPathParameters parameters = new X509ProxyCertPathParameters(trustStore, crlStore, policyStore,
rejectLimitedProxy);
TrustManager trustManager = new PKITrustManager(new X509ProxyCertPathValidator(), parameters);

0 comments on commit 0b32a26

Please sign in to comment.