Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

plugins: Flexible runtime and restricting plugins with plugin-runner #7928

Open
cdecker opened this issue Dec 10, 2024 · 0 comments
Open

plugins: Flexible runtime and restricting plugins with plugin-runner #7928

cdecker opened this issue Dec 10, 2024 · 0 comments

Comments

@cdecker
Copy link
Member

cdecker commented Dec 10, 2024

This issue describes an idea that has been floating around in the CLN
community for some time, and since it could provide a solution to some
common problems, I'll quickly describe the idea, and see what other
issues are addressable with it.

Plugin execution

The lightningd main daemon starts each plugin as a subprocess, via
execve, then takes over the stdout and stdin file descriptors in
order to communicate with it.

The command being executed is either of the following:

  • ["/path/to/plugin.exe"]
  • ["/path/to/plugin.exe", "--developer"]

So control is passed directly to the plugin executable, and the
subprocess runs in the same user context, and with the same
permissions as lightningd itself.

plugin-runner

The --plugin-runner option would add the ability to specify a
wrapper that should be used to isolate plugins from the parent
context.

This allows the creation of plugin-runner wrappers that open up a
wide range of possibilities:

  • Remote plugins: the plugin runner could just be a stub that
    exposes a (partial) RPC interface, and starts the plugin somewhere
    remote (Kubernetes, cgroup, docker, central service...).
  • Unprivileged plugins: the plugin does not get access to the
    lightning-dir and its interactions with lightningd go through a
    proxy RPC that is re-exposed by the wrapper in the plugin
    context. This could be running in docker isolated via chroot or
    running as an unprivileged user.
  • Policy enforcement on plugins: the wrapper can enforce
    arbitrary logic, including things that aren't expressible in runes.
  • Access control: Limit to what runes permit you to do as a
    separate layer.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant