fxbox / registration_server Goto Github PK
View Code? Open in Web Editor NEWThe registration server to help with foxbox discovery
The registration server to help with foxbox discovery
We want this to be accessible to any web app on any client inside the network, right? Then we need to add a Access-Control-Allow-Origin: *
header. It will allow any web page to scan the local network for Boxes that are currently in setup mode, but I think that's the goal, right?
Currently a "client" field must be POSTed, ideally we should use a client cert and use the fingerprint of this certificate to identify the client (where the client is a box).
It's not done like this right now as the Iron Framework does not support this easily as it is right now.
The box should also send the port number it's listening on, and maybe the local hostname in addition to the local ip.
It seems that the registration server doesn't serve CORS headers.
It should have at least a Access-Control-Allow-Origin header.
We don't need the data to be persistent, so we may want to use another storage system like Redis.
Instead of running the server and redis in the same container, we should link them and run only the server in the container this project's docker file describes.
We can probably use http://ironframework.io/doc/openssl/ssl/struct.SslContext.html#method.set_certificate_chain_file or similar.
Instead of building inside the docker container, and then deploying - we should cross compile (or delete intermediate layers in the docker image?) so that the final image is minimal. Maybe switch from debian to the alpine base container.
Given that IIUC this registration server needs to be a Mozilla-hosted service, which is not ideal for security, privacy, as well as resilience reasons (the foxbox you own will become useless if we ever decide to discontinue this server). So we should document why we need this, and explain that those reasons outweigh the security/privacy/resilience implications, and which alternative options we discarded.
I think the primary reason is that unlike iOS, Windows, and OSX, Android does not support mDNS, right? Are there other reasons?
And I think one alternative option we discarded was adding mDNS support to Fennec, because this would still leave out users of other browsers on Android (notably the Android stock browser), right?
Right now we just keep the last entry for each (public, local) pair. We should delete those who are older than some threshold.
In order to improve security and privacy, we should:
curl -i -X POST -d'{"local_ip":"foo"}' http://knilxof.org:4242/register
/ping
end-point (initially only https://app.knilxof.org/; host http://fxbox.github.io/app there)./register
clients using signed client certs (we can fake this for the staging build using a signing-cert that's in the foxbox repo)If we run into difficulties with the signed client certs, a simpler approach would be to add an Authorization header or something similar.
In dual stack environments, Foxbox and client won't necessarily be using the same external IP address for server requests. Foxbox should ensure to register through both IPv4 and IPv6 where available.
It might make sense to return both the internal IPv4 and IPv6 address regardless of which stack was used by the client for the ping. The addresses could be coalesced by a strong random (but reproducible) ID used by the Foxbox for registration.
cloud.desre.org doesn't support IPv6 at this point, so this is certainly a low-priority issue.
Right now, a Box can call:
curl -X POST https://knilxof.org:4243/register -d "{\"local_ip\":\"some...very...long...string\",\"tunnel_url\":\"b\"}"
and we don't limit how long that string is. We should harden this a bit; this is a follow-up to: #11 (comment)
When limiting the length of the string sent in one call, we probably also want to limit the number of calls per second.
We can do this at the same time where we drop the formatting restrictions on the string sent (these restrictions don't really contribute anything apart from complicating our server upgrade path), see #11 (comment)
To reproduce:
docker pull schickling/rust
docker run -it schickling/rust /bin/bash
> apt-get update
> apt-get install -y git
> git clone https://github.com/fxbox/registration_server
> cd registration_server
> cargo build
It complains that it can't compile the `formdata` crate.
... instead of hardcoding the host:port we listen on.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.