-
Notifications
You must be signed in to change notification settings - Fork 137
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[#2825] Make use of auth-id template to get credentials #2968
[#2825] Make use of auth-id template to get credentials #2968
Conversation
Signed-off-by: Kartheeswaran Kalidass <[email protected]>
@kaniyan I agree that we need to consider how to deal with changing templates. However, I am not sure if the change you propose will work for the original use case that we had in mind, i.e. resilience against an updated client certificate that contains a changed subject DN. My understanding is that when a device tries to authenticate using a client certificate we
So, if the client certificate's subject DN changes over time, we would no longer be able to find the credentials if we kept the original subject DN as the auth-id on record, would we? |
The auth-id is generated by applying the auth-id template to the subject DN. Hence the generated auth-id (placeholders part) is always subset of the original subject DN. Hence it doesn't matter if we store the subject DN or the generated auth-id. We need to slightly change the logic of how we find the credentials as in the draft (
|
...ce-registry-base/src/main/java/org/eclipse/hono/deviceregistry/util/DeviceRegistryUtils.java
Outdated
Show resolved
Hide resolved
...ce-registry-base/src/main/java/org/eclipse/hono/deviceregistry/util/DeviceRegistryUtils.java
Outdated
Show resolved
Hide resolved
Signed-off-by: Kartheeswaran Kalidass <[email protected]>
299d82c
to
5b11c3e
Compare
How do we do that if we do not have the device ID? |
Yes you are right that we don't have device-id to filter all the credentials belonging to a particular device. My bad that I assumed it is there. The other way would be to compare the template placeholders value with that of the subject DN stored in the auth-id to filter credentials. It is relatively easier to implement in MongoDb registry. Whereas in case of JDBC the queries are already defined statically in a file and not that easy to frame dynamic queries with the current setup. Also we cannot ensure that all JDBC databases support such features or easier to implement. Such pattern searching can impact the performance of the query thereby the authentication time of devices might increase (if not cached). I don't see any other way to overcome template modifications. It seems to me that we go back to our first approach with the constraint that it is not resilient to template modifications. |
Can you elaborate how this is supposed to work? Maybe you can use an example client cert and an example auth-id template to illustrate your idea? |
Let us assume that the template is MongoDB example: Postgres example: |
Even the first approach cannot be implemented as it is, which is computing the auth-id by applying template and store them. If the update credentials request has certificate, we can retrieve the issuer DN to find the corresponding template. If the request has only subject DN then we cannot retrieve the template as the issuer DN is not available. We need to extend the credential management spec additionally to provide issuer DN too. Else the user should provide the final auth-id to be used for authentication and the device registry won't generate auth-id based on the defined template. |
In your example, what do we store as the auth-id property's value in the credentials? The client certificate's unaltered subject DN or the result of applying the auth-id template to the client certificate's subject DN? |
We store the client certificate's unaltered subject DN as the auth-id property's value. |
@sophokles73 WDYT? |
I am in favor of the former option, i.e. adding an optional issuer-dn. With the latter option, I am 100% sure that users will not be able to produce the correct auth-id based on the template. |
Closed in favor of #2985. |
While working on extending Credentials Management implementations to generate auth-id (if auth-id template is available) from subject DN and store it, I came across a severe drawback in that approach. What if the auth-id template has been changed after device/credentials registration or removed? In that case, with the current approach, we won't get any credentials as no auth-id will match. To overcome this, I believe that we should always store the subject DN as the auth-id as we did before. During get credentials operation, we can apply the auth-id template to the subject DN and then filter based on the template. This approach is resilient to such auth-id template modifications.
@sophokles73 WDYT?