walterddr commented on a change in pull request #7860: [FLINK-9685] Adding 
support hostname-substitution for security.kerberos login.principal
URL: https://github.com/apache/flink/pull/7860#discussion_r263553448
 
 

 ##########
 File path: 
flink-runtime/src/main/java/org/apache/flink/runtime/security/SecurityConfiguration.java
 ##########
 @@ -80,13 +86,21 @@ public SecurityConfiguration(Configuration flinkConf,
                        List<SecurityModuleFactory> securityModuleFactories) {
                this.isZkSaslDisable = 
flinkConf.getBoolean(SecurityOptions.ZOOKEEPER_SASL_DISABLE);
                this.keytab = 
flinkConf.getString(SecurityOptions.KERBEROS_LOGIN_KEYTAB);
-               this.principal = 
flinkConf.getString(SecurityOptions.KERBEROS_LOGIN_PRINCIPAL);
                this.useTicketCache = 
flinkConf.getBoolean(SecurityOptions.KERBEROS_LOGIN_USETICKETCACHE);
                this.loginContextNames = 
parseList(flinkConf.getString(SecurityOptions.KERBEROS_LOGIN_CONTEXTS));
                this.zkServiceName = 
flinkConf.getString(SecurityOptions.ZOOKEEPER_SASL_SERVICE_NAME);
                this.zkLoginContextName = 
flinkConf.getString(SecurityOptions.ZOOKEEPER_SASL_LOGIN_CONTEXT_NAME);
                this.securityModuleFactories = 
Collections.unmodifiableList(securityModuleFactories);
                this.flinkConfig = checkNotNull(flinkConf);
+               String rawPrincipal = 
flinkConf.getString(SecurityOptions.KERBEROS_LOGIN_PRINCIPAL);
+               if (rawPrincipal != null) {
+                       try {
+                               rawPrincipal = rawPrincipal.replace("HOSTNAME", 
InetAddress.getLocalHost().getCanonicalHostName());
 
 Review comment:
   IN order to make dynamic replacement, I think we have to have some indicator 
on which of the 3 Kerberos principal is used:
   ```
   user_name@REALM
   host/host_name@REALM
   service_name/host_name@REALM
   ```
   and if we use `"HOSTNAME"` as reserved keyword we also need to change 
documentations as well

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to