F45 Change Proposal: Encapsule isolated devel containers (self-contained)

Encapsule isolated devel containers

This is a proposed Change for Fedora Linux.
This document represents a proposed Change. As part of the Changes process, proposals are publicly announced in order to receive community feedback. This proposal will only be implemented if approved by the Fedora Engineering Steering Committee.

Wiki
Announced

:link: Summary

encapsule is a new small CLI tool for developers who want to try out “tools installed from the internet” for example (or use them within a project workdir) inside a safer container environment rather than directly in their home directory and host system.

:link: Owner

:link: Detailed Description

The CLI tool allows running developer containers, isolating your home directory and host from container side effects: it can “encapsule” a project and/or temp homedir there together with select enabled “capabilities”. It uses Podman to run a (derived) container image (which can be generated by Buildah from a toolbox container say). The project readme file has more details about the specific features and commandline options.

In this age developers are frequently asked to install and run all kind of commands or software directly from the internet whether from source or more often now binaries. In recent years curl https://some.project/install.sh | bash or npm/npx install ... (and many others: pip, cargo, etc) are being normalized and can both pollute one’s home directory or system, and also put it at increased security risk. encapsule provides a lightweight, somewhat safer environment for installing and running such tools. Note however it is not intended for running known malicious programs or security testing, etc - though at least it provides some basic separation or system hygiene. Users can also disable sudo or even the network (or potentially DNS) inside the encapsule container.

In many ways it makes opposite design choices to toolbox: closed by default rather than open - but one can opt in to sharing specific things from the host.

A lot of the original ideas are derived from toolbox-constrained by Sebastian Wick, without which this tool probably wouldn’t exist now in its current form.

For more hardened isolation it is recommended to look at OpenShell though it is not available yet in Fedora. In the future it may be possible to migrate encapsule to wrap openshell for instance and use its gateway perhaps, which would enhance network isolation considerably.

The alternative is to use a VM of course, but that is much more heavyweight and awkward: though there is the similar whot/schupfn project, which allows exporting specified directories with 9p to a QEMU VM instance, also generated from a toolbox.

:link: Feedback

:link: Benefit to Fedora

Fedora users will have a simple way to isolate toolbox containers etc from their homedir and host system for running third party tools inside a contained environment, where they control what is shared from their home or host system.

:link: Scope

  • Proposal owners:

    • Submit encapsule for package review and get it approved
    • Fix reported issues and improve further
  • Other developers: N/A

  • Release engineering: #Releng issue number

  • Policies and guidelines: N/A (not needed for this Change)

  • Trademark approval: N/A (not needed for this Change)

  • Alignment with the Fedora Strategy:

:link: Upgrade/compatibility impact

N/A

:link: Early Testing (Optional)

:link: How To Test

:link: User Experience

Users will have a safer way to run harnesses and other tools grabbed from the internet.

:link: Dependencies

:link: Contingency Plan

  • Contingency mechanism: (What to do? Who will do it?) N/A (not a System Wide Change)
  • Contingency deadline: N/A (not a System Wide Change)
  • Blocks release? N/A (not a System Wide Change)

:link: Documentation

N/A (not a System Wide Change)

:link: Release Notes

To be written

Last edited by @amoloney 2026-07-22T14:57:38Z

Last edited by @amoloney 2026-07-22T14:57:38Z

1 Like

How do you feel about the proposal as written?

  • Strongly in favor
  • In favor, with reservations
  • Neutral
  • Opposed, but could be convinced
  • Strongly opposed
0 voters

If you are in favor but have reservations, or are opposed but something could change your mind, please explain in a reply.

We want everyone to be heard, but many posts repeating the same thing actually makes that harder. If you have something new to say, please say it. If, instead, you find someone has already covered what you’d like to express, please simply give that post a :heart: instead of reiterating. You can even do this by email, by replying with the heart emoji or just “+1”. This will make long topics easier to follow.

