Skip to content

Commit dfc41db

Browse files
authored
Merge pull request #34 from NihalHarish/6.7-migration
Support for Elasticsearch 6.7.1
2 parents 4487bf4 + cfc9be6 commit dfc41db

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+2046
-928
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,5 @@ data/
3434
puppet/.vagrant
3535
test.sh
3636
.vagrant/
37+
.idea/
38+
*.iml

plugin-descriptor.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
description=Provide access control related features for Elasticsearch 6
44
#
55
# 'version': plugin's version
6-
version=0.8.0.0
6+
version=0.9.0.0
77
#
88
# 'name': the plugin name
99
name=opendistro_security
@@ -22,4 +22,4 @@ java.version=1.8
2222
# elasticsearch release. This version is checked when the plugin
2323
# is loaded so Elasticsearch will refuse to start in the presence of
2424
# plugins with the incorrect elasticsearch.version.
25-
elasticsearch.version=6.6.2
25+
elasticsearch.version=6.7.1

pom.xml

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -34,17 +34,15 @@
3434
<parent>
3535
<groupId>com.amazon.opendistroforelasticsearch</groupId>
3636
<artifactId>opendistro_security_parent</artifactId>
37-
<version>0.8.0.0</version>
37+
<version>0.9.0.0</version>
3838
</parent>
3939

4040
<artifactId>opendistro_security</artifactId>
4141
<packaging>jar</packaging>
42-
<version>0.8.0.0</version>
43-
<name>Open Distro For Elasticsearch Security</name>
42+
<version>0.9.0.0</version>
43+
<name>Open Distro Security for Elasticsearch</name>
4444
<description>Open Distro For Elasticsearch Security</description>
45-
<url>https://github.com/opendistro-for-elasticsearch/security</url>
4645
<inceptionYear>2015</inceptionYear>
47-
4846
<licenses>
4947
<license>
5048
<name>The Apache Software License, Version 2.0</name>
@@ -54,9 +52,9 @@
5452
</licenses>
5553

5654
<properties>
57-
<opendistro_security_ssl.version>0.8.0.0</opendistro_security_ssl.version>
58-
<opendistro_security_advanced_modules.version>0.8.0.0</opendistro_security_advanced_modules.version>
59-
<elasticsearch.version>6.6.2</elasticsearch.version>
55+
<opendistro_security_ssl.version>0.9.0.0</opendistro_security_ssl.version>
56+
<opendistro_security_advanced_modules.version>0.9.0.0</opendistro_security_advanced_modules.version>
57+
<elasticsearch.version>6.7.1</elasticsearch.version>
6058

6159
<!-- deps -->
6260
<netty-native.version>2.0.20.Final</netty-native.version>
@@ -78,7 +76,7 @@
7876
<url>https://github.com/opendistro-for-elasticsearch/security</url>
7977
<connection>scm:git:[email protected]:opendistro-for-elasticsearch/security.git</connection>
8078
<developerConnection>scm:git:[email protected]:opendistro-for-elasticsearch/security.git</developerConnection>
81-
<tag>0.8.0.0</tag>
79+
<tag>0.9.0.0</tag>
8280
</scm>
8381

8482
<issueManagement>
@@ -247,8 +245,12 @@
247245
<plugin>
248246
<groupId>org.apache.maven.plugins</groupId>
249247
<artifactId>maven-surefire-plugin</artifactId>
248+
249+
<version>3.0.0-M3</version>
250250

251251
<configuration>
252+
<argLine>-Xmx3072m</argLine>
253+
<rerunFailingTestsCount>3</rerunFailingTestsCount>
252254
<forkCount>3</forkCount>
253255
<reuseForks>true</reuseForks>
254256
<!--

securityconfig/action_groups.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,6 @@ CLUSTER_COMPOSITE_OPS_RO:
117117
- "indices:data/read/mget"
118118
- "indices:data/read/msearch"
119119
- "indices:data/read/mtv"
120-
- "indices:data/read/coordinate-msearch*"
121120
- "indices:admin/aliases/exists*"
122121
- "indices:admin/aliases/get*"
123122
- "indices:data/read/scroll"

