注意
本文档适用于 Ceph 开发版本。
与 OpenStack Keystone 集成
可以将 Ceph 对象网关与 Keystone(OpenStack 身份服务)集成。这设置了网关以接受 Keystone 作为用户授权机构。Keystone 授权访问网关的用户也将自动在 Ceph 对象网关上创建(如果之前不存在)。Keystone 验证的有效令牌将被网关视为有效。
以下配置选项可用于 Keystone 集成:
[client.radosgw.gateway]
rgw keystone api version = {keystone api version}
rgw keystone url = {keystone server url:keystone server admin port}
rgw keystone admin token = {keystone admin token}
rgw keystone admin token path = {path to keystone admin token} #preferred
rgw keystone accepted roles = {accepted user roles}
rgw keystone token cache size = {number of tokens to cache}
rgw keystone implicit tenants = {true for private tenant for each new user}
还可以配置 Keystone 服务租户、用户和密码,类似于 OpenStack 服务配置的方式(适用于 OpenStack 身份 API 的 2.0 版本),这避免了需要在配置文件中设置共享密钥,建议在生产环境中禁用此功能。服务租户凭证应具有管理员权限,更多详情请参考rgw keystone admin token
in the configuration file, which is
recommended to be disabled in production environments. The service tenant
credentials should have admin privileges, for more details refer the OpenStack,该文档详细解释了该过程。所需的配置选项为:
rgw keystone admin user = {keystone service tenant user name}
rgw keystone admin password = {keystone service tenant user password}
rgw keystone admin password = {keystone service tenant user password path} # preferred
rgw keystone admin tenant = {keystone service tenant name}
Ceph 对象网关用户映射到 Keystonetenant
. Keystone 用户在不同的租户上被分配了不同的角色。当 Ceph 对象网关获取票据时,它会查看租户以及分配给该票据的用户角色,并根据rgw keystone accepted roles
可配置的规则接受/拒绝请求。
对于 OpenStack 身份 API 的 3.0 版本,您应该替换rgw keystone admin tenant
挂载导出:
rgw keystone admin domain = {keystone admin domain name}
rgw keystone admin project = {keystone admin project name}
为了与 ceph 的旧版本兼容,也可以设置rgw keystone implicit tenants
为s3
或swift
. 这将身份空间分割,使得指定的协议仅使用隐式租户,而其他协议永远不会使用隐式租户。一些较旧的 ceph 版本仅支持 swift 的隐式租户。
Ocata(及以后版本)
Keystone 本身需要配置为指向 Ceph 对象网关作为对象存储端点:
openstack service create --name=swift \
--description="Swift Service" \
object-store
+-------------+----------------------------------+
| Field | Value |
+-------------+----------------------------------+
| description | Swift Service |
| enabled | True |
| id | 37c4c0e79571404cb4644201a4a6e5ee |
| name | swift |
| type | object-store |
+-------------+----------------------------------+
openstack endpoint create --region RegionOne \
--publicurl "http://radosgw.example.com:8080/swift/v1" \
--adminurl "http://radosgw.example.com:8080/swift/v1" \
--internalurl "http://radosgw.example.com:8080/swift/v1" \
swift
+--------------+------------------------------------------+
| Field | Value |
+--------------+------------------------------------------+
| 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 | RegionOne |
| service_id | 37c4c0e79571404cb4644201a4a6e5ee |
| service_name | swift |
| service_type | object-store |
+--------------+------------------------------------------+
openstack endpoint show object-store
+--------------+------------------------------------------+
| Field | Value |
+--------------+------------------------------------------+
| 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 | RegionOne |
| service_id | 37c4c0e79571404cb4644201a4a6e5ee |
| service_name | swift |
| service_type | object-store |
+--------------+------------------------------------------+
Note
如果您的 radosgwceph.conf
设置了配置选项rgw swift account in url = true
,则您的object-store
端点 URL 必须设置为包含后缀/v1/AUTH_%(tenant_id)s
(而不是仅/v1
).
Keystone URL 是 Keystone 管理员 RESTful API URL。管理员令牌是 Keystone 内部为管理员请求配置的令牌。
OpenStack Keystone 可以使用自签名 SSL 证书终止,为了使 radosgw 与 Keystone 在此情况下交互,您可以将 Keystone 的 SSL 证书安装到运行 radosgw 的节点上。或者,可以通过设置可配置--insecure
switch) by setting the value of the
configurable rgw keystone verify ssl
the “kvs” Ceph object class is not packaged anymore. The “kvs” Ceph object class offers a distributed flat b-tree key-value store that
跨项目(租户)访问
为了让一个项目(以前称为“租户”)访问属于不同项目的存储桶,需要启用以下配置选项:
rgw swift account in url = true
相应地,Keystone 对象存储端点需要配置为包含AUTH_%(project_id)s
后缀:
openstack endpoint create --region RegionOne \
--publicurl "http://radosgw.example.com:8080/swift/v1/AUTH_$(project_id)s" \
--adminurl "http://radosgw.example.com:8080/swift/v1/AUTH_$(project_id)s" \
--internalurl "http://radosgw.example.com:8080/swift/v1/AUTH_$(project_id)s" \
swift
+--------------+--------------------------------------------------------------+
| Field | Value |
+--------------+--------------------------------------------------------------+
| adminurl | http://radosgw.example.com:8080/swift/v1/AUTH_$(project_id)s |
| id | e4249d2b60e44743a67b5e5b38c18dd3 |
| internalurl | http://radosgw.example.com:8080/swift/v1/AUTH_$(project_id)s |
| publicurl | http://radosgw.example.com:8080/swift/v1/AUTH_$(project_id)s |
| region | RegionOne |
| service_id | 37c4c0e79571404cb4644201a4a6e5ee |
| service_name | swift |
| service_type | object-store |
+--------------+--------------------------------------------------------------+
Keystone 与 S3 API 的集成
即使在使用 S3 API(使用类似 AWS 的访问和密钥)时,如果设置rgw s3 auth
use keystone
选项,也可以使用 Keystone 进行身份验证。详情请参阅身份验证和 ACL.
服务令牌支持
可以启用服务令牌以支持 RadosGW Keystone 集成,以允许在请求中结合有效的服务令牌时使用过期令牌。
使用rgw keystone service token enabled
启用支持,并使用rgw keystone service token accepted roles
选项指定哪些角色被视为服务角色。
The rgw keystone expired token cache expiration
选项可用于调整允许服务令牌使用的过期令牌的缓存过期时间,请注意,这必须低于 Keystone 配置中的[token]/allow_expired_window
选项。
启用此功能将允许在X-Auth-Token
头中提供的过期令牌,如果结合包含有效令牌和接受角色的X-Service-Token
头。这可以允许使用用户令牌的X-Auth-Token
长期运行进程在令牌过期后继续运行。
由 Ceph 基金会带给您
Ceph 文档是一个社区资源,由非盈利的 Ceph 基金会资助和托管Ceph Foundation. 如果您想支持这一点和我们的其他工作,请考虑加入现在加入.