Please note that this is an advisory “straw poll” meant to gauge sentiment. It isn’t a vote or a scientific survey. See About the Change Proposals category for more about the Change Process and moderation policy.

1 Like

Looks interesting, but a process question - does this need to be a Change Proposal tied to a release?

Could it be dealt with just like adding any other new package to Fedora?

Thanks, the reason for highlighting the package is that it is highly relevant at this time, when many users are increasingly installing CLI tools directly from the internet and particularly now making frequent use of agent harnesses. Encapsule can provide basic easy isolation of such tools from one’s system, only sharing what they need to see.


I am about to release version 0.4 which introduces subcommands and other changes, btw.

Also I could add I am not completely enamored with the name (it started as constrained-toolbox, then I briefly tried envclave locally, and now encapsule). I think it is an okay name though not the easiest to type (basically enca+Tab to complete). If there is a better name I could still consider renaming. Note currently the name is used to prefix the “encapsule” container names.

Would you think fence would be better?

Or maybe hegne! :slight_smile:

1 Like

Thanks for this proposal! This is exactly the direction I would like to see.

My personal use case: is an atomic desktop with toolbox as the main development environment. Toolbox is a great developer experience but kind of defeats the purpose of the atomic OS’s additional security, given the fact that one is again exposed to potential supply chain attacks.

For this to be useful as a developer tool, I would need two things:

  • Be able to run my IDE in the container and more in general be able to run GUIs → expose Wayland
  • Have a way to use SSH keys without them being shared in the mounted volume. One could also use hardware keys and achieve the same goal, so this item is not so important.

Improvement: Could be useful to have an easy way to expose Wayland for GUI apps via command line shortcut, like --enable-gui, instead of having to define it manually as a capability, most people (including me) wouldn’t know how to do it out of the box and this is, in my opinion, a major use case.

Problem: I see in your examples that you suggest exposing Wayland with security_opts = [“label=disable”]. I saw this also in other repositories, and although this may be considered good enough, dropping SELinux entirely doesn’t seem right. What I would like to propose is something “as secure as it gets” but still as user friendly as toolbox. Wouldn’t it be possible to work out the SELinux policies for Wayland and just allow what’s needed? I think this should be a requirement if this is to become the way one does “encapsulated” (I actually like the name) development environments in Fedora.

Other packages: among the other packages that implement similar approaches and may be worth checking out (if you didn’t already) is Litterbox, which implements one possible way of doing the SSH key sharing.

Overall I think this is a great idea, thanks for putting this together.

3 Likes

This should be done via ssh-agent exclusively, it is the correct way to allow ssh usage w/o sharing keys with an environment

1 Like

This change has been accepted by FESCo for Fedora Linux 45. A full list of approved changes to date can be found on the [Change Set Page](Releases/45/ChangeSet - Fedora Project Wiki).

To find out more about how our changes policy works, please visit our [docs site](Making sure you're not a bot!).

Thanks for the helpful feedback.

Perhaps the GUI support could be improved or made more friendly.
BTW I tend to make the available capabilities be installed as system config soon (currently there is only opt-in user config for capabilities).
But it is an intentional design choice of encapsule to default to locked-down.

Yes, I would prefer to avoid label=disable for Wayland, but not sure how to do that yet.
I am not sure if Toolbox or Distrobox handle this any better.

I am aware of Litterbox, thanks, and it does looks quite cool and featureful, if a little opinionated. I just tried it now and after answering a bunch of difficult questions, it looks like it is also unconfined_u for me. Anyway it may be an interesting alternative.

For my specific purpose (running vscode) I ended up using Udica to get the policies to be applied to a podman container.

I summarized the procedure for myself here: hardened-containers, the final policy that I’m using is also in there (devbox.cil). Not sure if it can be useful for a project like encapsule.

DISCLAIMER: I’m a total SELinux beginner, there is a good chance that this stuff is actually even wrong.

1 Like

Thank you very much, very interesting project. Unfortunately, it’s not a very active GitHub project, with only 18 stars and a single developer.