Metadata-Version: 2.4
Name: firemold
Version: 0.4.1
Summary: Asistente gráfico para crear perfiles de firejail
License-Expression: MIT
Requires-Python: >=3.11
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: PyGObject>=3.48
Provides-Extra: test
Requires-Dist: pytest>=8; extra == "test"
Dynamic: license-file

# <img src="firemold/data/icons/io.gitlab.firemold.Firemold.svg" alt="" width="48" height="48" align="absmiddle"> Firemold

[![OBS build status](https://build.opensuse.org/projects/home:liloman/packages/firemold/badge.svg?type=default)](https://build.opensuse.org/package/show/home:liloman/firemold)
[![Copr build status](https://copr.fedorainfracloud.org/coprs/liloman/firemold/package/firemold/status_image/last_build.png)](https://copr.fedorainfracloud.org/coprs/liloman/firemold/package/firemold/)

[![Download Firemold for openSUSE, Debian, Ubuntu, Raspberry Pi OS and Arch Linux](docs/download-obs.svg)](https://software.opensuse.org/download.html?project=home:liloman&package=firemold)
[![Firemold for Fedora and Amazon Linux on Copr](docs/download-copr.svg)](https://copr.fedorainfracloud.org/coprs/liloman/firemold/)

**Sandbox your Linux applications without writing a single line of configuration.**

[firejail](https://github.com/netblue30/firejail) is a powerful tool for locking programs inside a
sandbox: you decide whether they can use the network, which folders they see, whether they can
reach your webcam or microphone… But its profiles are written by hand, with dozens of directives
you need to know. Firemold is a desktop application that does it for you with a wizard.

![Home screen with the created profiles](docs/screenshots/home.png)

## What you can do

- **Answer simple questions.** Does it need the internet? Which folders of your home? Sound,
  webcam, printers? Firemold translates your answers into firejail rules and shows the profile
  live as you go.
- **Pick a starting security level** (Minimal, Permissive, Balanced or Strict) and fine-tune
  anything afterwards.
- **Observe the app.** Use it normally and Firemold suggests what to allow based on what it
  actually used.
- **Test before saving.** Firemold launches the app with the profile, detects what the sandbox
  stops it from doing and offers the fix in one click: «Allow» or «Keep blocked». If the app does
  not even start, it finds the rule that breaks it on its own.
- **Adjust firejail's official profiles** without touching them: your changes go into a separate
  `.local` file that survives updates.
- **Edit by hand** if you prefer, with syntax highlighting, autocompletion and help for every
  directive. Nothing is lost when you go back to the wizard.
- **Try an untrusted command in a sandbox.** Paste it (say, a `curl … | bash` installer) in the
  **Sandbox** tab: it runs with bubblewrap with an empty home, no network and the rest of the system in
  overlay, and Firemold lists the files it created, changed, deleted or read, what it tried to write and
  could not, the programs it ran and where it tried to connect. Share folders in *overlay* mode to see what
  it would change there, then apply those changes for real if you like. `firemold -s` opens that tab.

**Create profile** lists your applications (their menu launchers), filtered by *All*, *Your
profile*, *Official profile* or *No profile*. Choose one and Firemold shows what profile it has, with
**New**, **Modify** and **Test**. From a terminal, `firemold firefox` (or a path, such as
`firemold ./App.AppImage`) opens it straight away; see `man firemold`.

| Choose how to start | Answer the questions | Test and fix |
|---|---|---|
| ![Method and security level](docs/screenshots/method.png) | ![Question wizard](docs/screenshots/wizard.png) | ![Testing the application](docs/screenshots/test.png) |

The interface is available in English and Spanish.

## Installation

The [download page](https://software.opensuse.org/download.html?project=home:liloman&package=firemold)
of the openSUSE Build Service lists the packages for every supported distribution with their
instructions. The commands for each one are also below.

### Fedora

Available now on Copr ([liloman/firemold](https://copr.fedorainfracloud.org/coprs/liloman/firemold/)):

```sh
dnf copr enable liloman/firemold
dnf install firemold
```

It shows up in the application menu as **Firemold**. Updates arrive with the rest of the system
(`dnf upgrade`).

### Debian, Ubuntu and Raspberry Pi OS

Packages for **Debian 13**, **Ubuntu 26.04 LTS**, **Ubuntu 26.10** and **Raspberry Pi OS 13**
(32-bit, Raspbian) are built on the
[openSUSE Build Service](https://build.opensuse.org/package/show/home:liloman/firemold). Set `repo`
to your system (`Debian_13`, `xUbuntu_26.04`, `xUbuntu_26.10` or `Raspbian_13`), then add the signing key and
install:

```sh
repo=Debian_13

curl -fsSL "https://download.opensuse.org/repositories/home:/liloman/$repo/Release.key" \
  | gpg --dearmor | tee /etc/apt/keyrings/firemold.gpg > /dev/null
echo "deb [signed-by=/etc/apt/keyrings/firemold.gpg] https://download.opensuse.org/repositories/home:/liloman/$repo/ /" \
  | tee /etc/apt/sources.list.d/firemold.list
apt update
apt install firemold
```

Updates arrive with `apt upgrade`. Older releases (Debian 12, Ubuntu 24.04) are not
supported: Firemold needs libadwaita 1.7 or newer.

### Arch Linux

Add the repository to `/etc/pacman.conf`:

```ini
[home_liloman_Arch]
Server = https://download.opensuse.org/repositories/home:/liloman/Arch/$arch
```

Then trust its signing key and install:

```sh
curl -fsSL https://download.opensuse.org/repositories/home:/liloman/Arch/x86_64/home_liloman_Arch.key \
  | pacman-key --add -
pacman-key --lsign-key B2D80F13FB0BE60B596E0B475819F142931A4572
pacman -Syu firemold
```

### openSUSE

Packages for **openSUSE Tumbleweed** and **openSUSE Leap 16.0** are built on the same
[openSUSE Build Service](https://build.opensuse.org/package/show/home:liloman/firemold) project.
Set `repo` to your system (`openSUSE_Tumbleweed` or `16.0`), then add the repository and install
(zypper asks you to trust its signing key the first time):

```sh
repo=openSUSE_Tumbleweed

zypper addrepo "https://download.opensuse.org/repositories/home:/liloman/$repo/home:liloman.repo"
zypper refresh
zypper install firemold
```

Updates arrive with `zypper dup` (Tumbleweed) or `zypper update` (Leap). Leap 15 is not supported:
Firemold needs libadwaita 1.7 or newer.

### Other distributions

**Amazon Linux 2027.** It does not ship firejail, so firejail comes from a second Copr project
([liloman/firejail-amazon](https://copr.fedorainfracloud.org/coprs/liloman/firejail-amazon/), Fedora's
package rebuilt unchanged). Name the system explicitly, because `dnf copr` does not recognise it on its
own:

```sh
dnf install dnf5-plugins
dnf copr enable liloman/firemold amazonlinux-2027-x86_64
dnf copr enable liloman/firejail-amazon amazonlinux-2027-x86_64
dnf install firemold
```

**Anything else.** If your distribution is not listed, ask for it by
[opening an issue](https://gitlab.com/new-horizonts/firemold/-/issues), or run Firemold from source
(see [From source](#from-source)).

## Requirements

- firejail (tested with 0.9.82.2)
- bubblewrap ≥ 0.10, for the Sandbox tab; strace (optional) for its detailed log
- GTK 4 and libadwaita ≥ 1.7, Python ≥ 3.11 with PyGObject
- GtkSourceView 5 (optional: editor highlighting and autocompletion)
- pkexec, only to save system-wide profiles

## Where it stores things

Your profiles go to `~/.config/firejail/`, where firejail looks for them. The official profiles
in `/etc/firejail` are never modified. If a file already existed, a dated `.bak` copy is made first in
`~/.config/firejail/firemold-backups/`, where disabled `.local` files go too.

| What | Where |
|---|---|
| Own profile / adjustment of an official one | `~/.config/firejail/NAME.profile` / `NAME.local` |
| "Always sandboxed" launcher | `~/.local/share/applications/` (tagged `X-Firemold=true`) |
| Profile metadata (tested, launcher…) | `~/.local/share/firemold/managed.json` |
| Test drafts and traces | `~/.cache/firemold/` |
| Settings (language, theme, sandbox defaults) | `~/.config/firemold/settings.json` |
| Sandboxes (removed when the window closes) | `$XDG_RUNTIME_DIR/firemold-sandbox/` |
| System-wide (asks for a password) | `/etc/firejail/` and `/usr/local/bin/` through `firemold-helper` |

---

## For developers

### From source

```sh
python3 -m firemold [EXECUTABLE]
man ./data/firemold.1
```

### Tests

```sh
python3 -m pytest
```

- `tests/test_core.py`: parser, writer and validator over every profile in `/etc/firejail`, plus
  the wizard logic.
- `tests/test_integration.py`: real firejail (profiles load, `net none` leaves only `lo`, file
  and D-Bus block detection), storage, helper and the bubblewrap sandbox.
- `tests/test_ui.py`: walks through the whole interface headless with `gtk4-broadwayd`.
- `tests/test_i18n.py`: every text has its English translation.

The integration tests create temporary `~/.fm-test-*` folders and remove them when done.

The source strings are in Spanish and act as translation keys (`_()` in `firemold/i18n.py`); the
English text lives in `firemold/locale/en.po`.

### How it works

- **Test** runs the app with `firejail --trace` (plus the D-Bus proxy log and, optionally,
  seccomp in log mode) and works out what failed and why: which `.inc` hides it, `private-*`,
  Landlock, `noexec`, the D-Bus filter… Every block comes with its fix.
- **Find the directive that breaks it** tests copies of the profile without some directives
  (binary search) until it finds the smallest set that makes the app fail.
- **Observe** runs the app without a profile under `--trace` and suggests home folders, network,
  `private-bin` and `private-etc` from what it used.
- **Sandbox** runs `bash -c <command>` under `bwrap --unshare-all` with `/run`, `/tmp` and the home
  replaced, and the rest of the system and the shared folders as `--overlay` (unprivileged overlayfs, which
  refuses a lower folder with mounts below, so the tree is split at those). File changes
  come from the overlay upper layers; reads, deletions, programs and connections from firejail's
  `libtrace.so` (`LD_PRELOAD`) plus polling `/proc`, which a malicious command can evade.

### Privileged helper

Saving system-wide uses `pkexec` with `firemold-helper`, which only accepts four operations:
`install` and `remove` of profiles in `/etc/firejail`, and `link`/`unlink` of firecfg links in
`/usr/local/bin`. It validates names, rejects symlinks and files owned by another user, and never
overwrites or deletes a profile without the Firemold tag. The package installs it; by hand:

```sh
install -m755 helper/firemold-helper /usr/libexec/
install -m644 data/org.firemold.helper.policy /usr/share/polkit-1/actions/
```

## License

MIT. See [LICENSE](LICENSE).
