Is it possible to connect remotely to a c-lightning node with an exposed TCP port? 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

0.0.0.0:14302-&gt;9835/tcp

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.
EXPOSE_TCP is implemented in c-lightning's docker script:

https://github.com/ElementsProject/lightning/blob/2945b25b57db37dca31c10da34a4b1ca33d697c3/Dockerfile#L103

https://github.com/ElementsProject/lightning/blob/master/tools/docker-entrypoint.sh

If you didn't use that script or didn't implement it in your own docker script, it won't work.

It's easy to mistake EXPOSE_TCP for a parameter you can set when spinning up c-lighting.