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.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
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
lightningdgrpc API solspdis forced to uselightning-rpcby 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
lightningdlogs):lspdandlspd_cln_pluginand place them in their correct directory forlightningdto uselightningdentrypoint for a custom one where I can run bothlightningd(with--daemon) andlspdlspd.The obvious improvement that comes to mind is to encapsulate
lightningdandlspdin its own image (by implementing aDockerfile) guaranteeing thatlspd_cln_pluginandlspdare built in the same env aslightningdwith a custom entrypoint. it would then just be a matter of pulling thelightningd-lspdimage 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 aslspdhas 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_secretis encrypted (something I recommend you add to yourlspd-install.sh: https://docs.corelightning.org/docs/hsm-secret#encrypt-hsm-secret),lspdhas 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
lspdfromlightningdso thatlightningdis in total control of whatlspdcan 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
NODESenv var but it felt like nodes are not part of the configuration oflspdbut seemed more like data to be managed as CRUD. Something likelspd add-nodeor calls toPOST lspd/api/nodes,GET /nodes/{id}, etc. It was painful to create this ENV var. Specifying theEXTERNAL_IPseemed weird and a chicken and egg, seems that you first need to runlspdand then add nodes to it?Versions
Beta Was this translation helpful? Give feedback.
All reactions