mirror of
https://github.com/Alfresco/SearchServices.git
synced 2026-09-16 18:12:56 +00:00
Merge pull request #2052 from Alfresco/feature/ACS-7921_CVE_2017_3164_SOLR-12770_customized_fix
ACS-7921: Add a default property value for solr.shardsWhitelist to th…
This commit is contained in:
@@ -43,7 +43,7 @@
|
||||
<properties>
|
||||
<maven.build.sourceVersion>11</maven.build.sourceVersion>
|
||||
<solr.base.version>6.6.5</solr.base.version>
|
||||
<solr.version>${solr.base.version}-patched.16</solr.version>
|
||||
<solr.version>${solr.base.version}-patched.18</solr.version>
|
||||
<!-- The location to download the solr zip file from. -->
|
||||
<!-- <solr.zip>https://archive.apache.org/dist/lucene/solr/${solr.version}/solr-${solr.version}.zip</solr.zip> -->
|
||||
<!-- Solr startup scripts do not work with any Java version higher than 9 so the scripts have been patched -->
|
||||
|
||||
+31
-6
@@ -100,6 +100,8 @@ public abstract class SolrITInitializer extends SolrTestCaseJ4
|
||||
protected static final int DEFAULT_CONNECTION_TIMEOUT1 = DEFAULT_CONNECTION_TIMEOUT;
|
||||
protected static final int CLIENT_SO_TIMEOUT = 90000;
|
||||
protected final static int INDEX_TIMEOUT = 100000;
|
||||
protected static final String JETTY_CONTEXT = "/solr";
|
||||
protected static final String SHARD_NAME_PREFIX = "shard";
|
||||
|
||||
private static AtomicInteger nodeCnt;
|
||||
protected static boolean useExplicitNodeNames;
|
||||
@@ -107,6 +109,7 @@ public abstract class SolrITInitializer extends SolrTestCaseJ4
|
||||
public static Properties DEFAULT_CORE_PROPS = new Properties();
|
||||
|
||||
protected static Map<String, JettySolrRunner> jettyContainers;
|
||||
protected static int jettyPort;
|
||||
protected static Map<String, SolrClient> solrCollectionNameToStandaloneClient;
|
||||
protected static List<JettySolrRunner> solrShards;
|
||||
protected static List<SolrClient> clientShards;
|
||||
@@ -150,6 +153,9 @@ public abstract class SolrITInitializer extends SolrTestCaseJ4
|
||||
{
|
||||
testClassName = testClassName + "_" + System.currentTimeMillis();
|
||||
|
||||
if (numShards > 0) {
|
||||
jettyPort = getNextAvailablePort();
|
||||
}
|
||||
solrcoreProperties = addExplicitShardingProperty(solrcoreProperties);
|
||||
|
||||
clientShards = new ArrayList<>();
|
||||
@@ -164,6 +170,7 @@ public abstract class SolrITInitializer extends SolrTestCaseJ4
|
||||
String[] coreNames = new String[]{DEFAULT_TEST_CORENAME};
|
||||
|
||||
distribSetUp(testClassName);
|
||||
distribShardsSetUp(numShards);
|
||||
|
||||
RandomSupplier.RandVal.uniqueValues = new HashSet<>(); // reset random values
|
||||
|
||||
@@ -249,6 +256,24 @@ public abstract class SolrITInitializer extends SolrTestCaseJ4
|
||||
System.setProperty("solr.log.dir", testDir.toPath().resolve(serverName).toString());
|
||||
}
|
||||
|
||||
/**
|
||||
* Needed to test fix for CVE-2017-3164
|
||||
* @param numShards
|
||||
*/
|
||||
private static void distribShardsSetUp(int numShards){
|
||||
if (numShards <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
StringBuilder shardWhitelistBuilder = new StringBuilder();
|
||||
for (int i = 0; i < numShards; i++)
|
||||
{
|
||||
shardWhitelistBuilder.append("127.0.0.1:").append(jettyPort).append(JETTY_CONTEXT).append("/" + SHARD_NAME_PREFIX + i).append(',');
|
||||
}
|
||||
shardWhitelistBuilder.deleteCharAt(shardWhitelistBuilder.length() - 1);
|
||||
System.setProperty("solr.shardsWhitelist", shardWhitelistBuilder.toString());
|
||||
}
|
||||
|
||||
public static void distribTearDown()
|
||||
{
|
||||
System.clearProperty("solr.directoryFactory");
|
||||
@@ -276,7 +301,7 @@ public abstract class SolrITInitializer extends SolrTestCaseJ4
|
||||
{
|
||||
Path jettySolrHome = testDir.toPath().resolve(jettyKey);
|
||||
seedSolrHome(jettySolrHome);
|
||||
return createJetty(jettySolrHome.toFile(), null, null, false, 0, getSchemaFile(), basicAuth);
|
||||
return createJetty(jettySolrHome.toFile(), null, null, false, jettyPort, getSchemaFile(), basicAuth);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -365,7 +390,7 @@ public abstract class SolrITInitializer extends SolrTestCaseJ4
|
||||
Properties props = new Properties();
|
||||
props.putAll(additionalProperties);
|
||||
|
||||
final String shardname = "shard" + i;
|
||||
final String shardname = SHARD_NAME_PREFIX + i;
|
||||
props.put("shard.instance", Integer.toString(i));
|
||||
props.put("shard.count", Integer.toString(numShards));
|
||||
|
||||
@@ -396,7 +421,7 @@ public abstract class SolrITInitializer extends SolrTestCaseJ4
|
||||
for (int i = 0; i < numShards; i++)
|
||||
{
|
||||
if (sb.length() > 0) sb.append(',');
|
||||
final String shardname = "shard" + i;
|
||||
final String shardname = SHARD_NAME_PREFIX + i;
|
||||
String shardStr = buildUrl(solr.getLocalPort()) + "/" + shardname;
|
||||
LOGGER.info(shardStr);
|
||||
SolrClient clientShard = createNewSolrClient(shardStr);
|
||||
@@ -469,10 +494,10 @@ public abstract class SolrITInitializer extends SolrTestCaseJ4
|
||||
if(basicAuth)
|
||||
{
|
||||
LOGGER.info("###### adding basic auth ######");
|
||||
config = JettyConfig.builder().setContext("/solr").setPort(port).withFilter(BasicAuthFilter.class, "/sql/*").stopAtShutdown(true).withSSLConfig(sslConfig).build();
|
||||
config = JettyConfig.builder().setContext(JETTY_CONTEXT).setPort(port).withFilter(BasicAuthFilter.class, "/sql/*").stopAtShutdown(true).withSSLConfig(sslConfig).build();
|
||||
} else {
|
||||
LOGGER.info("###### no basic auth ######");
|
||||
config = JettyConfig.builder().setContext("/solr").setPort(port).stopAtShutdown(true).withSSLConfig(sslConfig).build();
|
||||
config = JettyConfig.builder().setContext(JETTY_CONTEXT).setPort(port).stopAtShutdown(true).withSSLConfig(sslConfig).build();
|
||||
}
|
||||
|
||||
return new JettySolrRunner(solrHome.getAbsolutePath(), props, config);
|
||||
@@ -514,7 +539,7 @@ public abstract class SolrITInitializer extends SolrTestCaseJ4
|
||||
|
||||
protected static String buildUrl(int port)
|
||||
{
|
||||
return buildUrl(port, "/solr");
|
||||
return buildUrl(port, JETTY_CONTEXT);
|
||||
}
|
||||
|
||||
protected static String getSolrXml()
|
||||
|
||||
@@ -183,28 +183,28 @@ jsonic-1.2.7.jar
|
||||
jul-to-slf4j-1.7.7.jar
|
||||
juniversalchardet-1.0.3.jar
|
||||
langdetect-1.1-20120112.jar
|
||||
lucene-analyzers-common-6.6.5-patched.16.jar
|
||||
lucene-analyzers-icu-6.6.5-patched.16.jar
|
||||
lucene-analyzers-kuromoji-6.6.5-patched.16.jar
|
||||
lucene-analyzers-morfologik-6.6.5-patched.16.jar
|
||||
lucene-analyzers-phonetic-6.6.5-patched.16.jar
|
||||
lucene-analyzers-smartcn-6.6.5-patched.16.jar
|
||||
lucene-analyzers-stempel-6.6.5-patched.16.jar
|
||||
lucene-backward-codecs-6.6.5-patched.16.jar
|
||||
lucene-classification-6.6.5-patched.16.jar
|
||||
lucene-codecs-6.6.5-patched.16.jar
|
||||
lucene-core-6.6.5-patched.16.jar
|
||||
lucene-expressions-6.6.5-patched.16.jar
|
||||
lucene-grouping-6.6.5-patched.16.jar
|
||||
lucene-highlighter-6.6.5-patched.16.jar
|
||||
lucene-join-6.6.5-patched.16.jar
|
||||
lucene-memory-6.6.5-patched.16.jar
|
||||
lucene-misc-6.6.5-patched.16.jar
|
||||
lucene-queries-6.6.5-patched.16.jar
|
||||
lucene-queryparser-6.6.5-patched.16.jar
|
||||
lucene-sandbox-6.6.5-patched.16.jar
|
||||
lucene-spatial-extras-6.6.5-patched.16.jar
|
||||
lucene-suggest-6.6.5-patched.16.jar
|
||||
lucene-analyzers-common-6.6.5-patched.18.jar
|
||||
lucene-analyzers-icu-6.6.5-patched.18.jar
|
||||
lucene-analyzers-kuromoji-6.6.5-patched.18.jar
|
||||
lucene-analyzers-morfologik-6.6.5-patched.18.jar
|
||||
lucene-analyzers-phonetic-6.6.5-patched.18.jar
|
||||
lucene-analyzers-smartcn-6.6.5-patched.18.jar
|
||||
lucene-analyzers-stempel-6.6.5-patched.18.jar
|
||||
lucene-backward-codecs-6.6.5-patched.18.jar
|
||||
lucene-classification-6.6.5-patched.18.jar
|
||||
lucene-codecs-6.6.5-patched.18.jar
|
||||
lucene-core-6.6.5-patched.18.jar
|
||||
lucene-expressions-6.6.5-patched.18.jar
|
||||
lucene-grouping-6.6.5-patched.18.jar
|
||||
lucene-highlighter-6.6.5-patched.18.jar
|
||||
lucene-join-6.6.5-patched.18.jar
|
||||
lucene-memory-6.6.5-patched.18.jar
|
||||
lucene-misc-6.6.5-patched.18.jar
|
||||
lucene-queries-6.6.5-patched.18.jar
|
||||
lucene-queryparser-6.6.5-patched.18.jar
|
||||
lucene-sandbox-6.6.5-patched.18.jar
|
||||
lucene-spatial-extras-6.6.5-patched.18.jar
|
||||
lucene-suggest-6.6.5-patched.18.jar
|
||||
metrics-core-3.2.2.jar
|
||||
metrics-ganglia-3.2.2.jar
|
||||
metrics-graphite-3.2.2.jar
|
||||
@@ -218,11 +218,11 @@ protobuf-java-3.23.4.jar
|
||||
rome-1.5.1.jar
|
||||
slf4j-api-1.7.7.jar
|
||||
slf4j-log4j12-1.7.7.jar
|
||||
solr-analysis-extras-6.6.5-patched.16.jar
|
||||
solr-clustering-6.6.5-patched.16.jar
|
||||
solr-core-6.6.5-patched.16.jar
|
||||
solr-langid-6.6.5-patched.16.jar
|
||||
solr-solrj-6.6.5-patched.16.jar
|
||||
solr-analysis-extras-6.6.5-patched.18.jar
|
||||
solr-clustering-6.6.5-patched.18.jar
|
||||
solr-core-6.6.5-patched.18.jar
|
||||
solr-langid-6.6.5-patched.18.jar
|
||||
solr-solrj-6.6.5-patched.18.jar
|
||||
spatial4j-0.6.jar
|
||||
start.jar
|
||||
stax2-api-3.1.4.jar
|
||||
|
||||
Reference in New Issue
Block a user