【问题标题】:Restrict AWS IOT Device to it's self with policy使用策略将 AWS IOT 设备限制为自身
【发布时间】:2021-02-06 22:20:36
【问题描述】:

希望根据设备用于身份验证的证书将设备限制在 AWS IOT 内的资源(影子)。

Device1 附加到 Cert1 - 我想要一个通用策略,只让 Device1 更新 Device 1 的影子,而不是 Device2

但所有这些都被设备用来进行身份验证的证书触发。

以下政策似乎不起作用 - 有什么帮助吗?

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": "iot:Connect",
      "Resource": "*",
      "Condition": {
        "Bool": {
          "iot:Connection.Thing.IsAttached": [
            "true"
          ]
        }
      }
    },
    {
      "Effect": "Allow",
      "Action": [
        "iot:Publish",
        "iot:Receive"
      ],
      "Resource": [
        "arn:aws:iot:us-east-1:xxxxxx:topic/${iot:Connection.Thing.ThingTypeName}/${iot:Connection.Thing.ThingName}",
        "arn:aws:iot:us-east-1:xxxxxx:topic/${iot:Connection.Thing.ThingTypeName}/${iot:Connection.Thing.ThingName}/*"
      ]
    },
    {
      "Effect": "Allow",
      "Action": [
        "iot:Subscribe"
      ],
      "Resource": [
        "arn:aws:iot:us-east-1:xxxxxx:topicfilter/${iot:Connection.Thing.ThingTypeName}/${iot:Connection.Thing.ThingName}",
        "arn:aws:iot:us-east-1:xxxxxx:topicfilter/${iot:Connection.Thing.ThingTypeName}/${iot:Connection.Thing.ThingName}/*"
      ]
    }
  ]
}

【问题讨论】:

  • 除了问题的标题之外,几乎没有任何关于它如何不起作用的信息。你能详细说明问题吗?
  • 希望根据设备用于身份验证的证书将设备限制为 AWS IOT 内部的资源(影子)。 Device1 已附加到 Cert1 - 希望有一个通用策略,仅让 Device1 更新 Device 1 的影子,而不是 Device2,但所有这些都被触发!

标签: aws-iot


【解决方案1】:

这就是我最终使用的,将设备限制为它自己的资源,并将 ClientID 也作为 AWS Thing 的名称

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": "iot:Connect",
      "Resource": "*",
      "Condition": {
        "Bool": {
          "iot:Connection.Thing.IsAttached": [
            "true"
          ]
        },
        "ForAnyValue:StringEquals": {
          "iot:ClientId": [
            "${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}/*"
    }
  ]
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-02-10
    • 2021-12-25
    • 1970-01-01
    • 1970-01-01
    • 2018-02-27
    • 1970-01-01
    • 1970-01-01
    • 2016-12-02
    相关资源
    最近更新 更多