VPC终端节点策略
SWR企业版的上传下载镜像都是通过VPC终端节点通道的,VPC终端节点支持配置策略,可以配置策略管控镜像的上传或者下载。创建VPC终端节点步骤请参见通过VPCEP方式访问SWR。具体配置步骤请参见管理终端节点的策略。
配置示例1:配置VPC终端节点策略,只允许上传下载指定的镜像。
下面策略的含义:VPC1内的服务器只能上传下载企业仓库实例test-swr,命名空间为test-namespace下的镜像。
{
  "Version": "5.0",
  "Statement": [
    {
      "Action": [
        "swr:repository:uploadArtifact",
        "swr:repository:downloadArtifact"
      ],
      "Resource": [
        "swr:*:*:repository:test-swr/test-namespace/*"
      ],
      "Effect": "Allow",
      "Principal": "*"
    }
  ]
}
 配置示例2:配置VPC终端节点策略,只允许下载指定的私有镜像,可以下载所有的公开镜像。
下面策略的含义:VPC1内的服务器只能下载企业仓库实例test-swr,命名空间为test-namespace下的镜像,公开镜像不受此限制。
{
  "Version": "5.0",
  "Statement": [
    {
      "Action": [
        "swr:repository:downloadArtifact"
      ],
      "Resource": [
        "swr:*:*:repository:test-swr/test-namespace/*"
      ],
      "Effect": "Allow",
      "Principal": "*"
    },
    {
      "Action": [
        "swr:repository:downloadArtifact"
      ],
      "Resource": [
        "*"
      ],
      "Effect": "Allow",
      "Principal": "*",
      "Condition": {
        "Bool": {
          "swr:RepositoryIsPublic": [
            "true"
          ]
        }
      }
    }
  ]
}
 
  