如果系统权限策略不能满足您的要求,您可以创建自定义权限策略实现最小授权。使用自定义权限策略有助于实现权限的精细化管控,是提升资源访问安全的有效手段。本文介绍云监控使用自定义权限策略的场景和策略示例。
什么是自定义权限策略
在基于RAM的访问控制体系中,自定义权限策略是指在系统权限策略之外,您可以自主创建、更新和删除的权限策略。自定义权限策略的版本更新需由您来维护。
创建自定义权限策略后,需为RAM用户、用户组或RAM角色绑定权限策略,这些RAM身份才能获得权限策略中指定的访问权限。
已创建的权限策略支持删除,但删除前需确保该策略未被引用。如果该权限策略已被引用,您需要在该权限策略的引用记录中移除授权。
自定义权限策略支持版本控制,您可以按照RAM规定的版本管理机制来管理您创建的自定义权限策略版本。
操作文档
常见自定义权限策略场景及示例
授予RAM用户云监控2.0服务模块的读写权限,示例如下所示:
读权限
{
"Version": "1",
"Statement": [
{
"Effect": "Allow",
"Action": [
"cms:Get*",
"cms:List*"
],
"Resource": [
"acs:cms:*:*:workspace/*",
"acs:cms:*:*:contactgroup/*",
"acs:cms:*:*:alertEventIntegrationPolicy/*",
"acs:cms:*:*:workspace/*/entitystore",
"acs:cms:*:*:cloudresource",
"acs:cms:*:*:workspace/*/umodel",
"acs:cms:*:*:ruminstance/*",
"acs:cms:*:*:cmsservice/*",
"acs:cms:*:*:alerthistory/*",
"acs:cms:*:*:prometheusview/*",
"acs:cms:*:*:contact/*",
"acs:cms:*:*:alertNotifyTemplate/*",
"acs:cms:*:*:alertruletemplate/*",
"acs:cms:*:*:alertmetricgroup/*",
"acs:cms:*:*:alertaction/*",
"acs:cms:*:*:webhook/*",
"acs:cms:*:*:oncallschedule/*",
"acs:cms:*:*:alertrule/*",
"acs:cms:*:*:alertmetric/*",
"acs:cms:*:*:subscription/*",
"acs:cms:*:*:prometheusinstance/*",
"acs:cms:*:*:biztrace/*",
"acs:cms:*:*:maintainWindow/*",
"acs:cms:*:*:integrationpolicy/*/addonrelease/*",
"acs:cms:*:*:prometheusinstance/*",
"acs:cms:*:*:notifyStrategy/*",
"acs:cms:*:*:entitygroup/*",
"acs:cms:*:*:integrationpolicy/*",
"acs:cms:*:*:robot/*",
"acs:cms:*:*:transformer/*"
]
},
{
"Effect": "Allow",
"Action": [
"cms:GetAddonMetrics",
"cms:GetAddonCodeTemplate",
"cms:ListAddons",
"cms:GetAddonAlertTemplates",
"cms:GetAddonSchema",
"cms:GetAddon",
"cms:ListEventLabelCacheKeys",
"cms:ListEventLabelCacheValues",
"cms:DescribeMetricDataForAlertPreview",
"cms:CheckDispatchRole",
"cms:GetPrometheusUserSetting"
],
"Resource": [
"*"
]
},
{
"Action": [
"arms:DoInsightsAction",
"arms:Describe*",
"arms:List*",
"arms:Get*",
"arms:Search*",
"arms:Check*",
"arms:Query*",
"xtrace:Read*",
"xtrace:Get*",
"xtrace:Describe*"
],
"Resource": "*",
"Effect": "Allow"
},
{
"Action": [
"log:Get*",
"log:List*",
"log:Query*"
],
"Resource": "*",
"Effect": "Allow"
}
]
}
写权限
{
"Version": "1",
"Statement": [
{
"Action": "ram:CreateServiceLinkedRole",
"Resource": "*",
"Effect": "Allow",
"Condition": {
"StringEquals": {
"ram:ServiceName": "cloudmonitor.aliyuncs.com"
}
}
},
{
"Action": "cms:*",
"Resource": "*",
"Effect": "Allow"
},,
{
"Action": "arms:*",
"Resource": "*",
"Effect": "Allow"
},
{
"Action": "log:*",
"Resource": "*",
"Effect": "Allow"
}
]
}
该文章对您有帮助吗?