STS cloudfoundy integration - SSL exception - java

scenario:
1. in STS open 'servers' view and add 'cloudFoundry' server
2. in the new server wizard enter "https://api.run.pivotal.io/" and user password
3. press next - I get the following exception :
Unable to communicate with server - I/O error on GET request for "https://api.run.pivotal.io/info":sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target; nested exception is javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
tried adding SSL certificate from the URL to the JDK used by STS , also
tried using the "Trust self-signed certificate" option
both didn't help.

One suggestion to see why connecting to Pivotal Web Services (api.run.pivotal.io) is not working through STS, is to verify that when you added the SSL certificate to the JDK used by STS, it is listed by Java keytool.
For Pivotal Web Services, I believe it should be DigiCert:
Owner: CN=DigiCert Global Root CA, OU=www.digicert.com, O=DigiCert Inc, C=US
Normally, if this certificate appears in the list of certificates used by the STS JDK, users should be able to connect without getting validator exceptions, and without having to check "Trust self-signed certificate" option.
Maybe this related post can provide additional information:
PKIX path building failed in Java application
Unlike the cf CLI via the option:
--skip-ssl-validation
the Cloud Foundry Tools in STS does not have an option to skip SSL validation.

Related

Certificate error "javax.net.ssl.SSLHandshakeException: PKIX path building failed"

I'm using JSOUP to connect to a web page and get some content via web scraping method. Everything seems to work fine for months but recently this error started to appear.
ERROR: javax.net.ssl.SSLHandshakeException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
javax.net.ssl.SSLHandshakeException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
I've added the certificate of the web page (downloaded the certificate from chrome explorer, base64 cer) and added to my java cacert using this command
keytool -import -alias certificatebase64-2 -keystore "C:\Program Files\Java\jdk-11.0.10\lib\security\cacerts" -file certificate-base64.cer
I've also installed the certificate in my windows machine, since in this machine is where the java app is running, using certificate windows assistant
right click on the certificate -> install certificate -> local machine -> and manually select "Trusted Root Certification Authorities"
After this two steps the app begin to works fine again, but after some hours the error pops up again.
The work around I've found is the execute the same comands explained above to add the certificate to my cacerts again (have to change the name of the import)
Here is how I connect to the web page using JSOUP
Connection.Response response = Jsoup.connect("https://www.test.store/us/").method(Connection.Method.GET)
.execute();
I can't seem to find to root cause of this error and why It fails to work some hours after I import the certificates again.

javax.net.ssl.SSLHandshakeException for some https url in nutch 1.13

I try crawling seed urls that are http/https
but for few https urls i get below error
FetcherThread INFO api.HttpRobotRulesParser (168) - Couldn't get robots.txt for https://corporate.douglas.de/investors/?lang=en: javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
on other hand https://www.integrafin.co.uk/annual-reports/ is crawled perfectly fine
below is my configuration
plugin.includes
protocol-http|urlfilter-regex|parse-(html|tika|text)|index-(basic|anchor|more|static|links)|indexer-solr|scoring-opic|urlnormalizer-(pass|regex|basic)|urlmeta|language-identifier
I think you need to put the certificate of server https://corporate.douglas.de/investors/?lang=en in the "cacerts" file of the JVM that runs your code.
First, download the certificate using Chrome:
Then, click in "details" tab and then in button "Copy to file"
In the wizard, select the option "DER binary.... (.CER)"
Now, you can use the tool "portecle" (http://portecle.sourceforge.net/) to add the certificate to the cacert file in your JVM followin this steps http://portecle.sourceforge.net/import-trusted-cert.html
Hope works for you.
You could try using a more recent version of Nutch, or compile directly from master, and then give a try to the http.tls.certificates.check setting, from (https://github.com/apache/nutch/pull/388). This will essentially allow you to skip the TLS/SSL verification.

getting sun.security.validator.ValidatorException: PKIX path building failed:

Trying to install Eclipse DTP (Data Tools Platform) from Eclipse marketPlace.I am using Eclipse Java Neon. I am getting following exception/error.
Unable to read repository at
http://download.eclipse.org/datatools/updates/content.jar.
sun.security.validator.ValidatorException: PKIX path building failed:
sun.security.provider.certpath.SunCertPathBuilderException: unable to find
valid certification path to requested target
Any help is appreciated.
When downloading the content.jar file you're redirected to another mirror site.
In my case i was redirected to "https://mirrors.shu.edu.cn/eclipse/datatools/updates/content.jar"
This website expose an ssl certificate to you but you don't have any certificate authority able to validate this certificate.
What can you do?
download keystore explorer
In Internet explorer open the developper tools and start network recording in the network view
In the address bar copy/paste "http://download.eclipse.org/datatools/updates/content.jar"
Get the https redirected url from the network view
Launch Keystore explorer and open your cacerts file (JRE_OR_JDK_HOME/jre/lib/security/cacerts). The access password is "changeit"
I don't know the exact translation but in keystore explorer menu bar you will find a menu item something along the line "get certificate from TLS/SSL", click on it and provide the secured domain name (for me : mirrors.shu.edu.cn)
Import the certificate in cacerts and save cacerts
restart eclipse and test again
Some important points:
. cacerts is the default repository for certificate authorities used by java
. it is better to import the certificate chain (all the certificates shown by keystore explorer except the website's one)
. Take a good look to the certificates you're importing in cacerts because java will trust them

I configured the Signer and SSL Certificate in my Pega enviroment.But now, I am getting below error.while configuring a REST connector in Pega

We are getting following error while configuring a REST connector in Pega.
SSL/TLS configuration issue detected. Please repair and try again.
Caught unhandled exception: java.lang.RuntimeException:
javax.net.ssl.SSLHandshakeException: com.ibm.jsse2.util.j: PKIX path
building failed: java.security.cert.CertPathBuilderException:
PKIXCertPathBuilderImpl could not build a valid CertPath.; internal
cause is: java.security.cert.CertPathValidatorException: The
certificate issued by CN=Baltimore CyberTrust Root, OU=CyberTrust,
O=Baltimore, C=IE is not trusted; internal cause is:
java.security.cert.CertPathValidatorException: Certificate chaining
error
Can someone help ow to check this.
The certificate you're trying to use is not trusted. This means you need to install the root resp. trust certificate as a truststore into the webserver so that the webserver trusts the certificate of your endpoint. That's the same error you sometimes see on your browser when certificates are self signed or expired.
When using Pega you can either deploy the truststore on application server level (that is into your Tomcat, Websphere or Weblogic) or into your PRPC environment.
In PRPC you can create a new Keystore instance with the Records Explorer, Security, Keystore, Create. Then you can upload the jks file and save. This keystore instance has to be referenced on the Connect-REST rule under the headline Security Settings under Truststore.

How can I add a server certificate to my local trusted Java key store?

I've written Java client to access a securely-served Web service, however the certificate used by the Web service host is not issued by certification authority, but a self signed or issued by a private CMS. I get the following error:
PKIX path building failed:
sun.security.provider.certpath.SunCertPathBuilderException:
unable to find valid certification path to requested target
use this class
https://confluence.atlassian.com/download/attachments/180292346/InstallCert.java?version=1&modificationDate=1315453596921
issue this command
Java InstallCert “yourserver:sslport”
ex Java InstallCert “chades:8443”
Also don't forget to copy your jssecacerts file to following directory
Java home/jre[version_number]/lib/security

Categories

Resources