[Snek] EV3: network server?

Mikhail Gusarov dottedmag at dottedmag.net
Sun Feb 23 00:25:00 PST 2020


Hello Keith,

On 23 Feb 2020, at 1:21, Keith Packard wrote:

> Sounds like you're on the right track; you want SaaS (Snek as a 
> Service
> :-) on the device. If you want to make it more like other Snek 
> devices,
> then Snek would start at power-up and run a saved program.

That's the idea, yes. I'm going to emulate "EEPROM" by writing the 
program
to a known file, or Get/Put buttons in mu and snekde won't work.

> My only concern would be security; connected to the network, it will 
> be
> more vulnerable than a USB connection.

EV3 has got three ways to have a network:

- usbnet, no problem in this configuration
- Bluetooth PAN, with the network between host computer and device,
   also no problem,

- WiFi or Ethernet, but it requires an external USB dongle.

So, would it be OK for now to add a warning in the documentation that 
Snek
on EV3 and shared networks are not a good match for now? I'm not looking
forward to cross-compiling libsodium.

However see below.

> You *could* add SSL support with mutual-authentication, but that seems
> like a configuration headache. Alternatively, have Snek listen on a
> local port and connect to that with either ssh port forwarding or ssh
> running 'nc' on the EV3. That seems like an ugly kludge though.

Actually ssh+nc sounds OK. What we need is 1) authentication; 2) secure
bidirectional channel. That's SSH.

I'm going to submit a patch to OpenSSH to add configuration option 
`SnekForward`.
Well, maybe not today.

> That seems like an ugly kludge though.

So is git+ssh:? For Snek another side of protocol is a trivial bytes 
forwarder, so
we don't need to write `snek-proxy` to be invoked by SSH, and can use 
`nc`.

> Oh, that's cool! Can the user name the device in case there are more
> than one?

`hostnamectl set-hostname`, sure. Avahi has a variable to expand to a 
hostname.


More information about the Snek mailing list