Workaround for BUG-64033
Description of Problem: Tags are not getting synchronized from any source in SSL environment or when Ranger admin is SSL enabled (BUG-64033).
Error Message: Tagsync process is not coming up due to
below error in file /var/log/ranger/tagsync/tagsync.log
10 Aug 2016 07:25:08 INFO TagSynchronizer [main] - 177 at org.apache.hadoop.conf.Configuration.getProps(Configuration.java:2418) at org.apache.hadoop.conf.Configuration.get(Configuration.java:981) at org.apache.ranger.plugin.util.RangerRESTClient.init(RangerRESTClient.java:246) at org.apache.ranger.plugin.util.RangerRESTClient.<init>(RangerRESTClient.java:116) at org.apache.ranger.tagsync.sink.tagadmin.TagAdminRESTSink.initialize(TagAdminRESTSink.java:97) at org.apache.ranger.tagsync.process.TagSynchronizer.initializeTagSink(TagSynchronizer.java:202) at org.apache.ranger.tagsync.process.TagSynchronizer.initialize(TagSynchronizer.java:104) at org.apache.ranger.tagsync.process.TagSynchronizer.main(TagSynchronizer.java:60) 10 Aug 2016 07:25:10 ERROR TagSynchronizer [main] - 207 Failed to initialize TAG sink. Error details: java.lang.RuntimeException: com.sun.org.apache.xerces.internal.impl.io.MalformedByteSequenceException: Invalid byte 1 of 1-byte UTF-8 sequence. at org.apache.hadoop.conf.Configuration.loadResource(Configuration.java:2673) at org.apache.hadoop.conf.Configuration.loadResources(Configuration.java:2536) at org.apache.hadoop.conf.Configuration.getProps(Configuration.java:2418) at org.apache.hadoop.conf.Configuration.get(Configuration.java:981) at org.apache.ranger.plugin.util.RangerRESTClient.init(RangerRESTClient.java:246) at org.apache.ranger.plugin.util.RangerRESTClient.<init>(RangerRESTClient.java:116) at org.apache.ranger.tagsync.sink.tagadmin.TagAdminRESTSink.initialize(TagAdminRESTSink.java:97) at org.apache.ranger.tagsync.process.TagSynchronizer.initializeTagSink(TagSynchronizer.java:202) at org.apache.ranger.tagsync.process.TagSynchronizer.initialize(TagSynchronizer.java:104) at org.apache.ranger.tagsync.process.TagSynchronizer.main(TagSynchronizer.java:60) Caused by: com.sun.org.apache.xerces.internal.impl.io.MalformedByteSequenceException: Invalid byte 1 of 1-byte UTF-8 sequence. at com.sun.org.apache.xerces.internal.impl.io.UTF8Reader.invalidByte(UTF8Reader.java:687) at com.sun.org.apache.xerces.internal.impl.io.UTF8Reader.read(UTF8Reader.java:557) at com.sun.org.apache.xerces.internal.impl.XMLEntityScanner.load(XMLEntityScanner.java:1753) at com.sun.org.apache.xerces.internal.impl.XMLEntityScanner.arrangeCapacity(XMLEntityScanner.java:1629) at com.sun.org.apache.xerces.internal.impl.XMLEntityScanner.skipString(XMLEntityScanner.java:1667) at com.sun.org.apache.xerces.internal.impl.XMLVersionDetector.determineDocVersion(XMLVersionDetector.java:196) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:812) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:777) at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141) at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:243) at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:347) at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:121) at org.apache.hadoop.conf.Configuration.parse(Configuration.java:2514) at org.apache.hadoop.conf.Configuration.loadResource(Configuration.java:2587)
Workaround:
Create file
ranger-policymgr-ssl.xml
under /usr/hdp/current/ranger-tagsync/conf/ with below content<configuration> <property> <name>xasecure.policymgr.clientssl.keystore</name> <value>/etc/security/serverKeys/ranger-tagsync-keystore.jks</value> </property> <property> <name>xasecure.policymgr.clientssl.keystore.credential.file</name> <value>jceks://file/etc/ranger/tagsync/cred.jceks</value> </property> <property> <name>xasecure.policymgr.clientssl.keystore.password</name> <value>myKeyFilePassword</value> </property> <property> <name>xasecure.policymgr.clientssl.truststore</name> <value>/etc/security/serverKeys/ranger-tagsync-mytruststore.jks</value> </property> <property> <name>xasecure.policymgr.clientssl.truststore.credential.file</name> <value>jceks://file/etc/ranger/tagsync/cred.jceks</value> </property> <property> <name>xasecure.policymgr.clientssl.truststore.password</name> <value>changeit</value> </property> </configuration>
Created below directory path if not exist:
/etc/ranger/tagsync/
/etc/security/serverKeys/
Create
ranger-tagsync-keystore.jks
:Note This is just provided as an example. How you implement this step depends on your deployment.
keytool -genkey -keyalg RSA -alias rangerTagsync -keystore /etc/security/serverKeys/ranger-tagsync-keystore.jks -storepass myKeyFilePassword -validity 360 -keysize 2048
chmod 640 /etc/security/serverKeys/ranger-tagsync-keystore.jks
chmod ranger:ranger /etc/security/serverKeys/ranger-tagsync-keystore.jks [1]
Create truststore
ranger-tagsync-mytruststore.jks
:Note This is just provided as an example. How you implement this step depends on your deployment.
Export
ranger-admin-keystore.jks
intoranger-admin-trust.cer
running the below command on ranger-admin host [2]:keytool -export -keystore /etc/ranger/admin/conf/ranger-admin-keystore.jks -alias rangeradmin -file ranger-admin-trust.cer
Import
ranger-admin-trust.cer
intoranger-tagsync-mytruststore.jks
.keytool -import -file ranger-admin-trust.cer -alias rangeradmintrust -keystore /etc/security/serverKeys/ranger-tagsync-mytruststore.jks -storepass changeit
chmod 640 /etc/security/serverKeys/ranger-tagsync-mytruststore.jks
chmod ranger:ranger /etc/security/serverKeys/ranger-tagsync-mytruststore.jks [1]
Create
cred.jceks
:java -cp "/usr/hdp/current/ranger-tagsync/lib/*" org.apache.ranger.credentialapi.buildks create sslKeyStore -value myKeyFilePassword -provider jceks://file/etc/ranger/tagsync/cred.jceks
java -cp "/usr/hdp/current/ranger-tagsync/lib/*" org.apache.ranger.credentialapi.buildks create sslTrustStore -value changeit -provider jceks://file/etc/ranger/tagsync/cred.jceks
chmod 640 /etc/ranger/tagsync/cred.jceks
chown ranger:ranger /etc/ranger/tagsync/cred.jceks [1]
From Ambari:
In ranger.tagsync.dest.ranger.ssl.config.filename property value to /usr/hdp/current/ranger-tagsync/conf/ranger-policymgr-ssl.xml
, update theRestart Ranger Tagsync.
Note:
Supply ownership to the ranger tagsync process user for .jks and .jceks files.
You will need to copy
ranger-admin-trust.cer
to ranger-tagsync host if ranger-admin and ranger-tagsync are not running on the same host.