If you run a c-lightning node with
EXPOSE_TCP set to True, it seems to me it should be possible to connect with it remotely, provided that the c-lightning RCP is listening to all incoming traffic. (IP is set to 0.0.0.0)
I tried the Docker setup recommended in the c-lightning readme and when I use socat to connect directly from inside the Docker container everything works smooth:
socat - UNIX-CONNECT:/home/simnet/.lightning/lightning-rpc
But when I try to use socat from the container host the connection closes directly upon opening with no error or anything:
socat - tcp:127.0.0.1:14302
The ports seem to be mapped correctly
I don't understand what I am missing here. Is it even possible to connect remotely with this setup? I've read this question as well, and the answer suggests to use socat inside the Docker container to bridge the Unix socket to TCP, but it seems to me that the
EXPOSE_TCP is meant to do exactly that natively.
UPDATE: The API doesn't really seem to be exposed over TCP after all, although the parameter is certainly set to True. This is how I found out:
- I wasn't even able to use the API over TCP from inside the docker container
- Then I bridged the Unix socket to TCP manually by using socat.
socat -d -d TCP-LISTEN:9835,fork,reuseaddr UNIX-CONNECT:/home/user/.lightning/lightning-rpc
- After this I was able to connect to the lignting-c node remotely.
So maybe there's something wrong with c-lightning in interpreting this setting, or maybe there's something wrong with my setup. I'll explore further and report back.