Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Got jets3t working with https. Currently the choices are:

1) http
2) https such that *all* server certs are accepted
3) use the java system key store
  • Loading branch information...
commit ce5d9fee0b405003b5bb28ea47ee280731b0f979 1 parent 78655b4
BuzzTroll authored
4 .idea/libraries/cloud_client_libs.xml
View
@@ -8,7 +8,9 @@
<root url="file://$PROJECT_DIR$/lib/clients" />
</CLASSES>
<JAVADOC />
- <SOURCES />
+ <SOURCES>
+ <root url="file://$PROJECT_DIR$/../../jets3/jets3t-0.7.3/src" />
+ </SOURCES>
<jarDirectory url="file://$PROJECT_DIR$/lib/clients" recursive="false" />
</library>
</component>
17 service/client/java/source/src/org/globus/workspace/cloud/client/AllArgs.java
View
@@ -97,6 +97,7 @@ public AllArgs(Print print) {
private String xferS3Key;
private String xferS3BaseKey;
private String xferS3Https;
+ private String xferS3AllowSelfSigned;
private String s3Bucket;
private String gridftpID;
private String handle;
@@ -641,6 +642,14 @@ public void intakeProperties(Properties props,
sourceName);
}
+ if(this.xferS3AllowSelfSigned == null) {
+ this.xferS3AllowSelfSigned =
+ CloudClientUtil.getProp(props, Props.KEY_S3_ALLOW_SELF_SIGNED);
+ this.gotProp(Props.KEY_S3_ALLOW_SELF_SIGNED,
+ this.xferS3AllowSelfSigned,
+ sourceName);
+ }
+
if (this.xferS3Https == null) {
this.xferS3Https =
CloudClientUtil.getProp(props, Props.KEY_S3_HTTPS);
@@ -1037,6 +1046,14 @@ public void setXferType(String xferType) {
this.xferType = xferType;
}
+ public String getXferS3AllowSelfSigned() {
+ return this.xferS3AllowSelfSigned;
+ }
+
+ public void setXferS3AllowSelfSigned(String xferS3AllowSelfSigned) {
+ this.xferS3AllowSelfSigned = xferS3AllowSelfSigned;
+ }
+
public String getXferS3Https() {
return this.xferS3Https;
}
3  service/client/java/source/src/org/globus/workspace/cloud/client/Props.java
View
@@ -34,6 +34,9 @@
KEY_FACTORY_HOSTPORT = "vws.factory";
public static final String
+ KEY_S3_ALLOW_SELF_SIGNED = "vws.repository.s3acceptallcerts";
+
+ public static final String
KEY_XFER_HOSTPORT = "vws.repository";
public static final String
13 service/client/java/source/src/org/globus/workspace/cloud/client/util/CumulusRepositoryUtil.java
View
@@ -47,7 +47,18 @@ public CumulusRepositoryUtil(
{
useHttps = "false";
}
- cumulusTask = new CumulusTask(args, pr, useHttps);
+ boolean ss;
+ String selfSigned = this.args.getXferS3AllowSelfSigned();
+ if(selfSigned == null || selfSigned.equalsIgnoreCase("true"))
+ {
+ ss = true;
+ }
+ else
+ {
+ ss = false;
+ }
+
+ cumulusTask = new CumulusTask(args, pr, useHttps, ss);
}
public void paramterCheck(
37 service/client/java/source/src/org/globus/workspace/cloud/client/util/CumulusTask.java
View
@@ -17,6 +17,12 @@
package org.globus.workspace.cloud.client.util;
import edu.emory.mathcs.backport.java.util.concurrent.Callable;
+import org.apache.commons.httpclient.HostConfiguration;
+import org.apache.commons.httpclient.HttpClient;
+import org.apache.commons.httpclient.contrib.ssl.EasySSLProtocolSocketFactory;
+import org.apache.commons.httpclient.contrib.ssl.TrustSSLProtocolSocketFactory;
+import org.apache.commons.httpclient.protocol.Protocol;
+import org.apache.commons.httpclient.protocol.SSLProtocolSocketFactory;
import org.globus.workspace.client_core.ExecutionProblem;
import org.globus.workspace.cloud.client.AllArgs;
import org.globus.workspace.common.print.Print;
@@ -251,16 +257,19 @@ public void updateBytesTransferred(
private AllArgs args;
private Print print;
private String useHttps;
+ private boolean allowSelfSigned;
public CumulusTask(
AllArgs args,
Print pr,
- String useHttps)
+ String useHttps,
+ boolean allowSelfSigned)
{
this.args = args;
this.print = pr;
this.useHttps = useHttps;
+ this.allowSelfSigned = allowSelfSigned;
}
public void setTask(
@@ -490,32 +499,48 @@ private S3Service getService()
int port = 80;
String portS = "80";
String httpsPortS = "443";
+ int httpsPort = 443;
if(ndx > 0)
{
portS = host.substring(ndx+1);
httpsPortS = portS;
port = new Integer(portS).intValue();
+ httpsPort = new Integer(httpsPortS).intValue();
host = host.substring(0, ndx);
}
Jets3tProperties j3p = new Jets3tProperties();
-
- portS = "5555";
- System.out.println(host);
- j3p.setProperty("s3service.s3-endpoint", host);
j3p.setProperty("s3service.s3-endpoint-http-port", portS);
j3p.setProperty("s3service.s3-endpoint-https-port", httpsPortS);
j3p.setProperty("s3service.disable-dns-buckets", "true");
+ j3p.setProperty("s3service.s3-endpoint", host);
j3p.setProperty("s3service.https-only", this.useHttps);
+ HostConfiguration hc = null;
+ if(allowSelfSigned)
+ {
+ // magic needed for jets3t to work with self signed cert.
+ try
+ {
+ String cert = "/home/bresnaha/2944337c.0.pem";
+ Protocol easyhttps = new Protocol("https", new EasySSLProtocolSocketFactory(), 443);
+ Protocol.registerProtocol("https", easyhttps);
+ }
+ catch(Exception ex)
+ {
+ throw new S3ServiceException("Could not make the self signed handler " + ex.toString(), ex);
+ }
+ hc = new HostConfiguration();
+ }
AWSCredentials awsCredentials = this.getAwsCredentail();
S3Service s3Service = new RestS3Service(
awsCredentials,
"cloud-client",
null,
- j3p);
+ j3p,
+ hc);
return s3Service;
}
Please sign in to comment.
Something went wrong with that request. Please try again.