Allow https communication per ec2 or s3 service
By default all communication w/ AWS services done by this plugin is sent the clear over `http`, overriding amazons own default of https: http://docs.aws.amazon.com/AWSJavaSDK/latest/javadoc/com/amazonaws/ClientConfiguration.html#getProtocol() One has to set `cloud.aws.protocol` in `elasticsearch.yml` to force SSL. cloud.aws.protocol: https This is not entirely clear to the average user, and should be added to the documentation on both this project's README. Closes #101.
This commit is contained in:
parent
f3a3262edf
commit
0474a1bfea
17
README.md
17
README.md
|
@ -42,6 +42,23 @@ cloud:
|
|||
secret_key: vExyMThREXeRMm/b/LRzEB8jWwvzQeXgjqMX+6br
|
||||
```
|
||||
|
||||
### Transport security
|
||||
|
||||
By default this plugin uses HTTP for all API calls to AWS endpoints. If you wish to configure HTTPS you can set
|
||||
`cloud.aws.protocol` in the elasticsearch config. You can optionally override this setting per individual service
|
||||
via: `cloud.aws.ec2.protocol` or `cloud.aws.s3.protocol`.
|
||||
|
||||
```
|
||||
cloud:
|
||||
aws:
|
||||
protocol: http
|
||||
s3:
|
||||
protocol: https
|
||||
ec2:
|
||||
protocol: http
|
||||
|
||||
```
|
||||
|
||||
### Region
|
||||
|
||||
The `cloud.aws.region` can be set to a region and will automatically use the relevant settings for both `ec2` and `s3`. The available values are:
|
||||
|
|
|
@ -61,6 +61,7 @@ public class AwsEc2Service extends AbstractLifecycleComponent<AwsEc2Service> {
|
|||
|
||||
ClientConfiguration clientConfiguration = new ClientConfiguration();
|
||||
String protocol = componentSettings.get("protocol", "http").toLowerCase();
|
||||
protocol = componentSettings.get("ec2.protocol", protocol).toLowerCase();
|
||||
if ("http".equals(protocol)) {
|
||||
clientConfiguration.setProtocol(Protocol.HTTP);
|
||||
} else if ("https".equals(protocol)) {
|
||||
|
|
|
@ -89,6 +89,7 @@ public class InternalAwsS3Service extends AbstractLifecycleComponent<AwsS3Servic
|
|||
|
||||
ClientConfiguration clientConfiguration = new ClientConfiguration();
|
||||
String protocol = componentSettings.get("protocol", "http").toLowerCase();
|
||||
protocol = componentSettings.get("s3.protocol", protocol).toLowerCase();
|
||||
if ("http".equals(protocol)) {
|
||||
clientConfiguration.setProtocol(Protocol.HTTP);
|
||||
} else if ("https".equals(protocol)) {
|
||||
|
|
|
@ -55,7 +55,7 @@ import static org.hamcrest.Matchers.*;
|
|||
*/
|
||||
@AwsTest
|
||||
@ClusterScope(scope = Scope.SUITE, numDataNodes = 2, numClientNodes = 0, transportClientRatio = 0.0)
|
||||
public class S3SnapshotRestoreTest extends AbstractAwsTest {
|
||||
abstract public class S3SnapshotRestoreAbstractTest extends AbstractAwsTest {
|
||||
|
||||
@Override
|
||||
public Settings indexSettings() {
|
|
@ -0,0 +1,35 @@
|
|||
/*
|
||||
* Licensed to Elasticsearch (the "Author") under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. Author 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.
|
||||
*/
|
||||
|
||||
package org.elasticsearch.repositories.s3;
|
||||
|
||||
import org.elasticsearch.common.settings.ImmutableSettings;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
|
||||
/**
|
||||
*/
|
||||
public class S3SnapshotRestoreOverHttpTest extends S3SnapshotRestoreAbstractTest {
|
||||
@Override
|
||||
public Settings nodeSettings(int nodeOrdinal) {
|
||||
ImmutableSettings.Builder settings = ImmutableSettings.builder()
|
||||
.put(super.nodeSettings(nodeOrdinal))
|
||||
.put("cloud.aws.s3.protocol", "http");
|
||||
return settings.build();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
/*
|
||||
* Licensed to Elasticsearch (the "Author") under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. Author 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.
|
||||
*/
|
||||
|
||||
package org.elasticsearch.repositories.s3;
|
||||
|
||||
import org.elasticsearch.common.settings.ImmutableSettings;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
|
||||
/**
|
||||
*/
|
||||
public class S3SnapshotRestoreOverHttpsTest extends S3SnapshotRestoreAbstractTest {
|
||||
@Override
|
||||
public Settings nodeSettings(int nodeOrdinal) {
|
||||
ImmutableSettings.Builder settings = ImmutableSettings.builder()
|
||||
.put(super.nodeSettings(nodeOrdinal))
|
||||
.put("cloud.aws.s3.protocol", "https");
|
||||
return settings.build();
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue