GIANLUCA VARISCO Paris Open Source Summit - 10/12/2019 Control your Embedded Linux remotely by using WebSockets @gvarisco
2 WHO AM I? FORMERLY CISO
Arduino is the world’s leading open-source hardware and software ecosystem
4 LEGENDA IoT Gateway EDGE Linux Device
5 Run Arduino code on Linux Devices! MANAGE EDGE LINUX DEVICES
6 CONTROL LINUX FROM THE WEB ● OLD problems, OLD solutions ● HTTPS is hard to achieve ● BI-DIRECTIONAL communication ● Work on most network topologies ● Create a web server, contact it via HTTP ● Cannot have HTTPS unless domain name is registered and IP address is static/known ● UDP ports are often closed
7 Give users a quick and easy-to-use web interface to ● Check the status of the system ● Configure networking ● Install packages ● Deploy apps / containers USE CASE
8 USE CASE MQTT server GW Connector Websocket + MQTT Browser
9 DO NOT OVERKILL We do not want to store users’ data unless needed or it brings big advantages for both users and us. We do not want to deal with state synchronization. Scaling is really expensive!
Arduino Connector
Features ● One single binary, ~20MB (no external deps) ● Works on every Debian-like Linux distro ● Secure-only connections ● MQTT (Stable TCP socket with remote server) ● Works on slow connections ● No need to know the IP in advance
Features ● Go Language runs on: ○ ARM v5, v6, v7 ○ ARM64 v8 ○ x86 ○ x86_64 Public repository: https://github.com/arduino/arduino- connector
About MQTT ● Well known ● Widely used ● Feature complete ● Simple enough ● Bi-directional
14 SERVER SIDE, WHAT DO YOU NEED? ● MQTT Server ● SSL support ● MQTT Client ● OAuth 2 server (optional) ● MQTT over WebSocket
15 EXAMPLE API
16 Use /proc , Luke! And remember, everything is a file in Linux We released arduino/go-system-stats, a library that gathers OS metrics about resource usage (memory, disk, network, etc.) STATS API
17 APT integration is dummy, APT lib APIs are in C++ only and nearly impossible to integrate with Go, thus we decided to use the CLI as an API and released arduino/go-apt-client A combination of dpkg + apt commands wrapped in an API Supports the management of apt repos APT INTEGRATION
18 APT INTEGRATION
19 NETWORK MANAGER INTEGRATION NetworkManager has a stable API (0.98 is really stable) We released arduino/gonetworkmanager, Go D-Bus bindings for NetworkManager You select ETH or Wi-Fi networks
20 NETWORK MANAGER INTEGRATION
21 ● We install Docker if not previously installed and if target supports it ● Docker Go APIs are really easy to manage (imagine why) ● Works with Private Registry ● Runs on huge servers (tested on Intel Data Center w/ 64+ core CPU) and small devices (e.g BeagleBone Black or Raspberry Pi) DOCKER INTEGRATION
22 DOCKER INTEGRATION
23 RUNS ON LINUX Support for all Debian-based devices Porting to other OSes / distros’ flavors is simple
24 Arduino uses the same underlying tech described in this talk for its own IoT Cloud: MQTT + TLS + WebSocket
Arduino IoT Strategy (End to end approach) 25
26 WHAT ARDUINO PROVIDES Sensors Data + Device Interaction Automatic Code Generation Arduino Hardware Secure Cloud Connection Device Management OTA Updates Firmware Changes Business Logic Firmware Upload Certificate or Password Provisioning Dashboards Third Parties IoT SaaS Arduino IoT Cloud
Connect securely to the Cloud HTTP OAuth JSON MQTT TLS / SSL Arduino IoT Cloud Low code / visual X.509 cert-based auth Ready made code examples for major IoT cloud providers Arduino libraries Connect to any HTTP REST API or MQTT server Quick Customizable https://github.com/arduino/ArduinoCloudProviderExamples 27
Arduino Create 28
A complete IoT Framework 29
CORE VALUES Easy to use and deploy Wizard based approach to simplify the user journey Secure and reliable Secure elements on HW, highest standard of encryption Open application protocols & automatic code generation Users can focus on “what” to do instead of “how”. Based on open industry protocols 3030
GIVE IT A TRY! create.arduino.cc
Arduino CLI
Features ● An all-in-one solution ● Provides builder, boards/library manager, uploader, discovery and many other tools needed to use any Arduino compatible board and platforms. ● Source Code: github.com/arduino/arduino-cli
THAT’S A WRAP, THANK YOU! Gianluca Varisco <g.varisco@arduino.cc> @gvarisco
35 ● https://github.com/arduino/arduino-connector ● https://github.com/arduino/go-system-stats ● https://github.com/arduino/go-apt-client/ ● https://github.com/arduino/gonetworkmanager ● https://github.com/arduino/arduino-cli ● https://create.arduino.cc References

