暂无图片
暂无图片
暂无图片
暂无图片
暂无图片

CDP-DC中Impala集成FreeIPA的LDAP认证

大数据杂货铺 2020-06-19
506

文档编写目的
Cloudera从CM6.3版本开始,引入了Red Hat IdM来做整个集群的认证,Red Hat IdM对应的软件为FreeIPA,在本文中描述如何使用FreeIPA来做CDP-DC集群的认证。关于FreeIPA服务器搭建参考<使用FreeIPA对Linux用户权限统一管理>。之前的文章包括<使用FreeIPA为CDP DC7.1集群部署安全>,<CDP-DC中为CM集成FreeIPA提供的LDAP认证>,<在CDP-DC中Ranger集成FreeIPA的LDAP用户>,<CDP-DC中Hue集成FreeIPA的LDAP认证>。
本篇文章主要介绍在CDP-DC平台上如何为Impala集成RedHat7的FreeIPA的LDAP认证。
内容概述
1) 测试环境描述
2) Impala集成FreeIPA的LDAP
3) Impala集成验证
测试环境
1) RedHat7.7
2) FreeIPA的版本为4.6.6
3) CM和Cloudera Runtime版本为7.1.1
4) 集群已使用FreeIPA启用的Kerberos
前置条件
1) FreeIPA已安装且正常使用
2) CDP-DC集群已启用FreeIPA提供的Kerberos

测试环境描述
LDAP服务信息
IP地址
Hostname
描述
10.0.0.170
ip-10-0-0-170.ap-southeast-1.compute.internal
FreeIPA服务器已安装
这里我们将10.0.0.170做为FreeIPA服务器的节点。
Impala服务信息
IP地址
Hostname
描述
10.0.0.214
ip-10-0-0-214.ap-southeast-1.compute.internal
CDP-DC7.1已安装
我们的测试集群安装了一个Impalad服务

Impala全局配置LDAP

1. 修改LDAP相关配置
修改LDAP相关配置,通过这里可以进行全局配置,配置后所有的Impala服务均使用该配置
参数名
描述
enable_ldap_auth
TRUE
启用LDAP认证
ldap_uri
ldaps://ip-10-0-0-170.ap-southeast-1.compute.internal:636
配置FreeIPALDAP URL
ldap_baseDN
cn=accounts,dc=ap-southeast-1,dc=compute,dc=internal

ldap_bind_pattern
uid={0},cn=users,cn=accounts,dc=ap-southeast-1,dc=compute,dc=internal

注意:ldap_baseDN和ldap_bind_pattern两个参数不能同时配置,只需要配置一个即可。
2.在Impala Daemon命令行添加如下配置” --ldap_passwords_in_clear_ok”
保存配置,回到CM主页根据提示重启相应服务即可。

