-
Notifications
You must be signed in to change notification settings - Fork 366
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Untrusted certificates support #13
Comments
…evelopment where untrusted certs are the norm
I just added this feature to the 1.0.1-SNAPSHOT. Make sure you update your dependencies for your project if your using Eclipse (sometimes you need to restart it depending on your version). If command line you can force maven dependencies by running "mvn -U clean compile" To use non-strict/self signed SSL client you will do the following during client creation:
Let me know if this works for you! |
We have updated our dependencies for our project in Eclipse. That's our java source code:
When we run our Tomcat in Eclipse, we obtain the following Exception:
Anybody knows what can we do? Thanks |
@Berbel92 I need more info on your configuration. Are you using maven? |
We don't use maven. |
@Berbel92 Did the previous 1.0.1-withdeps.jar work for you or is this your first time trying to use OpenStack4j with Tomcat, etc. |
It's our first time. |
Is there a way to test your code command line by including the jar, etc. ie. java -cp openstack4j-1.0.2-withdeps.jar com.Main Is there any other applications using Jersey or Jackson or are they in the common classpath within tomcat for another application? I'm wondering if there is a version conflict somewhere. |
It works his solution! Thanks for your attention! |
@Berbel92 I'm happy it worked for you!! It took me a while to realize and make it work!! 👍 :) |
@charliemc Thank you very much for your hard work! |
Oh! And @RPallas92 @gondor the '.useNonStrictSSLClient(true)' worked perfect for me! |
useNonStrictSSLClient looks like unsafe workaround, because in this case client will connect to any server with any https cert. OpenStack clients has option like "cacert" and OpenStack deployments are often using self signed certificates, so it would be great to have such option in openstack4j. |
@redixin would you like to contribute a fix for this? |
@vinodborole I just found a solution. This can be done by applying Config with custom SSLContext. Something like this: InputStream is = new FileInputStream("/tmp/ca.pem");
CertificateFactory cf = CertificateFactory.getInstance("X.509");
X509Certificate caCert = (X509Certificate) cf.generateCertificate(is);
TrustManagerFactory tmf = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
KeyStore ks = KeyStore.getInstance(KeyStore.getDefaultType());
ks.load(null);
ks.setCertificateEntry("caCert", caCert);
tmf.init(ks);
sslContext = SSLContext.getInstance("TLS");
sslContext.init(null, tmf.getTrustManagers(), null);
Config config = Config.newConfig();
config.withSSLContext(sslContext);
OSClient os = OSFactory.builderV3().withConfig(config).... |
@redixin great, thanks for the code snippet. |
Fix ContainX#5: Move to timestamped betamax snapshot
Hello, we are trying to connect to an untrusted certificate Openstack server, but it seems the API doesn't allow untrusted certs.
Anybody knows a solution? Thanks
The text was updated successfully, but these errors were encountered: