You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It will result in failure to parse the cert and eventually an SSLException.
Because the exception occurs in sun.security.provider.X509Factory we might need to do some pre-validation of the cert formatting before calling into these APIs.
In this case the issue occurred because there was an unexpected space at the end of the header -----BEGIN CERTIFICATE-----
2021-03-11T15:51:17,781-0800 [89136 1] com.newrelic ERROR: Unable to generate ca_bundle_path certificate. Will not process further certs.
java.security.cert.CertificateException: Could not parse certificate: java.io.IOException: Illegal header: -----BEGIN CERTIFICATE-----
at sun.security.provider.X509Factory.engineGenerateCertificate(X509Factory.java:115) ~[?:?]
at java.security.cert.CertificateFactory.generateCertificate(CertificateFactory.java:355) ~[?:?]
at com.newrelic.agent.transport.apache.ApacheSSLManager.getKeyStore(ApacheSSLManager.java:127) [newrelic.jar:6.5.0-SNAPSHOT]
at com.newrelic.agent.transport.apache.ApacheSSLManager.createSSLContext(ApacheSSLManager.java:48) [newrelic.jar:6.5.0-SNAPSHOT]
at com.newrelic.agent.transport.DataSenderFactory$DefaultDataSenderFactory.buildApacheHttpClientWrapper(DataSenderFactory.java:67) [newrelic.jar:6.5.0-SNAPSHOT]
at com.newrelic.agent.transport.DataSenderFactory$DefaultDataSenderFactory.create(DataSenderFactory.java:60) [newrelic.jar:6.5.0-SNAPSHOT]
at com.newrelic.agent.transport.DataSenderFactory.create(DataSenderFactory.java:46) [newrelic.jar:6.5.0-SNAPSHOT]
at com.newrelic.agent.RPMService.<init>(RPMService.java:107) [newrelic.jar:6.5.0-SNAPSHOT]
at com.newrelic.agent.RPMServiceManagerImpl.createRPMService(RPMServiceManagerImpl.java:174) [newrelic.jar:6.5.0-SNAPSHOT]
at com.newrelic.agent.RPMServiceManagerImpl.<init>(RPMServiceManagerImpl.java:78) [newrelic.jar:6.5.0-SNAPSHOT]
at com.newrelic.agent.service.ServiceManagerImpl.doStart(ServiceManagerImpl.java:237) [newrelic.jar:6.5.0-SNAPSHOT]
at com.newrelic.agent.service.AbstractService.start(AbstractService.java:63) [newrelic.jar:6.5.0-SNAPSHOT]
at com.newrelic.agent.Agent.continuePremain(Agent.java:162) [newrelic.jar:6.5.0-SNAPSHOT]
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?]
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
at java.lang.reflect.Method.invoke(Method.java:566) ~[?:?]
at com.newrelic.bootstrap.BootstrapAgent.startAgent(BootstrapAgent.java:181) [newrelic.jar:6.5.0-SNAPSHOT]
at com.newrelic.bootstrap.BootstrapAgent.premain(BootstrapAgent.java:119) [newrelic.jar:6.5.0-SNAPSHOT]
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?]
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
at java.lang.reflect.Method.invoke(Method.java:566) ~[?:?]
at sun.instrument.InstrumentationImpl.loadClassAndStartAgent(InstrumentationImpl.java:513) [?:?]
at sun.instrument.InstrumentationImpl.loadClassAndCallPremain(InstrumentationImpl.java:525) [?:?]
Caused by: java.io.IOException: Illegal header: -----BEGIN CERTIFICATE-----
at sun.security.provider.X509Factory.checkHeaderFooter(X509Factory.java:657) ~[?:?]
at sun.security.provider.X509Factory.readOneBlock(X509Factory.java:643) ~[?:?]
at sun.security.provider.X509Factory.engineGenerateCertificate(X509Factory.java:99) ~[?:?]
... 24 more
2021-03-11T15:51:17,793-0800 [89136 1] com.newrelic ERROR: Read ca_bundle_path /Users/jkeller/agents/newrelic_snapshot_build/DigiCertGlobalRootCA.crt.pem and found 0 certificates.
You can repro this by pasting the below contents into a file named DigiCertGlobalRootCA.crt.pem and configuring the agent to use it via ca_bundle_path. If you remove the extra space at the end of the first line the agent should successfully parse the cert and connect to New Relic.
This exception occurs if there is an unexpected space character when parsing an SSL certificate. It was discovered when configuring the agent to use the Mozilla root cert bundle: PEM of Root Certificates in Mozilla's Root Store with the Websites (TLS/SSL) Trust Bit Enabled (TXT)
ca_bundle_path: /Users/jkeller/agents/newrelic_snapshot_build/DigiCertGlobalRootCA.crt.pem
It will result in failure to parse the cert and eventually an
SSLException
.Because the exception occurs in
sun.security.provider.X509Factory
we might need to do some pre-validation of the cert formatting before calling into these APIs.In this case the issue occurred because there was an unexpected space at the end of the header
-----BEGIN CERTIFICATE-----
You can repro this by pasting the below contents into a file named
DigiCertGlobalRootCA.crt.pem
and configuring the agent to use it viaca_bundle_path
. If you remove the extra space at the end of the first line the agent should successfully parse the cert and connect to New Relic.The text was updated successfully, but these errors were encountered: