Nugine / s3s

S3 Service Adapter
Apache License 2.0
129 stars 31 forks source link

Is it possible to add IAM? #154

Closed loverustfs closed 2 weeks ago

loverustfs commented 1 month ago

IAM policies are used in each object store for permission control:

  1. bucket permissions;
  2. replication permissions;
  3. user access rights;
  4. other scenarios .....

There is an existing Rust library for IAM policies: https://crates.io/crates/aws-iam .

Is it possible to integrate IAM policies?

Thank you very much.

loverustfs commented 1 month ago

The s3s only does authentication of the interface's access_key and secret_key (given at service startup).

We thought:

  1. is it possible to add authentication of users, resources, etc. at the entry point of an interface request?
  2. and the source of data needed for authentication can be constrained and obtained through a trait.

s3s只做了接口的access_key和secret_key的验证(服务启动时给定的)。

我们想:

  1. 是不是可以在接口请求的入口处,增加对用户、资源等的认证;
  2. 而认证需要的数据来源可以通过一个trait来约束并获取。
Nugine commented 4 weeks ago

初步判断是可以做,通过添加一个 S3Policy trait,在适当的地方调用其提供的认证方法检测请求。

这个可以由用户实现,也可以集成到 s3s,集成可能更好。s3s 仅负责传入合适的上下文信息,调用认证方法,关于 policy 的后台管理不属于 s3s 的范围。

S3Policy 作为 S3Service 的可选组件,仅当传入 trait 后启用,保持兼容性。

目前还需要调查 minio 的 policy 实现方法,以及 s3s 下游用户是否已有相关实现。如果你们有时间,也可一同调查,加速这个 feature 的落地。


S3Policy 也可合并到 S3Auth 中,减少冗余概念。

Nugine commented 4 weeks ago

https://crates.io/crates/aws-iam 这个 crate 已有两年未更新,若功能不足以实现 demo,后续有可能需要 fork 或与作者沟通。