AWS IOT - 建立设备所有权和防止未经授权访问的最佳方式是什么

AWS IOT - What is the best way to establish device ownership and prevent unauthorized access

在 AWS IOT 中,我没有看到任何在线解释来描述确保发布包含敏感数据的主题的设备只能由设备所有者访问的最佳方法。

例如,Bob 登录他的智能手机应用程序并使用 Cognito 进行身份验证。已经有一个关于允许访问 AWS IOT 的身份池身份验证角色的策略,并且管理 lambda 在注册期间调用了 AttachPrincipalPolicy 并授予 Bob 访问 AWS IOT 的权限。

Bob 拥有一台名为“恒温器”的设备,上面安装了 x509 证书,用于通过 AWS IOT 进行身份验证。它正在发布 /thermostat/123/temperature/75(序列号:123,温度:75)等主题,Bob 在他的智能手机上订阅了相同的主题 (/thermostat/123/temperature/*)

我们如何防止另一位用户 Jill 订阅 /thermostat/123/temperature/* 并读取 Bob 的私人数据?她的恒温器已完成相同的设置,这使她可以访问 AWS IOT? =10=]

我猜这与序列号有关,但在那种情况下,您如何将 Bob 的身份 ID 与设备的序列号相关联?当用户和设备使用完全不同的身份验证机制(Cognito 和 X509)时,关联用户和设备的最佳方式是什么?

but in that case how do you associate Bob's identity ID with the device's serial number?

ThingAttributes 可以存储简单的设备所有者关系。将 ownerID 属性添加到您的设备 Things。或者使用外部存储来处理更复杂的场景。

AWS 在其 MQTT Topic Design doc to "Include any relevant routing information in the MQTT topic". Topic patterns such as jill/thermostat/123/temperature/* might be useful if you have single, stable owners. A thing policy variable {iot:Connection.Thing.Attributes[ownerID]}in the IoT Core Policy 中建议可以使这些动态化。

Cognito auth: How do we prevent another user, Jill ... reading Bob's private data?

当 Jill 使用 Amazon Cognito 身份向 IoT Core 进行身份验证时,您的客户端代码或 lambda 可以生成用户特定的 IoT Core 策略以附加到 Jill 的用户身份 as part of the auth flow。将写入策略以仅允许 Jill 访问她的设备。