6.3. Ceph 对象网关和 OpenStack Keystone


作为存储管理员,您可以使用 OpenStack 的 Keystone 身份验证服务通过 Ceph 对象网关对用户进行身份验证。在您可以配置 Ceph 对象网关之前,您需要先配置 Keystone。这将启用 Swift 服务,并将 Keystone 服务指向 Ceph 对象网关。接下来,您需要配置 Ceph 对象网关,以接受来自 Keystone 服务的身份验证请求。

先决条件

  • 正在运行的 Red Hat OpenStack Platform 环境。
  • 正在运行的 Red Hat Ceph Storage 环境。
  • 正在运行的 Ceph 对象网关环境。

6.3.1. Keystone 身份验证的角色

OpenStack Keystone 服务提供三个角色: admin、member 和 reader。这些角色是分层的;具有 admin 角色的用户继承 member 角色的能力,并且具有 member 角色的用户继承 reader 角色的能力。

注意

member 角色的读取权限仅应用到它所属的项目的对象。

admin

admin 角色保留为特定范围内最高级别的授权。这通常包括资源或 API 的所有 create、read、update 或 delete 操作。

成员

默认不直接使用 member 角色。它在部署期间提供灵活性,有助于减少管理员的职责。

例如,您可以使用默认 member 角色和简单的策略覆盖覆盖部署的策略,以允许系统成员更新服务和端点。这提供了 admin 和 reader 角色之间的授权层。

读取器

reader 角色为只读操作保留,而不考虑范围。

警告

如果您使用 读取器 访问敏感信息,如镜像许可证密钥、管理镜像数据、管理卷元数据、应用程序凭证和 secret,您可能需要意外地公开敏感信息。因此,公开这些资源的 API 应仔细考虑 reader 角色的影响,并正确延迟 成员和 admin 角色。

6.3.2. Keystone 身份验证和 Ceph 对象网关

使用 OpenStack Keystone 验证用户身份的组织可以将 Keystone 与 Ceph 对象网关集成。Ceph 对象网关使网关能够接受 Keystone 令牌,对用户进行身份验证,并且创建对应的 Ceph 对象网关用户。当 Keystone 验证令牌时,网关将考虑用户经过身份验证。

优点

  • 使用 Keystone 为用户分配 admin、member 和 reader 角色。
  • 在 Ceph 对象网关中创建用户。
  • 使用 Keystone 管理用户.
  • Ceph 对象网关将定期查询 Keystone,以获取已撤销令牌的列表。

6.3.3. 创建 Swift 服务

在配置 Ceph 对象网关之前,请配置 Keystone,使 Swift 服务已启用并指向 Ceph 对象网关。

先决条件

  • 一个正在运行的 Red Hat Ceph Storage 集群。
  • 访问 Ceph 软件存储库。
  • OpenStack 控制器节点的根级别访问权限.

流程

  • 创建 Swift 服务:

    [root@swift~]# openstack service create --name=swift --description="Swift Service" object-store

    创建服务将回显服务设置。

    表 6.1. 示例
    字段值

    description

    Swift 服务

    enabled

    true

    id

    37c4c0e79571404cb4644201a4a6e5ee

    name

    swift

    type

    object-store

6.3.4. 设置 Ceph 对象网关端点

在创建了 Swift 服务后,将服务指向 Ceph 对象网关。

先决条件

  • 一个正在运行的 Red Hat Ceph Storage 集群。
  • 访问 Ceph 软件存储库。
  • 在红帽 OpenStack 平台 17.1 环境中运行的 Swift 服务。

流程

  • 创建指向 Ceph 对象网关的 OpenStack 端点:

    语法

    openstack endpoint create --region REGION_NAME swift admin "URL"
    openstack endpoint create --region REGION_NAME swift public "URL"
    openstack endpoint create --region REGION_NAME swift internal "URL"

    将 REGION_NAME 替换为网关的 zone group name 或 region 名称的名称。使用适合 Ceph 对象网关的 URL 替换 URL。

    示例

    [root@osp ~]# openstack endpoint create --region us-west swift admin "http://radosgw.example.com:8080/swift/v1"
    [root@osp ~]# openstack endpoint create --region us-west swift public "http://radosgw.example.com:8080/swift/v1"
    [root@osp ~]# openstack endpoint create --region us-west swift internal "http://radosgw.example.com:8080/swift/v1"

    字段值

    adminurl

    http://radosgw.example.com:8080/swift/v1

    id

    e4249d2b60e44743a67b5e5b38c18dd3

    internalurl

    http://radosgw.example.com:8080/swift/v1

    publicurl

    http://radosgw.example.com:8080/swift/v1

    region

    us-west

    service_id

    37c4c0e79571404cb4644201a4a6e5ee

    service_name

    swift

    service_type

    object-store

    设置端点将输出服务端点设置。

