控制资源的访问权限

这是一个最好的时代,也是一个最焦虑的时代,如果你停滞不前,时代抛弃你的时候,连一句再见都不会说。

What

Identity & Access Mangement, 身份验证以及访问控制,一种对资源提供可控安全的访问解决方案。 用来控制对 AWS 资源的访问权限,把资源 (Resouuce) 上的操作 (Action) 授权给谁 (identity)

IAM: https://docs.aws.amazon.com/zh_cn/IAM/latest/UserGuide/intro-structure.html

图中三种 Authorization,看完这个链接,不止 three type :

  • Identity-based polices To provide your users with permission to access the AWS resource in their own account
    • Managed policy (托管策略)
      • AWS Managed policy,
      • Customer managed policy,
    • inline policy(内联策略): embedded in an IAM identity(a user, group, or role)
  • Resource-based polices Popular for granting cross-account access, Resource-based policies are inline only, not managed
  • Other polices Should be used carefully

Q: 这三种跟 Policy 的三种类型有什么区别? A: 下面三种隶属于 Identity-based policy, 详细见:Identity-Based Policies

How

  • 如何优雅的定义 Resource
  • 如何优雅的定义 Action
  • Identity
  • Policy

Resource

AWS 给出的答案是: ARN(AWS Resource Namespace), ARN 是一个命名规则,用于无歧义的对 AWS 的资源进行命名。

AWS 针对调用 API 的许可控制。 对 API 许可的资源格式定义非常全面,值得借鉴

Identity

User, Group, Roles

Action

Action 也就是针对 AWS 上的服务提供的 API。 Condition Context Keys,是 AWS IAM 中支持的一个功能。即在定义 Policy 时可以使用一些变量,支持复杂的表达式。

Policy TODO

Policies Type, 详细描述有哪些 Policy 种类,几乎覆盖大部分的场景

  • Identity-based policies
  • Resource-based policies
  • Permissions boundaries
  • Organizations SCPS
  • Accss control lists(ACLs)
  • Session Policies

用来描述授权策略的一种描述语言,用于描述谁在 xx 条件下对 xx 资源具有 xx 操作。 组成如下:

一个 identity 所有的多个 Policy 会发生冲突,IAM 采用的策略可以概括为 8 个字: ~凡事声明, 一票否决~

  • 凡事声明: 默认情况下, Resource 是禁止访问的,只有显式声明了对资源的 Allow 权限,才允许访问。
  • 一票否决: 即便是有 Policy 开启了 Allow, 一旦其他的 Policy 中出现对 Resource 的 Deny 声明,一律 Deny

Open Policy Agent

入门: Open Policy Agent:简化了微服务授权

  • OPA定义一套DSL语言rego,
  • 上文中提到微服务架构下借助nginx实现权限控制的一种方式

OPA 入门系列

中文资料

IAM 实践 TODO

AWS IAM is supporting a role-based access control(RBAC), paradigm by defining permissions within policies and attaching those to applicable principlas(IAM users and roles)

besides supporting both identity- and resource- based policies, IAM has alway supported aspects of attribute-based access control(ABAC) via the optional condition policy element and “expressions in which you use condition operators(equal, less than, etc.) to match the condition in the policy against values in the request”, such as IP address or time of day.

furthermore it has supported authorization based on tags.

Implement TODO

怎么实现这个系统,以及各个系统怎么接入 当我继续深入了解IAM,接触到一个全新的概念零安全架构,来源于 Google Enterprise Security BeyondCorp: a new approach to enterprise security, 同时同行也在实践这个方案,比如中通安全 中通下一步的 IAM 架构设计, 接下来需要充分对这个架构的理解。

各个系统依赖于这个 IAM 权限控制系统,要实现的话两步走:

  • 怎么实现这个系统
    • 基于 hydra 来实现 OAuth2.0 和 OIDC
    • 基于 keto,参考实现权限系统
  • 各个系统怎么接入

所有服务以一种语言实现, IAM 的功能作为 SDK 的方式集成在服务之中,SDK 依赖弹性伸缩的数据服务,辅以上层负载均衡依照 AK 将请求路由到不同的分区,以期保证性能的同时,达到更高的灵活度。

hydra

拉取hydra代码, 本地启动服务:

docker-compose -f quickstart.yml -f quickstart-postgres.yml up --build

TODO

参考

AWS IAM 从入门再到入门 提到一些有用的工具

IAM 身份验证以及访问控制 提到临时访问凭证的方案。

阿里云 RAM 策略整理 对 Policy 详细的讲解。对于“RAM 角色身份的授权策策略检查逻辑” 最后两步不是很理解。为什么“检查 RAM 角色所属的主账号是否有授权”, 以及检查“该资源是否支持跨账号 ACL 许可” ?

阿里云 访问控制 pdf 文件 产品简介,了解 RAM-User 和 RAM-Role 的定义。

Restful Api 的访问控制方式

当前国内外云计算平台的访问控制机制分析 图挂了。

零信任的 5W1H 解释什么是零信任。回答了这个概念。

Amazon Cognito allow secure authentication in a world where mobile apps are regularly being accessed by individuals using multiple smart devices 资源怎么被 APP 使用。

贝壳找房权限服务的探索和实践 贝壳找房权限服务的实践分享

AWS Identity and Access Management Gains Tags and Attribute-Based Access Control 2019.2.8 IAM 这一发布表示 Support the ability to embrace attribue-based access control (ABAC) and match aws resources with IAM principals dynamically to “simplify permissions management at scale”

Takahiko Kawasaki Co-founder and representative director of Authlete, Inc., working as a software engineer since 1997. 图做的非常清晰.


·End·
最后修改 January 18, 2021 : fix only one h1 in page (76541b8)