配置OpenStack Swift支持Amazon S3 API
首先需要Keystone支持S3格式的证书扩展,EC2的扩展只是能帮助Keystone识别和创建EC2证书,也就是AK和SK。EC2的证书和S3的证书是通用的。
默认的Keystone安装后并不支持S3扩展,需要修改Keystone的PasteDeploy配置文件,在ec2_extension之后加入s3_extension中间件,首先还需要定义该中间件,具体的修改过程为:
在/etc/keystone/keystone.conf文件中增加如下配置:
[filter:s3_extension] paste.filter_factory = keystone.contrib.s3:S3Extension.factory
修改public_api和admin_api的pipline配置,增加s3_extension:
[pipeline:public_api] pipeline = token_auth admin_token_auth xml_body json_body debug ec2_extension s3_extension public_service [pipeline:admin_api] pipeline = token_auth admin_token_auth xml_body json_body debug ec2_extension s3_extension crud_extension admin_service
Swift则需要安装Swift3插件。首先下载该插件:
下载地址:https://github.com/fujita/swift3
修改Swift的proxy-server的配置文件:/etc/swift/proxy-server.conf,新增两个middleware:
[filter:s3token] paste.filter_factory = keystone.middleware.s3_token:filter_factory auth_port = 35357 auth_host = 127.0.0.1 auth_protocol = http
[filter:swift3]
use = egg:swift3#swift3
在pipline中添加这两个Middleware:
[pipeline:main]
# Order of execution of modules defined below
pipeline = catch_errors healthcheck cache swift3 s3token authtoken keystone proxy-server
注意,插件的位置,swift3在s3token之前,s3token在authtoken之前。Swift3 Middleware实现请求逻辑的转换。s3_token是keystone提供给其他应用使用的认证中间件,负责将S3的鉴权信息发给Keystone作认证,返回用户的tenant和token等信息,该token仍然可以再使用authtoken认证,但是这样一个请求就会经过两次认证,与keystone有两次的交互过程,后面再做一次authtoken的认证是多余的,可以将其去掉。
2 条评论
你好,想问一下,适配S3 API的openstack swift只需要改配置就好了吗,还是要执行其他的。我按照文章中步骤一直返回 Permission denied
可能swift的版本已经不一样了吧。我当时是这样能通的。
现在还需要这个来出S3吗?minio会不会更好用呢?