2 Answers
- Newest
- Most votes
- Most comments
1
It turns out that for some reason, If you connect with a "client_id" that is random, you will only get Policies applied, that are directly associated with the certificate you use to connect. So you can use a client_id of whatever you want, in the case where you are directly associating policies.
To take advantage of groups, you MUST use a client_id that exactly matches the thing-name that your cert is associated with.
answered 2 years ago
0
Hi,
did you try to list the effective policies for your thing? This could help to debug this issue.
Did you use a static thing group? Dynamic thing groups to not support attaching policies to the group.
There is a chapter about thing groups in the IoT Device Management workshop which might help.
Cheers,
Philipp
Relevant content
- asked 2 years ago
- asked 3 years ago
- AWS OFFICIALUpdated 6 months ago
interesting. I shall look into those references. but for the record, it is a static group.
erm. also your first link is just to thing groups, it doesnt seem to describe how to "list effective policies for a thing"?
Scroll down in the page to https://docs.aws.amazon.com/iot/latest/developerguide/thing-groups.html#group-get-effective-policies
The docs for get-effective-policies claim that valid arguments for --principal, are cert ARN, or thinggroup arn.
However, when I literally cutnpaste the ARN for my thing group, ithe get-effective-policies call complains, An error occurred (InvalidRequestException) when calling the GetEffectivePolicies operation: The given ARN does not represent a cert
This kinda implies the docs lie, and you cant actually use IoT policies for thing groups?
FYI, I just literally cutnpasted that Workshop code. made the "building_one" related group and policy.
I just added a fuller clause to the policy,
Assigned my test thing to the group. nothing.
waited a bit. still nothing. awscrt.exceptions.AwsCrtError: AWS_ERROR_MQTT_UNEXPECTED_HANGUP: The connection was closed unexpectedly.
Assigned the CERT for my test thing, to the policy. Then my MQTT connections work fine.
Given that the error is, "AwsCrtError".... is there some magic iot lib code where I'm supposed to request access a DIFFERENT way when using inherited group permissions or something?