aws-iot - AWS IOT 策略 - 仅限于指定的 ClientID
问题描述
我在下面创建了以下策略,以限制 MQTT 客户端允许的 ClientID 连接。它应该限制为一个硬编码的 ClientID“测试”和一个作为 AWS 事物名称的 CLientID。使用 AWS Thing 的名称有效,但我的硬编码“测试”ClientId 不起作用?
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": "iot:Connect",
"Resource": "*",
"Condition": {
"Bool": {
"iot:Connection.Thing.IsAttached": [
"true"
]
},
"ForAnyValue:StringEquals": {
"iot:ClientId": [
"test",
"${iot:Connection.Thing.ThingName}"
]
}
}
},
{
"Effect": "Allow",
"Action": "iot:Publish",
"Resource": "arn:aws:iot:us-east-1:xxx:topic/$aws/things/${iot:Connection.Thing.ThingName}/*"
},
{
"Effect": "Allow",
"Action": "iot:Subscribe",
"Resource": "arn:aws:iot:us-east-1:xxx:topicfilter/$aws/things/${iot:Connection.Thing.ThingName}/*"
},
{
"Effect": "Allow",
"Action": "iot:Receive",
"Resource": "arn:aws:iot:us-east-1:xxx:topic/$aws/things/${iot:Connection.Thing.ThingName}/*"
}
]
}
解决方案
既然你有这个"iot:Connection.Thing.IsAttached": ["true"]
集合,我相信一个名为 的事物test
需要在事物注册表中注册,并附有主体。
推荐阅读
- azure - azurewebsites.net 内置证书
- sql - SQL - 我想不出任何方法来做到这一点,我已经完成了所有的研究?
- ms-access - MS ACCESS 指定字段 [XXXXX} 可以引用 FROM 中列出的多个表
- regex - Perl regex splitting a single line
- asp.net-core - 为什么与结构的模型绑定不起作用?
- css - 如何在 React Native 中使用百分比填充顶部和底部?
- php - 如何要求身份验证才能访问网络服务器(运行 Nginx)上的文件?
- swift - ScrollView 约束问题抛出情节提要
- c - 二维数组解释
- sql-server - 将列从 1 个表添加到另一个