安全性与合规性


Red Hat OpenShift Service on AWS 4

在 AWS 集群上配置安全性上下文约束

Red Hat OpenShift Documentation Team

摘要

本文档提供有关配置安全性上下文约束的说明。

您可以在 AWS 帐户中实施额外的安全层,以防止有未列出的 IP 地址进行角色假设。

1.1. 创建基于身份的 IAM 策略

您可以创建一个基于身份的 Identity and Access Management (IAM)策略,在请求源自红帽提供的 IP 地址时拒绝访问所有 AWS 操作。

先决条件

流程

  1. 使用您的 AWS 帐户凭证登录到 AWS 管理控制台。
  2. 进入 IAM 服务。
  3. 在 IAM 控制台中,从左侧导航菜单中选择 Policies
  4. 点击 Create policy
  5. 选择 JSON 选项卡,以使用 JSON 格式定义策略。
  6. 要获取您需要进入 JSON 策略文档的 IP 地址,请运行以下命令:

    $ ocm get /api/clusters_mgmt/v1/trusted_ip_addresses
    Copy to Clipboard Toggle word wrap
    注意

    这些 IP 地址不是永久性的,可能随时更改。您必须持续检查 API 输出,并在 JSON 策略文档中进行必要的更新。

  7. 将以下 policy_document.json 文件复制并粘贴到编辑器中:

    {
        "Version": "2012-10-17",
        "Statement": [
            {
                "Effect": "Deny",
                "Action": "*",
                "Resource": "*",
                "Condition": {
                    "NotIpAddress": {
                        "aws:SourceIp": []
                    },
                    "Bool": {
                        "aws:ViaAWSService": "false"
                    }
                }
            }
        ]
    }
    Copy to Clipboard Toggle word wrap
  8. 将在第 6 步中获得的所有 IP 地址复制并粘贴到 policy_document.json 文件中的 "aws:SourceIp": [] 数组中。
  9. Review and create
  10. 提供策略的名称和描述,并查看准确性的详细信息。
  11. Create policy 保存策略。
注意

条件键 aws:ViaAWSService 必须设为 false,以便后续调用根据初始调用成功。例如,如果您对 aws ec2 describe-instances 发出初始调用,则 AWS API 服务器中的所有后续调用都会检索附加到 ec2 实例的 EBS 卷的信息,如果条件键 aws:ViaAWSService 没有设置为 false,则会失败。后续的调用将失败,因为它们源自于 AllowList 中的 AWS IP 地址。

1.2. 附加基于身份的 IAM 策略

创建基于身份的 IAM 策略后,将其附加到 AWS 帐户中的相关 IAM 用户、组或角色,以防止这些实体基于 IP 的角色假设。

流程

  1. 进入 AWS 管理控制台中的 IAM 控制台。
  2. 选择您要附加策略的默认 IAM ManagedOpenShift-Support-Role 角色。

    注意

    您可以更改默认的 IAM ManagedOpenShift-Support-Role 角色。有关角色的更多信息,请参阅 红帽支持访问

  3. Permissions 选项卡中,从 Add Permissions 下拉列表中选择 Add PermissionsCreate inline policy
  4. 搜索您之前创建的策略:

    1. 输入策略名称。
    2. 根据适当的类别过滤。
  5. 选择策略并单击 Attach policy
重要

为确保基于 IP 的有效角色假设阻止,您必须将允许列表的 IP 保持最新状态。如果不这样做,可能会导致红帽站点可靠性工程(SRE)无法访问您的帐户并影响您的 SLA。如果您有进一步的问题或需要协助,请联系我们的支持团队。

Legal Notice

Copyright © 2025 Red Hat

OpenShift documentation is licensed under the Apache License 2.0 (https://www.apache.org/licenses/LICENSE-2.0).

Modified versions must remove all Red Hat trademarks.

Portions adapted from https://github.com/kubernetes-incubator/service-catalog/ with modifications by Red Hat.

Red Hat, Red Hat Enterprise Linux, the Red Hat logo, the Shadowman logo, JBoss, OpenShift, Fedora, the Infinity logo, and RHCE are trademarks of Red Hat, Inc., registered in the United States and other countries.

Linux® is the registered trademark of Linus Torvalds in the United States and other countries.

Java® is a registered trademark of Oracle and/or its affiliates.

XFS® is a trademark of Silicon Graphics International Corp. or its subsidiaries in the United States and/or other countries.

MySQL® is a registered trademark of MySQL AB in the United States, the European Union and other countries.

Node.js® is an official trademark of Joyent. Red Hat Software Collections is not formally related to or endorsed by the official Joyent Node.js open source or commercial project.

The OpenStack® Word Mark and OpenStack logo are either registered trademarks/service marks or trademarks/service marks of the OpenStack Foundation, in the United States and other countries and are used with the OpenStack Foundation’s permission. We are not affiliated with, endorsed or sponsored by the OpenStack Foundation, or the OpenStack community.

All other trademarks are the property of their respective owners.

返回顶部
Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。 了解我们当前的更新.

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

Theme

© 2025 Red Hat