Bug 1503450

Summary: 3.7.1 White spaces in the cert prevents Origin Metrics from starting
Product: OpenShift Container Platform Reporter: Juraci Paixão Kröhling <jcosta>
Component: HawkularAssignee: Juraci Paixão Kröhling <jcosta>
Status: CLOSED ERRATA QA Contact: Junqi Zhao <juzhao>
Severity: urgent Docs Contact:
Priority: urgent    
Version: 3.7.1CC: aos-bugs, cbucur, erich, erjones, hgomes, jcantril, jcosta, juzhao, mwringe, pweil, snegrea, stwalter
Target Milestone: ---   
Target Release: 3.7.z   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
When either a certificate within the chain at `serviceaccount/ca.crt` or any of the certificates within the provided truststore file contain a white space after the `BEGIN CERTIFICATE` declaration, the Java keytool rejects the certificate with an error, causing Origin Metrics to fail to start. As a workaround, Origin Metrics will now attempt to remove the spaces before feeding the certificate to the Keytool, but admins should make sure their certificates don't contain such spaces.
Story Points: ---
Clone Of: 1471251 Environment:
Last Closed: 2017-11-28 22:17:38 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Bug Depends On: 1471251    
Bug Blocks: 1500464, 1500471    

Comment 1 Juraci Paixão Kröhling 2017-10-18 08:08:05 UTC
The fix is available on this build:
https://brewweb.engineering.redhat.com/brew/buildinfo?buildID=608943

Comment 2 Junqi Zhao 2017-10-20 12:53:07 UTC
Tested with metrics-hawkular-metrics:3.7.0-0.159.0.0
Steps:
1. Add more spaces to the end of "-----BEGIN CERTIFICATE-----" in /etc/origin/master/ca-bundle.crt.
2. Restart server and deploy metrics 3.7 by using image metrics-hawkular-metrics:3.7.0-0.159.0.0 
3. #oc rsh ${HAWKULAR_METRICS_PODS};
   sh-4.2$cat /var/run/secrets/kubernetes.io/serviceaccount/ca.crt

   #oc rsh ${HAWKULAR_CASSANDRA_PODS};
   sh-4.2$cat /var/run/secrets/kubernetes.io/serviceaccount/ca.crt

   #oc rsh ${HEAPSTER_PODS};
   sh-4.2$cat /var/run/secrets/kubernetes.io/serviceaccount/ca.crt

"-----BEGIN CERTIFICATE-----" field don't have spaces in /var/run/secrets/kubernetes.io/serviceaccount/ca.crt of each pod, beside this, the content is thse same with /etc/origin/master/ca-bundle.crt.

4. Sanity testing of Metrics, it works well.

env:
# openshift version
openshift v3.7.0-0.143.7
kubernetes v1.7.0+80709908fd
etcd 3.2.1

Comment 5 errata-xmlrpc 2017-11-28 22:17:38 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2017:3188