Skip to content

Commit

Permalink
Added encryption flags for configuration (#40)
Browse files Browse the repository at this point in the history
* Added encryption flags for configuration
* Added missing flags to example/test configuration
  • Loading branch information
Tiihott authored Aug 20, 2024
1 parent 18de5a1 commit 220d0d5
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 4 deletions.
4 changes: 3 additions & 1 deletion rpm/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,6 @@ dfs.namenode.kerberos.principal.pattern=test
KerberosKeytabUser=test
KerberosKeytabPath=test
dfs.client.use.datanode.hostname=false
kerberosLoginAutorenewal=true
kerberosLoginAutorenewal=true
dfs.data.transfer.protection=test
dfs.encrypt.data.transfer.cipher.suites=test
19 changes: 19 additions & 0 deletions src/main/java/com/teragrep/cfe_39/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ public class Config {
private final long pruneOffset;
private final boolean skipNonRFC5424Records;
private final boolean skipEmptyRFC5424Records;
private final String dfsDataTransferProtection;
private final String dfsEncryptDataTransferCipherSuites;

public Config() throws IOException {
Properties properties = new Properties();
Expand Down Expand Up @@ -147,6 +149,15 @@ public Config() throws IOException {
}
this.kerberosTestMode = properties.getProperty("dfs.client.use.datanode.hostname", "false");

this.dfsDataTransferProtection = properties.getProperty("dfs.data.transfer.protection");
if (this.dfsDataTransferProtection == null) {
throw new IllegalArgumentException("dfsDataTransferProtection not set");
}
this.dfsEncryptDataTransferCipherSuites = properties.getProperty("dfs.encrypt.data.transfer.cipher.suites");
if (this.dfsEncryptDataTransferCipherSuites == null) {
throw new IllegalArgumentException("dfsEncryptDataTransferCipherSuites not set");
}

// kafka
this.queueTopicPattern = properties.getProperty("queueTopicPattern", "^.*$");
this.numOfConsumers = Integer.parseInt(properties.getProperty("numOfConsumers", "1"));
Expand Down Expand Up @@ -274,4 +285,12 @@ public boolean getSkipEmptyRFC5424Records() {
public String getKerberosLoginAutorenewal() {
return kerberosLoginAutorenewal;
}

public String getDfsDataTransferProtection() {
return dfsDataTransferProtection;
}

public String getDfsEncryptDataTransferCipherSuites() {
return dfsEncryptDataTransferCipherSuites;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,10 @@ These values should be fetched from config and other input parameters (topic+par
// server principal, the kerberos principle that the namenode is using
conf.set("dfs.namenode.kerberos.principal.pattern", config.getKerberosPrincipal());

// set sasl
conf.set("dfs.data.transfer.protection", config.getDfsDataTransferProtection());
conf.set("dfs.encrypt.data.transfer.cipher.suites", config.getDfsEncryptDataTransferCipherSuites());

// filesystem for HDFS access is set here
fs = FileSystem.get(conf);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,9 @@ public HdfsDataIngestion(Config config) throws IOException {
/* server principal
the kerberos principle that the namenode is using*/
conf.set("dfs.namenode.kerberos.principal.pattern", config.getKerberosPrincipal());
// set sasl
conf.set("dfs.data.transfer.protection", config.getDfsDataTransferProtection());
conf.set("dfs.encrypt.data.transfer.cipher.suites", config.getDfsEncryptDataTransferCipherSuites());
// set usergroup stuff
UserGroupInformation.setConfiguration(conf);
UserGroupInformation.loginUserFromKeytab(config.getKerberosKeytabUser(), config.getKerberosKeytabPath());
Expand Down
4 changes: 3 additions & 1 deletion src/test/resources/broken.application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,6 @@ dfs.namenode.kerberos.principal.pattern=test
KerberosKeytabUser=test
KerberosKeytabPath=test
dfs.client.use.datanode.hostname=false
kerberosLoginAutorenewal=true
kerberosLoginAutorenewal=true
dfs.data.transfer.protection=test
dfs.encrypt.data.transfer.cipher.suites=test
4 changes: 3 additions & 1 deletion src/test/resources/failProcessing.application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,6 @@ dfs.namenode.kerberos.principal.pattern=test
KerberosKeytabUser=test
KerberosKeytabPath=test
dfs.client.use.datanode.hostname=false
kerberosLoginAutorenewal=true
kerberosLoginAutorenewal=true
dfs.data.transfer.protection=test
dfs.encrypt.data.transfer.cipher.suites=test
4 changes: 3 additions & 1 deletion src/test/resources/valid.application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,6 @@ dfs.namenode.kerberos.principal.pattern=test
KerberosKeytabUser=test
KerberosKeytabPath=test
dfs.client.use.datanode.hostname=false
kerberosLoginAutorenewal=true
kerberosLoginAutorenewal=true
dfs.data.transfer.protection=test
dfs.encrypt.data.transfer.cipher.suites=test

0 comments on commit 220d0d5

Please sign in to comment.