Example #1
0
 public static void initProcessSecurity(Configuration conf)
     throws IOException, BadConfigException {
   log.info("Secure mode with kerberos realm {}", HoyaUtils.getKerberosRealm());
   // this gets UGI to reset its previous world view (i.e simple auth)
   // security
   SecurityUtil.setAuthenticationMethod(UserGroupInformation.AuthenticationMethod.KERBEROS, conf);
   UserGroupInformation.setConfiguration(conf);
   UserGroupInformation ugi = UserGroupInformation.getCurrentUser();
   log.debug("Authenticating as " + ugi.toString());
   log.debug("Login user is {}", UserGroupInformation.getLoginUser());
   if (!UserGroupInformation.isSecurityEnabled()) {
     throw new BadConfigException(
         "Although secure mode is enabled,"
             + "the application has already set up its user as an insecure entity %s",
         ugi);
   }
   HoyaUtils.verifyPrincipalSet(conf, YarnConfiguration.RM_PRINCIPAL);
   HoyaUtils.verifyPrincipalSet(conf, DFSConfigKeys.DFS_NAMENODE_USER_NAME_KEY);
 }
Example #2
0
 /**
  * Submit a JAR containing a specific class and map it
  *
  * @param providerResources provider map to build up
  * @param clusterFS remote fs
  * @param clazz class to look for
  * @param libdir lib directory
  * @param jarName <i>At the destination</i>
  * @return the local resource ref
  * @throws IOException trouble copying to HDFS
  */
 public static LocalResource putJar(
     Map<String, LocalResource> providerResources,
     FileSystem clusterFS,
     Class clazz,
     Path tempPath,
     String libdir,
     String jarName)
     throws IOException, HoyaException {
   LocalResource res = HoyaUtils.submitJarWithClass(clusterFS, clazz, tempPath, libdir, jarName);
   providerResources.put(libdir + "/" + jarName, res);
   return res;
 }
Example #3
0
 /**
  * Query for the image path being set (non null/non empty)
  *
  * @return true if there is a path in the image path option
  */
 @JsonIgnore
 public boolean isImagePathSet() {
   return HoyaUtils.isSet(getImagePath());
 }
Example #4
0
 /**
  * Verify that an option is set: that is defined AND non-empty
  *
  * @param key
  * @throws BadConfigException
  */
 public void verifyOptionSet(String key) throws BadConfigException {
   if (HoyaUtils.isUnset(getOption(key, null))) {
     throw new BadConfigException("Unset cluster option %s", key);
   }
 }