-
Notifications
You must be signed in to change notification settings - Fork 409
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Support of SNI #1447
Comments
@jakubsobolewskisag, I see you request about it at #1386 (comment) Do you have a clear idea about how it should looks like ? (I will be not too much available in May, so don't worry if I didn't answer this month) |
Hi @sbernard31 ! And it seemed to work fine when device connected in regular (no bootstrap) session. Connection worked, SNI name was correctly provided in "serverNames" variable in CertificateProvider. It looked really, really good! However, when I tried to bootstrap with SNI, at some point the SNI information was lost. It started OK, "serverNames" variable was OK, cipher suite negotiation went fine, and at the point where bootstrap server was making "WriteBootstrapRequest", there was an exception because of not matching endpoints/contexts.
After some debugging I think the problem is here: CoapRequestBuilder.java line 353
When destination context is built, the SNI infornation is not there and Californium/Scandium throws exception when we try to send the message because contexts do not match. To support SNI on the server side, we must pass it to the code above so it can properly prepare endpoint context. I think this should solve the issue completely because all the other necessary blocks seem to be in place (i.e. it's possible to set SNI on BootstrapConfig.ServerSecurity). The Leshan Client on the other hand has zero SNI support (from what I've seen in the code) so it would have to be designed. Basically the idea is to:
And that's all I can think of :) Best regards! |
@jakubsobolewskisag thx for this valuable feedback. I will let you know if/when we move forward on this. If you want to help on this, let us know. You could even precise which kind of help you can provide :
@JaroslawLegierski @cyril2maq is it SNI support something that you will need at some point ? |
@sbernard31 We'd love to help. My team agreed that we should contribute as much as possible, so we'd like to work on the code (and test code) starting with server changes. The only problem is that we can't start right away because of other obligations, but I think we could start at the end of June. If it's OK with you of course :) |
@jakubsobolewskisag that sounds good. I think we can first focus on bootstrap server issue you report above. |
@sbernard31 I agree - that's a good place to start. |
I was taking a look at LWM2M-v1.1.1@transport about SNI and I understand there are 2 SNI usage described :
I'm curious which one of them are you using ? 🙂 |
@sbernard31 actually both :) |
Thx. Just to let you l know, I started to write some code but for now this is just to experiment a bit.
That seemed like a good idea but I haven't any client to be able to test that, so I started to work on client side 😅 Anyway about LWM2M-v1.1.1@core§Table: E.1-2 LwM2M Object: LWM2M Security Resource definitions :
I'm not sure to understand the last part about PSK identity ? do you have any idea ? |
Oh wow... I missed that! Until now I was sure that SNI is only used with X.509 authentication. I have to dig deeper to understand what it means for PSK... Thank you! |
Until the OMA says something, I'd assume that the SNI resource doesn't have a meaning for NO_SEC and PSK. |
I guess this could be eventually used as a hint for a server to know which PSK key to use for a given PSK Identity ? But I find it hard to understand why the specification would refer to server behavior in a client object resource 🤔. So this is probably not what the authors intended to express. But I agree waiting answer, let's focus on X509 (and maybe RPK too) |
I looked at SNI support a bit deeper and I try to summarize my current understanding : At LWM2M client side We need to support
At LWM2M Server and Bootstrap server side For "usage about client connecting server using IP literal" (e.g. Deployments without DNS ), the server just need to add For "multiple virtual servers using a single underlying network address", It's not so clear what is expected at Leshan Server. @jakubsobolewskisag @sag-eweingaertner, let me know if you understand SNI support in a same way ? and if there is some point described above that you don't really need ? Maybe you could describe more precisely "your multiple virtual servers" use case ? (this will maybe help me to better understand how Leshan should be modified) |
@sbernard31 our main goal is to make X.509 work with SNI. To my understanding, SNI is provided by the client when it establishes connection with the server. It's a hint for the server that client expects specific server name (CN) in X.509 certificate. org.eclipse.californium.scandium.dtls.x509.CertificateProvider method: CertificateIdentityResult requestCertificateIdentity(ConnectionId cid, boolean client, List issuers, SNI is provided in "serverNames" variable and this part is working fine right now. We can write our own CertificateProvider and based on "serverNames" we can select one of configured certificates. When I tested this with a client that supports SNI, regular server connection worked like a charm. The only problem I had was when I tried to bootstrap with SNI (see my first comment). Most probably what we need to do is to fix "endpoint context" and like you said - add ServerName extension in SERVER_HELLO. |
Noted
Not really a Leshan API, but maybe we don't need Leshan abstraction for that in a first time. 🤔
That sounds strange to me 🤔 |
Just to let you know that I didn't succeed to reproduce the Do you succeed to bootstrap using same Certificate without SNI ? On my side, I will try to implement a cleaner minimal version for the client, then write some unit tests, then share this code. |
@sbernard31 actually I was testing with M7 Server version. I will update and test again with the latest main branch. Maybe the problem is somewhere on our side. I will let you know the results. |
I created a new PR about SNI support. See : #1466
On my side, I still can't reproduce the problem |
Just in case, you are using M7 in production environment, I let you know that it is affected by some californium security issue. See https://github.com/eclipse-leshan/leshan/security/policy#versions-security-state So it would be better to upgrade to a safe version, e.g 2.0.0-M10 or 2.0.0-M11 after reading all information about it. |
@jakubsobolewskisag do you find time to look at #1466 ? |
@sbernard31 I looked at the code changes you've made and it looks cool! I just need some time to test them on our environment (unfortunately it's not that easy since we have some custom stuff on top of older Leshan version so upgrading will take some time). I'll let you know as soon as I'll do it. Thank you! |
@jakubsobolewskisag, I integrated 3 first commits of PR #1466 which was not related to SNI in As soon as I get your green light, I will integrate the rest of the PR in |
I would like to integrate #1466 in few days/weeks. If you think you will be able to test it before I can wait a little bit, so let me know. |
@jakubsobolewskisag any news/feedback about that ? |
SNI support is currently not planed at short / mid term but this issue aims to discuss about it.
The text was updated successfully, but these errors were encountered: