Trino连接启用Kerberos认证的CDH集群

Trino连接启用Kerberos认证的CDH集群

Trino 连接启用 Kerberos 认证的CDH

Kudu

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
kudu.authentication.type = KERBEROS

## The kerberos client principal name
kudu.authentication.client.principal = clientprincipalname

## The path to the kerberos keytab file
## The configured client principal must exist in this keytab file
kudu.authentication.client.keytab = /path/to/keytab/file.keytab

## The path to the krb5.conf kerberos config file
kudu.authentication.config = /path/to/kerberos/krb5.conf

## Optional and defaults to "kudu"
## If kudu is running with a custom SPN this needs to be configured
kudu.authentication.server.principal.primary = kudu

kudu.authentication.server.principal.primary = kudu 这个没搞懂用途,用的默认值

HIVE

hive.security 默认 legacy,需要额外授权

1
配置属性hive.allow-drop-table、 hive.allow-rename-table、hive.allow-add-column和 。hive.allow-drop-columnhive.allow-rename-column

Hive 连接器的默认安全配置在连接到 Hadoop 集群时不使用身份验证。所有查询都以运行 Trino 进程的用户身份执行,无论哪个用户提交查询。

在访问HDFS时,Trino 可以 模拟运行查询的最终用户。这可以与 HDFS 权限和ACL一起使用,为数据提供额外的安全性。

kerberos 身份验证

HIVE连接器连接启用kerberos 身份验证的Hadoop集群 时,需要配置两项服务

  1. Hive Metastore Thrift 服务
  2. Hadoop 分布式文件系统 (HDFS)

Hive 连接器对这些服务的访问是在包含常规 Hive 连接器配置的属性文件中配置的

首先 配置 krb5.conf 路径(如果没有存放在/etc/krb5.conf),在jvm.conf 中加上:

1
-Djava.security.krb5.conf=/example/path/krb5.conf

Hive Metastore Thrift 服务的身份验证配置

属性名称 描述
hive.metastore.authentication.type Hive Metastore 身份验证类型。
hive.metastore.thrift.impersonation.enabled 启用 Hive Metastore 最终用户模拟。
hive.metastore.service.principal Hive 元存储服务的 Kerberos 主体。
hive.metastore.client.principal Trino 在连接到 Hive 元存储服务时使用的 Kerberos 主体。
hive.metastore.client.keytab Hive Metastore 客户端密钥表位置。

KERBEROS带有身份验证的示例配置:

1
2
3
4
5
hive.metastore.authentication.type=KERBEROS
hive.metastore.thrift.impersonation.enabled=true
hive.metastore.service.principal=hive/hive-metastore-host.example.com@EXAMPLE.COM
hive.metastore.client.principal=trino@EXAMPLE.COM
hive.metastore.client.keytab=/etc/trino/hive.keytab

hive.metastore.thrift.impersonation.enabled#

启用最终用户 Hive Metastore 模拟。

该属性是可选的;默认为false. 有关更多信息,请参阅模拟访问 Hive 元存储

hive.metastore.service.principal#

Hive metastore服务的 Kerberos 主体。Trino 协调器使用它来验证 Hive metastore。

_HOST占位符可用于此属性值。连接到 Hive 元存储时,Hive 连接器会替换它连接到的元存储服务器的主机名。如果元存储在多个主机上运行,这很有用。

示例:hive/hive-server-host@EXAMPLE.COMhive/_HOST@EXAMPLE.COM

该属性是可选的;没有默认值。

hive.metastore.client.principal#

Trino 在连接到 Hive 元存储时使用的 Kerberos 主体。

_HOST占位符可用于此属性值。当连接到 Hive 元存储时,Hive 连接器会替换 Trino正在运行的工作节点的主机名。如果每个工作节点都有自己的 Kerberos 主体,这很有用。

示例:trino/trino-server-node@EXAMPLE.COMtrino/_HOST@EXAMPLE.COM

HDFS 身份验证#

在 Kerberized Hadoop 集群中,Trino 使用 Kerberos 向 HDFS 进行身份验证。HDFS 的 Kerberos 身份验证在连接器的属性文件中使用以下属性进行配置:

属性名称 描述
hive.hdfs.authentication.type HDFS 身份验证类型。可能的值为NONEKERBEROS
hive.hdfs.impersonation.enabled 启用 HDFS 最终用户模拟。
hive.hdfs.trino.principal Trino 在连接到 HDFS 时使用的 Kerberos 主体。
hive.hdfs.trino.keytab HDFS 客户端密钥keytab位置。
hive.hdfs.wire-encryption.enabled 启用 HDFS 线路加密。

KERBEROS带有身份验证的示例配置#

1
2
3
4
hive.hdfs.authentication.type=KERBEROS
hive.hdfs.impersonation.enabled=true
hive.hdfs.trino.principal=trino@EXAMPLE.COM
hive.hdfs.trino.keytab=/etc/trino/hdfs.keytab

hive.hdfs.impersonation.enabled#

启用最终用户 HDFS 模拟。

最终用户模拟部分对 HDFS 模拟进行了深入的解释。

该属性是可选的;默认为false.

hive.hdfs.trino.principal#

Trino 在连接到 HDFS 时使用的 Kerberos 主体。

_HOST占位符可用于此属性值。当连接到 HDFS 时,Hive 连接器会替换 Trino 正在运行的工作节点的主机名。如果每个工作节点都有自己的 Kerberos 主体,这很有用。

示例:trino-hdfs-superuser/trino-server-node@EXAMPLE.COMtrino-hdfs-superuser/_HOST@EXAMPLE.COM

该属性是可选的;没有默认值。

hive.hdfs.wire-encryption.enabled#

在使用 HDFS 线路加密的 Kerberized Hadoop 集群中,应将其设置为true使 Trino 能够访问 HDFS。请注意,使用有线加密可能会影响查询执行性能。

当身份验证类型为时,Trino 以属性KERBEROS指定的主体访问 HDFS 。hive.hdfs.trino.principalTrino 使用 keytab 指定的 hive.hdfs.trino.keytabkeytab 验证这个主体。

Keytab 文件必须分发到集群中运行 Trino 的每个节点。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
connector.name=hive-hadoop2

hive.metastore.uri=thrift://hive_meta_store_host.sample.com:9083

hive.metastore.authentication.type=KERBEROS
hive.metastore.service.principal=hive/_HOST@SAMPLE.COM
hive.metastore.client.principal=principal_name@SAMPLE.COM
hive.metastore.client.keytab=/etc/presto/principal_name.keytab

hive.hdfs.authentication.type=KERBEROS
hive.hdfs.presto.principal=principal_name@SAMPLE.COM
hive.hdfs.presto.keytab=/etc/presto/principal_name.keytab

hive.config.resources=/etc/presto/core-site.xml,/etc/presto/hdfs-site.xml

最终用户模拟

Trino 可以模拟运行查询的最终用户。在用户从命令行界面运行查询的情况下,最终用户是与 Trino CLI 进程关联的用户名或可选 --user选项的参数。如果使用 HDFS 权限或 ACL,则在访问 HDFS 时模拟最终用户可以提供额外的安全性。

当使用KERBEROS模拟身份验证时,Trino 在访问 HDFS 时模拟正在运行查询的用户。hive.hdfs.trino.principal必须允许 该属性指定的主体模拟当前 Trino 用户

模拟访问 Hive 元存储

Trino 支持在访问 Hive 元存储时模拟最终用户。Metastore 模拟可以启用

1
hive.metastore.thrift.impersonation.enabled=true

在模拟使用KERBEROSMetastore 身份验证时,hive.metastore.client.principal必须允许该属性指定的主体模拟当前 Trino 用户

在以下情况下应用模拟:

  • 修改(创建或删除)数据库(模式),
  • 获取有关单个表的信息,
  • 创建或修改表。

进行以下操作时不应用模拟。如果发生以下操作,Trino 将全权负责进行所有相关的安全检查。

  • 列出数据库(模式),
  • 列出表格,
  • 列出角色、授权、
  • 改变角色,授予。

Hadoop 中的模拟#

为了使用模拟,必须将 Hadoop 集群配置为允许运行 Trino 的用户或主体模拟登录到 Trino 的用户。Hadoop 中的模拟在文件中配置core-site.xml。可以在Hadoop 文档中找到配置选项的完整描述


Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now

×