6.3.5. 验证 Openstack 使用 Ceph 对象网关端点

创建 Swift 服务并设置端点后,请显示端点以确保所有设置都正确。

先决条件

  • 一个正在运行的 Red Hat Ceph Storage 集群。
  • 访问 Ceph 软件存储库。

流程

  1. 列出 Swift 服务下的端点:

    [root@swift~]# openstack endpoint list --service=swift
  2. 验证上一命令中列出的端点的设置:

    语法

    [root@swift~]# openstack endpoint show ENDPOINT_ID

    显示端点将回显端点设置和服务设置。

    表 6.2. 示例
    字段值

    adminurl

    http://radosgw.example.com:8080/swift/v1

    enabled

    true

    id

    e4249d2b60e44743a67b5e5b38c18dd3

    internalurl

    http://radosgw.example.com:8080/swift/v1

    publicurl

    http://radosgw.example.com:8080/swift/v1

    region

    us-west

    service_id

    37c4c0e79571404cb4644201a4a6e5ee

    service_name

    swift

    service_type

    object-store

其它资源

  • 有关获取端点详情的更多信息,请参阅 Red Hat OpenStack 指南中的 显示端点。

6.3.6. 配置 Ceph 对象网关以使用 Keystone SSL

转换 Keystone 使用的 OpenSSL 证书,配置 Ceph 对象网关以搭配 Keystone 使用。当 Ceph 对象网关与 OpenStack 的 Keystone 身份验证交互时,Keystone 将终止自签名 SSL 证书。

先决条件

  • 一个正在运行的 Red Hat Ceph Storage 集群。
  • 访问 Ceph 软件存储库。

流程

  1. 将 OpenSSL 证书转换为 db 格式:

    示例

    [root@osp ~]# mkdir /var/ceph/nss
    
    [root@osp ~]# openssl x509 -in /etc/keystone/ssl/certs/ca.pem -pubkey | \
        certutil -d /var/ceph/nss -A -n ca -t "TCu,Cu,Tuw"
    
    [root@osp ~]# openssl x509 -in /etc/keystone/ssl/certs/signing_cert.pem -pubkey | \
        certutil -A -d /var/ceph/nss -n signing_cert -t "P,P,P"

  2. 在运行 Ceph 对象网关的节点中安装 Keystone 的 SSL 证书。或者,将可配置的 rgw_keystone_verify_ssl 设置的值设置为 false。

    将 rgw_keystone_verify_ssl 设置为 false 表示网关不会尝试验证证书。

配置 Red Hat Ceph Storage,以使用 OpenStack 的 Keystone 身份验证。

先决条件

  • 一个正在运行的 Red Hat Ceph Storage 集群。
  • 访问 Ceph 软件存储库。
  • 具有生产环境的 admin 特权。

