创建安全配置 - Amazon EMR
Amazon Web Services 文档中描述的 Amazon Web Services 服务或功能可能因区域而异。要查看适用于中国区域的差异,请参阅 中国的 Amazon Web Services 服务入门 (PDF)

创建安全配置

本主题介绍使用 EMR 控制台和 Amazon CLI 创建安全配置的一般过程,并介绍有关加密、身份验证和 EMRFS 的 IAM 角色的参数的参考信息。有关这些功能的更多信息,请参阅以下主题:

使用控制台创建安全配置
  1. 通过以下链接打开 Amazon EMR 控制台:https://console.aws.amazon.com/emr

  2. 在导航窗格中,选择 Security Configurations (安全配置)Create security configuration (创建安全配置)

  3. 键入安全配置的 Name (名称)

  4. 按照以下部分中所述选择 Encryption (加密)Authentication (身份认证) 选项,然后选择 Create (创建)

使用 Amazon CLI 创建安全配置
  • 使用以下示例中所示的 create-security-configuration 命令。

    • 对于 SecConfigName,指定安全配置的名称。这是您在创建使用此安全配置的集群时指定的名称。

    • 对于 SecConfigDef,指定内联 JSON 结构或本地 JSON 文件的路径,例如 file://MySecConfig.json。JSON 参数定义 Encryption (加密)IAM Roles for EMRFS access to Amazon S3 (用于处理 EMRFS 对 Amazon S3 的访问的 IAM 角色)Authentication (身份验证) 的选项,如下面部分所述。

    aws emr create-security-configuration --name "SecConfigName" --security-configuration SecConfigDef

配置数据加密

在配置安全配置中的加密之前,创建用于加密的密钥和凭证。有关更多信息,请参阅提供通过 Amazon EMR 加密静态数据的密钥为通过 Amazon EMR 加密来加密传输中的数据提供凭证

在创建安全配置时,需要指定两组加密选项:静态数据加密和传输中数据加密。静态数据加密选项包括采用 EMRFS 的 Amazon S3 和本地磁盘加密。传输中加密选项为支持传输层安全性 (TLS) 的某些应用程序启用开源加密功能。静态选项和传输中选项可以同时启用或分别启用。有关更多信息,请参阅加密静态数据和传输中的数据

注意

使用 Amazon KMS 时,加密密钥的存储和使用将产生费用。有关更多信息,请参阅 Amazon KMS 定价

使用控制台指定加密选项

根据以下准则选择 Encryption (加密) 下的选项。

  • 选择静态加密下的选项以加密存储在文件系统中的数据。

    您可以选择加密 Amazon S3 和/或本地磁盘中的数据。

  • S3 data encryption (S3 数据加密) 下,对于 Encryption mode (加密模式),选择一个值以确定 Amazon EMR 如何使用 EMRFS 加密 Amazon S3 数据。

    下一步取决于所选的加密模式:

  • Local disk encryption (本地磁盘加密) 下,为 Key provider type (密钥提供程序类型) 选择一个值。

    • Amazon KMS key

      选择此选项以指定一个 Amazon KMS key。对于 Amazon KMS key,选择一个键。该密钥必须与您的 EMR 集群同在一个区域中。有关密钥要求的更多信息,请参阅使用 Amazon KMS keys 加密

      EBS 加密

      当您指定 Amazon KMS 作为密钥提供程序时,可以启用 EBS 加密来加密 EBS 根设备和存储卷。要启用此选项,您必须向 EMR 服务角色 EMR_DefaultRole 使用您指定的 Amazon KMS key 的权限。有关密钥要求的更多信息,请参阅通过为 KMS 密钥提供额外的权限来启用 EBS 加密

    • Custom (自定义)

      选择此选项可指定自定义密钥提供程序。对于 S3 object (S3 对象),输入您的自定义密钥提供程序 JAR 文件在 Amazon S3 中或 Amazon S3 ARN 的位置。对于 Key provider class (密钥提供程序类别),输入在实现 EncryptionMaterialsProvider 接口的应用程序中声明的类的完整类名。这里提供的类名必需与为 CSE-Custom 提供的类名不同。

  • 选择 In-transit encryption (传输中加密) 为传输中的数据启用开源 TLS 加密功能。根据以下指南选择 Certificate provider type (凭证提供程序类型)

    • PEM

      选择此选项将使用您在 zip 文件中提供的 PEM 文件。zip 文件中需要有两个构件:privateKey.pem 和 certificateChain.pem。第三个文件 trustedCertificates.pem 是可选文件。有关详细信息,请参阅为通过 Amazon EMR 加密来加密传输中的数据提供凭证。对于 S3 object (S3 对象),指定 zip 文件字段在 Amazon S3 中的位置或 Amazon S3 ARN。

    • Custom (自定义)

      选择此选项可指定一个自定义凭证提供程序,然后在 S3 object (S3 对象) 中输入您的自定义凭证提供程序 JAR 文件在 Amazon S3 中的位置或 Amazon S3 ARN。对于 Key provider class (密钥提供程序类别),输入在实现 TLSArtifactsProvider 接口的应用程序中声明的类的完整类名。

