是否可以检查特定的AWS IAM密钥是否具有对一组特定命令的权限?在
本质上,AWS的privacy simulator是否有一个API?在
到目前为止,我一直在使用hacks,比如用不正确的参数执行一个命令,使用有问题的权限,并观察我得到的响应。在
示例:
# needed resource: 'elasticloadbalancer:SetLoadBalancerListenerSSLCertificate'
# Check:
try:
elb.set_listener_SSL_certificate(443, 'fake')
except BotoServerError as e:
if e.error_code == 'AccessDenied':
print ("You don't have access to "
"elasticloadbalancer:SetLoadBalancerListenerSSLCertificate")
这显然是老调重弹。理想情况下,我会有一些函数调用,比如iam.check_against(resource)
或其他什么。有什么建议吗?在
IAM Policy Simulator为确定哪些用户有权访问特定的API调用提供了一个优秀的UI。在
如果您希望以编程方式测试此项,请使用
DryRun
参数进行API调用。该函数不会实际执行,但会通知您它是否有足够的权限执行。但是,它不会检查调用本身是否成功(例如证书名称不正确)。在见第三条simulate_principal_policy。在
我用这个函数来测试权限(您需要稍微修改一下,因为它不是完全自包含的):
您需要将权限的原始操作名传递给
^{pr2}$actions
,如下所示:下面是一个使用
resources
和context
参数的示例:相关问题 更多 >
编程相关推荐