开发者社区> 问答> 正文

如何进行默认实例版镜像安全扫描?

如何进行默认实例版镜像安全扫描?

展开
收起
小天使爱美 2020-03-25 12:15:16 658 0
1 条回答
写回答
取消 提交回答
  • 阿里云权限管理机制包括访问控制(简称 RAM)和安全凭证管理(简称 STS),灵活使用 RAM 和 STS,可以极大地提高管理的灵活性和安全性。本文介绍如何在不同的场景下配置仓库的访问控制。 背景信息

    默认情况下,主帐号对自己的资源拥有完整的操作权限。借助 RAM 和 STS,可以使不同的子账号拥有访问镜像资源的不同权限,同时也支持为用户提供临时的访问授权。在了解如何配置授权策略前,请先详细阅读 RAM 产品文档。 系统策略配置

    AliyunContainerRegistryFullAccess
    
    子用户拥有该授权后,对于镜像资源的权限等同于主账号,可以做任意操作。
    
    {
      "Statement": [
        {
          "Action": "cr:*",
          "Effect": "Allow",
          "Resource": "*"
        }
      ],
      "Version": "1"
    }
    					
    
    AliyunContainerRegistryReadOnlyAccess
    
    子用户拥有该授权后,对于所有镜像资源有只读权限,例如:可以查看仓库列表,Pull 镜像等。
    
    {
      "Statement": [
        {
          "Action": [
            "cr:Get*",
            "cr:List*",
            "cr:PullRepository"
          ],
          "Effect": "Allow",
          "Resource": "*"
        }
      ],
      "Version": "1"
    }
    

    典型场景策略配置

    场景 1
    
    场景描述:授权子账号某个命名空间(例如:juzhong)的读权限。子账号登录 Registry 后 pull 所有该命名空间下的镜像,可以通过OpenAPI 查看到该命名空间的信息及该命名空间下所有镜像仓库的相关信息。
    
    {
      "Statement": [
        {
          "Action": [
            "cr:Get*",
            "cr:List*",
            "cr:PullRepository"
          ],
          "Effect": "Allow",
          "Resource": [
            "acs:cr:*:*:repository/juzhong/*"
          ]
        }
      ],
      "Version": "1"
    }
    					
    
    注意 如果同时需要子账号在控制台查看命名空间,需要进行如下授权。子账号可以看到全量的命名空间及仓库列表,但仅能 Pull 其中juzhong 这个命名空间下的仓库。
    
    {
      "Statement": [
        {
          "Action": [
            "cr:Get*",
            "cr:List*",
            "cr:PullRepository"
          ],
          "Effect": "Allow",
          "Resource": [
            "acs:cr:*:*:repository/juzhong/*"
          ]
        },
        {
          "Action": [
            "cr:ListNamespace",
            "cr:ListRepository"
          ],
          "Effect": "Allow",
          "Resource": [
            "*"
          ]
        }
      ],
      "Version": "1"
    }
    					
    
    场景 2
    
    场景描述:授权子账号某个镜像仓库(例如:镜像仓库名为 nginx,所属命名空间名为 juzhong,所属地域为华东 1)的所有权限。
    注意 如需通过子账号在控制台上管理镜像仓库,依然需要参考场景 1 配置。
    
    {
      "Statement": [
        {
          "Action": [
            "cr:*"
          ],
          "Effect": "Allow",
          "Resource": [
            "acs:cr:cn-hangzhou:*:repository/juzhong/nginx"
          ]
        },
        {
          "Action": [
            "cr:Get*",
            "cr:List*"
          ],
          "Effect": "Allow",
          "Resource": [
            "acs:cr:*:*:repository/juzhong"
          ]
        }
      ],
      "Version": "1"
    }
    

    RAM 说明

    在使用 RAM 对子账号授权时,请特别关注下面的说明,以免您为子账号授予过大的权限。

    如果您通过 RAM 为某一个子账号授予阿里云所有资源的管理权限(即 AdministratorAccess),无论您之前是否为该子账号授予过镜像服务的权限,该子账号都将拥有对镜像服务的全部权限。 镜像服务鉴权规则

    资源描述
    
    在通过RAM进行授权时,资源的描述方式如下表所示:
    资源类型 	授权策略中的资源描述
    repository 	acs:cr:$regionid:$accountid:repository/$namespacename/$repositorynameacs:cr:$regionid:$accountid:repository/$namespacename/*acs:cr:$regionid:$accountid:repository/$namespacename
    
    参数说明如下表所示:
    参数名称 	说明
    $regionid 	地域 ID,可用*代替。
    $accountid 	云账号数字 ID,可用 * 代替。
    $namespacename 	命名空间名称。
    $repositoryname 	镜像仓库名称。
    鉴权规则
    
    子账号或者 STS 方式访问镜像服务 API 时,镜像服务会向 RAM 进行权限检查,以确保调用者拥有相应权限。每个 API 会根据涉及到的资源以及 API 的语义来确定需要检查哪些资源的权限。每个 API 的鉴权规则如下表所示:
    API 	鉴权Action 	鉴权Resource
    创建命名空间 	cr:CreateNamespace 	*
    删除命名空间 	cr:DeleteNamespace 	acs:cr:$regionid:$accountid:repository/$namespacename
    更新命名空间信息 	cr:UpdateNamespace 	acs:cr:$regionid:$accountid:repository/$namespacename
    获取指定命名空间 	cr:GetNamespace 	acs:cr:$regionid:$accountid:repository/$namespacename
    获取命名空间列表 	cr:ListNamespace 	*
    创建仓库 	cr:CreateRepository 	acs:cr:$regionid:$accountid:repository/$namespacename/$repositoryname
    删除仓库 	cr:DeleteRepository 	acs:cr:$regionid:$accountid:repository/$namespacename/$repositoryname
    更新仓库信息 	cr:UpdateRepository 	acs:cr:$regionid:$accountid:repository/$namespacename/$repositoryname
    查询仓库信息 	cr:GetRepository 	acs:cr:$regionid:$accountid:repository/$namespacename/$repositoryname
    查询仓库列表信息 	cr:ListRepository 	*
    根据命名空间查询仓库列表信息 	cr:ListRepository 	*
    查询仓库标签信息 	cr:ListRepositoryTag 	acs:cr:$regionid:$accountid:repository/$namespacename/$repositoryname
    删除镜像版本 	cr:DeleteRepositoryTag 	acs:cr:$regionid:$accountid:repository/$namespacename/$repositoryname
    查询镜像Manifest信息 	cr:GetRepositoryManifest 	acs:cr:$regionid:$accountid:repository/$namespacename/$repositoryname
    查询镜像层信息 	cr:GetRepositoryLayers 	acs:cr:$regionid:$accountid:repository/$namespacename/$repositoryname
    获取临时Token 	cr:GetAuthorizationToken 	*
    Pull镜像 	cr:PullRepository 	acs:cr:$regionid:$accountid:repository/$namespacename/$repositoryname
    Push镜像 	cr:PushRepository 	acs:cr:$regionid:$accountid:repository/$namespacename/$repositoryname
    
    2020-03-25 12:25:59
    赞同 展开评论 打赏
问答分类:
问答地址:
问答排行榜
最热
最新

相关电子书

更多
低代码开发师(初级)实战教程 立即下载
冬季实战营第三期:MySQL数据库进阶实战 立即下载
阿里巴巴DevOps 最佳实践手册 立即下载