xaya/libxayagame

Listen only locally for game RPC server

Closed this issue · 1 comments

The JSON-RPC servers run by the game daemon (using DefaultMain) listen on the specified port "globally", i.e. also accept non-local connections. This is likely undesirable, as "anyone" would be able to shut the server down or perhaps call other sensitive methods (depending on the game).

A firewall that blocks the port externally can be used to prevent that, but it creates extra configuration burden and another venue for accidental mistakes. We should check if/how jsonrpccpp's server (run by microhttpd) can be made to listen only on localhost.

It seems that's not easily possible with the HTTP server: cinemast/libjson-rpc-cpp#200

The suggested alternative seems to be using non-HTTP transports for local servers. @RyuMaster, do you know if either the UnixDomainSocketServer or the FileDescriptorServer would work on Windows? I think the latter would be ideal - we could just make it communicate through stdin/stdout of the daemon process. I think that would be easy to use for applications where you start and manage the daemon from some frontend process, right?