Search in sources :

Example 1 with ClientHSPolicyProvider

use of org.apache.hadoop.mapreduce.v2.app.security.authorize.ClientHSPolicyProvider in project hadoop by apache.

the class HSAdminServer method serviceInit.

@Override
public void serviceInit(Configuration conf) throws Exception {
    RPC.setProtocolEngine(conf, RefreshUserMappingsProtocolPB.class, ProtobufRpcEngine.class);
    RefreshUserMappingsProtocolServerSideTranslatorPB refreshUserMappingXlator = new RefreshUserMappingsProtocolServerSideTranslatorPB(this);
    BlockingService refreshUserMappingService = RefreshUserMappingsProtocolService.newReflectiveBlockingService(refreshUserMappingXlator);
    GetUserMappingsProtocolServerSideTranslatorPB getUserMappingXlator = new GetUserMappingsProtocolServerSideTranslatorPB(this);
    BlockingService getUserMappingService = GetUserMappingsProtocolService.newReflectiveBlockingService(getUserMappingXlator);
    HSAdminRefreshProtocolServerSideTranslatorPB refreshHSAdminProtocolXlator = new HSAdminRefreshProtocolServerSideTranslatorPB(this);
    BlockingService refreshHSAdminProtocolService = HSAdminRefreshProtocolService.newReflectiveBlockingService(refreshHSAdminProtocolXlator);
    clientRpcAddress = conf.getSocketAddr(JHAdminConfig.MR_HISTORY_BIND_HOST, JHAdminConfig.JHS_ADMIN_ADDRESS, JHAdminConfig.DEFAULT_JHS_ADMIN_ADDRESS, JHAdminConfig.DEFAULT_JHS_ADMIN_PORT);
    clientRpcServer = new RPC.Builder(conf).setProtocol(RefreshUserMappingsProtocolPB.class).setInstance(refreshUserMappingService).setBindAddress(clientRpcAddress.getHostName()).setPort(clientRpcAddress.getPort()).setVerbose(false).build();
    addProtocol(conf, GetUserMappingsProtocolPB.class, getUserMappingService);
    addProtocol(conf, HSAdminRefreshProtocolPB.class, refreshHSAdminProtocolService);
    // Enable service authorization?
    if (conf.getBoolean(CommonConfigurationKeysPublic.HADOOP_SECURITY_AUTHORIZATION, false)) {
        clientRpcServer.refreshServiceAcl(conf, new ClientHSPolicyProvider());
    }
    adminAcl = new AccessControlList(conf.get(JHAdminConfig.JHS_ADMIN_ACL, JHAdminConfig.DEFAULT_JHS_ADMIN_ACL));
}
Also used : AccessControlList(org.apache.hadoop.security.authorize.AccessControlList) HSAdminRefreshProtocolServerSideTranslatorPB(org.apache.hadoop.mapreduce.v2.hs.protocolPB.HSAdminRefreshProtocolServerSideTranslatorPB) RefreshUserMappingsProtocolServerSideTranslatorPB(org.apache.hadoop.security.protocolPB.RefreshUserMappingsProtocolServerSideTranslatorPB) RPC(org.apache.hadoop.ipc.RPC) ClientHSPolicyProvider(org.apache.hadoop.mapreduce.v2.app.security.authorize.ClientHSPolicyProvider) BlockingService(com.google.protobuf.BlockingService) GetUserMappingsProtocolServerSideTranslatorPB(org.apache.hadoop.tools.protocolPB.GetUserMappingsProtocolServerSideTranslatorPB)

Example 2 with ClientHSPolicyProvider

use of org.apache.hadoop.mapreduce.v2.app.security.authorize.ClientHSPolicyProvider in project hadoop by apache.

the class HistoryClientService method serviceStart.

protected void serviceStart() throws Exception {
    Configuration conf = getConfig();
    YarnRPC rpc = YarnRPC.create(conf);
    initializeWebApp(conf);
    InetSocketAddress address = conf.getSocketAddr(JHAdminConfig.MR_HISTORY_BIND_HOST, JHAdminConfig.MR_HISTORY_ADDRESS, JHAdminConfig.DEFAULT_MR_HISTORY_ADDRESS, JHAdminConfig.DEFAULT_MR_HISTORY_PORT);
    server = rpc.getServer(HSClientProtocol.class, protocolHandler, address, conf, jhsDTSecretManager, conf.getInt(JHAdminConfig.MR_HISTORY_CLIENT_THREAD_COUNT, JHAdminConfig.DEFAULT_MR_HISTORY_CLIENT_THREAD_COUNT));
    // Enable service authorization?
    if (conf.getBoolean(CommonConfigurationKeysPublic.HADOOP_SECURITY_AUTHORIZATION, false)) {
        server.refreshServiceAcl(conf, new ClientHSPolicyProvider());
    }
    server.start();
    this.bindAddress = conf.updateConnectAddr(JHAdminConfig.MR_HISTORY_BIND_HOST, JHAdminConfig.MR_HISTORY_ADDRESS, JHAdminConfig.DEFAULT_MR_HISTORY_ADDRESS, server.getListenerAddress());
    LOG.info("Instantiated HistoryClientService at " + this.bindAddress);
    super.serviceStart();
}
Also used : Configuration(org.apache.hadoop.conf.Configuration) InetSocketAddress(java.net.InetSocketAddress) HSClientProtocol(org.apache.hadoop.mapreduce.v2.api.HSClientProtocol) ClientHSPolicyProvider(org.apache.hadoop.mapreduce.v2.app.security.authorize.ClientHSPolicyProvider) YarnRPC(org.apache.hadoop.yarn.ipc.YarnRPC)

Aggregations

ClientHSPolicyProvider (org.apache.hadoop.mapreduce.v2.app.security.authorize.ClientHSPolicyProvider)2 BlockingService (com.google.protobuf.BlockingService)1 InetSocketAddress (java.net.InetSocketAddress)1 Configuration (org.apache.hadoop.conf.Configuration)1 RPC (org.apache.hadoop.ipc.RPC)1 HSClientProtocol (org.apache.hadoop.mapreduce.v2.api.HSClientProtocol)1 HSAdminRefreshProtocolServerSideTranslatorPB (org.apache.hadoop.mapreduce.v2.hs.protocolPB.HSAdminRefreshProtocolServerSideTranslatorPB)1 AccessControlList (org.apache.hadoop.security.authorize.AccessControlList)1 RefreshUserMappingsProtocolServerSideTranslatorPB (org.apache.hadoop.security.protocolPB.RefreshUserMappingsProtocolServerSideTranslatorPB)1 GetUserMappingsProtocolServerSideTranslatorPB (org.apache.hadoop.tools.protocolPB.GetUserMappingsProtocolServerSideTranslatorPB)1 YarnRPC (org.apache.hadoop.yarn.ipc.YarnRPC)1