Apache Solr open-source search software
SOLR-6915: SaslZkACLProvider and Kerberos Test Using MiniKdc
Gregory Chanana4e089e662cc
diff --git a/lucene/ivy-versions.properties b/lucene/ivy-versions.propertiesindex 08b295f5493..25c001f4e0e 100644--- a/lucene/ivy-versions.properties+++ b/lucene/ivy-versions.properties@@ -88,6 +88,7 @@ com.sun.jersey.version = 1.9/org.apache.avro/avro = 1.7.5/org.apache.commons/commons-compress = 1.8.1/org.apache.derby/derby = 10.9.1.0+/org.apache.directory.server/apacheds-all = 2.0.0-M15org.apache.hadoop.version = 2.3.0/org.apache.hadoop/hadoop-annotations = ${org.apache.hadoop.version}@@ -101,6 +102,7 @@ org.apache.hadoop.version = 2.3.0/org.apache.hadoop/hadoop-mapreduce-client-hs = ${org.apache.hadoop.version}/org.apache.hadoop/hadoop-mapreduce-client-jobclient = ${org.apache.hadoop.version}/org.apache.hadoop/hadoop-mapreduce-client-shuffle = ${org.apache.hadoop.version}+/org.apache.hadoop/hadoop-minikdc = ${org.apache.hadoop.version}/org.apache.hadoop/hadoop-yarn-api = ${org.apache.hadoop.version}/org.apache.hadoop/hadoop-yarn-client = ${org.apache.hadoop.version}/org.apache.hadoop/hadoop-yarn-common = ${org.apache.hadoop.version}diff --git a/lucene/tools/junit4/tests.policy b/lucene/tools/junit4/tests.policyindex 98e3f2b33fa..a8abe618850 100644--- a/lucene/tools/junit4/tests.policy+++ b/lucene/tools/junit4/tests.policy@@ -77,4 +77,9 @@ grant {// SSL related properties for Solr testspermission java.security.SecurityPermission "getProperty.ssl.*";+ // SASL/Kerberos related properties for Solr tests+ permission javax.security.auth.PrivateCredentialPermission "javax.security.auth.kerberos.KerberosTicket * \"*\"", "read";+ permission javax.security.auth.kerberos.ServicePermission "krbtgt/[email protected]", "initiate";+ permission javax.security.auth.kerberos.ServicePermission "zookeeper/[email protected]", "initiate";+ permission javax.security.auth.kerberos.ServicePermission "zookeeper/[email protected]", "accept";};diff --git a/solr/core/build.xml b/solr/core/build.xmlindex 7a746d12b2a..f320f764300 100644--- a/solr/core/build.xml+++ b/solr/core/build.xml@@ -63,7 +63,7 @@<target name="resolve" depends="ivy-availability-check,ivy-fail,ivy-configure"><sequential><ivy:retrieve conf="compile,compile.hadoop" type="jar,bundle" sync="${ivy.sync}" log="download-only" symlink="${ivy.symlink}"/>- <ivy:retrieve conf="test,test.DfsMiniCluster" type="jar,bundle,test" sync="${ivy.sync}" log="download-only" symlink="${ivy.symlink}"+ <ivy:retrieve conf="test,test.DfsMiniCluster,test.MiniKdc" type="jar,bundle,test" sync="${ivy.sync}" log="download-only" symlink="${ivy.symlink}"pattern="${test.lib.dir}/[artifact]-[revision](-[classifier]).[ext]"/></sequential></target>diff --git a/solr/core/ivy.xml b/solr/core/ivy.xmlindex b552aa389de..e47d0479ec1 100644--- a/solr/core/ivy.xml+++ b/solr/core/ivy.xml@@ -19,13 +19,14 @@<ivy-module version="2.0" xmlns:maven="http://ant.apache.org/ivy/maven"><info organisation="org.apache.solr" module="core"/>- <configurations defaultconfmapping="compile->master;compile.hadoop->master;test->master;test.DfsMiniCluster->master">+ <configurations defaultconfmapping="compile->master;compile.hadoop->master;test->master;test.DfsMiniCluster->master;test.MiniKdc->master"><!-- artifacts in the "compile" and "compile.hadoop" configurations will go into solr/core/lib/ --><conf name="compile" transitive="false"/><conf name="compile.hadoop" transitive="false"/>- <!-- artifacts in the "test" and "test.DfsMiniCluster" configuration will go into solr/core/test-lib/ -->+ <!-- artifacts in the "test", "test.DfsMiniCluster", and "test.MiniKdc" configuration will go into solr/core/test-lib/ --><conf name="test" transitive="false"/><conf name="test.DfsMiniCluster" transitive="false"/>+ <conf name="test.MiniKdc" transitive="false"/></configurations><dependencies>@@ -78,6 +79,10 @@<dependency org="com.sun.jersey" name="jersey-server" rev="${/com.sun.jersey/jersey-server}" conf="test.DfsMiniCluster"/><dependency org="commons-collections" name="commons-collections" rev="${/commons-collections/commons-collections}" conf="test.DfsMiniCluster"/>+ <!-- Hadoop MiniKdc Dependencies-->+ <dependency org="org.apache.hadoop" name="hadoop-minikdc" rev="${/org.apache.hadoop/hadoop-minikdc}" conf="test.MiniKdc"/>+ <dependency org="org.apache.directory.server" name="apacheds-all" rev="${/org.apache.directory.server/apacheds-all}" conf="test.MiniKdc"/>+<exclude org="*" ext="*" matcher="regexp" type="${ivy.exclude.types}"/></dependencies></ivy-module>diff --git a/solr/core/src/test-files/log4j.properties b/solr/core/src/test-files/log4j.propertiesindex f084601b262..4a3a20ab863 100644--- a/solr/core/src/test-files/log4j.properties+++ b/solr/core/src/test-files/log4j.properties@@ -8,6 +8,7 @@ log4j.appender.CONSOLE.layout.ConversionPattern=%-5p - %d{yyyy-MM-dd HH:mm:ss.SSlog4j.logger.org.apache.zookeeper=WARNlog4j.logger.org.apache.hadoop=WARN+log4j.logger.org.apache.directory=WARNlog4j.logger.org.apache.solr.hadoop=INFO#log4j.logger.org.apache.solr.update.processor.LogUpdateProcessor=DEBUGdiff --git a/solr/core/src/test/org/apache/solr/cloud/KerberosTestUtil.java b/solr/core/src/test/org/apache/solr/cloud/KerberosTestUtil.javanew file mode 100644index 00000000000..632c59adc79--- /dev/null+++ b/solr/core/src/test/org/apache/solr/cloud/KerberosTestUtil.java@@ -0,0 +1,105 @@+package org.apache.solr.cloud;++import java.io.File;+import java.util.HashMap;+import java.util.Map;+import java.util.Properties;++import javax.security.auth.login.AppConfigurationEntry;+import javax.security.auth.login.Configuration;++import org.apache.hadoop.minikdc.MiniKdc;++/*+ * Licensed to the Apache Software Foundation (ASF) under one or more+ * contributor license agreements. See the NOTICE file distributed with+ * this work for additional information regarding copyright ownership.+ * The ASF licenses this file to You under the Apache License, Version 2.0+ * (the "License"); you may not use this file except in compliance with+ * the License. You may obtain a copy of the License at+ *+ * http://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing, software+ * distributed under the License is distributed on an "AS IS" BASIS,+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */++public class KerberosTestUtil {++ /**+ * Returns a MiniKdc that can be used for creating kerberos principals+ * and keytabs. Caller is responsible for starting/stopping the kdc.+ */+ public static MiniKdc getKdc(File workDir) throws Exception {+ Properties conf = MiniKdc.createConf();+ return new MiniKdc(conf, workDir);+ }++ /**+ * Programmatic version of a jaas.conf file suitable for connecting+ * to a SASL-configured zookeeper.+ */+ public static class JaasConfiguration extends Configuration {++ private static AppConfigurationEntry[] clientEntry;+ private static AppConfigurationEntry[] serverEntry;++ /**+ * Add an entry to the jaas configuration with the passed in name,+ * principal, and keytab. The other necessary options will be set for you.+ *+ * @param clientPrincipal The principal of the client+ * @param clientKeytab The location of the keytab with the clientPrincipal+ * @param serverPrincipal The principal of the server+ * @param serverKeytab The location of the keytab with the serverPrincipal+ */+ public JaasConfiguration(String clientPrincipal, File clientKeytab,+ String serverPrincipal, File serverKeytab) {+ Map<String, String> clientOptions = new HashMap<String, String>();+ clientOptions.put("principal", clientPrincipal);+ clientOptions.put("keyTab", clientKeytab.getAbsolutePath());+ clientOptions.put("useKeyTab", "true");+ clientOptions.put("storeKey", "true");+ clientOptions.put("useTicketCache", "false");+ clientOptions.put("refreshKrb5Config", "true");+ String jaasProp = System.getProperty("solr.jaas.debug");+ if (jaasProp != null && "true".equalsIgnoreCase(jaasProp)) {+ clientOptions.put("debug", "true");+ }+ clientEntry = new AppConfigurationEntry[]{+ new AppConfigurationEntry(getKrb5LoginModuleName(),+ AppConfigurationEntry.LoginModuleControlFlag.REQUIRED,+ clientOptions)};+ Map<String, String> serverOptions = new HashMap<String, String>(clientOptions);+ serverOptions.put("principal", serverPrincipal);+ serverOptions.put("keytab", serverKeytab.getAbsolutePath());+ serverEntry = new AppConfigurationEntry[]{+ new AppConfigurationEntry(getKrb5LoginModuleName(),+ AppConfigurationEntry.LoginModuleControlFlag.REQUIRED,+ serverOptions)};+ }++ @Override+ public AppConfigurationEntry[] getAppConfigurationEntry(String name) {+ if ("Client".equals(name)) {+ return clientEntry;+ } else if ("Server".equals(name)) {+ return serverEntry;+ }+ return null;+ }++ private String getKrb5LoginModuleName() {+ String krb5LoginModuleName;+ if (System.getProperty("java.vendor").contains("IBM")) {+ krb5LoginModuleName = "com.ibm.security.auth.module.Krb5LoginModule";+ } else {+ krb5LoginModuleName = "com.sun.security.auth.module.Krb5LoginModule";+ }+ return krb5LoginModuleName;+ }+ }+}diff --git a/solr/core/src/test/org/apache/solr/cloud/SaslZkACLProviderTest.java b/solr/core/src/test/org/apache/solr/cloud/SaslZkACLProviderTest.javanew file mode 100644index 00000000000..be1c6a4032e--- /dev/null+++ b/solr/core/src/test/org/apache/solr/cloud/SaslZkACLProviderTest.java@@ -0,0 +1,219 @@+package org.apache.solr.cloud;++import com.carrotsearch.randomizedtesting.annotations.ThreadLeakScope;+import com.carrotsearch.randomizedtesting.annotations.ThreadLeakScope.Scope;++import java.io.File;+import java.io.IOException;+import java.nio.charset.Charset;+import java.util.List;+import javax.security.auth.login.Configuration;++import org.apache.hadoop.minikdc.MiniKdc;+import org.apache.solr.SolrTestCaseJ4;+import org.apache.solr.common.cloud.SaslZkACLProvider;+import org.apache.solr.common.cloud.SolrZkClient;+import org.apache.solr.common.cloud.ZkACLProvider;+import org.apache.solr.common.cloud.DefaultZkACLProvider;+import org.apache.zookeeper.CreateMode;++import org.junit.AfterClass;+import org.junit.BeforeClass;+import org.junit.Test;++import org.slf4j.Logger;+import org.slf4j.LoggerFactory;++/*+ * Licensed to the Apache Software Foundation (ASF) under one or more+ * contributor license agreements. See the NOTICE file distributed with+ * this work for additional information regarding copyright ownership.+ * The ASF licenses this file to You under the Apache License, Version 2.0+ * (the "License"); you may not use this file except in compliance with+ * the License. You may obtain a copy of the License at+ *+ * http://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing, software+ * distributed under the License is distributed on an "AS IS" BASIS,+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */++@ThreadLeakScope(Scope.NONE) // zookeeper sasl login can leak threads, see ZOOKEEPER-2100+public class SaslZkACLProviderTest extends SolrTestCaseJ4 {++ protected static Logger log = LoggerFactory+ .getLogger(SaslZkACLProviderTest.class);++ private static final Charset DATA_ENCODING = Charset.forName("UTF-8");++ protected ZkTestServer zkServer;++ @BeforeClass+ public static void beforeClass() {+ System.setProperty("solrcloud.skip.autorecovery", "true");+ }++ @AfterClass+ public static void afterClass() throws InterruptedException {+ System.clearProperty("solrcloud.skip.autorecovery");+ }++ @Override+ public void setUp() throws Exception {+ super.setUp();+ log.info("####SETUP_START " + getTestName());+ createTempDir();++ String zkDir = createTempDir() + File.separator+ + "zookeeper/server1/data";+ log.info("ZooKeeper dataDir:" + zkDir);+ zkServer = new SaslZkTestServer(zkDir, createTempDir() + File.separator + "miniKdc");+ zkServer.run();++ System.setProperty("zkHost", zkServer.getZkAddress());++ SolrZkClient zkClient = new SolrZkClientWithACLs(zkServer.getZkHost(), AbstractZkTestCase.TIMEOUT);+ try {+ zkClient.makePath("/solr", false, true);+ } finally {+ zkClient.close();+ }+ setupZNodes();++ log.info("####SETUP_END " + getTestName());+ }++ protected void setupZNodes() throws Exception {+ SolrZkClient zkClient = new SolrZkClientWithACLs(zkServer.getZkAddress(), AbstractZkTestCase.TIMEOUT);+ try {+ zkClient.create("/protectedCreateNode", "content".getBytes(DATA_ENCODING), CreateMode.PERSISTENT, false);+ zkClient.makePath("/protectedMakePathNode", "content".getBytes(DATA_ENCODING), CreateMode.PERSISTENT, false);+ } finally {+ zkClient.close();+ }++ zkClient = new SolrZkClientNoACLs(zkServer.getZkAddress(), AbstractZkTestCase.TIMEOUT);+ try {+ zkClient.create("/unprotectedCreateNode", "content".getBytes(DATA_ENCODING), CreateMode.PERSISTENT, false);+ zkClient.makePath("/unprotectedMakePathNode", "content".getBytes(DATA_ENCODING), CreateMode.PERSISTENT, false);+ } finally {+ zkClient.close();+ }+ }++ @Override+ public void tearDown() throws Exception {+ zkServer.shutdown();++ super.tearDown();+ }++ @Test+ public void testSaslZkACLProvider() throws Exception {+ // Test with Sasl enabled+ SolrZkClient zkClient = new SolrZkClientWithACLs(zkServer.getZkAddress(), AbstractZkTestCase.TIMEOUT);+ try {+ VMParamsZkACLAndCredentialsProvidersTest.doTest(zkClient, true, true, true, true, true);+ } finally {+ zkClient.close();+ }++ // Test without Sasl enabled+ setupZNodes();+ System.setProperty("zookeeper.sasl.client", "false");+ zkClient = new SolrZkClientNoACLs(zkServer.getZkAddress(), AbstractZkTestCase.TIMEOUT);+ try {+ VMParamsZkACLAndCredentialsProvidersTest.doTest(zkClient, true, true, false, false, false);+ } finally {+ zkClient.close();+ System.clearProperty("zookeeper.sasl.client");+ }+ }++ /**+ * A SolrZKClient that adds Sasl ACLs+ */+ private static class SolrZkClientWithACLs extends SolrZkClient {++ public SolrZkClientWithACLs(String zkServerAddress, int zkClientTimeout) {+ super(zkServerAddress, zkClientTimeout);+ }++ @Override+ public ZkACLProvider createZkACLProvider() {+ return new SaslZkACLProvider();+ }+ }++ /**+ * A SolrZKClient that doesn't add ACLs+ */+ private static class SolrZkClientNoACLs extends SolrZkClient {++ public SolrZkClientNoACLs(String zkServerAddress, int zkClientTimeout) {+ super(zkServerAddress, zkClientTimeout);+ }++ @Override+ public ZkACLProvider createZkACLProvider() {+ return new DefaultZkACLProvider();+ }+ }++ /**+ * A ZkTestServer with Sasl support+ */+ public static class SaslZkTestServer extends ZkTestServer {+ private String kdcDir;+ private MiniKdc kdc;+ private Configuration conf;++ public SaslZkTestServer(String zkDir, String kdcDir) {+ super(zkDir);+ this.kdcDir = kdcDir;+ }++ public SaslZkTestServer(String zkDir, int port, String kdcDir) {+ super(zkDir, port);+ this.kdcDir = kdcDir;+ conf = Configuration.getConfiguration();+ }++ @Override+ public void run() throws InterruptedException {+ try {+ kdc = KerberosTestUtil.getKdc(new File(kdcDir));+ // Don't require that credentials match the entire principal string, e.g.+ // can match "solr" rather than "solr/host@DOMAIN"+ System.setProperty("zookeeper.kerberos.removeRealmFromPrincipal", "true");+ System.setProperty("zookeeper.kerberos.removeHostFromPrincipal", "true");+ File keytabFile = new File(kdcDir, "keytabs");+ String zkClientPrincipal = "solr";+ String zkServerPrincipal = "zookeeper/127.0.0.1";++ kdc.start();+ // Create ZK client and server principals and load them into the Configuration+ kdc.createPrincipal(keytabFile, zkClientPrincipal, zkServerPrincipal);+ KerberosTestUtil.JaasConfiguration jaas = new KerberosTestUtil.JaasConfiguration(+ zkClientPrincipal, keytabFile, zkServerPrincipal, keytabFile);+ Configuration.setConfiguration(jaas);+ } catch (Exception ex) {+ throw new RuntimeException(ex);+ }+ super.run();+ }++ @Override+ public void shutdown() throws IOException, InterruptedException {+ super.shutdown();+ System.clearProperty("zookeeper.authProvider.1");+ System.clearProperty("zookeeper.kerberos.removeRealmFromPrincipal");+ System.clearProperty("zookeeper.kerberos.removeHostFromPrincipal");+ Configuration.setConfiguration(conf);+ kdc.stop();+ }+ }+}diff --git a/solr/licenses/apacheds-all-2.0.0-M15.jar.sha1 b/solr/licenses/apacheds-all-2.0.0-M15.jar.sha1new file mode 100644index 00000000000..73021a3cfc3--- /dev/null+++ b/solr/licenses/apacheds-all-2.0.0-M15.jar.sha1@@ -0,0 +1 @@+14285c8b4399d18097140b74fb5b4783807730e2diff --git a/solr/licenses/apacheds-all-LICENSE-ASL.txt b/solr/licenses/apacheds-all-LICENSE-ASL.txtnew file mode 100644index 00000000000..3615005dcfc--- /dev/null+++ b/solr/licenses/apacheds-all-LICENSE-ASL.txt@@ -0,0 +1,341 @@++ Apache License+ Version 2.0, January 2004+ http://www.apache.org/licenses/++ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION++ 1. Definitions.++ "License" shall mean the terms and conditions for use, reproduction,+ and distribution as defined by Sections 1 through 9 of this document.++ "Licensor" shall mean the copyright owner or entity authorized by+ the copyright owner that is granting the License.++ "Legal Entity" shall mean the union of the acting entity and all+ other entities that control, are controlled by, or are under common+ control with that entity. For the purposes of this definition,+ "control" means (i) the power, direct or indirect, to cause the+ direction or management of such entity, whether by contract or+ otherwise, or (ii) ownership of fifty percent (50%) or more of the+ outstanding shares, or (iii) beneficial ownership of such entity.++ "You" (or "Your") shall mean an individual or Legal Entity+ exercising permissions granted by this License.++ "Source" form shall mean the preferred form for making modifications,+ including but not limited to software source code, documentation+ source, and configuration files.++ "Object" form shall mean any form resulting from mechanical+ transformation or translation of a Source form, including but+ not limited to compiled object code, generated documentation,+ and conversions to other media types.++ "Work" shall mean the work of authorship, whether in Source or+ Object form, made available under the License, as indicated by a+ copyright notice that is included in or attached to the work+ (an example is provided in the Appendix below).++ "Derivative Works" shall mean any work, whether in Source or Object+ form, that is based on (or derived from) the Work and for which the+ editorial revisions, annotations, elaborations, or other modifications+ represent, as a whole, an original work of authorship. For the purposes+ of this License, Derivative Works shall not include works that remain+ separable from, or merely link (or bind by name) to the interfaces of,+ the Work and Derivative Works thereof.++ "Contribution" shall mean any work of authorship, including+ the original version of the Work and any modifications or additions+ to that Work or Derivative Works thereof, that is intentionally+ submitted to Licensor for inclusion in the Work by the copyright owner+ or by an individual or Legal Entity authorized to submit on behalf of+ the copyright owner. For the purposes of this definition, "submitted"+ means any form of electronic, verbal, or written communication sent+ to the Licensor or its representatives, including but not limited to+ communication on electronic mailing lists, source code control systems,+ and issue tracking systems that are managed by, or on behalf of, the+ Licensor for the purpose of discussing and improving the Work, but+ excluding communication that is conspicuously marked or otherwise+ designated in writing by the copyright owner as "Not a Contribution."++ "Contributor" shall mean Licensor and any individual or Legal Entity+ on behalf of whom a Contribution has been received by Licensor and+ subsequently incorporated within the Work.++ 2. Grant of Copyright License. Subject to the terms and conditions of+ this License, each Contributor hereby grants to You a perpetual,+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable+ copyright license to reproduce, prepare Derivative Works of,+ publicly display, publicly perform, sublicense, and distribute the+ Work and such Derivative Works in Source or Object form.++ 3. Grant of Patent License. Subject to the terms and conditions of+ this License, each Contributor hereby grants to You a perpetual,+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable+ (except as stated in this section) patent license to make, have made,+ use, offer to sell, sell, import, and otherwise transfer the Work,+ where such license applies only to those patent claims licensable+ by such Contributor that are necessarily infringed by their+ Contribution(s) alone or by combination of their Contribution(s)+ with the Work to which such Contribution(s) was submitted. If You+ institute patent litigation against any entity (including a+ cross-claim or counterclaim in a lawsuit) alleging that the Work+ or a Contribution incorporated within the Work constitutes direct+ or contributory patent infringement, then any patent licenses+ granted to You under this License for that Work shall terminate+ as of the date such litigation is filed.++ 4. Redistribution. You may reproduce and distribute copies of the+ Work or Derivative Works thereof in any medium, with or without+ modifications, and in Source or Object form, provided that You+ meet the following conditions:++ (a) You must give any other recipients of the Work or+ Derivative Works a copy of this License; and++ (b) You must cause any modified files to carry prominent notices+ stating that You changed the files; and++ (c) You must retain, in the Source form of any Derivative Works+ that You distribute, all copyright, patent, trademark, and+ attribution notices from the Source form of the Work,+ excluding those notices that do not pertain to any part of+ the Derivative Works; and++ (d) If the Work includes a "NOTICE" text file as part of its+ distribution, then any Derivative Works that You distribute must+ include a readable copy of the attribution notices contained+ within such NOTICE file, excluding those notices that do not+ pertain to any part of the Derivative Works, in at least one+ of the following places: within a NOTICE text file distributed+ as part of the Derivative Works; within the Source form or+ documentation, if provided along with the Derivative Works; or,+ within a display generated by the Derivative Works, if and+ wherever such third-party notices normally appear. The contents+ of the NOTICE file are for informational purposes only and+ do not modify the License. You may add Your own attribution+ notices within Derivative Works that You distribute, alongside+ or as an addendum to the NOTICE text from the Work, provided+ that such additional attribution notices cannot be construed+ as modifying the License.++ You may add Your own copyright statement to Your modifications and+ may provide additional or different license terms and conditions+ for use, reproduction, or distribution of Your modifications, or+ for any such Derivative Works as a whole, provided Your use,+ reproduction, and distribution of the Work otherwise complies with+ the conditions stated in this License.++ 5. Submission of Contributions. Unless You explicitly state otherwise,+ any Contribution intentionally submitted for inclusion in the Work+ by You to the Licensor shall be under the terms and conditions of+ this License, without any additional terms or conditions.+ Notwithstanding the above, nothing herein shall supersede or modify+ the terms of any separate license agreement you may have executed+ with Licensor regarding such Contributions.++ 6. Trademarks. This License does not grant permission to use the trade+ names, trademarks, service marks, or product names of the Licensor,+ except as required for reasonable and customary use in describing the+ origin of the Work and reproducing the content of the NOTICE file.++ 7. Disclaimer of Warranty. Unless required by applicable law or+ agreed to in writing, Licensor provides the Work (and each+ Contributor provides its Contributions) on an "AS IS" BASIS,+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or+ implied, including, without limitation, any warranties or conditions+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A+ PARTICULAR PURPOSE. You are solely responsible for determining the+ appropriateness of using or redistributing the Work and assume any+ risks associated with Your exercise of permissions under this License.++ 8. Limitation of Liability. In no event and under no legal theory,+ whether in tort (including negligence), contract, or otherwise,+ unless required by applicable law (such as deliberate and grossly+ negligent acts) or agreed to in writing, shall any Contributor be+ liable to You for damages, including any direct, indirect, special,+ incidental, or consequential damages of any character arising as a+ result of this License or out of the use or inability to use the+ Work (including but not limited to damages for loss of goodwill,+ work stoppage, computer failure or malfunction, or any and all+ other commercial damages or losses), even if such Contributor+ has been advised of the possibility of such damages.++ 9. Accepting Warranty or Additional Liability. While redistributing+ the Work or Derivative Works thereof, You may choose to offer,+ and charge a fee for, acceptance of support, warranty, indemnity,+ or other liability obligations and/or rights consistent with this+ License. However, in accepting such obligations, You may act only+ on Your own behalf and on Your sole responsibility, not on behalf+ of any other Contributor, and only if You agree to indemnify,+ defend, and hold each Contributor harmless for any liability+ incurred by, or claims asserted against, such Contributor by reason+ of your accepting any such warranty or additional liability.++ END OF TERMS AND CONDITIONS++ APPENDIX: How to apply the Apache License to your work.++ To apply the Apache License to your work, attach the following+ boilerplate notice, with the fields enclosed by brackets "[]"+ replaced with your own identifying information. (Don't include+ the brackets!) The text should be enclosed in the appropriate+ comment syntax for the file format. We also recommend that a+ file or class name and description of purpose be included on the+ same "printed page" as the copyright notice for easier+ identification within third-party archives.++ Copyright [yyyy] [name of copyright owner]++ Licensed under the Apache License, Version 2.0 (the "License");+ you may not use this file except in compliance with the License.+ You may obtain a copy of the License at++ http://www.apache.org/licenses/LICENSE-2.0++ Unless required by applicable law or agreed to in writing, software+ distributed under the License is distributed on an "AS IS" BASIS,+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+ See the License for the specific language governing permissions and+ limitations under the License.+--------------------------------------------------------------------------------------------------+ANTLR 2 License++We reserve no legal rights to the ANTLR--it is fully in the public domain. An individual or company+may do whatever they wish with source code distributed with ANTLR or the code generated by ANTLR,+including the incorporation of ANTLR, or its output, into commerical software.++We encourage users to develop software with ANTLR. However, we do ask that credit is given to us+for developing ANTLR. By "credit", we mean that if you use ANTLR or incorporate any source code+into one of your programs (commercial product, research project, or otherwise) that you acknowledge+this fact somewhere in the documentation, research report, etc... If you like ANTLR and have developed+a nice tool with the output, please mention that you developed it using ANTLR. In addition, we ask that+the headers remain intact in our source code. As long as these guidelines are kept, we expect to+continue enhancing this system and expect to make other tools available as they are completed.++--------------------------------------------------------------------------------------------------+/**+ * JDBM LICENSE v1.00+ *+ * Redistribution and use of this software and associated documentation+ * ("Software"), with or without modification, are permitted provided+ * that the following conditions are met:+ *+ * 1. Redistributions of source code must retain copyright+ * statements and notices. Redistributions must also contain a+ * copy of this document.+ *+ * 2. Redistributions in binary form must reproduce the+ * above copyright notice, this list of conditions and the+ * following disclaimer in the documentation and/or other+ * materials provided with the distribution.+ *+ * 3. The name "JDBM" must not be used to endorse or promote+ * products derived from this Software without prior written+ * permission of Cees de Groot. For written permission,+ * please contact [email protected].+ *+ * 4. Products derived from this Software may not be called "JDBM"+ * nor may "JDBM" appear in their names without prior written+ * permission of Cees de Groot.+ *+ * 5. Due credit should be given to the JDBM Project+ * (http://jdbm.sourceforge.net/).+ *+ * THIS SOFTWARE IS PROVIDED BY THE JDBM PROJECT AND CONTRIBUTORS+ * ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT+ * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND+ * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL+ * CEES DE GROOT OR ANY CONTRIBUTORS BE LIABLE FOR ANY DIRECT,+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED+ * OF THE POSSIBILITY OF SUCH DAMAGE.+ *+ * Copyright 2000 (C) Cees de Groot. All Rights Reserved.+ * Contributions are Copyright (C) 2000 by their associated contributors.+ *+ * $Id: LICENSE.txt,v 1.1 2000/05/05 23:59:52 boisvert Exp $+ */+--------------------------------------------------------------------------------------------------+Copyright (c) 2000-2006 The Legion Of The Bouncy Castle (http://www.bouncycastle.org)++Permission is hereby granted, free of charge, to any person obtaining a copy of this software+and associated documentation files (the "Software"), to deal in the Software without restriction,+including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,+and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,+subject to the following conditions:++The above copyright notice and this permission notice shall be included in all copies or substantial+portions of the Software.++THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,+INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR+PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR+OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER+DEALINGS IN THE SOFTWARE.+--------------------------------------------------------------------------------------------------+JUG (package org/safehaus/uuid) is licensed under the AL v2.+--------------------------------------------------------------------------------------------------+Spring is licensed under the AL v2.+--------------------------------------------------------------------------------------------------+slf4j license:+Copyright (c) 2004-2007 QOS.ch All rights reserved. Permission is hereby granted, free of charge,+to any person obtaining a copy of this software and associated documentation files (the "Software"),+to deal in the Software without restriction, including without limitation the rights to use, copy,+modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit+persons to whom the Software is furnished to do so, subject to the following conditions: The above+copyright notice and this permission notice shall be included in all copies or substantial portions+of the Software.+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT+NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.+IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.+--------------------------------------------------------------------------------------------------+Copyright (c) 1999, 2004 Tanuki Software++Permission is hereby granted, free of charge, to any person+obtaining a copy of the Java Service Wrapper and associated+documentation files (the "Software"), to deal in the Software+without restriction, including without limitation the rights+to use, copy, modify, merge, publish, distribute, sub-license,+and/or sell copies of the Software, and to permit persons to+whom the Software is furnished to do so, subject to the+following conditions:++The above copyright notice and this permission notice shall be+included in all copies or substantial portions of the Software.++THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND+NON-INFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT+HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR+OTHER DEALINGS IN THE SOFTWARE.+++Portions of the Software have been derived from source code+developed by Silver Egg Technology under the following license:++Copyright (c) 2001 Silver Egg Technology++Permission is hereby granted, free of charge, to any person+obtaining a copy of this software and associated documentation+files (the "Software"), to deal in the Software without+restriction, including without limitation the rights to use,+copy, modify, merge, publish, distribute, sub-license, and/or+sell copies of the Software, and to permit persons to whom the+Software is furnished to do so, subject to the following+conditions:++The above copyright notice and this permission notice shall be+included in all copies or substantial portions of the Software.diff --git a/solr/licenses/apacheds-all-NOTICE.txt b/solr/licenses/apacheds-all-NOTICE.txtnew file mode 100644index 00000000000..2e454e2b3be--- /dev/null+++ b/solr/licenses/apacheds-all-NOTICE.txt@@ -0,0 +1,23 @@++Apache Directory Server+Copyright 2003-2013 The Apache Software Foundation++This product includes software developed at+The Apache Software Foundation (http://www.apache.org/).++Safehaus JUG+Copyright 2005 Safehaus++This product includes software developed at+Safehaus (http://docs.safehaus.org/display/HAUS/Home).++ ======================================================================+ == NOTICE file corresponding to section 4 d of the Apache License, ==+ == Version 2.0, in this case for the Spring Framework distribution. ==+ ======================================================================++ This product includes software developed by+ the Apache Software Foundation (http://www.apache.org).++ This product also includes software developed by+ Clinton Begin (http://www.ibatis.com).diff --git a/solr/licenses/hadoop-minikdc-2.3.0.jar.sha1 b/solr/licenses/hadoop-minikdc-2.3.0.jar.sha1new file mode 100644index 00000000000..8243e9267d4--- /dev/null+++ b/solr/licenses/hadoop-minikdc-2.3.0.jar.sha1@@ -0,0 +1 @@+e55e4a3be5ab5c1b26706c81ca287ac573054153diff --git a/solr/licenses/hadoop-minikdc-LICENSE-ASL.txt b/solr/licenses/hadoop-minikdc-LICENSE-ASL.txtnew file mode 100644index 00000000000..9a8e847ee84--- /dev/null+++ b/solr/licenses/hadoop-minikdc-LICENSE-ASL.txt@@ -0,0 +1,244 @@++ Apache License+ Version 2.0, January 2004+ http://www.apache.org/licenses/++ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION++ 1. Definitions.++ "License" shall mean the terms and conditions for use, reproduction,+ and distribution as defined by Sections 1 through 9 of this document.++ "Licensor" shall mean the copyright owner or entity authorized by+ the copyright owner that is granting the License.++ "Legal Entity" shall mean the union of the acting entity and all+ other entities that control, are controlled by, or are under common+ control with that entity. For the purposes of this definition,+ "control" means (i) the power, direct or indirect, to cause the+ direction or management of such entity, whether by contract or+ otherwise, or (ii) ownership of fifty percent (50%) or more of the+ outstanding shares, or (iii) beneficial ownership of such entity.++ "You" (or "Your") shall mean an individual or Legal Entity+ exercising permissions granted by this License.++ "Source" form shall mean the preferred form for making modifications,+ including but not limited to software source code, documentation+ source, and configuration files.++ "Object" form shall mean any form resulting from mechanical+ transformation or translation of a Source form, including but+ not limited to compiled object code, generated documentation,+ and conversions to other media types.++ "Work" shall mean the work of authorship, whether in Source or+ Object form, made available under the License, as indicated by a+ copyright notice that is included in or attached to the work+ (an example is provided in the Appendix below).++ "Derivative Works" shall mean any work, whether in Source or Object+ form, that is based on (or derived from) the Work and for which the+ editorial revisions, annotations, elaborations, or other modifications+ represent, as a whole, an original work of authorship. For the purposes+ of this License, Derivative Works shall not include works that remain+ separable from, or merely link (or bind by name) to the interfaces of,+ the Work and Derivative Works thereof.++ "Contribution" shall mean any work of authorship, including+ the original version of the Work and any modifications or additions+ to that Work or Derivative Works thereof, that is intentionally+ submitted to Licensor for inclusion in the Work by the copyright owner+ or by an individual or Legal Entity authorized to submit on behalf of+ the copyright owner. For the purposes of this definition, "submitted"+ means any form of electronic, verbal, or written communication sent+ to the Licensor or its representatives, including but not limited to+ communication on electronic mailing lists, source code control systems,+ and issue tracking systems that are managed by, or on behalf of, the+ Licensor for the purpose of discussing and improving the Work, but+ excluding communication that is conspicuously marked or otherwise+ designated in writing by the copyright owner as "Not a Contribution."++ "Contributor" shall mean Licensor and any individual or Legal Entity+ on behalf of whom a Contribution has been received by Licensor and+ subsequently incorporated within the Work.++ 2. Grant of Copyright License. Subject to the terms and conditions of+ this License, each Contributor hereby grants to You a perpetual,+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable+ copyright license to reproduce, prepare Derivative Works of,+ publicly display, publicly perform, sublicense, and distribute the+ Work and such Derivative Works in Source or Object form.++ 3. Grant of Patent License. Subject to the terms and conditions of+ this License, each Contributor hereby grants to You a perpetual,+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable+ (except as stated in this section) patent license to make, have made,+ use, offer to sell, sell, import, and otherwise transfer the Work,+ where such license applies only to those patent claims licensable+ by such Contributor that are necessarily infringed by their+ Contribution(s) alone or by combination of their Contribution(s)+ with the Work to which such Contribution(s) was submitted. If You+ institute patent litigation against any entity (including a+ cross-claim or counterclaim in a lawsuit) alleging that the Work+ or a Contribution incorporated within the Work constitutes direct+ or contributory patent infringement, then any patent licenses+ granted to You under this License for that Work shall terminate+ as of the date such litigation is filed.++ 4. Redistribution. You may reproduce and distribute copies of the+ Work or Derivative Works thereof in any medium, with or without+ modifications, and in Source or Object form, provided that You+ meet the following conditions:++ (a) You must give any other recipients of the Work or+ Derivative Works a copy of this License; and++ (b) You must cause any modified files to carry prominent notices+ stating that You changed the files; and++ (c) You must retain, in the Source form of any Derivative Works+ that You distribute, all copyright, patent, trademark, and+ attribution notices from the Source form of the Work,+ excluding those notices that do not pertain to any part of+ the Derivative Works; and++ (d) If the Work includes a "NOTICE" text file as part of its+ distribution, then any Derivative Works that You distribute must+ include a readable copy of the attribution notices contained+ within such NOTICE file, excluding those notices that do not+ pertain to any part of the Derivative Works, in at least one+ of the following places: within a NOTICE text file distributed+ as part of the Derivative Works; within the Source form or+ documentation, if provided along with the Derivative Works; or,+ within a display generated by the Derivative Works, if and+ wherever such third-party notices normally appear. The contents+ of the NOTICE file are for informational purposes only and+ do not modify the License. You may add Your own attribution+ notices within Derivative Works that You distribute, alongside+ or as an addendum to the NOTICE text from the Work, provided+ that such additional attribution notices cannot be construed+ as modifying the License.++ You may add Your own copyright statement to Your modifications and+ may provide additional or different license terms and conditions+ for use, reproduction, or distribution of Your modifications, or+ for any such Derivative Works as a whole, provided Your use,+ reproduction, and distribution of the Work otherwise complies with+ the conditions stated in this License.++ 5. Submission of Contributions. Unless You explicitly state otherwise,+ any Contribution intentionally submitted for inclusion in the Work+ by You to the Licensor shall be under the terms and conditions of+ this License, without any additional terms or conditions.+ Notwithstanding the above, nothing herein shall supersede or modify+ the terms of any separate license agreement you may have executed+ with Licensor regarding such Contributions.++ 6. Trademarks. This License does not grant permission to use the trade+ names, trademarks, service marks, or product names of the Licensor,+ except as required for reasonable and customary use in describing the+ origin of the Work and reproducing the content of the NOTICE file.++ 7. Disclaimer of Warranty. Unless required by applicable law or+ agreed to in writing, Licensor provides the Work (and each+ Contributor provides its Contributions) on an "AS IS" BASIS,+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or+ implied, including, without limitation, any warranties or conditions+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A+ PARTICULAR PURPOSE. You are solely responsible for determining the+ appropriateness of using or redistributing the Work and assume any+ risks associated with Your exercise of permissions under this License.++ 8. Limitation of Liability. In no event and under no legal theory,+ whether in tort (including negligence), contract, or otherwise,+ unless required by applicable law (such as deliberate and grossly+ negligent acts) or agreed to in writing, shall any Contributor be+ liable to You for damages, including any direct, indirect, special,+ incidental, or consequential damages of any character arising as a+ result of this License or out of the use or inability to use the+ Work (including but not limited to damages for loss of goodwill,+ work stoppage, computer failure or malfunction, or any and all+ other commercial damages or losses), even if such Contributor+ has been advised of the possibility of such damages.++ 9. Accepting Warranty or Additional Liability. While redistributing+ the Work or Derivative Works thereof, You may choose to offer,+ and charge a fee for, acceptance of support, warranty, indemnity,+ or other liability obligations and/or rights consistent with this+ License. However, in accepting such obligations, You may act only+ on Your own behalf and on Your sole responsibility, not on behalf+ of any other Contributor, and only if You agree to indemnify,+ defend, and hold each Contributor harmless for any liability+ incurred by, or claims asserted against, such Contributor by reason+ of your accepting any such warranty or additional liability.++ END OF TERMS AND CONDITIONS++ APPENDIX: How to apply the Apache License to your work.++ To apply the Apache License to your work, attach the following+ boilerplate notice, with the fields enclosed by brackets "[]"+ replaced with your own identifying information. (Don't include+ the brackets!) The text should be enclosed in the appropriate+ comment syntax for the file format. We also recommend that a+ file or class name and description of purpose be included on the+ same "printed page" as the copyright notice for easier+ identification within third-party archives.++ Copyright [yyyy] [name of copyright owner]++ Licensed under the Apache License, Version 2.0 (the "License");+ you may not use this file except in compliance with the License.+ You may obtain a copy of the License at++ http://www.apache.org/licenses/LICENSE-2.0++ Unless required by applicable law or agreed to in writing, software+ distributed under the License is distributed on an "AS IS" BASIS,+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+ See the License for the specific language governing permissions and+ limitations under the License.+++APACHE HADOOP SUBCOMPONENTS:++The Apache Hadoop project contains subcomponents with separate copyright+notices and license terms. Your use of the source code for the these+subcomponents is subject to the terms and conditions of the following+licenses.++For the org.apache.hadoop.util.bloom.* classes:++/**+ *+ * Copyright (c) 2005, European Commission project OneLab under contract+ * 034819 (http://www.one-lab.org)+ * All rights reserved.+ * Redistribution and use in source and binary forms, with or+ * without modification, are permitted provided that the following+ * conditions are met:+ * - Redistributions of source code must retain the above copyright+ * notice, this list of conditions and the following disclaimer.+ * - Redistributions in binary form must reproduce the above copyright+ * notice, this list of conditions and the following disclaimer in+ * the documentation and/or other materials provided with the distribution.+ * - Neither the name of the University Catholique de Louvain - UCL+ * nor the names of its contributors may be used to endorse or+ * promote products derived from this software without specific prior+ * written permission.+ *+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE+ * POSSIBILITY OF SUCH DAMAGE.+ */\ No newline at end of filediff --git a/solr/licenses/hadoop-minikdc-NOTICE.txt b/solr/licenses/hadoop-minikdc-NOTICE.txtnew file mode 100644index 00000000000..c56a5e4eac1--- /dev/null+++ b/solr/licenses/hadoop-minikdc-NOTICE.txt@@ -0,0 +1,2 @@+This product includes software developed by The Apache Software+Foundation (http://www.apache.org/).\ No newline at end of filediff --git a/solr/solrj/src/java/org/apache/solr/common/cloud/SaslZkACLProvider.java b/solr/solrj/src/java/org/apache/solr/common/cloud/SaslZkACLProvider.javanew file mode 100644index 00000000000..86ab25f19ac--- /dev/null+++ b/solr/solrj/src/java/org/apache/solr/common/cloud/SaslZkACLProvider.java@@ -0,0 +1,49 @@+package org.apache.solr.common.cloud;++/*+ * Licensed to the Apache Software Foundation (ASF) under one or more+ * contributor license agreements. See the NOTICE file distributed with+ * this work for additional information regarding copyright ownership.+ * The ASF licenses this file to You under the Apache License, Version 2.0+ * (the "License"); you may not use this file except in compliance with+ * the License. You may obtain a copy of the License at+ *+ * http://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing, software+ * distributed under the License is distributed on an "AS IS" BASIS,+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */++import java.util.ArrayList;+import java.util.List;++import org.apache.zookeeper.ZooDefs;+import org.apache.zookeeper.data.ACL;+import org.apache.zookeeper.data.Id;++/**+ * ZkACLProvider that gives all permissions for the user specified in System+ * property "solr.authorization.superuser" (default: "solr") when using sasl,+ * and gives read permissions for anyone else. Designed for a setup where+ * configurations have already been set up and will not be modified, or+ * where configuration changes are controlled via Solr APIs.+ */+public class SaslZkACLProvider extends DefaultZkACLProvider {++ private static String superUser = System.getProperty("solr.authorization.superuser", "solr");++ @Override+ protected List<ACL> createGlobalACLsToAdd() {+ List<ACL> result = new ArrayList<ACL>();+ result.add(new ACL(ZooDefs.Perms.ALL, new Id("sasl", superUser)));+ result.add(new ACL(ZooDefs.Perms.READ, ZooDefs.Ids.ANYONE_ID_UNSAFE));++ if (result.isEmpty()) {+ result = super.createGlobalACLsToAdd();+ }+ return result;+ }+}diff --git a/solr/test-framework/src/java/org/apache/solr/cloud/ZkTestServer.java b/solr/test-framework/src/java/org/apache/solr/cloud/ZkTestServer.javaindex c4747c9e9d0..645a8fbfff4 100644--- a/solr/test-framework/src/java/org/apache/solr/cloud/ZkTestServer.java+++ b/solr/test-framework/src/java/org/apache/solr/cloud/ZkTestServer.java@@ -287,6 +287,11 @@ public class ZkTestServer {public void runFromConfig(ServerConfig config) throws IOException {log.info("Starting server");try {+ // ZooKeeper maintains a static collection of AuthenticationProviders, so+ // we make sure the SASL provider is loaded so that it can be used in+ // subsequent tests.+ System.setProperty("zookeeper.authProvider.1",+ "org.apache.zookeeper.server.auth.SASLAuthenticationProvider");// Note that this thread isn't going to be doing anything else,// so rather than spawning another thread, we will just call// run() in this thread.