流程

  1. 为每个网关实例执行以下操作:

    1. 将 thenss_db_path 设置设置为 NSS 数据库存储的路径:

      示例

      [ceph: root@host01 /]# ceph config set client.rgw nss_db_path "/var/lib/ceph/radosgw/ceph-rgw.rgw01/nss"

  2. 提供身份验证凭证:

    可以为 OpenStack Identity API 为 keystone 配置 Keystone 服务租户、用户和密码,这与系统管理员倾向于配置 OpenStack 服务的方式类似。提供用户名和密码可避免向 rgw_keystone_admin_token 设置提供共享 secret。

    重要

    红帽建议在生产环境中通过 admin 令牌禁用身份验证。服务租户凭据应当具有 admin 特权。

    所需的配置选项有:

    语法

    ceph config set client.rgw rgw_keystone_verify_ssl TRUE/FALSE
    ceph config set client.rgw rgw_s3_auth_use_keystone TRUE/FALSE
    ceph config set client.rgw rgw_keystone_api_version API_VERSION
    ceph config set client.rgw rgw_keystone_url KEYSTONE_URL:ADMIN_PORT
    ceph config set client.rgw rgw_keystone_accepted_roles ACCEPTED_ROLES_
    ceph config set client.rgw rgw_keystone_accepted_admin_roles ACCEPTED_ADMIN_ROLES
    ceph config set client.rgw rgw_keystone_admin_domain default
    ceph config set client.rgw rgw_keystone_admin_project SERVICE_NAME
    ceph config set client.rgw rgw_keystone_admin_user KEYSTONE_TENANT_USER_NAME
    ceph config set client.rgw rgw_keystone_admin_password KEYSTONE_TENANT_USER_PASSWORD
    ceph config set client.rgw rgw_keystone_implicit_tenants KEYSTONE_IMPLICIT_TENANT_NAME
    ceph config set client.rgw rgw_swift_versioning_enabled TRUE/FALSE
    ceph config set client.rgw rgw_swift_enforce_content_length TRUE/FALSE
    ceph config set client.rgw rgw_swift_account_in_url TRUE/FALSE
    ceph config set client.rgw rgw_trust_forwarded_https TRUE/FALSE
    ceph config set client.rgw rgw_max_attr_name_len MAXIMUM_LENGTH_OF_METADATA_NAMES
    ceph config set client.rgw rgw_max_attrs_num_in_req MAXIMUM_NUMBER_OF_METADATA_ITEMS
    ceph config set client.rgw rgw_max_attr_size MAXIMUM_LENGTH_OF_METADATA_VALUE
    ceph config set client.rgw rgw_keystone_accepted_reader_roles SwiftSystemReader

    示例

    [ceph: root@host01 /]# ceph config set client.rgw rgw_keystone_verify_ssl false
    [ceph: root@host01 /]# ceph config set client.rgw rgw_s3_auth_use_keystone true
    [ceph: root@host01 /]# ceph config set client.rgw rgw_keystone_api_version 3
    [ceph: root@host01 /]# ceph config set client.rgw rgw_keystone_url http://<public Keystone endpoint>:5000/
    [ceph: root@host01 /]# ceph config set client.rgw rgw_keystone_accepted_roles 'member, Member, admin'
    [ceph: root@host01 /]# ceph config set client.rgw rgw_keystone_accepted_admin_roles 'ResellerAdmin, swiftoperator'
    [ceph: root@host01 /]# ceph config set client.rgw rgw_keystone_admin_domain default
    [ceph: root@host01 /]# ceph config set client.rgw rgw_keystone_admin_project service
    [ceph: root@host01 /]# ceph config set client.rgw rgw_keystone_admin_user swift
    [ceph: root@host01 /]# ceph config set client.rgw rgw_keystone_admin_password password
    [ceph: root@host01 /]# ceph config set client.rgw rgw_keystone_implicit_tenants true
    [ceph: root@host01 /]# ceph config set client.rgw rgw_swift_versioning_enabled  true
    [ceph: root@host01 /]# ceph config set client.rgw rgw_swift_enforce_content_length true
    [ceph: root@host01 /]# ceph config set client.rgw rgw_swift_account_in_url true
    [ceph: root@host01 /]# ceph config set client.rgw rgw_trust_forwarded_https true
    [ceph: root@host01 /]# ceph config set client.rgw rgw_max_attr_name_len 128
    [ceph: root@host01 /]# ceph config set client.rgw rgw_max_attrs_num_in_req 90
    [ceph: root@host01 /]# ceph config set client.rgw rgw_max_attr_size  1024
    [ceph: root@host01 /]# ceph config set client.rgw rgw_keystone_accepted_reader_roles SwiftSystemReader

    Ceph 对象网关用户映射到 Keystone 租户。Keystone 用户在 上分配有不同的角色,可能有多个租户。当 Ceph 对象网关获取票据时,它将查看租户,以及分配给该票据的用户角色,并且根据可配置的 rgw_keystone_accepted_roles 接受或拒绝请求。

6.3.8. 重启 Ceph 对象网关守护进程

必须重新启动 Ceph 对象网关才能激活配置更改。

先决条件

  • 一个正在运行的 Red Hat Ceph Storage 集群。
  • 访问 Ceph 软件存储库。
  • 生产环境的 admin特权。

流程

  • 保存 Ceph 配置文件并将其分发到每个 Ceph 节点后,重启 Ceph 对象网关实例:

    注意

    使用 ceph orch ps 命令的输出,在 NAME 列下获取 SERVICE_TYPE。ID 信息。

    1. 在存储集群中的单独节点上重启 Ceph 对象网关:

      语法

      systemctl restart ceph-CLUSTER_ID@SERVICE_TYPE.ID.service

      示例

      [root@host01 ~]# systemctl restart ceph-c4b34c6f-8365-11ba-dc31-529020a7702d@rgw.realm.zone.host01.gwasto.service

    2. 在存储集群的所有节点上重启 Ceph 对象网关:

      语法

      ceph orch restart SERVICE_TYPE

      示例

      [ceph: root@host01 /]# ceph orch restart rgw

Red Hat logoGithubRedditYoutubeTwitter

学习

尝试、购买和销售

社区

關於紅帽

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

让开源更具包容性

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

关于红帽文档

Legal Notice

Theme

© 2026 Red Hat
返回顶部