#OSSPARIS19 : Control your Embedded Linux remotely by using WebSockets - Gianluca VARISCO, Arduino

  • 1.
    GIANLUCA VARISCO Paris OpenSource Summit - 10/12/2019 Control your Embedded Linux remotely by using WebSockets @gvarisco
  • 2.
  • 3.
    Arduino is theworld’s leading open-source hardware and software ecosystem
  • 4.
  • 5.
    5 Run Arduino code onLinux Devices! MANAGE EDGE LINUX DEVICES
  • 6.
    6 CONTROL LINUX FROMTHE WEB ● OLD problems, OLD solutions ● HTTPS is hard to achieve ● BI-DIRECTIONAL communication ● Work on most network topologies ● Create a web server, contact it via HTTP ● Cannot have HTTPS unless domain name is registered and IP address is static/known ● UDP ports are often closed
  • 7.
    7 Give users aquick and easy-to-use web interface to ● Check the status of the system ● Configure networking ● Install packages ● Deploy apps / containers USE CASE
  • 8.
  • 9.
    9 DO NOT OVERKILL Wedo not want to store users’ data unless needed or it brings big advantages for both users and us. We do not want to deal with state synchronization. Scaling is really expensive!
  • 10.
  • 11.
    Features ● One singlebinary, ~20MB (no external deps) ● Works on every Debian-like Linux distro ● Secure-only connections ● MQTT (Stable TCP socket with remote server) ● Works on slow connections ● No need to know the IP in advance
  • 12.
    Features ● Go Languageruns on: ○ ARM v5, v6, v7 ○ ARM64 v8 ○ x86 ○ x86_64 Public repository: https://github.com/arduino/arduino- connector
  • 13.
    About MQTT ● Wellknown ● Widely used ● Feature complete ● Simple enough ● Bi-directional
  • 14.
    14 SERVER SIDE, WHATDO YOU NEED? ● MQTT Server ● SSL support ● MQTT Client ● OAuth 2 server (optional) ● MQTT over WebSocket
  • 15.
  • 16.
    16 Use /proc ,Luke! And remember, everything is a file in Linux We released arduino/go-system-stats, a library that gathers OS metrics about resource usage (memory, disk, network, etc.) STATS API
  • 17.
    17 APT integration isdummy, APT lib APIs are in C++ only and nearly impossible to integrate with Go, thus we decided to use the CLI as an API and released arduino/go-apt-client A combination of dpkg + apt commands wrapped in an API Supports the management of apt repos APT INTEGRATION
  • 18.
  • 19.
    19 NETWORK MANAGER INTEGRATION NetworkManagerhas a stable API (0.98 is really stable) We released arduino/gonetworkmanager, Go D-Bus bindings for NetworkManager You select ETH or Wi-Fi networks
  • 20.
  • 21.
    21 ● We installDocker if not previously installed and if target supports it ● Docker Go APIs are really easy to manage (imagine why) ● Works with Private Registry ● Runs on huge servers (tested on Intel Data Center w/ 64+ core CPU) and small devices (e.g BeagleBone Black or Raspberry Pi) DOCKER INTEGRATION
  • 22.
  • 23.
    23 RUNS ON LINUX Supportfor all Debian-based devices Porting to other OSes / distros’ flavors is simple
  • 24.
    24 Arduino uses thesame underlying tech described in this talk for its own IoT Cloud: MQTT + TLS + WebSocket
  • 25.
    Arduino IoT Strategy(End to end approach) 25
  • 26.
    26 WHAT ARDUINO PROVIDES SensorsData + Device Interaction Automatic Code Generation Arduino Hardware Secure Cloud Connection Device Management OTA Updates Firmware Changes Business Logic Firmware Upload Certificate or Password Provisioning Dashboards Third Parties IoT SaaS Arduino IoT Cloud
  • 27.
    Connect securely tothe Cloud HTTP OAuth JSON MQTT TLS / SSL Arduino IoT Cloud Low code / visual X.509 cert-based auth Ready made code examples for major IoT cloud providers Arduino libraries Connect to any HTTP REST API or MQTT server Quick Customizable https://github.com/arduino/ArduinoCloudProviderExamples 27
  • 28.
  • 29.
    A complete IoTFramework 29
  • 30.
    CORE VALUES Easy touse and deploy Wizard based approach to simplify the user journey Secure and reliable Secure elements on HW, highest standard of encryption Open application protocols & automatic code generation Users can focus on “what” to do instead of “how”. Based on open industry protocols 3030
  • 31.
    GIVE IT ATRY! create.arduino.cc
  • 32.
  • 33.
    Features ● An all-in-onesolution ● Provides builder, boards/library manager, uploader, discovery and many other tools needed to use any Arduino compatible board and platforms. ● Source Code: github.com/arduino/arduino-cli
  • 34.
    THAT’S A WRAP, THANKYOU! Gianluca Varisco <g.varisco@arduino.cc> @gvarisco
  • 35.
    35 ● https://github.com/arduino/arduino-connector ● https://github.com/arduino/go-system-stats ●https://github.com/arduino/go-apt-client/ ● https://github.com/arduino/gonetworkmanager ● https://github.com/arduino/arduino-cli ● https://create.arduino.cc References