8000 Roadmap to EST support · Issue #859 · eclipse-leshan/leshan · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Roadmap to EST support #859

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

Closed
dachaac opened this issue Jul 8, 2020 · 38 comments
Closed

Roadmap to EST support #859

dachaac opened this issue Jul 8, 2020 · 38 comments
Labels
bsserver Impact LWM2M bootstrap server client Impact LWM2M client new feature New feature from LWM2M specification

Comments

@dachaac
Copy link
Contributor
dachaac commented Jul 8, 2020

EST support is partly supported already in LWM2M specification 1.0.2 but is further improved in LWM2M specification 1.1.(1).

I have started writing wiki page with a bit more details in here:
https://github.com/dachaac/leshan/wiki/Improving-support-for-LWM2M-with-Certificates

Will try to make as small changes as possible as PRs to make integration work easier and also to get earlier feedback from other developers.

Will try to tag all related PRs with this ticket.

I believe the goal is achieved when the EST functionality is matching the latest released LWM2M specification (1.1.1 at the moment).

@sbernard31
Copy link
Contributor

Very interesting wiki page.
@msangoi you could be interested by this as you worked on EST by the past.

Will try to make as small changes as possible as PRs to make integration work easier and also to get earlier feedback from other developers.
Will try to tag all related PRs with this ticket.

👍

@sbernard31 sbernard31 added this to the 2.0.0 milestone Jul 8, 2020
@dachaac
Copy link
Contributor Author
dachaac commented Aug 19, 2020

@sbernard31 I am currently modifying the web user interface for bootstrap server.

When I click on "Add new client bootstrap configuration" it displays a configuration.

Let's assume we have a device with device certificate which is connecting (before auto registration support is ready) I was thinking I would do following:

  • Fill in "client endpoint" field
  • Select "LWM2M Bootstrap Server" tab
  • Observation: Don't really understand why there is LWM2M Server URL in here. Can this be removed?
  • For certificate auth -- I would select Security Mode: X.509 Certificate
  • Now we get fields: Client Certificate and Client Private key
    • don't really understand why we have private key in here -- should really be removed.
  • Now I can just copy client certificate here -- but the whole benefit with certificates is that you only need to care with CA certificates in configurations -- so should this be Client Certificate or Client Root CA Certificate? Or even empty and configure Client Root CA thru trust store?
  • Observation: We have Server Certificate here as read only field -- can we remove this as one cannot really use the HEX value for anything in here?
  • Then to configure LWM2M Server details for client I would go for "LWM2M Server" tab.
  • I would fill in LWM2M Server URL setting
  • I would select Security Mode as "X.509 Certificate with EST"
  • Then in Server Certificate field I would paste the Server Certificate (or with upcoming Certificate Usage field having other value than default 3 the CA certificate)

Now related question:

  • Is it OK to add support to paste certificates as PEM to user interface? Playing with DER encoding and then HEX versions of those is cumbersome. If one loads PEM it can be easily converted to DER (with Certificate.getEncoded()). Actually you already support loading of PEM if you just let it thru :).

@sbernard31
Copy link
Contributor

The LWM2M bootstrap server is just a demo and is clearly not perfect. I think it should not really aims to be like a production ready server but maybe more a way to discover LWM2M, Leshan and its API but also to do quick interoperability tests.

About some question about the "LWM2M Bootstrap Server" tab :
I think most of them come from that ConfigStore and SecurityStore information are mixed. see for more details : #690 (comment)

The read only field and private key value are here because this is the BootstrapConfig to write.

Now I can just copy client certificate here -- but the whole benefit with certificates is that you only need to care with CA certificates in configurations -- so should this be Client Certificate or Client Root CA Certificate? Or even empty and configure Client Root CA thru trust store?

This is the client certificate we will write in security object.

