mirror of https://github.com/apache/nifi.git
NIFI-2923 Added evaluation of attribute expressions for Kerberos principal and keytab
Signed-off-by: Bryan Bende <bbende@apache.org>
This commit is contained in:
parent
86fa1bba4f
commit
59a32948ea
|
@ -148,8 +148,8 @@ public abstract class AbstractHadoopProcessor extends AbstractProcessor {
|
||||||
@Override
|
@Override
|
||||||
protected Collection<ValidationResult> customValidate(ValidationContext validationContext) {
|
protected Collection<ValidationResult> customValidate(ValidationContext validationContext) {
|
||||||
final String configResources = validationContext.getProperty(HADOOP_CONFIGURATION_RESOURCES).getValue();
|
final String configResources = validationContext.getProperty(HADOOP_CONFIGURATION_RESOURCES).getValue();
|
||||||
final String principal = validationContext.getProperty(kerberosProperties.getKerberosPrincipal()).getValue();
|
final String principal = validationContext.getProperty(kerberosProperties.getKerberosPrincipal()).evaluateAttributeExpressions().getValue();
|
||||||
final String keytab = validationContext.getProperty(kerberosProperties.getKerberosKeytab()).getValue();
|
final String keytab = validationContext.getProperty(kerberosProperties.getKerberosKeytab()).evaluateAttributeExpressions().getValue();
|
||||||
|
|
||||||
final List<ValidationResult> results = new ArrayList<>();
|
final List<ValidationResult> results = new ArrayList<>();
|
||||||
|
|
||||||
|
@ -262,8 +262,8 @@ public abstract class AbstractHadoopProcessor extends AbstractProcessor {
|
||||||
UserGroupInformation ugi;
|
UserGroupInformation ugi;
|
||||||
synchronized (RESOURCES_LOCK) {
|
synchronized (RESOURCES_LOCK) {
|
||||||
if (SecurityUtil.isSecurityEnabled(config)) {
|
if (SecurityUtil.isSecurityEnabled(config)) {
|
||||||
String principal = context.getProperty(kerberosProperties.getKerberosPrincipal()).getValue();
|
String principal = context.getProperty(kerberosProperties.getKerberosPrincipal()).evaluateAttributeExpressions().getValue();
|
||||||
String keyTab = context.getProperty(kerberosProperties.getKerberosKeytab()).getValue();
|
String keyTab = context.getProperty(kerberosProperties.getKerberosKeytab()).evaluateAttributeExpressions().getValue();
|
||||||
ugi = SecurityUtil.loginKerberos(config, principal, keyTab);
|
ugi = SecurityUtil.loginKerberos(config, principal, keyTab);
|
||||||
fs = getFileSystemAsUser(config, ugi);
|
fs = getFileSystemAsUser(config, ugi);
|
||||||
lastKerberosReloginTime = System.currentTimeMillis() / 1000;
|
lastKerberosReloginTime = System.currentTimeMillis() / 1000;
|
||||||
|
|
|
@ -190,8 +190,8 @@ public class HiveConnectionPool extends AbstractControllerService implements Hiv
|
||||||
|
|
||||||
if (confFileProvided) {
|
if (confFileProvided) {
|
||||||
final String configFiles = validationContext.getProperty(HIVE_CONFIGURATION_RESOURCES).evaluateAttributeExpressions().getValue();
|
final String configFiles = validationContext.getProperty(HIVE_CONFIGURATION_RESOURCES).evaluateAttributeExpressions().getValue();
|
||||||
final String principal = validationContext.getProperty(kerberosProperties.getKerberosPrincipal()).getValue();
|
final String principal = validationContext.getProperty(kerberosProperties.getKerberosPrincipal()).evaluateAttributeExpressions().getValue();
|
||||||
final String keyTab = validationContext.getProperty(kerberosProperties.getKerberosKeytab()).getValue();
|
final String keyTab = validationContext.getProperty(kerberosProperties.getKerberosKeytab()).evaluateAttributeExpressions().getValue();
|
||||||
problems.addAll(hiveConfigurator.validate(configFiles, principal, keyTab, validationResourceHolder, getLogger()));
|
problems.addAll(hiveConfigurator.validate(configFiles, principal, keyTab, validationResourceHolder, getLogger()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -229,8 +229,8 @@ public class HiveConnectionPool extends AbstractControllerService implements Hiv
|
||||||
|
|
||||||
final String drv = HiveDriver.class.getName();
|
final String drv = HiveDriver.class.getName();
|
||||||
if (SecurityUtil.isSecurityEnabled(hiveConfig)) {
|
if (SecurityUtil.isSecurityEnabled(hiveConfig)) {
|
||||||
final String principal = context.getProperty(kerberosProperties.getKerberosPrincipal()).getValue();
|
final String principal = context.getProperty(kerberosProperties.getKerberosPrincipal()).evaluateAttributeExpressions().getValue();
|
||||||
final String keyTab = context.getProperty(kerberosProperties.getKerberosKeytab()).getValue();
|
final String keyTab = context.getProperty(kerberosProperties.getKerberosKeytab()).evaluateAttributeExpressions().getValue();
|
||||||
|
|
||||||
log.info("Hive Security Enabled, logging in as principal {} with keytab {}", new Object[]{principal, keyTab});
|
log.info("Hive Security Enabled, logging in as principal {} with keytab {}", new Object[]{principal, keyTab});
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -349,8 +349,8 @@ public class PutHiveStreaming extends AbstractSessionFactoryProcessor {
|
||||||
hiveConfigurator.preload(hiveConfig);
|
hiveConfigurator.preload(hiveConfig);
|
||||||
|
|
||||||
if (SecurityUtil.isSecurityEnabled(hiveConfig)) {
|
if (SecurityUtil.isSecurityEnabled(hiveConfig)) {
|
||||||
final String principal = context.getProperty(kerberosProperties.getKerberosPrincipal()).getValue();
|
final String principal = context.getProperty(kerberosProperties.getKerberosPrincipal()).evaluateAttributeExpressions().getValue();
|
||||||
final String keyTab = context.getProperty(kerberosProperties.getKerberosKeytab()).getValue();
|
final String keyTab = context.getProperty(kerberosProperties.getKerberosKeytab()).evaluateAttributeExpressions().getValue();
|
||||||
|
|
||||||
log.info("Hive Security Enabled, logging in as principal {} with keytab {}", new Object[]{principal, keyTab});
|
log.info("Hive Security Enabled, logging in as principal {} with keytab {}", new Object[]{principal, keyTab});
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -167,8 +167,8 @@ public class HBase_1_1_2_ClientService extends AbstractControllerService impleme
|
||||||
}
|
}
|
||||||
|
|
||||||
final Configuration hbaseConfig = resources.getConfiguration();
|
final Configuration hbaseConfig = resources.getConfiguration();
|
||||||
final String principal = validationContext.getProperty(kerberosProperties.getKerberosPrincipal()).getValue();
|
final String principal = validationContext.getProperty(kerberosProperties.getKerberosPrincipal()).evaluateAttributeExpressions().getValue();
|
||||||
final String keytab = validationContext.getProperty(kerberosProperties.getKerberosKeytab()).getValue();
|
final String keytab = validationContext.getProperty(kerberosProperties.getKerberosKeytab()).evaluateAttributeExpressions().getValue();
|
||||||
|
|
||||||
problems.addAll(KerberosProperties.validatePrincipalAndKeytab(
|
problems.addAll(KerberosProperties.validatePrincipalAndKeytab(
|
||||||
this.getClass().getSimpleName(), hbaseConfig, principal, keytab, getLogger()));
|
this.getClass().getSimpleName(), hbaseConfig, principal, keytab, getLogger()));
|
||||||
|
@ -223,8 +223,8 @@ public class HBase_1_1_2_ClientService extends AbstractControllerService impleme
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SecurityUtil.isSecurityEnabled(hbaseConfig)) {
|
if (SecurityUtil.isSecurityEnabled(hbaseConfig)) {
|
||||||
final String principal = context.getProperty(kerberosProperties.getKerberosPrincipal()).getValue();
|
final String principal = context.getProperty(kerberosProperties.getKerberosPrincipal()).evaluateAttributeExpressions().getValue();
|
||||||
final String keyTab = context.getProperty(kerberosProperties.getKerberosKeytab()).getValue();
|
final String keyTab = context.getProperty(kerberosProperties.getKerberosKeytab()).evaluateAttributeExpressions().getValue();
|
||||||
|
|
||||||
getLogger().info("HBase Security Enabled, logging in as principal {} with keytab {}", new Object[] {principal, keyTab});
|
getLogger().info("HBase Security Enabled, logging in as principal {} with keytab {}", new Object[] {principal, keyTab});
|
||||||
ugi = SecurityUtil.loginKerberos(hbaseConfig, principal, keyTab);
|
ugi = SecurityUtil.loginKerberos(hbaseConfig, principal, keyTab);
|
||||||
|
|
Loading…
Reference in New Issue