【发布时间】:2020-04-16 15:49:48
【问题描述】:
我需要创建 AWS 服务控制策略,以限制通过安全组为具有公共访问权限的 ssh 创建入站规则。
我已经尝试过使用下面的 JSON 脚本,但我搞砸了。
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "VisualEditor0",
"Effect": "Deny",
"Action": [
"ec2:RevokeSecurityGroupIngress",
"ec2:AuthorizeSecurityGroupEgress",
"ec2:AuthorizeSecurityGroupIngress",
"ec2:UpdateSecurityGroupRuleDescriptionsEgress",
"ec2:RevokeSecurityGroupEgress",
"ec2:UpdateSecurityGroupRuleDescriptionsIngress"
],
"Resource": "arn:aws:ec2:*:352571213128:security-group/*",
"Condition": {
"ForAnyValue:NotIpAddress": {
"aws:SourceIp": [
"192.0.2.0/24",
"203.0.113.0/24"
]
}
}
}
]
}
仍然可以创建 0.0.0.0/0 的入站规则。 需要:我只需要 ssh 协议。
【问题讨论】:
标签: json amazon-web-services amazon-ec2 aws-security-group aws-policies