My understanding :

  • Your main issue here is about you don't want to write bootstrap config but just want to configure security info needed to authenticate to bootstrap server.
    => IMHO the right way should be to refactor bootstrap server to clearly separate those 2 concepts.
    => In a perfect world the UI to add the bootstrapConfig should be totally different as you should be able to write any kind of object (not only server and security). (see "BootstrapConfig" should be a list of request #437)

I'm not sure you will like this answer 😬


About PEM support, I don't know. Dp you want to support both format in demos or replace DER by PEM ?
DER was chosen to be nearer from the format used by LWM2M.
I'm afraid that adding one more format could be confusing (E.g. in REST API we also use DER : #404)

If we decide to add it, this should be done in a consistent way :


All of this make me think that maybe we are not really ready to put EST now. 🤔
We should maybe first try to have a good support of x509 by addressing some Certificate Usage one by one ?

@dachaac
Copy link
Contributor Author
dachaac commented Aug 20, 2020

About Certificate Usage support:

I believe I have it implemented in here:
https://github.com/dachaac/leshan/commits/improve-certificate-support

  • dachaac@625773c - CertificateUsage: Add CertificateUsage type and support to configure it.
  • dachaac@dc48402 - CertificateUsage: Add CertificateUsage support
  • dachaac@d08dec5 - CaliforniumEndpointsManager: Add support to verify server identity in certificate verifier.

And you actually need some other changes in the branch there to actually too.

I am happy to make PR from that branch but I am wondering should it be split a bit first? And you probably want more testing ;)

@dachaac
Copy link
Contributor Author
dachaac commented Aug 20, 2020

About PEM support, I don't know. Dp you want to support both format in demos or replace DER by PEM ?
DER was chosen to be nearer from the format used by LWM2M.
I'm afraid that adding one more format could be confusing (E.g. in REST API we also use DER : #404)

If w 8000 e decide to add it, this should be done in a consistent way :

You actually support PEM format already -- just may have not noticed it -- code transparently parses both PEM and DER.

DER format has a limitation that it does not support one to carry certificate chain where as PEM format has agreement that you can put multiple PEM blocks in sequence to specify certificate chain. Even this is supported out-of-the-box but it just needs to be taken in use which is also supported in:
https://github.com/dachaac/leshan/commits/improve-certificate-support

I am happy to support both DER and PEM. But in order to define chain you commonly just use PEM format and usually just copy'n'paste it either to the field or to the file. Another common way to do it in Java application is to utilize Java/pkcs12 key/truststore. I have support for Java trust store in Californium way in that branch.

So my question is it OK to support both DER (as hex) and PEM in demo application web user interfaces.

Tools will be synchronized for same functionality as I have done already for other improvements in that branch.

I also have some code for use Java keystore (utilizing californium) to provide private key and certificate and its chain -- but that is not in the branch as I was not sure this was something that you wanted or not -- but I can bring that support also back.

What is good in here that internally the code is using X509Certificate class which abstract way how the certificate was loaded. And you can convert that to DER byte code or to PEM.

Only "ugly" thing I had to do is that when one configures certificate chain from command line (or gets it from EST) it stores it in Security object as PEM string (instead of DER byte array). What is good in here that it handles transparently both cases so not a big deal. LWM2M only uses DER to carry it within security object so it is currently limited to only one level CA setup. Only with EST one can carry whole chain. Probably something that should be improved in LWM2M protocol itself.

@dachaac
Copy link
Contributor Author
dachaac commented Aug 20, 2020

The LWM2M bootstrap server is just a demo and is clearly not perfect. I think it should not really aims to be like a production ready server but maybe more a way to discover LWM2M, Leshan and its API but also to do quick interoperability tests.

About some question about the "LWM2M Bootstrap Server" tab :
I think most of them come from that ConfigStore and SecurityStore information are mixed. see for more details : #690 (comment)

The read only field and private key value are here because this is the BootstrapConfig to write.

Now I can just copy client certificate here -- but the whole benefit with certificates is that you only need to care with CA certificates in configurations -- so should this be Client Certificate or Client Root CA Certificate? Or even empty and configure Client Root CA thru trust store?

This is the client certificate we will write in security object.

Isn't that in the LWM2M Server tab as that also contains the server to write?

My understanding :

  • Your main issue here is about you don't want to write bootstrap config but just want to configure security info needed to authenticate to bootstrap server.
    => IMHO the right way should be to refactor bootstrap server to clearly separate those 2 concepts.
    => In a perfect world the UI to add the bootstrapConfig should be totally different as you should be able to write any kind of object (not only server and security). (see "BootstrapConfig" should be a list of request #437)

I'm not sure you will like this answer 😬

No I want to write both configs :)

