-
Notifications
You must be signed in to change notification settings - Fork 72
Kerberos support #1025 #1030
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
base: main
Are you sure you want to change the base?
Kerberos support #1025 #1030
Changes from 2 commits
2a653d8
c2ecc75
6c75835
580e582
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -48,6 +48,22 @@ public class FluoConfiguration extends SimpleConfiguration { | |
|
||
// Client properties | ||
private static final String CLIENT_PREFIX = FLUO_PREFIX + ".client"; | ||
|
||
/** | ||
* @since 1.2.0 | ||
*/ | ||
public static final String CLIENT_KERBEROS = CLIENT_PREFIX + ".kerberos"; | ||
|
||
|
||
/** | ||
* @since 1.2.0 | ||
*/ | ||
public static final String CLIENT_KERBEROS_REALM = CLIENT_PREFIX + ".kerberos.realm"; | ||
|
||
/** | ||
* @since 1.2.0 | ||
*/ | ||
public static final String CLIENT_KERBEROS_KEYTAB = CLIENT_PREFIX + ".kerberos.keytab"; | ||
|
||
/** | ||
* @deprecated since 1.2.0 replaced by fluo.connection.application.name | ||
*/ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -59,6 +59,7 @@ | |
import org.apache.hadoop.conf.Configuration; | ||
import org.apache.hadoop.fs.FileSystem; | ||
import org.apache.hadoop.fs.Path; | ||
import org.apache.hadoop.security.UserGroupInformation; | ||
import org.apache.zookeeper.KeeperException; | ||
import org.apache.zookeeper.KeeperException.NodeExistsException; | ||
import org.slf4j.Logger; | ||
|
@@ -76,6 +77,28 @@ public class FluoAdminImpl implements FluoAdmin { | |
|
||
private final String appRootDir; | ||
|
||
/** | ||
* Kerberos autentication method. | ||
* | ||
* @param realm Realm to be used in authentication. | ||
* @param keytab Keytab path. | ||
* @since 1.2.0 | ||
*/ | ||
public void loginWithKerberos(final String realm, final String keytab) { | ||
|
||
|
||
try { | ||
Configuration conf = new Configuration(); | ||
conf.set("hadoop.security.authentication", "kerberos"); | ||
conf.set("hadoop.security.authorization", "true"); | ||
UserGroupInformation.setConfiguration(conf); | ||
UserGroupInformation.loginUserFromKeytab(realm, keytab); | ||
|
||
logger.info("Connected with REALM: '{}'.", realm); | ||
} catch (Exception e) { | ||
throw new RuntimeException(e); | ||
} | ||
} | ||
|
||
public FluoAdminImpl(FluoConfiguration config) { | ||
this.config = config; | ||
|
||
|
@@ -373,6 +396,14 @@ public static String copyDirToDfs(String dfsRoot, String appName, String srcDir, | |
} | ||
|
||
private String copyJarsToDfs(String jars, String destDir) { | ||
|
||
if (config.getClientConfiguration().getBoolean(FluoConfiguration.CLIENT_KERBEROS, false)) { | ||
this.loginWithKerberos( | ||
config.getClientConfiguration().getString(FluoConfiguration.CLIENT_KERBEROS_REALM, ""), | ||
config.getClientConfiguration().getString(FluoConfiguration.CLIENT_KERBEROS_KEYTAB, "")); | ||
} | ||
|
||
|
||
String dfsAppRoot = config.getDfsRoot() + "/" + config.getApplicationName(); | ||
String dfsDestDir = dfsAppRoot + "/" + destDir; | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be 1.3.0