Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

PVF worker: consider securing with landlock #7243

Closed
mrcnski opened this issue May 17, 2023 · 3 comments · Fixed by #7303
Closed

PVF worker: consider securing with landlock #7243

mrcnski opened this issue May 17, 2023 · 3 comments · Fixed by #7303
Assignees
Labels
T4-parachains_engineering This PR/Issue is related to Parachains performance, stability, maintenance.

Comments

@mrcnski
Copy link
Contributor

mrcnski commented May 17, 2023

ISSUE

Overview

I just found out about landlock. We are already working on a seccomp-based solution but that has been delayed due to, in a nutshell, the difficulty of knowing which syscalls are safe to block. Landlock might be easier and less controversial to implement, as it has a smaller scope (only restricts FS access). I expect it to be a temporary solution that can be totally replaced by seccomp sandboxing once that lands, but if it's quick to implement we should do it now. There is a Rust crate.

Alternative

If for some reason landlock doesn't work out, we can consider using chroot to restrict FS access. Its use as a security mechanism is widely discouraged, even by the manpage, but it may be better than nothing for now, and I think the caveats don't apply to us.

Related issues

#7266 is a prerequisite.

@mrcnski mrcnski added the T4-parachains_engineering This PR/Issue is related to Parachains performance, stability, maintenance. label May 17, 2023
@sandreim
Copy link
Contributor

I consider this another layer of defense in depth , but it seems to require kernel configuration support which might make it harder for node operators to enable it: https://docs.kernel.org/userspace-api/landlock.html#kernel-support

@mrcnski
Copy link
Contributor Author

mrcnski commented May 17, 2023

We should anyway check if it's enabled before running it. We can add a recommendation to enable it to the validator's guide.

@mrcnski
Copy link
Contributor Author

mrcnski commented May 22, 2023

I checked on my Linux environment (GCP) and Landlock is enabled there:

$ sudo dmesg | grep landlock
[    0.553664] landlock: Up and running.

I found an example for restricting the current thread and checking whether the operation was successful. This seems like low-hanging fruit, so I'll implement this and add a note about it to the validator's guide (maybe with this guide?). Also seems worthwhile to send to telemetry whether Landlock is enabled or not.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
T4-parachains_engineering This PR/Issue is related to Parachains performance, stability, maintenance.
Projects
No open projects
Development

Successfully merging a pull request may close this issue.

2 participants