* Linux: enforce SELinux container_t + MCS confinement, :z/:Z relabelling, and --security-opt label=...
On Linux hosts with SELinux active (`/sys/fs/selinux` `SELINUX_MAGIC`) and `container-selinux` installed (`/etc/selinux/<type>/contexts/lxc_contexts`), confine containers and `docker exec` processes under `container_t` with a unique reference-counted MCS category pair (`s0:cX,cY`), label container overlayfs roots, `/dev`, `/dev/pts`, `/dev/shm`, masked `tmpfs` directories, and `--tmpfs` mounts via `context="<mount_label>"`, label `/etc/{hosts,resolv.conf,hostname}`, shared `IpcMode::Shareable` shm, and local volumes with `container_file_t:s0`, and transition threads via `/proc/thread-self/attr/selinux/exec` (`current` for `--init` PID 1) after verifying `PROC_SUPER_MAGIC`.
Support `--security-opt label=disable|user:...|role:...|type:...|level:...|filetype:...` (`label=` and `label:`) with strict character validation preventing `context="..."` mount-option injection, persist `process_label` and `mount_label` on `Spec` for `GET /containers/{id}/json` (`ProcessLabel`, `MountLabel`) and restarts, expose `name=selinux` in `GET /info` `SecurityOptions`, support `:z` and `:Z` bind-mount relabelling via an iterative non-symlink-following `relabel_tree` with top-level system path guards while rejecting `:z,Z`, degrade cleanly when SELinux or `container-selinux` is absent, and add `Recommends: container-selinux` to `packaging/linux/rpm/kiri.spec`.
* Linux: gate SELinux relabel path guards on active confinement
Match Docker 29 and opencontainers/selinux semantics so :z and :Z remain a non-breaking no-op on non-SELinux hosts (macOS, Windows/WSL 2, Ubuntu, Debian) and when MountLabel is empty (--privileged or --security-opt label=disable), while enforcing excludePaths (including /etc/passwd, /etc/pki, /etc/shadow, /media, /srv, /var/log) and bottom-up directory relabelling whenever SELinux confinement is active.
Packaging
How Kiri reaches people on each platform, and what each piece of this
directory (and installer/windows) does.
| Platform | Package | Built by | Contents |
|---|---|---|---|
| Linux (Debian, Ubuntu) | kiri_<v>_amd64.deb, _arm64.deb |
packaging/linux/build.sh |
engine + docker CLI, Compose, buildx; the window on x86-64 |
| Linux (Debian, Ubuntu) | kiri-lite_<v>_amd64.deb, _arm64.deb |
packaging/linux/build.sh |
engine only |
| Linux (Fedora, RHEL, openSUSE) | kiri-<v>-1.x86_64.rpm, .aarch64.rpm, kiri-lite-…rpm |
packaging/linux/build.sh |
same two flavours |
| Windows | Kiri-<v>-x86_64.msi |
cargo xtask msi |
engine for WSL2, kiri-win.exe, docker CLI, Compose, buildx |
| Windows on Arm | Kiri-<v>-arm64.msi |
cargo xtask msi --arch arm64 |
the same, arm64 throughout (docker CLI built from source) |
| macOS | Kiri.app in Kiri-<v>-arm64.dmg (-x86_64 for Intel), Kiri-<v>-<arch>.tar.gz, Kiri Lite |
cargo xtask release |
app + CLI tools (DMG for cask, .tar.gz for Homebrew formula); Lite downloads the tools |
| NixOS / Linux (Nix) | kiri and kiri-lite in flake.nix |
nix build .#kiri |
engine + Docker CLI, Compose, buildx (kiri), or engine only (kiri-lite), plus nixosModules.default |
Two flavours everywhere, with the same meaning: Kiri brings the docker
CLI, Compose and buildx so docker run works right after installing;
Kiri Lite is the engine alone for people who already have a docker.
The CLI versions and their SHA-256s are pinned once, in
crates/kiri/src/cli_pins.rs, for all three platforms.
Linux
packaging/linux/fetch-cli.sh target/linux-cli # docker, compose, buildx, verified against cli_pins.rs
packaging/linux/fetch-forge.sh target/linux-x86_64-musl # kiri-forge, verified against cli_pins.rs
packaging/linux/build.sh target/linux-x86_64-musl target/packages x86_64 target/linux-cli
A release builds all eight packages (both flavours, .deb and .rpm, x86-64
and arm64) with scripts/ci/linux-build.sh on Ubuntu, zig cross-compiling
the arm64 engine; then installs the x86-64 .debs under systemd and runs
containers through them (packaging/linux/test-host.sh), and the .rpms the
same way on Fedora. Each file goes up with SHA256SUMS-linux.
A v* tag builds Mac, Windows and Linux; each build puts its files on
download.runkiri.com with its feeds staged, and the release moves every
feed and updates the website once all three are up (RELEASES.md). On a Mac, scripts/ci/linux-packages.sh builds
the same packages in a Linux container.
build.sh needs dpkg-deb and rpmbuild (apt install rpm on Debian;
both are in WSL Ubuntu). Without the CLI directory it builds only
kiri-lite. The binaries come from cargo xtask linux or
scripts/windows-engine.sh (static musl, so one package runs on every
distro). What the packages do:
/usr/bin/kiri,/usr/bin/kiri-init,kiri.service(installed, not started: installing alone runs nothing. The engine starts, and starts at boot, when someone sets Kiri up: the window's Allow access, orsudo kiri host-access $USER. An upgrade leaves a running engine as it is), thekirigroup that owns/run/kiri/docker.sock. Members of the kiri group can run containers as root on this machine; treat it like the docker group. State in/var/lib/kiri-daemon(0700), images and containers in/var/lib/kiri(0710); removal keeps them,apt purgedeletes them.- The full package adds
/usr/libexec/kiri/bin/dockerwith Compose and buildx in/usr/libexec/kiri/cli-plugins, and offersdockeron PATH throughupdate-alternativesat priority 10, only when/usr/bin/dockeris absent or already an alternatives link: a docker CLI another package owns keeps winning, as on Windows. Compose and buildx go into/usr/lib/docker/cli-pluginsthe same way, one alternatives link each, so the package installs besidedocker-compose-plugin,docker-buildx-pluginanddocker-desktop(whose plugins Kiri's docker then uses). A link is made only when Docker's own copy isn't in any of the CLI's plugin folders (/usr/lib,/usr/libexec,/usr/local/lib,/usr/local/libexec…/docker/cli-plugins), and a dpkg trigger (rpm%filetriggerinand%filetriggerpostun) checks again whenever another package changes those folders, so Docker's plugins installed or removed after Kiri still win. Itsdockertalks to Kiri's socket unlessDOCKER_HOST,DOCKER_CONTEXTor a context of your own says otherwise. - The x86-64 full package also has the window:
/usr/lib/kiri/kiri-window(kiri built with--features window, linking GTK 3 and WebKitGTK 4.1, so the package depends on the window binary's glibc floor and recommends GTK 3 and WebKitGTK 4.1), its launcher in the app menu and the icons.kiri uistarts it, or says which GTK and WebKitGTK packages to install when those shared libraries are absent; where the window isn't packaged (kiri-lite, and the arm64 packages, which zig cross-compiles),kiri uisays so.linux-build.shbuilds the window for its own machine's architecture whenlibwebkit2gtk-4.1-devis there. - Upgrading the package restarts a running engine on the new version, as the Mac and Windows apps do after an update: running containers stop, and those with a restart policy start again.
Tests: packaging/linux/test.sh (package listings, install/remove in
privileged Ubuntu and Fedora containers on any Docker-compatible engine, Kiri
included; nested, so it proves the files and scripts, not container runs) and
packaging/linux/test-host.sh (on a real host or VM with systemd: install,
run containers, publish a port, remove; it stops a kiri daemon already running
there, so it wants KIRI_TEST_KILL=1).
Not yet: an apt/dnf repository (today the packages are release assets;
a repository is what gives apt upgrade), and signing.
Arch Linux
arch/PKGBUILD builds kiri-ui, the desktop window (kiri --features window),
for Arch Linux (x86_64 and aarch64, including Omarchy and Asahi). It
installs /usr/lib/kiri/kiri-window where kiri ui expects it, plus the
application-menu launcher and icons, without replacing an installed Kiri engine,
CLI, systemd service, Docker context, or container store. See arch/README.md
for build and install steps.
Nix and NixOS
flake.nix builds two packages on x86_64-linux and aarch64-linux, matching
the .deb and .rpm split:
packages.<system>.kiri(default):kiri,kiri-init, polkit policy and NetworkManager configuration, bundled withpkgs.docker-client,pkgs.docker-composeandpkgs.docker-buildxunder$out/libexec/kiriand a$out/bin/dockerwrapper (nix build .#kiri).packages.<system>.kiri-lite: the engine alone (nix build .#kiri-lite).overlays.default: addskiriandkiri-liteto anixpkgsset.nixosModules.default(alsonixosModules.kiri): declarative NixOS service configuration.
Example flake.nix consumer on NixOS:
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
kiri.url = "github:libracoder/kiri";
kiri.inputs.nixpkgs.follows = "nixpkgs";
};
outputs = { nixpkgs, kiri, ... }: {
nixosConfigurations.my-host = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
kiri.nixosModules.default
{
services.kiri = {
enable = true;
users = [ "alice" ];
# package = kiri.packages.x86_64-linux.kiri-lite;
# enableDockerCli = true; # defaults to !config.virtualisation.docker.enable
# socketGroup = "kiri";
};
}
];
};
};
}
Enabling services.kiri loads the kernel modules Kiri uses (overlay,
br_netfilter, nf_tables, tun, loop, veth), turns on IPv4 forwarding
and polkit by default, creates services.kiri.socketGroup with
services.kiri.users as members, links /libexec/docker/cli-plugins into
/run/current-system/sw, configures NetworkManager to leave Kiri's bridges and
veths unmanaged, puts NixOS's host tools (kmod, iproute2, util-linux,
e2fsprogs, nftables, iptables, coreutils, procps) on the unit's
PATH, and runs kiri.service with the same cgroup delegation, resource
limits and /run/docker.sock fallback link as packaging/linux/kiri.service.
Homebrew
The official tap is libracoder/homebrew-kiri,
which offers both a cask (for the desktop app in /Applications) and a formula
(for headless CLI and brew services workflows):
- Cask (
Casks/kiri.rb):brew install --cask libracoder/kiri/kiri. InstallsKiri.appfromKiri-<v>-<arch>.dmginto/Applications, updates in place via Kiri's signed updater, and cleans up setup state onbrew uninstall --zap --cask kiri. - Formula (
Formula/kiri.rb):brew install libracoder/kiri/kiri. Installs the signed, notarizedKiri.appfromKiri-<v>-<arch>.tar.gz(preserving itscom.apple.security.virtualizationentitlement) under$(brew --prefix)/opt/kiri/libexec/Kiri.app, symlinks$(brew --prefix)/bin/kiri, and defines abrew servicesLaunchAgent (brew services start kiri). Persisted paths written bykiri setupuse the version-independentopt/kiri/libexec/Kiri.appsymlink sobrew upgrade kirinever leaves staleCellarpaths behind,kiri setupcoexists withhomebrew.mxcl.kiri.plistwithout writing a duplicate LaunchAgent, and in-app self-update defers tobrew upgrade kiri. Both entries conflict with one another so only one owns the engine at a time. - Release automation: mirroring a release to GitHub updates both
Casks/kiri.rbandFormula/kiri.rbfromSHA256SUMSand opens a pull request onlibracoder/homebrew-kiri.