-
Notifications
You must be signed in to change notification settings - Fork 370
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
Add a credentials store #536
Conversation
FMPOV, the leak issue in #429 consumes all my time I can invest in californium for release 2.0.0. |
I understand. Does it means that I should not even rely on a review from you ? |
Yes, in fact, the plan was to release 2.0.0 next week. |
+1 |
d06d5dd
to
51985c6
Compare
I rebased it on 2.0.x, I will start an experimental branch in leshan to test if this makes the job. |
Signed-off-by: Achim Kraus <achim.kraus@bosch-si.com> also-by: Simon Bernard <sbernard@sierrawireless.com>
51985c6
to
6836709
Compare
6836709
to
ba252e7
Compare
I added support of RPK to Leshan client thx to this PR My first feeling is pretty good. @boaks, I would really appreciate if we could consider to integrate this for the 2.0.0 release. (Not for the 2.0.0-M11 of course) Next step support of x509. |
FMPOV, the reuse of a client-side-connector for multiple destinations, comes with the risk, that it fails, if the servers are potentially co-locate on the same server-side-endpoint. This PR would not change the possibility to do so, it makes it just easier to do and so more probable. Maybe server-co-location is not too much used, but, on the other side, I'm not sure, how many different destinations will be used by one client. If it's only a small number, then there are also alternatives. In a first step, I have reused the DTLS timer to be also the executor, if only 1 thread is used (I will update PR #699 tomorrow). This will lower the resources per DTLS connector. |
I'm sorry :-/ but I can not understand the server-co-location issue ? are you talking about virtualhost(SNI) ? |
Yes, "connecting" to two servers but ends up at the same server-endpoint. Basically this may lead to different issues before, and would fail even earlier. But if it somehow succeeds, then you will not be able to decrypt the messages, if your connected to that endpoint twice. |
If this is the only issue, we could start with a first version of We will be able to add SNI support later, like we did for PSKStore. |
That's a misunderstanding! If that "virtual"/"co-located" stuff is intended to be supported, then this PR will bring not too much benefits at all, but may aggravate the pitfalls.
So, FMPOV, the question is: how many destinations are intended for one client? I think this number is low enough, to go for the save variant of using different client-endpoints for different destinations. And so I would consider to optimize the use of a connectors instead. |
Just to mention, the PSKStore only solves the "realm"! |
Could you explain which problems this will bring exactly ? |
client c-ep1 ---- handshake --> server1 (actually s-ep-common), establish session-1 client c-ep1 ---- request --> server 1 (s-ep-common) now the client doesn't know, which session it has to use to decrypt the response. its identified by the "s-ep-common" but this is the same as for server-2 / session-2. With TLS, this works, because the second handshake will use it's own connection. |
So this is the case where, we are using SNI and, the client tries to talk to 2 different servers behind the same IP/port. I don't know if this is a common use case. So, I think this still makes sense to provide an API like this even if this does not support this very particular use case. This API could also be used to change credentials dynamically without restarted endpoint. By the way, I already tried to implement the "1 endpoint by server" solution a long time ago (eclipse-leshan/leshan#450) and you oriented me towards this kind of solution (eclipse-leshan/leshan#450 (comment)) and now I find this very |
Investigating in issue #677 I got aware, that the "virtual" stuff requires different connections, for both
It will not help for DTLS 1.2, because the server side will not use a cid (page 7, figure 4).
No, but though the "virtual" stuff is included in DTLS (SNI) and in CoAP (URI-HOST), and the real pain is caused by DNS entries to the same host, I think this requires either an explicit exclusion or the "multi connector" approach. But you ask questions without answering my question: I still guess, this are only a few connections. And so my conclusion is: Optimize the use of multiple connectors instead! |
Minimum 1 device management server and probably 1 bootstrap server, I think in real world not so much more (even if the lwm2m spec allow up to 65535 server for 1 client)
I'm not really interested in optimizing resource for now but mainly by implementing RPK, x509 at lwm2m client side (with bootstrap of course). This PR helps to do that in an elegant way with the only pitfall that it does not work for co-located server which sounds to be a really particular use case.
This PR does not prevent all of this. |
Sure, but as I already wrote above: |
Could I join this issue? As the disscusion above all, also I didn't find any clues for recognizing server name on exchanging message after handshaking. First of all, with TLS, this will be work as like @boaks mentioned. Second of all, also I didn't find any clues that the port(endpoint) should be separated when DTLS with SNI extension used. IMHO, the DTLS spec doesn't explain the SNI extension enoughly. Or is there any clues i didn't found? |
Sure, your welcome :-).
That's also, what I ask myself. AFAIK the intention to support SNI was to make the (PSK) credentials tenant aware. But with #677 and URI-HOST option, which also targets the "virtual server", I'm not longer sure, if this limitation to tenants is really good.
The point is: it works, if the client uses different endpoints for different destinations!
Sure, but sometimes it takes longer to get answers. :-). And what's you impression, go for these changes here in this PR and risk, that it fails, if "virtual host" are getting used? |
What I wanted to talk about is that if SNI extension is for both of TLS and DTLS, it also should work as same way on both of it. But actually it does not. On TLS, it can used by single endpoint with multiple virtual server. And on DTLS, it must be separated to different endpoint. This is what I feel weird and want to check to IETF. Also because of it's undefinition of DTLS's RFC docs. |
Am I have a wrong point of view? |
No, that's a misunderstanding! |
FMPOV, it works in the same way, but requires the client to use explicit different endpoints, what is implicit done in the same way for TLS. |
Thank you @boaks. Now I got the point. |
OK, so what should now be the next steps? Write to the IETF core list? Should this PR be reviewed anyway? It doesn't introduce this issue nor does it prevent a solution. But it may aggravate this misuse. So add clear warnings will be one action, which would be required for this PR. |
No, I think this is so far from focus for now.
Yes. I think the first concept(multiple server connections for single endpoint) was wrong point.
I think it's No. And then, what my first focus about this issue was reusing endpoint when the connection has changed to another server. |
This is not exactly true. e.g.
With this configuration a client which are using only one endpoint can talk to "virtual host 2" and "virtual host 3" without any issue using SNI. But it can not talk with "virtual host 1" and "virtual host 2".
This seems to be the only argument against this PR, and it seems to be very light to me. For a lwm2m client (that's my use cases currently), should we support the co-located server ? Generally my feeling is to go with the simple/elegant way which solves the need we have at short or midterm and do not make plans of what would be the needs in a far future. So as this solution is more elegant/simple and is adapted to current use cases, I would rather go with it. But as both of you seems to think that this is not the right way, and as I'm maybe biased by sunk-cost fallacy, I will consider to go back 6 or 7 month in the past and rework on a 1 endpoint by server solution ... @boaks please next time, do not hesitate to share your thought as soon as possible, this time 1 weeks before could make me save several days of work. If any of you change your mind again to not hesitate to share it here. I would be glad to re-switch on 1 endpoint for multiple server. There is really no irony here. |
Exactly.
My point here is, that "share" mostly mean "time consuming discussions", and, though the hono-coap-adapter is behind my timelines, I had to focus on that work. By the way, if your workmates think it's a good solution, I have no general objection, |
To @sbernard31
Actually, I made some private branch of old version leshan(2.0.0-M3). In case of client, i have to make it as possible to connect multiple server, and modified it myself. If this issue is closed in any of way, and multiple registration is possible, I think I can move to latest version. Currently, my private branch shutdown endpoint every time for updating security policy. |
I revive the 1 endpoint by server solution for Leshan, so I think we can close this PR. |
Add a credentials store to be able to change credentials depending on foreign peer.
This PR is not really polished, this is version with minimal changing.
This aims to start more technical discussion about it.