platformio / bintray-secure-ota

Over-The-Air firmware upgrades for the Internet of Things devices with JFrog @Bintray
Apache License 2.0
53 stars 25 forks source link

How do we handle certficate changes on bintray.com? #7

Open cyberman54 opened 6 years ago

cyberman54 commented 6 years ago

How can we change a certificate on a node, after bintray made changes on their server side certificates? How do we handle certifcate renewals?

ivankravets commented 5 years ago
cyberman54 commented 5 years ago

This seems like a chicken-and-egg-problem: after bintray changes certificate on their servers, nodes which hold previous certificate in flash memory are no longer able to download binaries from bintray.com. Therefore it will not be possible to update certificates on nodes by pushing a new firmware to them, incorporating the new bintray certificate.

ivankravets commented 5 years ago

Ah... you are right. I already reported this issue to Bintray. Let's see maybe they will improve something.

S2Doc commented 5 years ago

@ivankravets - Has there been any progress on this?

ivankravets commented 5 years ago

Sorry, no updates :(

S2Doc commented 5 years ago

This would seem to make BinTray an unusable method for OTA updates of large numbers of edge IoT devices. Are there any solutions out there that work with the Arduino framework?

ivankravets commented 5 years ago

If you plan to use for production, it's better to use own endpoint with free https://letsencrypt.org/. There are a lot of chip VPS for a few dollars per month. So, you can create own JSON manifest and DL endpoint.

Bintray is mostly oriented on powerful clients.

S2Doc commented 5 years ago

Thanks for the suggestion, @ivankravets . Unfortunately, it looks like letsencrypt.org requires that certificates be changed every 90 days. That is worse than Bintray. :(

S2Doc commented 5 years ago

@ivankravets - I didn't pick up on your VPS suggestion when I first read your comment. That's a great idea which I will definitely explore. Thanks!!

cyberman54 commented 5 years ago

Did not get it yet, can you explain the concept a little further? What is VPS?

ivankravets commented 5 years ago

VPS for $5/mo

Instead of VPS, you can AWS or another computing service which will charge your per resource usage.


You can tune publish process here https://github.com/platformio/bintray-secure-ota/blob/master/publish_firmware.py#L31

So, you will still be able to deploy firmware to your VPS backend where IoT devices will check for updates.

S2Doc commented 5 years ago

VPS = Virtual Private Server (see https://en.wikipedia.org/wiki/Virtual_private_server). It is a virtual machine running on a cloud device which acts as a server. This allows the user to have superuser authority on the virtual server. As I understand it from reading the linked article, this should allow one to control their own security certificates and when they are updated.

Its an elegant solution, but may require more expertise than I currently have. Still learning, though.

S2Doc commented 5 years ago

@ivankravets and I cross-posted.

cyberman54 commented 5 years ago

ok, you're talking on own servers, now i got it. Of course i have "VPS" (at Scaleway, as low as $2,99/mth. max). But doesn't it mean i must install complete bintray jfrog instance on my VPS?

ivankravets commented 5 years ago

Just install nginx on a server and serve firmware_updates.json. Later you can load this JSON via HTTPS, parse with ArduinoJSON library and do self upgrade.

cyberman54 commented 5 years ago

@ivankravets i'm not sure i got it - that means to not use jfrog bintray and the bintray class in code any more, but to setup own update server and code for downloading?

ivankravets commented 5 years ago

I'm not a security expert. Can we keep on a target device only root certificate?