Skip to content

Commit

Permalink
Update plugin for security policy changes in ES 2.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Branor committed Apr 12, 2016
1 parent a4ff441 commit a442c59
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 23 deletions.
30 changes: 15 additions & 15 deletions README.md
Expand Up @@ -8,6 +8,8 @@ This plugin makes your ElasticSearch node appear like a Couchbase Server node.
Installation
============

Note that as of Elasticsearch version 2.0, plugins are version specific. This means that each minor version of Elasticsearch has a corresponding version of the plugin. For example, ES 2.3.1 works with plugin version 2.2.3.1 and so on.

To install the ES 1.x compatible plugin, run the following command from your ElasticSearch installation folder:

bin/plugin -i -url http://packages.couchbase.com.s3.amazonaws.com/releases/elastic-search-adapter/2.1.2/elasticsearch-transport-couchbase-2.1.2.zip
Expand All @@ -16,14 +18,22 @@ To install the ES 2.1.1 compatible version, run the following command from your

bin/plugin install https://github.com/couchbaselabs/elasticsearch-transport-couchbase/releases/download/2.2.1.2/elasticsearch-transport-couchbase-2.2.1.2.zip

As of ES 2.2, the plugin versions are aligned to be 2.<ES_VERSION>, so to install for ES 2.2+, use the following command and replace <ES_VERSION> with your ES version:

bin/plugin install https://github.com/couchbaselabs/elasticsearch-transport-couchbase/releases/download/2.<ES_VERSION>/elasticsearch-transport-couchbase-2.<ES_VERSION>.zip

You will be asked to approve additional permissions required by the plugin, please do so.

Version Compatibility:

+------------------------------------------------------------------+
| Plugin | Couchbase | ElasticSearch |
+------------------------------------------------------------------+
| master | 2.5.x - 4.x | 2.2.1 |
| master | 2.5.x - 4.x | 2.3.1 |
+------------------------------------------------------------------+
| 2.2.3.x | 2.5.x - 4.x | 2.3.x |
+------------------------------------------------------------------+
| 2.3.0 | 2.5.x - 4.x | 2.x |
| 2.2.2.x | 2.5.x - 4.x | 2.2.x |
+------------------------------------------------------------------+
| 2.2.1 | 2.5.x - 4.x | 2.1.1 |
+------------------------------------------------------------------+
Expand All @@ -33,22 +43,12 @@ Version Compatibility:
+------------------------------------------------------------------+
| 2.0 | 3.x, 2.5.x | 1.3.0 |
+------------------------------------------------------------------+
| 1.3.0 | 2.5.x | 1.1.0 |
+------------------------------------------------------------------+
| 1.2.0 | 2.2 | 0.90.5 |
+------------------------------------------------------------------+
| 1.1.0 | 2.0 | 0.90.2 |
+------------------------------------------------------------------+
| 1.0.0-dp | 2.0 (beta) | 0.19.9 |
+------------------------------------------------------------------+
| 1.0.0-beta | 2.0.0 | 0.20.2 |
+------------------------------------------------------------------+
| 1.0.0 | 2.0.0 | 0.20.2 |
+------------------------------------------------------------------+

# Configuration #

**Important note for Elasticsearch 2.1**: Due to changes in the plugin security mechanism, when installing v2.2.x of the plugin you must also edit the Java security policy to grant it appropriate permissions. See the **Java Security Policy Permissions** topic below for instructions.
**Important note for Elasticsearch 2.1**: Due to changes in the plugin security mechanism, when installing v2.2.0.x and v2.2.1.x of the plugin you must also edit the Java security policy to grant it appropriate permissions. See the **Java Security Policy Permissions** topic below for instructions.

**This workaround is not required for Elasticsearch 2.2+ with plugin 2.2.2.0+.**

Configuration for the plugin is specified as part of the ElasticSearch config file (usually elasticsearch.yml) and is currently only read when ElasticSearch starts. Dynamic configuration support is planned for the future.

Expand Down
4 changes: 2 additions & 2 deletions pom.xml
Expand Up @@ -2,9 +2,9 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.couchbase</groupId>
<artifactId>elasticsearch-transport-couchbase</artifactId>
<version>2.2.1.2</version>
<version>2.2.2.0</version>
<properties>
<elasticsearch.version>2.1.0</elasticsearch.version>
<elasticsearch.version>2.2.0</elasticsearch.version>
</properties>

<repositories>
Expand Down
5 changes: 4 additions & 1 deletion src/main/assemblies/plugin.xml
Expand Up @@ -25,5 +25,8 @@
<source>src/main/plugin-metadata/plugin-descriptor.properties</source>
<outputDirectory>/</outputDirectory>
</file>
</files>
<file>
<source>src/main/plugin-metadata/plugin-security.policy</source>
<outputDirectory>/</outputDirectory>
</file> </files>
</assembly>
Expand Up @@ -96,8 +96,8 @@ public CouchbaseCAPITransportImpl(Settings settings, RestController restControll
this.client = client;
this.port = settings.get("couchbase.port", "9091-10091");

this.bindHost = settings.get("bind_host");
this.publishHost = settings.get("publish_host");
this.bindHost = settings.get("network.bind_host");
this.publishHost = settings.get("network.publish_host");

this.username = settings.get("couchbase.username", "Administrator");
this.password = settings.get("couchbase.password", "");
Expand Down Expand Up @@ -178,14 +178,15 @@ protected void doStart() throws ElasticsearchException {
// Bind and start to accept incoming connections.
InetAddress[] hostAddressX;
try {
hostAddressX = networkService.resolveBindHostAddress(bindHost);
hostAddressX = networkService.resolveBindHostAddresses(null);

} catch (IOException e) {
throw new BindHttpException("Failed to resolve host [" + bindHost + "]", e);
}

InetAddress publishAddressHostX;
try {
publishAddressHostX = networkService.resolvePublishHostAddress(publishHost);
publishAddressHostX = networkService.resolvePublishHostAddresses(null);
} catch (IOException e) {
throw new BindHttpException("Failed to resolve publish address host [" + publishHost + "]", e);
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/plugin-metadata/plugin-descriptor.properties
Expand Up @@ -65,7 +65,7 @@ java.version=1.7
# elasticsearch release. This version is checked when the plugin
# is loaded so Elasticsearch will refuse to start in the presence of
# plugins with the incorrect elasticsearch.version.
elasticsearch.version=2.1.1
elasticsearch.version=2.2.0
#
### deprecated elements for jvm plugins :
#
Expand Down
9 changes: 9 additions & 0 deletions src/main/plugin-metadata/plugin-security.policy
@@ -0,0 +1,9 @@
grant {
permission javax.security.auth.AuthPermission "modifyPrincipals";
permission javax.security.auth.AuthPermission "modifyPrivateCredentials";
permission javax.security.auth.AuthPermission "setReadOnly";
permission java.lang.RuntimePermission "setContextClassLoader";
permission java.lang.RuntimePermission "getClassLoader";
permission java.net.SocketPermission "*", "listen,resolve";
permission java.lang.reflect.ReflectPermission "suppressAccessChecks";
};

0 comments on commit a442c59

Please sign in to comment.