使用 Amazon CLI 指定加密选项

下面部分使用示例方案,说明对不同配置和密钥提供程序的正确 --security-configuration JSON 格式,再提供 JSON 参数和相应值的参考信息。

传输中数据加密选项示例

下面的示例将说明以下情景:

aws emr create-security-configuration --name "MySecConfig" --security-configuration '{ "EncryptionConfiguration": { "EnableInTransitEncryption": true, "EnableAtRestEncryption": false, "InTransitEncryptionConfiguration": { "TLSCertificateConfiguration": { "CertificateProviderType": "PEM", "S3Object": "s3://MyConfigStore/artifacts/MyCerts.zip" } } } }'

下面的示例将说明以下情景:

aws emr create-security-configuration --name "MySecConfig" --security-configuration '{ "EncryptionConfiguration": { "EnableInTransitEncryption": true, "EnableAtRestEncryption": false, "InTransitEncryptionConfiguration": { "TLSCertificateConfiguration": { "CertificateProviderType": "Custom", "S3Object": "s3://MyConfig/artifacts/MyCerts.jar", "CertificateProviderClass": "com.mycompany.MyCertProvider" } } } }'

静态数据加密选项示例

下面的示例将说明以下情景:

  • 传输中的数据加密已禁用,而静态数据加密已启用。

  • SSE-S3 已用于 Amazon S3 加密。

  • 本地磁盘加密使用 Amazon KMS 作为密钥提供程序。

aws emr create-security-configuration --name "MySecConfig" --security-configuration '{ "EncryptionConfiguration": { "EnableInTransitEncryption": false, "EnableAtRestEncryption": true, "AtRestEncryptionConfiguration": { "S3EncryptionConfiguration": { "EncryptionMode": "SSE-S3" }, "LocalDiskEncryptionConfiguration": { "EncryptionKeyProviderType": "AwsKms", "AwsKmsKey": "arn:aws:kms:us-east-1:123456789012:key/12345678-1234-1234-1234-123456789012" } } } }'

下面的示例将说明以下情景:

  • 传输中数据加密已启用且使用 ARN 引用了 Amazon S3 中包含 PEM 凭证的 ZIP 文件。

  • SSE-KMS 已用于 Amazon S3 加密。

  • 本地磁盘加密使用 Amazon KMS 作为密钥提供程序。

aws emr create-security-configuration --name "MySecConfig" --security-configuration '{ "EncryptionConfiguration": { "EnableInTransitEncryption": true, "EnableAtRestEncryption": true, "InTransitEncryptionConfiguration": { "TLSCertificateConfiguration": { "CertificateProviderType": "PEM", "S3Object": "arn:aws:s3:::MyConfigStore/artifacts/MyCerts.zip" } }, "AtRestEncryptionConfiguration": { "S3EncryptionConfiguration": { "EncryptionMode": "SSE-KMS", "AwsKmsKey": "arn:aws:kms:us-east-1:123456789012:key/12345678-1234-1234-1234-123456789012" }, "LocalDiskEncryptionConfiguration": { "EncryptionKeyProviderType": "AwsKms", "AwsKmsKey": "arn:aws:kms:us-east-1:123456789012:key/12345678-1234-1234-1234-123456789012" } } } }'

下面的示例将说明以下情景:

  • 传输中数据加密已启用且引用了 Amazon S3 中包含 PEM 凭证的 ZIP 文件。

  • CSE-KMS 已用于 Amazon S3 加密。

  • 本地磁盘加密使用了通过其 ARN 引用的自定义密钥提供程序。