How I understand is that bootstrap config tab defines how one identifies the connecting client. Then the server tab specifies contents for the security object to be written into the client.

But as an example if you configure authentication with X.509 certificate -- bootstrap server shouldn't have a need to have client's private key at all and now this field is mandatory in UI. I don't see a way in client demo to have access to store to fetch it either (and I don't think that is probably even a good idea).

I believe the private key in bootstrap configuration in X.509 certificate authentication should be removed so that people don't get confused about it and in reality one shouldn't even have a means the get it from device. (In server tab it should be kept when client is configured with X.509 security config with bootstrap writes)

I can improve the situation -- I anyway need to modify it to support for EST which I have started in this branch (expect that branch to be windy):
https://github.com/dachaac/leshan/commits/est-support

@sbernard31
Copy link
Contributor

Here some quick answers, but I think we should not focus on this.

About PEM, we could add it later (storing PEM in security object sounds really out of the spec and asI first sight I don't really like the idea but maybe this would be another case where we need to not respect the standard to make it works in the real life ... 😞 )

About bootstrap config,

How I understand is that bootstrap config tab defines how one identifies the connecting client. Then the server tab specifies contents for the security object to be written into the client.

=> this is not the idea of current bs server demo (even if this sounds probably a bad idea to you). Both bootstrap and server config tabs aim to show what will be written in the security and server object for both servers on the device. (bootstrap and LWM2M server). We first clear (delete request) object 0 and 1, then we rewrite it with given credentials. (There is a lot of issue about that but again this is not a real server and the idea was more to be able to test if bootstrap delete and bootstrap write request works as expected).


But talking about bootstrap server demo sounds premature to me, again my feeling that we want to address too many subject at the same time.
So why not trying to agreed on the first use-case to support,
then define the first step to implement for this use-case.
And maybe even before that understand from what we start.

LWM2M v1.0 has a very limited support of x509.
For server authentication : It supports only "Certificate usage 3 ("domain-issued certificate"), meaning that this is more or less the same thing as RPK instead you are using a certificate to store your public key.
For client authentication : this should be more free but we will see that there is maybe some limitation.
(source : OpenMobileAlliance/OMA_LwM2M_for_Developers#257)

As I understand the specification, in all mode except EST, the secret can be written (and so known) by the bootstrap server. (I know this could be troubling)
I also understand that "device security information need to bootstrap" could be changed, meaning that you can change the device credentials used to bootstrap and you can even change the bootstrap server URL.(If you want to let another sever handle this device)

So how could you handle bootstrap to make the device uses x509.
For server certificate, it's easy this is a "domain-issue" certificate usage, so you just write your server certificate (self-signed if you want) PKI validation is not done anyway.

For client credentials, you need to write the private key and the client certificate but there is no information about how server should use it and there is a limitation : "no way to set the certchain" (which sounds still there in LWM2M 1.1) ...
So my current understanding is that you can either use :

  1. a self signed certificate for the client and just check exact match.
  2. or you consider that device already embeds all the trusted certificate and is able to rebuild the certchain. (it sounds an optimist assumption)
  3. or use a cert chain of only 2 certificates as root certificates can be omitted. (limited but will robustly work)

In Leshan :

  1. is not supported by server out of the box (you can maybe implement it in a crappy way using a custom CertificateVerifier)
  2. is not supported at client side. (but could be added)
  3. is the only supported way.

Do you agree with the current situation ?

@dachaac
Copy link
Contributor Author
dachaac commented Aug 22, 2020

@sbernard31 About current state:

I believe there is now some confusion so I did a test sequence with PSK to make it simple and it seems to match my understanding what I tried to describe up there:

git clone git@github.com:eclipse/leshan.git master
cd master
mvn clean install

# generate pass codes
echo -n "pass-to-bootsrap" | xxd -p -c 4096
-> "706173732d746f2d626f6f7473726170"
echo -n "pass-to-server" | xxd -p -c 4096
-> "706173732d746f2d736572766572"

# use default ports for bootstrap server
java -jar leshan-bsserver-demo/target/leshan-bsserver-demo-2.0.0-SNAPSHOT-jar-with-dependencies.jar

In another terminal (for LWM2M Server):

# start leshan server to custom ports so that it can reside in same machine
java -jar leshan-server-demo/target/leshan-server-demo-2.0.0-SNAPSHOT-jar-with-dependencies.jar -wp 9090 -lp 6683 -slp 6684

# configure bootstrap info
Open browser to http://0.0.0.0:8080/

Click on "Add new client bootstrap configuration"

Fill in "Client endpoint" with "testclient"

# In "LWM2M Server" tab
Fill in "LWM2M Server URL" with "coaps://localhost:6684"
Select security mode "Pre-Shared Key"
Fill in "Identity" with "testclient"
Fill in "Key" with "706173732d746f2d736572766572"

# In "LWM2M Bootstrap Server" tab
Select security mode "Pre-Shared Key"
Note: In "LWM2M Server URL" the is in gray "coaps://0.0.0.0:5684"
Fill in "Identity" with "testclient"
Fill in "Key" with "706173732d746f2d626f6f7473726170"

Click on "Create"

# Now details visible in client list:

Client Endpoint: 
testclient	

LWM2M Bootstrap Server:
coaps://0.0.0.0:5684
security mode : PSK
Identity :
testclient
Key :
706173732D746F2D626F6F7473726170

LWM2M Server:
coaps://localhost:6684
security mode : PSK
Identity :
testclient
key :
706173732D746F2D736572766572

# Configure lwm2m server info
Open browser to http://0.0.0.0:9090/

Click on "SECURITY"

Click on "Add new client server configuration"

Select security mode "Pre-Shared Key"
Fill in "Client endpoint" with "testclient"
Fill in "Identity" with "testclient"
Fill in "Key" with "706173732d746f2d736572766572"

# Now details visible in client list:
Client Endpoint:
testclient

Security Mode:
Pre-Shared Key	

Security Information:
Identity :
testclient
Key :
706173732d746f2d736572766572

In another terminal (for LWM2M Client):

java -jar leshan-client-demo/target/leshan-client-demo-2.0.0-SNAPSHOT-jar-with-dependencies.jar -b -n "testclient" -i "testclient" -p "706173732d746f2d626f6f7473726170"

Observe in web browser in "LWM2M Server" (:9090)

Client "testclient" is now listed in "CLIENTS"

So in summary:

  • In LWM2M Bootstrap Server Demo:
    • Tab "LWM2M Bootstratp Server" describes how client authenticates
    • Tab "LWM2M Server" describes security configuration to be written to client
  • In LWM2M Server Demo:
    • Only client authentication is configured

Do you agree?

I believe this is how logically one would configure it with PSK.

@dachaac
Copy link
Contributor Author
dachaac commented Aug 22, 2020

@sbernard31 please don't be alarmed even if I talk in the future as I try to get the concept working with Leshan -- I have a need to proof it and then we can slice it to smaller pieces. However I think if I ask advice how things should be implemented it makes integration process a bit easier in future. I don't intend to do PR with all in one go.

I believe I am missing only coap-est -> est proxy at this time for server side. Don't know yet what kind of problems that brings up.

@sbernard31
Copy link
Contributor
sbernard31 commented Aug 24, 2020

@sbernard31 please don't be alarmed even if I talk in the future as I try to get the concept working with Leshan -- I have a need to proof it and then we can slice it to smaller pieces. However I think if I ask advice how things should be implemented it makes integration process a bit easier in future. I don't intend to do PR with all in one go.

OK, thanks to let me know that. 🙏

So in summary:

In LWM2M Bootstrap Server Demo:
- Tab "LWM2M Bootstratp Server" describes how client authenticates
- Tab "LWM2M Server" describes security configuration to be written to client
In LWM2M Server Demo:
- Only client authentication is configured

Do you agree?

Yes and no 😁
Because tab "LWM2M Bootstrap Server" is how client authenticates but this is also part of the security configuration (about bootstrap server) to be written to the client.
This is way I tried to explain here => #690 (comment)
And I agree this is confusing and not the better idea. (use wireshark or logs to see what is written on the device)

In a better world, the configuration should be :

  • define how client authenticate to LWM2M Bootstrap server. (should be pretty much the same UI that in LWM2M server)
  • define bootstrap configuration (data to write during the bootstrap session)

About defining bootstrap configuration UI we can imagine several step

  1. being able to write 1 LWM2M server,
  2. being able to write 1 LWM2M server + 1 LWM2M Bootstrap server (the same used to bootstrap or another one),
  3. or even better being able to do "anything" (so instead of input server you could add a list of write request : see "BootstrapConfig" should be a list of request #437).

By the way #437, is something needed by OSCORE and maybe by you too so I should maybe put it in my priority list 🤔 ?

@sbernard31
Copy link
Contributor
sbernard31 commented Sep 4, 2020

(I begin to work/experiment #437 idea in #883 PR, current code does not impact leshan-bsserver-demo but maybe it should)

@dachaac
Copy link
Contributor Author
dachaac commented Sep 8, 2020

@sbernard31 I have a PoC in test code base for CoAP-EST <-> EST proxy code in Java.

Next thing is to start figuring out how to put all that in Leshan code base.

One of the crucial things is the HTTP(S) Request Library. As there are quite many available I just used OkHttp to test it out but that might not be something you prefer to have in Leshan. Do you have preferences for the library?

@sbernard31
Copy link
Contributor

have a PoC in test code base for CoAP-EST <-> EST proxy code in Java.

This is available at https://github.com/dachaac/leshan/commits/est-support , correct ?

Next thing is to start figuring out how to put all that in Leshan code base.

You want me to look at code and tell you if I have idea how to integrate this in Leshan ? (I ask because looking at so much code is time-consuming and want to be sure first)

One of the crucial things is the HTTP(S) Request Library. As there are quite many available I just used OkHttp to test it out but that might not be something you prefer to have in Leshan. Do you have preferences for the library?

I do not have real preference, but currently we have some constraints :

  • license should be compatible with eclipse IP policy. (I looked quickly and some version of OKhttp was already approved)
  • currently we target java 7, but maybe for 2.0.0 will could change it. (OKhttp needs java8)

@dachaac
Copy link
Contributor Author
dachaac commented Sep 14, 2020

About Java versions.

Java 7 has been EOL since 2015 (for paid customers said to be up till 07/2022).

Java 8 is LTS release and is about to be EOL at end of 2020 (or 2019). With extended support contract perhaps till 2030.

Current LTS release is Java 11.

Don't know what kind of effort supporting Java 11 would be but based on those EOL's that sounds like good target for next major version.

@dachaac
Copy link
Contributor Author
dachaac commented Sep 14, 2020

About HTTP Request Library.

Apache has HttpClient:
https://hc.apache.org/httpcomponents-client-5.0.x/index.html

Which seems to be Java 7 compliant.

Example code:
https://hc.apache.org/httpcomponents-client-5.0.x/httpclient5/examples/ClientAuthentication.java
https://hc.apache.org/httpcomponents-client-5.0.x/httpclient5/examples/ClientCustomSSL.java

Don't know how good this library is but can try it if it looks/feels better than OkHttp.

@dachaac
Copy link
Contributor Author
dachaac commented Sep 14, 2020

About CoAP-EST<->EST PoC Code.

It is not yet there as I wanted to have easy to hack environment for coding so I took californium's DTLS example server and client and started playing with it. It is somewhat ugly hack ;) but if you want to see it -- suppose I could push it on github.

Tested the PoC client code -> libest's CoAP-EST backend and it seems to be functionally matching vs. PoC client -> PoC server code -> libest's EST server.

Making it production quality code is yet another thing to ponder thou -- as I took a bit shortcut to just test the real beef.

I can look around and give first hypothesis what it could be and push somewhat tested solution on that repo/branch.

@sbernard31
Copy link
Contributor

java7:
The idea is mainly to be java7 compliant but clearly I will not encourage to use java7 except if you have no choice.
The main reason to keep stuck with java7 is to not close the door to android devices. (I don't know so much about android development but I understand that java7 is the only one really well supported)
(Just to let you know, the java7 constraint is not needed for demo or redis module)

httpclient:
AFAIK, it is largely used, probably a good candidate if it is java7 compliant.

@dachaac
Copy link
Contributor Author
dachaac commented Sep 21, 2020
8000

Just a warning note about Apache HttpClient -- seems a bit unpolished from usability point of view -- doesn't handle error cases as nicely as OkHttp did. As an example libest has a problem -- it closed the server connection in between Basic Auth requests even thou it should be persistent (one could say that it is a bug in libest) and it doesn't know how to recover. Workaround was to do add credentials to auth cache before so that only one request is sent with basic auth right away. I will use this for now but if you have some other options those might actually be better.

When looking around I noticed that Java 11 actually has:
https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpClient.html

Don't know how good that is but at least they have got that into the standard library so it should be at least though a bit more.

@sbernard31
Copy link
Contributor

Maybe it would not be easy to have a modern API + support of java 7 😅.
Another idea but which could be even more unpolished : the old java 7 API : HttpsURLConnection ?

@dachaac
Copy link
Contributor Author
dachaac commented Sep 26, 2020

My development branch can handle (in a bit dirty way) bootstrapping request with X.509 certificate and then when configured for EST mode from Leshan's bootstrap server's Web UI then it does following flow bootstrap->coap-est-server->lwm2m server.

It has still problems in code quality and handling error cases and handling persistence of bootstrapped client certificates and ca certificates. And does not support delayed certificate generation as that includes retrying the process. Does not support PoP support in challenge password. CoAP-EST Registrar->EST server connection with support for client certificate authentication has not been tested only basic auth has been tested.

It also brings new dependencies from Apache HTTP Client/codecs and BouncyCastle for CSR generation.

If someone plays with it -- word of warning with Cisco's libest -- it needed some fixes in order for it to operate in better fashion. I can try to clean it up my changes and push it on github later. More commercial grade EST server should work better. Also the certificate setup is a bit deep and I will publish them a bit later on my test certificate scripts repo.

With libest got once a situation that Apache HTTP Client debug was claiming proper sending of message and libest claiming received completely different request (previously sent request) -- I hope that this is a problem of libest and not Apache HTTP Client. Didn't have debugger plugged in for libest at that time so could not verify that.

CoAP-EST support is missing server side key generation facilities as that would require multipart sending in CoAP which seems to be missing from californium/leshan.
https://tools.ietf.org/html/draft-ietf-ace-coap-est-18#section-5.8
@sbernard31 and @boaks In what library you think this should be implemented?

This may also require one to use BouncyCaste in more core Leshan libraries as one may need to translate a bit requests.

Sever side key generation is also defined OPTIONAL so we can also skip implementing that if you think it is good enough without that support:
https://tools.ietf.org/html/draft-ietf-ace-coap-est-18#section-5.2

Then again -- one could use that within leshan to auto generate certificates when configuring security objects with X.509 certificates on server side or so.

CoAP service discovery for CoAP-EST is not supported. I suppose there is no CoAP discovery support in Leshan.

@boaks
Copy link
boaks commented Sep 26, 2020

I had a short look at RFC 8710 - multipart content-format.

At least in the past, californium handles the payload in an agnostic way, it just offers the accept/content-type option and the payload bytes. So, I'm not sure, if it fits into Californium and when I find the time to add it.

@sbernard31
Copy link
Contributor

It also brings new dependencies from Apache HTTP Client/codecs and BouncyCastle for CSR generation.

We succeed to limit dependencies with Leshan 1.0. It sounds this will be difficult to do the same for Leshan 2.0. 😕
About BountyCastle, I have a tiny memory that this could be difficult(maybe even impossible) to use it in an Eclipse project but. (because of IP issues)
@boaks maybe you have some hints about that.

CoAP-EST support is missing server side key generation facilities as that would require multipart sending in CoAP which seems to be missing from californium/leshan.

If I read rfc corrrectly, multipart content format is just a new content format + a way to encode/decode a payload using CBOR.
So I thing we "just" need a kind of utility class to make easier to encode/decode the payload.
This could make sense to put it in californium but this will create a dependency to a CBOR library just for this.
(AFAIK, for now only cf-oscore depends on CBOR in cf)
Knowning that Leshan already depends of CBOR maybe in a first time this makes more sense to put it in Leshan.
(If more features needs CBOR in cf we could move it in cf-core or a dedicated cf-cbor ?)
⚠️ there is question about which CBOR library to use : #866 (comment)

I suppose there is no CoAP discovery support in Leshan.

As I don't know what it is, I suppose there is not.

Sever side key generation is also defined OPTIONAL so we can also skip implementing

I know I repeat myself 😅 but I still think that that we should move forward step by step and so begin with the minimal feature set and then add new feature if needed.
So I think we can skip this at least in a first time.

@boaks
Copy link
boaks commented Sep 28, 2020

maybe you have some hints about that.

Not really. I tried to check the old bouncy-castle CQs. As far as I remember, they have been withdrawn. Unfortunately, I currently couldn't login to verify that ;-(.

@sbernard31
Copy link
Contributor

@dachaac I asked to OMA about your certchain concerns : OpenMobileAlliance/OMA_LwM2M_for_Developers#502

@boaks
Copy link
boaks commented Sep 29, 2020

Some good news (IP-Zilla works again :-) ):

There is now a license certified for org.bouncycastle:bcprov-jdk15on:jar:1.62. So maybe, it has now a better chance.

@dachaac
Copy link
Contributor Author
dachaac commented Oct 5, 2020

@sbernard31 There is a need to store state information from LeshanClientDemo. Now that we have Jackson available we could use YAML or JSON for serializing state to the file. In this state we could store received configuration during bootstrap and as an example EST objects.

Other thing that probably would be very useful is actually moving this command line configuration to configuration file. I am starting to think that it might make it even cleaner and more easier to understand now that there is going to be more flexibility also for bootstrap configuration writing. Using YAML seems to be rather common today for things like configuration files.

What do you think if we would create a configuration file which syntax would be somewhat common in *Demo? And start reducing the command line arguments.

@dachaac
Copy link
Contributor Author
dachaac commented Oct 5, 2020

@sbernard31 Other thing that I was thinking is that there should be persistent device inventory. I am thinking that device configurations between bootstrap server and normal lwm2m server should be shared so that one could maintain them a bit easier and also to support device auto registration when device is connecting with X.509 certificates.

There is already a Redis support but I haven't really looked too deep in that code. Is this intended to be used for this? If I am not mistaken Redis is not exactly meant for configuration store but more like a fast runtime cache with atomicity in a cluster.

@sbernard31
Copy link
Contributor

There is a need to store state information from LeshanClientDemo. Now that we have Jackson available we could use YAML or JSON for serializing state to the file. In this state we could store received configuration during bootstrap and as an example EST objects.

If a persistent state is needed, maybe an interface should be define this way the user can persist as wanted.

Now that we have Jackson available we could use YAML or JSON

No strong opinion but I would prefer to not add new dependencies. (so probably not YAML 😕)

Other thing that probably would be very useful is actually moving this command line configuration to configuration file.

There is an idea about change command line library using picocli for demo : #569
picocli allow to have default value for command option in a `.properties" file : https://picocli.info/apidocs/picocli/CommandLine.PropertiesDefaultProvider.html
Maybe a good candidate ? 🤔

@sbernard31 Other thing that I was thinking is that there should be persistent device inventory. I am thinking that device configurations between bootstrap server and normal lwm2m server should be shared so that one could maintain them a bit easier and also to support device auto registration when device is connecting with X.509 certificates.

My first feeling, so not set in stone :
I think this is maybe out of scope or at least not in core scope.
I would prefer to have interface which allow to do that but maybe not provide implementation.
The idea is to focus on core LWM2M feature in Leshan with some interfaces to let users integrating this in their existing infrastructure.
We also provides some default in memory implementation to make leshan testable and usable out of the box (not production ready).
We also provides some redis implementation. This helps for testing and validating shared/persistent behavior but this not the priority to provides this kind of implementation.
E.g. in production, currently we get our devices credentials from differences store (database, csv file, hsm, http api call, ...) all of this is hiding behind Leshan interface.

@dachaac
Copy link
Contributor Author
dachaac commented Oct 7, 2020

I have wrote down instructions on how to test EST support with my est-support branch in here:
https://github.com/dachaac/leshan/wiki/Testing-EST-support

@dachaac
Copy link
Contributor Author
dachaac commented Oct 9, 2020

Device auto registration will need some kind of shared persistent storage between LWM2M Bootsrap server and LWM2M Server so I will do experiment with shared persistent storage (mongodb probably) and as that needs a bit more configuration I will experiment with YAML file. When done I will push this to custom branch and we can see how it looks.

About Picocli -- don't really have opinion is it good or bad -- at least it can be shiny. Seems to provide annotation automata if that is something you wish to have.

About configuration I currently think that there would need to be more levels than one to make it easily understandable for grouping things and if needed extendable.

As an example for trust store there could be different options how to get them:

trust-store:
  type: path
  path: /path/to/ca

or:

trust-store:
  type: file
  path: /path/to/cacerts.pem

or:

trust-store:
  type: pkcs12
  path: /path/trust-store.p12
  password: changeit

Then there might be custom trust store for EST server connectivity:

est:
  trust-store:
    <same as normal trust-store>

@sbernard31
Copy link
Contributor
sbernard31 commented Oct 9, 2020

About Picocli -- don't really have opinion is it good or bad -- at least it can be shiny. Seems to provide annotation automata if that is something you wish to have.

I was talking about picocli because, it provides free config file from command line option and so it could maybe cover the config needs.

Device auto registration

Not sure to get what you call "auto registration".

@dachaac
Copy link
Contributor Author
dachaac commented Oct 9, 2020

With auto registration in here I mean that:

  • Manufacturer has manufacturer device with Initial Device Certificate.
  • When device is powered on it will use this Initial Device Certificate to connect to LWM2M Bootstrap server
  • LWM2M Bootstrap server notices that this device is not known and it will perform some checks and if those pass then registers the device into device inventory
  • LWM2M Bootstrap server will probably configure device to EST mode so that Initial Device Certiifcate gets exchanged for Service Specific Device Certificate
  • Device will then connect to LWM2M Server with Service Specific Device Cerificate (as Service Specific CA is the only trusted CA)
  • Device will connect successfully to LWM2M Server

And whole this chain would not require any manual intervention from operator to accept the device into the system.

This can only work when Manufacturer's CA is pre-registered into the service and possible policies has been configured.

I see part of this as out-of-scope for Leshan but in order to figure out Leshan parts it needs to be tested. If you are happy with those other changes then we can of course consider merging them here too -- but let's see how it first looks.

@dachaac
Copy link
Contributor Author
dachaac commented Oct 9, 2020

About Picocli -- don't really have opinion is it good or bad -- at least it can be shiny. Seems to provide annotation automata if that is something you wish to have.

I was talking about picocli because, it provides free config file from command line option and so it could maybe cover the config needs.

Yes. I want to experiment with YAML on how that works first -- if picocli works with the same I don't have anything against that. We can even try both and see how they compare.

@dachaac
Copy link
Contributor Author
dachaac commented Mar 12, 2021

Reworked my est-support test branch on top of master.

@dachaac
Copy link
Contributor Author
dachaac commented Mar 13, 2021

Added IEEE Secure Device Identity (IDevID) support.

Updated the instructions and fixed end point name to be valid urn:dev:ops value (eg. no space nor underscore):
https://github.com/dachaac/leshan/wiki/Testing-EST-support

@sbernard31
Copy link
Contributor

@dachaac we didn't get any news from you since a while now (something 3 or 4 month).
I really hope you're doing well. I really appreciate all the contributions you bring to Leshan and your skill on Certificate use cases.
I would be happy if you could continue to work on this, but if you decided to stop or if you just can't, let use know.
Thx again for all 🙏 !!

@sbernard31
Copy link
Contributor

(There some works maybe indirectly related to this which was not merged at #896 (comment))

@sbernard31 sbernard31 added bsserver Impact LWM2M bootstrap server client Impact LWM2M client new feature New feature from LWM2M specification labels Oct 29, 2021
@sbernard31
Copy link
Contributor

As this one is maybe a bit long discussion for some one which would like to start on this subject I create a new one (#1135) which point to this one.

@sbernard31 sbernard31 removed this from the 2.0.0 milestone Oct 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bsserver Impact LWM2M bootstrap server client Impact LWM2M client new feature New feature from LWM2M specification
Projects
None yet
Development

No branches or pull requests

3 participants
0