Impala集成LDAP验证
1. 使用impala-shell命令登录Impala Daemon测试
    [root@ip-10-0-0-214 cloudera-scm-server]# impala-shell -i ip-10-0-0-214.ap-southeast-1.compute.internal -l -u superuser  --auth_creds_ok_in_clear
    Starting Impala Shell using LDAP-based authentication
    LDAP password for superuser:
    Error connecting: TTransportException, TSocket read 0 bytes
    Kerberos ticket found in the credentials cache, retrying the connection with a secure transport.
    Opened TCP connection to ip-10-0-0-214.ap-southeast-1.compute.internal:21000
    Connected to ip-10-0-0-214.ap-southeast-1.compute.internal:21000
    Server version: impalad version 3.4.0-SNAPSHOT RELEASE (build 9d706887f48ea336865d9cb7ddb266999668eb6e)
    ***********************************************************************************
    Welcome to the Impala shell.
    (Impala Shell v3.4.0-SNAPSHOT (9d70688) built on Wed May 20 19:05:43 UTC 2020)


    Run the PROFILE command after a query has finished to see a comprehensive summary
    of all the performance and diagnostic information that Impala gathered for that
    query. Be warned, it can be very long!
    ***********************************************************************************


    LDAP authentication is enabled, but the connection to Impala is not secured by TLS.
    ALL PASSWORDS WILL BE SENT IN THE CLEAR TO IMPALA.
    [ip-10-0-0-214.ap-southeast-1.compute.internal:21000] default>

    从日志中可以看到使用的LDAP认证方式,登录成功,可以正常执行SQL操作。
    注意:在使用impala-shell命令登录Impala Daemon时需要增加参数“--auth_creds_ok_in_clear”,因为我们的OpenLDAP服务未启用TLS加密的原因。
    在不带--auth_creds_ok_in_clear参数时执行上面的登陆命令:
      [root@ip-10-0-0-214 cloudera-scm-server]# impala-shell -i ip-10-0-0-214.ap-southeast-1.compute.internal -l -u superuser
      LDAP credentials may not be sent over insecure connections. Enable SSL or set --auth_creds_ok_in_clear

      可以继续使用kerberos认证登陆。
        impala-shell -i ip-10-0-0-214.ap-southeast-1.compute.internal -d default -k


        [root@ip-10-0-0-214 cloudera-scm-server]# klist
        Ticket cache: FILE:/tmp/krb5cc_0
        Default principal: admin@AP-SOUTHEAST-1.COMPUTE.INTERNAL


        Valid starting Expires Service principal
        06/17/2020 05:11:31 06/18/2020 05:11:29 krbtgt/AP-SOUTHEAST-1.COMPUTE.INTERNAL@AP-SOUTHEAST-1.COMPUTE.INTERNAL
        renew until 06/24/2020 05:11:29
        06/17/2020 05:24:25 06/18/2020 05:11:29 impala/ip-10-0-0-214.ap-southeast-1.compute.internal@AP-SOUTHEAST-1.COMPUTE.INTERNAL
        renew until 06/24/2020 05:11:29
        [root@ip-10-0-0-214 cloudera-scm-server]# impala-shell -i ip-10-0-0-214.ap-southeast-1.compute.internal -d default -k
        Starting Impala Shell using Kerberos authentication
        Using service name 'impala'
        Opened TCP connection to ip-10-0-0-214.ap-southeast-1.compute.internal:21000
        Connected to ip-10-0-0-214.ap-southeast-1.compute.internal:21000
        Server version: impalad version 3.4.0-SNAPSHOT RELEASE (build 9d706887f48ea336865d9cb7ddb266999668eb6e)
        Query: use `default`
        ***********************************************************************************
        Welcome to the Impala shell.
        (Impala Shell v3.4.0-SNAPSHOT (9d70688) built on Wed May 20 19:05:43 UTC 2020)


        Every command must be terminated by a ';'.
        ***********************************************************************************
        Query: use `default`
        [ip-10-0-0-214.ap-southeast-1.compute.internal:21000] default>


        在Hue中为Impala启用LDAP认证
        Cloudera Manager-> 群集 -> Hue -> 配置,在范围中选择Hue Server,在类别中选择高级。然后找到Hue Server Advanced Configuration Snippet (Safety Valve) for hue_safety_valve_server.ini ,添加下面的属性。

          [impala]
          auth_username=<LDAP username of Hue user to be authenticated>
          auth_password=<LDAP password of Hue user to be authenticated>

          然后重启hue服务。

          总结

          同一个Impala Daemon服务可以同时支持Kerberos和LDAP认证。
          和Hive一样,一旦集群启用了Kerberos,Impala默认使用Kerberos认证,不需要单独配置。注意这里和LDAP认证配置的区别。
          在OpenLDAP服务未启用TLS加密时,impala-shell访问Impala Daemon需要在增加参数--auth_creds_ok_in_clear,否则会报错“LDAP credentials may not besent over insecure connections. Enable SSL or set --auth_creds_ok_in_clear”

          文章转载自大数据杂货铺,如果涉嫌侵权,请发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

          评论