aws emr create-security-configuration --name "MySecConfig" --security-configuration '{ "EncryptionConfiguration": { "EnableInTransitEncryption": true, "EnableAtRestEncryption": true, "InTransitEncryptionConfiguration": { "TLSCertificateConfiguration": { "CertificateProviderType": "PEM", "S3Object": "s3://MyConfigStore/artifacts/MyCerts.zip" } }, "AtRestEncryptionConfiguration": { "S3EncryptionConfiguration": { "EncryptionMode": "CSE-KMS", "AwsKmsKey": "arn:aws:kms:us-east-1:123456789012:key/12345678-1234-1234-1234-123456789012" }, "LocalDiskEncryptionConfiguration": { "EncryptionKeyProviderType": "Custom", "S3Object": "arn:aws:s3:::artifacts/MyKeyProvider.jar", "EncryptionKeyProviderClass": "com.mycompany.MyKeyProvider" } } } }'

下面的示例将说明以下情景:

  • 利用自定义密钥提供程序启用了传输中的数据加密。

  • CSE-Custom 已用于 Amazon S3 数据。

  • 本地磁盘加密使用了自定义密钥提供程序。

aws emr create-security-configuration --name "MySecConfig" --security-configuration '{ "EncryptionConfiguration": { "EnableInTransitEncryption": "true", "EnableAtRestEncryption": "true", "InTransitEncryptionConfiguration": { "TLSCertificateConfiguration": { "CertificateProviderType": "Custom", "S3Object": "s3://MyConfig/artifacts/MyCerts.jar", "CertificateProviderClass": "com.mycompany.MyCertProvider" } }, "AtRestEncryptionConfiguration": { "S3EncryptionConfiguration": { "EncryptionMode": "CSE-Custom", "S3Object": "s3://MyConfig/artifacts/MyCerts.jar", "EncryptionKeyProviderClass": "com.mycompany.MyKeyProvider" }, "LocalDiskEncryptionConfiguration": { "EncryptionKeyProviderType": "Custom", "S3Object": "s3://MyConfig/artifacts/MyCerts.jar", "EncryptionKeyProviderClass": "com.mycompany.MyKeyProvider" } } } }'

下面的示例将说明以下情景:

  • 传输中的数据加密已禁用,而静态数据加密已启用。

  • 通过 SSE-KMS 启用了 Amazon S3 加密。

  • 使用多个 Amazon KMS 密钥,每个 S3 存储桶一个密钥,并且加密例外应用于这些单独的 S3 存储桶。

  • 本地磁盘加密已禁用。

aws emr create-security-configuration --name "MySecConfig" --security-configuration '{ "EncryptionConfiguration": { "AtRestEncryptionConfiguration": { "S3EncryptionConfiguration": { "EncryptionMode": "SSE-KMS", "AwsKmsKey": "arn:aws:kms:us-east-1:123456789012:key/12345678-1234-1234-1234-123456789012", "Overrides": [ { "BucketName": "sse-s3-bucket-name", "EncryptionMode": "SSE-S3" }, { "BucketName": "cse-kms-bucket-name", "EncryptionMode": "CSE-KMS", "AwsKmsKey": "arn:aws:kms:us-east-1:123456789012:key/12345678-1234-1234-1234-123456789012" }, { "BucketName": "sse-kms-bucket-name", "EncryptionMode": "SSE-KMS", "AwsKmsKey": "arn:aws:kms:us-east-1:123456789012:key/12345678-1234-1234-1234-123456789012" } ] } }, "EnableInTransitEncryption": false, "EnableAtRestEncryption": true } }'

下面的示例将说明以下情景:

  • 传输中的数据加密已禁用,而静态数据加密已启用。

  • 通过 SSE-S3 启用了 Amazon S3 加密,并且本地磁盘加密已禁用。

aws emr create-security-configuration --name "MyS3EncryptionConfig" --security-configuration '{ "EncryptionConfiguration": { "EnableInTransitEncryption": false, "EnableAtRestEncryption": true, "AtRestEncryptionConfiguration": { "S3EncryptionConfiguration": { "EncryptionMode": "SSE-S3" } } } }'

下面的示例将说明以下情景:

  • 传输中的数据加密已禁用,而静态数据加密已启用。

  • 本地磁盘加密已启用并将 Amazon KMS 作为密钥提供程序,Amazon S3 加密已禁用。

aws emr create-security-configuration --name "MyLocalDiskEncryptionConfig" --security-configuration '{ "EncryptionConfiguration": { "EnableInTransitEncryption": false, "EnableAtRestEncryption": true, "AtRestEncryptionConfiguration": { "LocalDiskEncryptionConfiguration": { "EncryptionKeyProviderType": "AwsKms", "AwsKmsKey": "arn:aws:kms:us-east-1:123456789012:key/12345678-1234-1234-1234-123456789012" } } } }'

