Kubernetes deployment and security concerns #210
Replies: 3 comments
-
I made an issue for replacing the client with a grpc version: #209 |
Beta Was this translation helpful? Give feedback.
-
@darioAnongba I've been looking at replacing the client that lspd uses with a grpc client. In order to connect to the cln grpc interface, you'll need to have access to the certficates, namely Thinking about your docker deployment, maybe it's possible to have lspd run in a different container than lightningd, but share the lightning-rpc file in a volume, to make it readable by the lspd container? Because ideally when working with certificates, you would also have access to the certificate files themselves for when they become invalid and new ones have to be created |
Beta Was this translation helpful? Give feedback.
-
Hi @JssDWt. In general I guess the certificates would be generated outside and injected into the It is also possible to mount the But ideally, the concept of "runes" seems ideal for |
Beta Was this translation helpful? Give feedback.
-
Hi, thank you for this example implementation of a Lightning Service Provider Daemon and for open sourcing it.
I've recently deployed LSPD successfully in Kubernetes infra along with
lightningd
(helm charts can be found here https://github.com/bitcoin-numeraire/k8s-infra, note that it is a work in progress). Here are the pain points I faced in case in case someone needs it:Containerization
The main point that I want to raise is regarding containerization, which in turn greatly impacts security. @JssDWt explained that it is currently not possible to use
lightningd
grpc API solspd
is forced to uselightning-rpc
by being deployed in the same container aslightningd
.This breaks the principle of "1 process per container" of Kubernetes, which greatly decreases separation of concerns, ease of deployment and monitoring (can't see
lightningd
logs):lspd
andlspd_cln_plugin
and place them in their correct directory forlightningd
to uselightningd
entrypoint for a custom one where I can run bothlightningd
(with--daemon
) andlspd
lspd
.The obvious improvement that comes to mind is to encapsulate
lightningd
andlspd
in its own image (by implementing aDockerfile
) guaranteeing thatlspd_cln_plugin
andlspd
are built in the same env aslightningd
with a custom entrypoint. it would then just be a matter of pulling thelightningd-lspd
image and running it.Security
More importantly is that
lspd
, exposed to the internet, is running on the same container as the lightning node, which is in control of the funds. The attack surface is thus immense aslspd
has 100% access to the lightning node, itshsm_secret
, config, everything. This is of course not acceptable for anything else than a PoC.Even if the
hsm_secret
is encrypted (something I recommend you add to yourlspd-install.sh
: https://docs.corelightning.org/docs/hsm-secret#encrypt-hsm-secret),lspd
has access to the running node so it has power to withdraw all the funds.In the future, IMO the perfect fix is to completely separate
lspd
fromlightningd
so thatlightningd
is in total control of whatlspd
can do by issuing a very specific rune forlspd
, a variety of network policies could be added as well.NODES
I didn't really understand the
NODES
env var but it felt like nodes are not part of the configuration oflspd
but seemed more like data to be managed as CRUD. Something likelspd add-node
or calls toPOST lspd/api/nodes
,GET /nodes/{id}
, etc. It was painful to create this ENV var. Specifying theEXTERNAL_IP
seemed weird and a chicken and egg, seems that you first need to runlspd
and then add nodes to it?Versions
Beta Was this translation helpful? Give feedback.
All reactions