Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for truststore and keystore password parameters in Kafdrop #708

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/main/java/kafdrop/config/KafkaConfiguration.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,10 @@ public final class KafkaConfiguration {
private String saslMechanism;
private String securityProtocol;
private String truststoreFile;
private String truststorePassword;
private String propertiesFile;
private String keystoreFile;
private String keystorePassword;

public void applyCommon(Properties properties) {
properties.setProperty(CommonClientConfigs.BOOTSTRAP_SERVERS_CONFIG, brokerConnect);
Expand All @@ -43,12 +45,18 @@ public void applyCommon(Properties properties) {
if (new File(truststoreFile).isFile()) {
LOG.info("Assigning truststore location to {}", truststoreFile);
properties.put("ssl.truststore.location", truststoreFile);
if (truststorePassword != null && !truststorePassword.isEmpty()) {
properties.put("ssl.truststore.password", truststorePassword);
}
}

LOG.info("Checking keystore file {}", keystoreFile);
if (new File(keystoreFile).isFile()) {
LOG.info("Assigning keystore location to {}", keystoreFile);
properties.put("ssl.keystore.location", keystoreFile);
if (keystorePassword != null && !keystorePassword.isEmpty()) {
properties.put("ssl.keystore.password", keystorePassword);
}
}

LOG.info("Checking properties file {}", propertiesFile);
Expand Down
4 changes: 3 additions & 1 deletion src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,7 @@ kafka:
saslMechanism: "PLAIN"
securityProtocol: "SASL_PLAINTEXT"
truststoreFile: "${KAFKA_TRUSTSTORE_FILE:kafka.truststore.jks}"
propertiesFile : "${KAFKA_PROPERTIES_FILE:kafka.properties}"
keystoreFile: "${KAFKA_KEYSTORE_FILE:kafka.keystore.jks}"
propertiesFile: "${KAFKA_PROPERTIES_FILE:kafka.properties}"
truststorePassword: "${KAFKA_TRUSTSTORE_PASSWORD}"
keystorePassword: "${KAFKA_KEYSTORE_PASSWORD}"