18 Commits
Author SHA1 Message Date
Precious Okwu 4fc571b87c Linux: wait for /_ping before checking restarted socket access (#1260)
After `systemctl restart kiri`, `packaging/linux/test-host.sh` only waited for `-S /run/kiri/docker.sock`. The daemon binds the socket before writing its POSIX access list and booting the engine, leaving a 2 ms race where the unprivileged `setpriv` check ran before socket access was granted and the daemon started accepting requests.

Add a bounded `wait_engine` helper polling `/run/kiri/docker.sock` until `/_ping` returns `OK` (up to 30 s) and use it after both `kiri host-access` and `systemctl restart kiri`.
2026-12-06 10:17:13 +01:00
Precious Okwu 308f372e67 Linux: enforce SELinux container_t + MCS confinement, :z/:Z relabelling, and --security-opt label=... (#1190)
* 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.
2026-12-03 19:26:24 +01:00
Precious Okwu 750bd8a7de Packaging: recommend GTK 3 and WebKitGTK 4.1 in Linux packages and guide kiri ui when absent (#1189)
Move GTK 3 and WebKitGTK 4.1 from hard Requires/Depends to Recommends in the full Linux .rpm and .deb packages while keeping the libc6 glibc floor check on the .deb. Desktop dnf (Fedora, openSUSE) and apt installs still pull the window libraries automatically, while RHEL, Rocky Linux and AlmaLinux (where webkit2gtk4.1 lives in EPEL) and headless servers (--no-install-recommends or install_weak_deps=False) install the static engine and bundled Docker CLI cleanly.

Before execing /usr/lib/kiri/kiri-window on Linux, kiri ui now probes dynamic library resolution via LD_TRACE_LOADED_OBJECTS=1 and reports an actionable package install message instead of a raw ld.so failure when GTK 3 or WebKitGTK 4.1 is missing.

Fixes #260
2026-12-03 18:46:42 +01:00
Precious Okwu 90a202231b Setup, services & DNS: harden CLI plugin stamps, LaunchAgent and WSL toggles, and DoH NXDOMAIN (#1176)
- Recognise cross-volume Copy-Item CLI plugin copies via byte-size and SHA-256 content equality when no file-ID hardlink or .kiri-cli-plugins.json stamp matches, stamp managed plugins from setup-tools.ps1 and kiri.ps1, re-heal ~/.docker/cli-plugins live in kiri-win when Docker Desktop is installed or uninstalled, and include /opt/homebrew/lib/docker/cli-plugins and NixOS plugin paths in setup.rs SYSTEM_PLUGIN_DIRS (#1150, #1054 follow-up).
- Guard macOS set_start_at_login when brew services is active so Kiri never falls through to writing a duplicate dev.kiri.daemon.plist when homebrew.mxcl.kiri.plist is absent or lacks RunAtLoad (#1134 follow-up).
- Persist /etc/kiri/no-docker-sock when WSL socket integration is disabled on a user engine distro and honour it in kiri.service ExecStartPost and daemon::maybe_link_docker_sock across restarts (#1131 follow-up).
- Pass kDNSServiceFlagsReturnIntermediates to DNSServiceGetAddrInfo, skip unusable IPv6 lookups on IPv4-only Macs, and distinguish clean NoSuchRecord results from lookup failures so DoH/DoT Supplemental domains with no UDP servers return NXDOMAIN (or NODATA when the sibling address family exists) instead of SERVFAIL (#1145 follow-up).
2026-12-03 11:52:16 +01:00
Precious Okwu 9e4860ff52 Packaging: harden macOS Homebrew formula support and complete NixOS flake (#1134)
- Canonicalise current_exe() across macOS bundle-relative lookups and normalise versioned Homebrew Cellar/kiri/<version>/libexec/Kiri.app paths to opt/kiri/libexec/Kiri.app across kiri setup and update checks.
- Coexist cleanly with brew services (homebrew.mxcl.kiri.plist) in kiri setup without registering a duplicate dev.kiri.daemon.plist, and disable in-app self-overwrite on Homebrew formula installs in favour of brew upgrade kiri.
- Upgrade flake.nix with kiri (bundled docker, Compose, and buildx) and kiri-lite packages, overlays.default, and a full services.kiri NixOS module matching packaging/linux/kiri.service, plus NixOS /run/current-system/sw binary and CLI-plugin discovery.
2026-12-02 06:08:38 +01:00
Precious Okwu dbaa28c4ed Linux packages bundle the pinned kiri-forge; Kiri Forge 0.1.1; 0.3.0 notes (#1048)
The Linux package build now fetches the pinned kiri-forge for each architecture, checks it against the SHA-256 in cli_pins.rs and bundles it, as the Mac and Windows builds do; before, /usr/bin/kiri-forge in the packages was a link to kiri. A release build stops if the binary is missing.

The bundled Kiri Forge is 0.1.1. docs/releases/0.3.0.md holds the notes for 0.3.0 and docs/releases/0.3.0.announce.json its announcement.
2026-11-30 00:55:37 +01:00
Precious Okwu b66d3e3ad9 Kiri Forge: Kiri's own build engine, on by default (#1039) 2026-11-29 20:51:21 +01:00
Precious Okwu 67808ef8b0 Harden image diff_ids, mounts/volumes, caller/WSL gates, networking/DNS, AppArmor, Kubernetes, UI, and updaters (#1013)
* security: harden mount/volume confinement, WSL roots, caller gates, labels & domain routing

* net: isolate --internal bridges/DNS, support gateway_mode_ipv4 & host_binding_ipv4

- GHSA-gp5c-4g58-vr24 & #1010: enforce nftables isolation for --internal
  bridges across prerouting (early accept before HOST_ADDR/WSL_HOST_ADDR/
  EGRESS_ROUTES redirects), forward (iifname/oifname cross-bridge drops in
  both ip and ip6 tables even when non-internal subnets are empty), input
  (allow only bridge gw4 or NDP+gw6 on plain internal bridges; drop all
  on gateway_mode_ipv4=isolated / inhibit_ipv4=true), and postrouting
  (never masquerade internal subnets; disable IPv6 on IPv4-only internal
  bridges).
- GHSA-7x2g-c7pw-mpc6: refuse external UDP and TCP DNS forwarding on
  internal-only containers before custom --dns and AAAA handling, track
  all container bridges including kiri0 across spawn/NetAttach/NetDetach
  with vacuous internal_only when disconnected from all networks, and
  bind per-bridge UDP and TCP gateway DNS listeners with SO_BINDTODEVICE
  when bridge != kiri0.
- GHSA-vmx6-3c4p-cjr2 (#985): honor com.docker.network.bridge.host_binding_ipv4
  for TCP and UDP published ports with empty HostIp while keeping empty
  value as unset, validating Ipv4Addr at network create and use, and
  preserving #1011 names_sync lock ordering around container start gate.
- #1000: honor com.docker.network.bridge.enable_icc=false via IFLA_BRPORT_ISOLATED.
- #1008: support KIRI_HOST_LOOPBACK=off to block host loopback via host.docker.internal.
- #992: refuse 'default' network name and network/broadcast IPAM gateway or
  auxiliary addresses for prefix < 31 without /31 or /32 shift overflow.

* Verify image rootfs.diff_ids, pin managed BuildKit, and bound rmtree FDs

* security: fix AppArmor profile, WebView URL/CSP/i18n, k3s kubeconfig/pinning, elevation TOCTOU & MSI verification, and diag redaction

- GHSA-xx5v-42pc-2x72: enforce Linux AppArmor kiri-default profile with
  PROC_SUPER_MAGIC verification on /proc/thread-self/attr/apparmor/{exec,current}
  and Host::Absent no-op on SELinux/VM/WSL2 hosts.
- GHSA-hmxq-c9pq-2fm2: add strict weburl allowlist (preserving all 13 exact
  URLs and non-empty docs.docker.com/go/ subpath check), localUrl plainHost
  validation (preserving rports running/serving guard), strict WebView CSP and
  navigation blocking on macOS/Linux/Windows, typed numeric coercions in
  hubrows/sharing, and strict i18n tag+attribute parity enforcement.
- GHSA-9mjv-25f8-p9p9: replace raw k3s kubeconfig line pass-through with a
  strict line-by-line allowlist parser rejecting exec/auth-provider/file-path
  credentials and YAML anchors/flow collections, and pin default
  rancher/k3s:v1.37.1-k3s1 multi-arch index and per-arch config digests.
- GHSA-vc32-9whf-m39j / GHSA-wjfx-gjxf-6h52 / GHSA-hx2c-xfr4-jqm2: fix
  AppleScript backslash-before-quote escaping in setup::as_admin, eliminate
  all TMPDIR staging before root elevation in setup.rs and usb/helper.rs
  (verifying SHA-256 on {bin}.new as root before codesign and atomic mv), and
  enforce private staging + SHA-256 + WinVerifyTrust Authenticode / optional
  Ed25519 signature verification in kiri-win/update.rs and kiri.ps1.
- #994: redact truncated secret JSON string values at end-of-input in
  kiri diag.

* Keep rmtree deep-readonly test setup at O(1) open FDs and parse URL host in domain-label test
2026-11-28 14:12:38 +01:00
Precious OkwuandVictor Borja e26bd5bfb9 Add Nix flake and NixOS module (#335)
Co-authored-by: Victor Borja <vborja@apache.org>
2026-11-26 06:29:29 +01:00
Precious OkwuandCesar Roberto Pamplona Filho 2453ee94ea Arch: package Kiri desktop UI (#526)
Co-authored-by: Cesar Roberto Pamplona Filho <cesarpamplonafilho@gmail.com>
2026-11-26 06:29:29 +01:00
Precious OkwuandUrdemonlord c221c7c9f4 Linux: compute .deb libc6 floor from non-weak GLIBC_* symbols (#252) (#950)
Co-authored-by: Urdemonlord <150226383+Urdemonlord@users.noreply.github.com>
2026-11-25 17:36:41 +01:00
Precious OkwuandAntony Nyagah fb1cc6a176 Linux packages: ship additive NetworkManager kiri.conf for Kiri interfaces (#172) (#906)
Co-authored-by: Antony Nyagah <tony.m.nyagah@gmail.com>
2026-11-24 19:31:50 +01:00
Precious OkwuandUrdemonlord cfb8b5330d Linux: Kiri's networks keep clear of Docker's, whichever engine starts first (#700)
Co-authored-by: Urdemonlord <hasrinata@gmail.com>
2026-11-21 18:37:46 +01:00
Precious Okwu 4d4429fd7d Linux units: containers get Docker's process, core-size and task limits (#660) 2026-11-21 11:50:00 +01:00
Precious Okwu 7dc72ea59c Engine: restarts on the new version after every update (#48) (#264) 2026-11-15 14:17:03 +01:00
Precious Okwu a705eb16a6 Docs: Linux engine start, the docker.sock link and IPv6 networks (#87) 2026-11-09 04:45:50 +01:00
Alex Idowu 8685472df8 Linux packages install beside Docker's own Compose and buildx (#47)
* Linux packages install beside Docker's own Compose and buildx

The full kiri .deb/.rpm put docker-compose and docker-buildx straight into
/usr/lib/docker/cli-plugins, which docker-desktop, docker-compose-plugin and
docker-buildx-plugin own, so dpkg refused the install ("trying to overwrite
'/usr/lib/docker/cli-plugins/docker-buildx', which is also in package
docker-desktop").

The plugins now live in /usr/libexec/kiri/cli-plugins and are linked into
/usr/lib/docker/cli-plugins through update-alternatives only where the slot
is free, as /usr/bin/docker already was; otherwise Docker's plugins stay and
Kiri's docker uses them. The rpm does it in %posttrans, since an upgrade
erases the old package's real files there only after %post.

* Leave Docker's plugins in /usr/libexec alone, and re-check when they change

Docker's apt/dnf packages (docker-compose-plugin, docker-buildx-plugin) put
their plugins in /usr/libexec/docker/cli-plugins. The CLI searches
/usr/lib/docker/cli-plugins first, so a Kiri link there replaced Docker's
Compose and buildx. A plugin's slot now counts as taken when Docker's copy is
in any of the CLI's plugin folders (/usr/lib, /usr/libexec, /usr/local/lib,
/usr/local/libexec), and Kiri's link is removed if Docker's copy turns up.

A dpkg trigger (interest-noawait on those folders) and rpm
%filetriggerin/%filetriggerpostun run the check again when another package
adds or removes plugins there, so Docker's packages installed or removed
after Kiri are handled too.
2026-11-08 17:35:20 +01:00
Precious Okwu 15c6bd7a48 Kiri 0.1.14 2026-11-02 18:32:31 +01:00