src/main/java/com/amazon/opendistroforelasticsearch/security/OpenDistroSecurityPlugin.java

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -315,10 +315,7 @@ public List<Path> run() {
315315
final Path confPath = new Environment(settings, configPath).configFile().toAbsolutePath();
316316
if(Files.isDirectory(confPath, LinkOption.NOFOLLOW_LINKS)) {
317317
try (Stream<Path> s = Files.walk(confPath)) {
318-
return s
319-
.distinct()
320-
.filter(p->checkFilePermissions(p))
321-
.collect(Collectors.toList());
318+
return s.distinct().filter(p -> checkFilePermissions(p)).collect(Collectors.toList());
322319
} catch (Exception e) {
323320
log.error(e);
324321
return null;
@@ -348,10 +345,7 @@ public List<String> run() {
348345
final Path confPath = new Environment(settings, configPath).configFile().toAbsolutePath();
349346
if(Files.isDirectory(confPath, LinkOption.NOFOLLOW_LINKS)) {
350347
try (Stream<Path> s = Files.walk(confPath)) {
351-
return s
352-
.distinct()
353-
.map(p->sha256(p))
354-
.collect(Collectors.toList());
348+
return s.distinct().map(p -> sha256(p)).collect(Collectors.toList());
355349
} catch (Exception e) {
356350
log.error(e);
357351
return null;
@@ -421,8 +415,7 @@ private boolean checkFilePermissions(final Path p) {
421415
return true;
422416
}
423417
} else {
424-
if (perms.contains(PosixFilePermission.OWNER_EXECUTE)
425-
|| perms.contains(PosixFilePermission.GROUP_EXECUTE)
418+
if (perms.contains(PosixFilePermission.OWNER_EXECUTE) || perms.contains(PosixFilePermission.GROUP_EXECUTE)
426419
|| perms.contains(PosixFilePermission.OTHERS_EXECUTE)) {
427420
// no x must be set
428421
return true;
@@ -776,13 +769,14 @@ public Collection<Object> createComponents(Client localClient, ClusterService cl
776769
adminDns = new AdminDNs(settings);
777770
//final PrincipalExtractor pe = new DefaultPrincipalExtractor();
778771
cr = (IndexBaseConfigurationRepository) IndexBaseConfigurationRepository.create(settings, this.configPath, threadPool, localClient, clusterService, auditLog, complianceConfig);
772+
cr.subscribeOnChange(ConfigConstants.CONFIGNAME_CONFIG, irr);
779773
final InternalAuthenticationBackend iab = new InternalAuthenticationBackend(cr);
780774
final XFFResolver xffResolver = new XFFResolver(threadPool);
781775
cr.subscribeOnChange(ConfigConstants.CONFIGNAME_CONFIG, xffResolver);
782776
backendRegistry = new BackendRegistry(settings, configPath, adminDns, xffResolver, iab, auditLog, threadPool);
783777
cr.subscribeOnChange(ConfigConstants.CONFIGNAME_CONFIG, backendRegistry);
784778
final ActionGroupHolder ah = new ActionGroupHolder(cr);
785-
evaluator = new PrivilegesEvaluator(clusterService, threadPool, cr, ah, resolver, auditLog, settings, privilegesInterceptor, cih);
779+
evaluator = new PrivilegesEvaluator(clusterService, threadPool, cr, ah, resolver, auditLog, settings, privilegesInterceptor, cih, irr, advancedModulesEnabled);
786780

787781
final CompatConfig compatConfig = new CompatConfig(environment);
788782
cr.subscribeOnChange(ConfigConstants.CONFIGNAME_CONFIG, compatConfig);
@@ -1023,6 +1017,9 @@ public Collection<Class<? extends LifecycleComponent>> getGuiceServiceClasses()
10231017
@Override
10241018
public Function<String, Predicate<String>> getFieldFilter() {
10251019
return index -> {
1020+
if (threadPool == null) {
1021+
return field -> true;
1022+
}
10261023
final Map<String, Set<String>> allowedFlsFields = (Map<String, Set<String>>) HeaderHelper
10271024
.deserializeSafeFromHeader(threadPool.getThreadContext(), ConfigConstants.OPENDISTRO_SECURITY_FLS_FIELDS_HEADER);
10281025

@@ -1033,9 +1030,9 @@ public Function<String, Predicate<String>> getFieldFilter() {
10331030
} else {
10341031

10351032
final Set<String> includesExcludes = allowedFlsFields.get(eval);
1033+
final Set includesSet = new HashSet<>(includesExcludes.size());
1034+
final Set excludesSet = new HashSet<>(includesExcludes.size());
10361035

1037-
final Set<String> includesSet = new HashSet<>(includesExcludes.size());
1038-
final Set<String> excludesSet = new HashSet<>(includesExcludes.size());
10391036

10401037
for (final String incExc : includesExcludes) {
10411038
final char firstChar = incExc.charAt(0);

0 commit comments

Comments
 (0)