Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CC-9314: Allow disabling hostname verification (#410)
* CC-9314: Allow disabling hostname verification When `elastic.https.ssl.endpoint.identification.algorithm` is empty, instead of default hostname verifier, use an all-trusting verifier. Updated SecurityIT with testcase to verify
- Loading branch information
Showing
6 changed files
with
85 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
...t/java/io/confluent/connect/elasticsearch/integration/HostnameVerificationDisabledIT.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package io.confluent.connect.elasticsearch.integration; | ||
|
||
import org.junit.Test; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
import java.util.Map; | ||
|
||
public class HostnameVerificationDisabledIT extends SecurityIT { | ||
private static final Logger log = LoggerFactory.getLogger(HostnameVerificationDisabledIT.class); | ||
|
||
@Test | ||
public void testSecureConnectionHostnameVerificationDisabled() throws Throwable { | ||
// Use 'localhost' here that is not in self-signed cert | ||
String address = container.getConnectionUrl(); | ||
address = address.replace(container.getContainerIpAddress(), "localhost"); | ||
log.info("Creating connector for {}", address); | ||
|
||
connect.kafka().createTopic(KAFKA_TOPIC, 1); | ||
|
||
Map<String, String> props = getProps(); | ||
props.put("connection.url", address); | ||
props.put("elastic.security.protocol", "SSL"); | ||
props.put("elastic.https.ssl.keystore.location", container.getKeystorePath()); | ||
props.put("elastic.https.ssl.keystore.password", container.getKeystorePassword()); | ||
props.put("elastic.https.ssl.key.password", container.getKeyPassword()); | ||
props.put("elastic.https.ssl.truststore.location", container.getTruststorePath()); | ||
props.put("elastic.https.ssl.truststore.password", container.getTruststorePassword()); | ||
|
||
// disable hostname verification | ||
props.put("elastic.https.ssl.endpoint.identification.algorithm", ""); | ||
|
||
// Start connector | ||
testSecureConnection(props); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,6 @@ instances: | |
- name: elasticsearch | ||
dns: | ||
- elasticsearch | ||
- localhost | ||
ip: | ||
- ipAddress | ||
- name: kibana | ||
|