Securing Configs with ZooKeeper ACLs and Ranger
You can restrict access to configuration sets by setting ZooKeeper ACLs on all
znodes under and including /solr and using Ranger to control access
to the ConfigSets API. Ranger requires Kerberos authentication.
The solrctl instancedir command interacts directly with ZooKeeper, and
therefore cannot be protected by Ranger. Because the solrctl config
command is a wrapper script for the ConfigSets API, it can be protected by Ranger.
To force users to use the ConfigSets API, you must set all ZooKeeper znodes under and
including /solr to read-only (except for the solr user):
- Create a
jaas.conffile containing the following:Client { com.sun.security.auth.module.Krb5LoginModule required useKeyTab=false useTicketCache=true principal="solr@EXAMPLE.COM"; };Replace
EXAMPLE.COMwith your Kerberos realm name. - Set the
LOG4J_PROPSenvironment variable to alog4j.propertiesfile:export LOG4J_PROPS=/etc/zookeeper/conf/log4j.properties - Set the
ZKCLI_JVM_FLAGSenvironment variable:export ZKCLI_JVM_FLAGS="-Djava.security.auth.login.config=/path/to/jaas.conf \ -DzkACLProvider=org.apache.solr.common.cloud.SaslZkACLProvider \ -Droot.logger=INFO,console" - Authenticate as the
solruser:kinit solr@EXAMPLE.COMReplace
EXAMPLE.COM with your Kerberos realm name. - Run the
zkcli.shscript as follows:/opt/cloudera/parcels/CDH/lib/solr/bin/zkcli.sh -zkhost zk01.example.com:2181 -cmd updateacls /solrReplace
zk01.example.com with the hostname of a ZooKeeper server.
After completing these steps, you cannot run commands such as
solrctl instancedir --create or solrctl
instancedir --delete without first authenticating as the
solr@EXAMPLE.COM super user principal.
Unauthenticated users can still run solrctl instancedir
--list and solrctl instancedir --get,
because those commands only perform read operations against
ZooKeeper.