下面的示例将说明以下情景:

  • 传输中的数据加密已禁用,而静态数据加密已启用。

  • 本地磁盘加密已启用并将 Amazon KMS 作为密钥提供程序,Amazon S3 加密已禁用。

  • EBS 加密已启用。

aws emr create-security-configuration --name "MyLocalDiskEncryptionConfig" --security-configuration '{ "EncryptionConfiguration": { "EnableInTransitEncryption": false, "EnableAtRestEncryption": true, "AtRestEncryptionConfiguration": { "LocalDiskEncryptionConfiguration": { "EnableEbsEncryption": true, "EncryptionKeyProviderType": "AwsKms", "AwsKmsKey": "arn:aws:kms:us-east-1:123456789012:key/12345678-1234-1234-1234-123456789012" } } } }'

加密设置的 JSON 引用

下表列出了用于加密设置的 JSON 参数并提供了每个参数的可接受值描述。

参数 描述
"EnableInTransitEncryption" : 真实 | false Specify 真实 to enable in-transit encryption and false to disable it. If omitted, false is assumed, and in-transit encryption is disabled.
"EnableAtRestEncryption": true | false Specify 真实 to enable at-rest encryption and false to disable it. If omitted, false is assumed and at-rest encryption is disabled.
传输中加密参数
"InTransitEncryptionConfiguration" : Specifies a collection of values used to configure in-transit encryption when EnableInTransitEncryption is 真实.
"CertificateProviderType": "PEM" | "Custom" Specifies whether to use PEM certificates referenced with a zipped file, or a 自定义 certificate provider. If PEM is specified, S3Object must be a reference to the location in Amazon S3 of a zip file containing the certificates. If Custom is specified, S3Object must be a reference to the location in Amazon S3 of a JAR file, followed by a CertificateProviderClass entry.
"S3Object" : "ZipLocation" | "JarLocation" Provides the location in Amazon S3 to a zip file when PEM is specified, or to a JAR file when 自定义 is specified. The format can be a path (for example, s3://MyConfig/artifacts/CertFiles.zip) or an ARN (for example, arn:aws:s3:::Code/MyCertProvider.jar). If a zip file is specified, it must contain files named exactly privateKey.pem and certificateChain.pem. A file named trustedCertificates.pem is optional.
"CertificateProviderClass" : "MyClassID" Required only if 自定义 is specified for CertificateProviderType. MyClassID specifies a full class name declared in the JAR file, which implements the TLSArtifactsProvider interface. For example, com.mycompany.MyCertProvider.
静态加密参数
"AtRestEncryptionConfiguration" : Specifies a collection of values for at-rest encryption when EnableAtRestEncryption is 真实, including Amazon S3 encryption and local disk encryption.
Amazon S3 加密参数
"S3EncryptionConfiguration" : Specifies a collection of values used for Amazon S3 encryption with the EMR File System (EMRFS).
"EncryptionMode": "SSE-S3" | "SSE-KMS" | "CSE-KMS" | "CSE-Custom" Specifies the type of Amazon S3 encryption to use. If SSE-S3 is specified, no further Amazon S3 encryption values are required. If either SSE-KMS or CSE-KMS is specified, an Amazon KMS key ARN must be specified as the AwsKmsKey value. If CSE-Custom (自定义 CSE) is specified, S3Object and EncryptionKeyProviderClass values must be specified.
"AwsKmsKey" : "MyKeyARN" Required only when either SSE-KMS or CSE-KMS is specified for EncryptionMode. MyKeyARN must be a fully specified ARN to a key (for example, arn:aws:kms:us-east-1:123456789012:key/12345678-1234-1234-1234-123456789012).
"S3Object" : "JarLocation" Required only when CSE-Custom (自定义 CSE) is specified for CertificateProviderType. JarLocation provides the location in Amazon S3 to a JAR file. The format can be a path (for example, s3://MyConfig/artifacts/MyKeyProvider.jar) or an ARN (for example, arn:aws:s3:::Code/MyKeyProvider.jar).
"EncryptionKeyProviderClass" : "MyS3KeyClassID" Required only when CSE-Custom (自定义 CSE) is specified for EncryptionMode. MyS3KeyClassID specifies a full class name of a class declared in the application that implements the EncryptionMaterialsProvider interface; for example, com.mycompany.MyS3KeyProvider.
本地磁盘加密参数
"LocalDiskEncryptionConfiguration" Specifies the key provider and corresponding values to be used for local disk encryption.
“EnableEbsEncryption”: true|false Specify 真实 to enable EBS encryption. EBS encryption encrypts the EBS root device volume and attached storage volumes. To use EBS encryption, you must specify AwsKms as your EncryptionKeyProviderType.
"EncryptionKeyProviderType" : "AwsKms" | "Custom" Specifies the key provider. If AwsKms is specified, an KMS key ARN must be specified as the AwsKmsKey value. If 自定义 is specified, S3Object and EncryptionKeyProviderClass values must be specified.
"AwsKmsKey : "MyKeyARN" Required only when AwsKms is specified for 类型. MyKeyARN must be a fully specified ARN to a key (for example, arn:aws:kms:us-east-1:123456789012:key/12345678-1234-1234-1234-456789012123).
"S3Object" : "JarLocation" Required only when CSE-Custom (自定义 CSE) is specified for CertificateProviderType. JarLocation provides the location in Amazon S3 to a JAR file. The format can be a path (for example, s3://MyConfig/artifacts/MyKeyProvider.jar) or an ARN (for example, arn:aws:s3:::Code/MyKeyProvider.jar).

"EncryptionKeyProviderClass" : "MyLocalDiskKeyClassID"

Required only when 自定义 is specified for 类型. MyLocalDiskKeyClassID specifies a full class name of a class declared in the application that implements the EncryptionMaterialsProvider interface; for example, com.mycompany.MyLocalDiskKeyProvider.

配置 Kerberos 身份验证

包含 Kerberos 设置的安全配置只能由使用 Kerberos 属性创建的集群使用,否则会发生错误。有关更多信息,请参阅使用 Kerberos 通过 Amazon EMR 进行身份验证。仅在 Amazon EMR 发行版 5.10.0 及更高版本中提供了 Kerberos。

使用控制台指定 Kerberos 设置

根据以下准则选择 Kerberos authentication (Kerberos 身份验证) 下的选项。

参数 描述

Kerberos

指定为使用此安全配置的集群启用 Kerberos。如果集群使用此安全配置,则集群还必须指定 Kerberos 设置,否则会发生错误。

Provider

集群专用 KDC

指定 Amazon EMR 在使用此安全配置的任何集群的主节点上创建 KDC。您可以在创建集群时指定领域名称和 KDC 管理员密码。

如果需要,您可以从其它集群引用此 KDC。使用不同的安全配置创建这些集群,指定外部 KDC,并使用您为集群专用 KDC 指定的领域名称和 KDC 管理员密码。

外部 KDC

仅在 Amazon EMR 5.20.0 版及更高版本中可用。指定使用此安全配置的集群使用集群外部的 KDC 服务器对 Kerberos 主体进行身份验证。未在集群上创建 KDC。创建集群时,您需要为外部 KDC 指定领域名称和 KDC 管理员密码。

票证生命周期

可选。指定 KDC 颁发的 Kerberos 票证在使用此安全配置的集群上有效的期间。

出于安全考虑,限制票证生命周期。集群应用程序和服务在过期后自动续订票证。使用 Kerberos 凭证通过 SSH 连接到集群的用户在票证过期后需要通过主节点命令行运行 kinit 来续订。

跨领域信任

指定使用此安全配置的集群上的集群专用 KDC 与不同 Kerberos 领域中的 KDC 之间的跨领域信任。

来自另一个领域的委托人(通常是用户)将通过使用此配置的集群进行身份验证。需要在其它 Kerberos 领域中进行其它配置。有关更多信息,请参阅教程:配置与 Active Directory 域的跨领域信任

跨领域信任属性

领域

指定信任关系中其它领域的 Kerberos 领域名称。按照惯例,Kerberos 领域名称与域名相同,但全部使用大写字母。

指定信任关系中其它领域的域名。

管理服务器

指定信任关系的其它领域中的管理服务器的完全限定域名(FQDN)或 IP 地址。管理服务器和 KDC 服务器通常运行在具有相同 FQDN 的同一台计算机上,但通过不同的端口进行通信。

如果未指定端口,则使用端口 749,这是 Kerberos 默认值。另外,您还可以指定端口 (例如,domain.example.com:749)。

KDC 服务器

指定信任关系的其它领域中 KDC 服务器的完全限定域名(FQDN)或 IP 地址。KDC 服务器和管理服务器通常运行在具有相同 FQDN 的同一台计算机上,但是使用不同的端口。

如果未指定端口,则使用端口 88,这是 Kerberos 默认值。另外,您还可以指定端口 (例如,domain.example.com:88)。

外部 KDC

指定集群使用集群外部 KDC。

外部 KDC 属性

管理服务器

指定外部管理服务器的完全限定域名(FQDN)或 IP 地址。管理服务器和 KDC 服务器通常运行在具有相同 FQDN 的同一台计算机上,但通过不同的端口进行通信。

如果未指定端口,则使用端口 749,这是 Kerberos 默认值。另外,您还可以指定端口 (例如,domain.example.com:749)。

KDC 服务器

指定外部 KDC 服务器的完全限定域名(FQDN)。KDC 服务器和管理服务器通常运行在具有相同 FQDN 的同一台计算机上,但是使用不同的端口。

如果未指定端口,则使用端口 88,这是 Kerberos 默认值。另外,您还可以指定端口 (例如,domain.example.com:88)。

Active Directory 集成

指定 Kerberos 委托人身份验证与 Microsoft Active Directory 域集成。

Active Directory 集成属性

Active Directory 领域

指定 Active Directory 域的 Kerberos 领域名称。按照惯例,Kerberos 领域名称通常与域名相同,但全部使用大写字母。

Active Directory 域

指定 Active Directory 域名。

Active Directory 服务器

指定 Microsoft Active Directory 域控制器的完全限定域名(FQDN)。

使用 Amazon CLI 指定 Kerberos 设置

以下参考表显示了安全配置中 Kerberos 设置的 JSON 参数。有关示例配置,请参阅配置示例

参数 描述

"AuthenticationConfiguration": {

对于 Kerberos 是必需的。指定身份验证配置是此安全配置的一部分。

"KerberosConfiguration": {

对于 Kerberos 是必需的。指定 Kerberos 配置属性。

"Provider": "ClusterDedicatedKdc",

或者

"Provider: "ExternalKdc",

ClusterDedicatedKdc 指定 Amazon EMR 在使用此安全配置的任何集群的主节点上创建 KDC。您可以在创建集群时指定领域名称和 KDC 管理员密码。如果需要,您可以从其它集群引用此 KDC。使用不同的安全配置创建这些集群,指定外部 KDC,并使用您在使用集群专用 KDC 创建集群时指定的领域名称和 KDC 管理员密码。

ExternalKdc 指定集群使用外部 KDC。Amazon EMR 未在主节点上创建 KDC。使用此安全配置的集群必须指定外部 KDC 的领域名称和 KDC 管理员密码。

"ClusterDedicatedKdcConfiguration": {

在指定 ClusterDedicatedKdc 时是必需的。

"TicketLifetimeInHours": 24,

可选。指定 KDC 颁发的 Kerberos 票证在使用此安全配置的集群上有效的期间。

出于安全考虑,限制票证生命周期。集群应用程序和服务在过期后自动续订票证。使用 Kerberos 凭证通过 SSH 连接到集群的用户在票证过期后需要通过主节点命令行运行 kinit 来续订。

"CrossRealmTrustConfiguration": {

指定使用此安全配置的集群上的集群专用 KDC 与不同 Kerberos 领域中的 KDC 之间的跨领域信任。

来自另一个领域的委托人(通常是用户)将通过使用此配置的集群进行身份验证。需要在其它 Kerberos 领域中进行其它配置。有关更多信息,请参阅教程:配置与 Active Directory 域的跨领域信任

"Realm": "KDC2.COM",

指定信任关系中其它领域的 Kerberos 领域名称。按照惯例,Kerberos 领域名称与域名相同,但全部使用大写字母。

"Domain": "kdc2.com",

指定信任关系中其它领域的域名。

"AdminServer": "kdc.com:749",

指定信任关系的其它领域中的管理服务器的完全限定域名(FQDN)或 IP 地址。管理服务器和 KDC 服务器通常运行在具有相同 FQDN 的同一台计算机上,但通过不同的端口进行通信。

如果未指定端口,则使用端口 749,这是 Kerberos 默认值。另外,您还可以指定端口 (例如,domain.example.com:749)。

"KdcServer": "kdc.com:88"

指定信任关系的其它领域中 KDC 服务器的完全限定域名(FQDN)或 IP 地址。KDC 服务器和管理服务器通常运行在具有相同 FQDN 的同一台计算机上,但是使用不同的端口。

如果未指定端口,则使用端口 88,这是 Kerberos 默认值。另外,您还可以指定端口 (例如,domain.example.com:88)。

}

}

"ExternalKdcConfiguration": {

在指定 ExternalKdc 时是必需的。

"TicketLifetimeInHours": 24,

可选。指定 KDC 颁发的 Kerberos 票证在使用此安全配置的集群上有效的期间。

出于安全考虑,限制票证生命周期。集群应用程序和服务在过期后自动续订票证。使用 Kerberos 凭证通过 SSH 连接到集群的用户在票证过期后需要通过主节点命令行运行 kinit 来续订。

"KdcServerType": "Single",

指定引用单个 KDC 服务器。Single 是目前唯一支持的值。

"AdminServer": "kdc.com:749",

指定外部管理服务器的完全限定域名(FQDN)或 IP 地址。管理服务器和 KDC 服务器通常运行在具有相同 FQDN 的同一台计算机上,但通过不同的端口进行通信。

如果未指定端口,则使用端口 749,这是 Kerberos 默认值。另外,您还可以指定端口 (例如,domain.example.com:749)。

"KdcServer": "kdc.com:88",

指定外部 KDC 服务器的完全限定域名(FQDN)。KDC 服务器和管理服务器通常运行在具有相同 FQDN 的同一台计算机上,但是使用不同的端口。

如果未指定端口,则使用端口 88,这是 Kerberos 默认值。另外,您还可以指定端口 (例如,domain.example.com:88)。

"AdIntegrationConfiguration": {

指定 Kerberos 委托人身份验证与 Microsoft Active Directory 域集成。

"AdRealm": "AD.DOMAIN.COM",

指定 Active Directory 域的 Kerberos 领域名称。按照惯例,Kerberos 领域名称通常与域名相同,但全部使用大写字母。

"AdDomain": "ad.domain.com"

指定 Active Directory 域名。

"AdServer": "ad.domain.com"

指定 Microsoft Active Directory 域控制器的完全限定域名(FQDN)。

}

}

}

}

为处理 EMRFS 对 Amazon S3 的请求配置 IAM 角色

EMRFS 的 IAM 角色让您能够为 Amazon S3 中的 EMRFS 数据提供不同权限。您可以创建角色映射,来指定在访问请求包含您指定的标识符时用来获得权限的 IAM 角色。标识符可以是 Hadoop 用户或角色,或 Amazon S3 前缀。

有关更多信息,请参阅为处理 EMRFS 对 Amazon S3 的请求配置 IAM 角色

使用 Amazon CLI 指定 EMRFS 的 IAM 角色

以下是一个示例 JSON 代码段,用于在安全配置中为 EMRFS 指定自定义 IAM 角色。它演示了三种不同标识符类型的角色映射,后跟参数引用。

{ "AuthorizationConfiguration": { "EmrFsConfiguration": { "RoleMappings": [{ "Role": "arn:aws:iam::123456789101:role/allow_EMRFS_access_for_user1", "IdentifierType": "User", "Identifiers": [ "user1" ] },{ "Role": "arn:aws:iam::123456789101:role/allow_EMRFS_access_to_MyBuckets", "IdentifierType": "Prefix", "Identifiers": [ "s3://MyBucket/","s3://MyOtherBucket/" ] },{ "Role": "arn:aws:iam::123456789101:role/allow_EMRFS_access_for_AdminGroup", "IdentifierType": "Group", "Identifiers": [ "AdminGroup" ] }] } } }
参数 描述

"AuthorizationConfiguration":

必需。

"EmrFsConfiguration":

必需。包含角色映射。

  "RoleMappings":

必需。包含一个或多个角色映射定义。按照角色映射的先后顺序对角色映射进行评估。对于 Amazon S3 中的 EMRFS 数据调用,如果角色映射评估为 true,则不会评估其它角色映射,并且 EMRFS 将使用指定的 IAM 角色进行请求。角色映射由以下必需参数组成:

   "Role":

arn:aws:iam::account-id:role/role-name 格式指定 IAM 角色的 ARN 标识符。如果 EMRFS 对 Amazon S3 的请求与指定的任何 Identifiers 匹配,则这是 Amazon EMR 承担的 IAM 角色。

   "IdentifierType":

可以是以下值之一:

  • "User" 指定标识符是一个或多个 Hadoop 用户,可以是 Linux 账户用户或 Kerberos 主体。如果 EMRFS 请求来自一个或多个指定用户,则担任 IAM 角色。

  • "Prefix" 指定该标识符是 Amazon S3 位置。用于调用具有指定前缀的一个或多个位置时代入 IAM 角色。例如,前缀 s3://mybucket/ 匹配 s3://mybucket/mydir s3://mybucket/yetanotherdir

  • "Group" 指定标识符是一个或多个 Hadoop 组。如果请求来自指定组或组中的用户,则代入 IAM 角色。

   "Identifiers":

指定一个或多个相应标识符类型的标识符。用逗号分隔多个标识符,不含空格。

配置到 Amazon EC2 实例的元数据服务请求

实例元数据 是有关您的实例的数据,可以用来配置或管理正在运行的实例。您可以使用以下其中一种方法,从正在运行的实例中访问实例元数据:

  • 实例元数据服务版本 1(IMDSv1)– 一种请求/响应方法

  • 实例元数据服务版本 2(IMDSv2)– 一种面向会话的方法

虽然 Amazon EC2 同时支持 IMDSv1 和 IMDSv2,但 Amazon EMR 在 Amazon EMR 5.23.1、5.27.1、5.32 或更高版本以及 6.2 或更高版本中支持 IMDSv2。在这些版本中,Amazon EMR 组件对所有 IMDS 调用都使用 IMDSv2。对于应用程序代码中的 IMDS 调用,您可以同时使用 IMDSv1 和 IMDSv2,或者将 IMDS 配置为仅使用 IMDSv2,以提高安全性。在指定必须使用 IMDSv2 时,IMDSv1 不再起作用。

有关更多信息,请参阅《适用于 Linux 实例的 Amazon EC2 用户指南》中的配置实例元数据服务

注意

在早期的 Amazon EMR 5.x 或 6.x 版本中,关闭 IMDSv1 会导致集群启动失败,因为 Amazon EMR 组件对所有 IMDS 调用都使用 IMDSv1。关闭 IMDSv1 时,请确保任何使用 IMDSv1 的自定义软件都已更新为 IMDSv2。

指定实例元数据服务配置,使用 Amazon CLI。

以下是一个示例 JSON 代码段,用于在安全配置中指定 Amazon EC2 实例元数据服务(IMDS)。

{ "InstanceMetadataServiceConfiguration" : { "MinimumInstanceMetadataServiceVersion": integer, "HttpPutResponseHopLimit": integer } }
参数 描述

"InstanceMetadataServiceConfiguration":

必需。

"MinimumInstanceMetadataServiceVersion":

必需。指定 121 的一个值允许 IMDSv1 和 IMDSv2。2 的一个值仅允许 IMDSv2。

"HttpPutResponseHopLimit":

必需。实例元数据请求的所需 HTTP PUT 响应跃点限制。该数字越大,实例元数据请求传播得越远。默认值:1。您可以指定 164 之间的整数。

使用控制台指定实例元数据服务配置

当您从 Amazon EMR 控制台启动集群时,您可以为集群配置 IMDS 的使用。

要使用控制台配置 IMDS 的使用,请执行以下操作:
  1. 在创建新的安全配置时,Security configurations (安全配置) 页面上,在 EC2 Instance Metadata Service (EC2 实例元数据服务) 设置下选择 Configure EC2 Instance metadata service (配置 EC2 实例元数据服务)。此配置仅在 Amazon EMR 5.23.1、5.27.1、5.32 或更高版本以及 6.2 或更高版本中受支持。

  2. 对于 Minimum Instance Metadata Service Version (最低实例元数据服务版本) 选项,请选择以下任一项:

    • Turn off IMDSv1 and only allow IMDSv2 (关闭 IMDSv1 并且仅允许使用 IMDSv2)(如果您只想在此集群上允许 IMDSv2)。请参阅《适用于 Linux 实例的 Amazon EC2 用户指南》中的过渡到使用实例元数据服务版本 2

    • 如果您希望在此集群上允许 IMDSv1 和面向会话的 IMDSv2,则允许集群上同时使用 IMDSv1 和 IMDSv2

  3. 对于 IMDSv2,您还可以通过将 HTTP put response hop limit (HTTP PUT 响应跃点限制) 设置为 164 之间的整数来为元数据令牌设置允许的网络跃点数。

有关更多信息,请参阅《适用于 Linux 实例的 Amazon EC2 用户指南》中的配置实例元数据服务

请参阅《适用于 Linux 实例的 Amazon EC2 用户指南》中的配置实例详细信息配置实例元数据服务