Commit Graph

366 Commits

Author SHA1 Message Date
Kevin Veen-Birkenbach
2c3b29ee98 test(e2e): full virtualized build+boot+unlock QEMU harness
Opt-in via LIM_E2E_QEMU=1. Models the whole process on a virtio VM (the
Pi's USB-gadget net can't be emulated, so it models the software stack,
not the board): builds a LUKS image carrying the real lim initcpio Tor
artifacts, boots it in QEMU rootless, lets the real netconf/tor/dropbear/
encryptssh chain publish the onion, delivers the passphrase over Tor, and
asserts the boot-ok marker on the serial console. Supports a private
offline Tor network via chutney.

The pure command builders (config.qemu_argv/kernel_cmdline/ssh_argv,
qemu_binary), the env parser, and drift guards that keep build_image.sh
aligned with the harness run in the normal suite — no QEMU/root/network.

The build stage needs root; harness.py primes sudo up front, keeps the
credential warm, and reclaims work-dir ownership on every exit path so
the pytest tmp cleanup never trips on root-owned files. QEMU stderr is
captured so an early exit is debuggable, and each teardown step is
fault-isolated so none masks the real error.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-21 19:12:35 +02:00
Kevin Veen-Birkenbach
6295c09b8f test(e2e): rootless Tor onion unlock end-to-end test
Opt-in via LIM_E2E_TOR=1. Generates the v3 onion keys offline exactly as
the image build does, stands up a real Tor onion service from a torrc
mirroring the baked-in one, and delivers a passphrase through Tor to a
dropbear stand-in — asserting it arrives and the endpoint "unlocks".
Needs the real tor binary and network, so it is skipped otherwise; the
offline keygen and production-flag guard run without network.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-21 19:12:35 +02:00
Kevin Veen-Birkenbach
1e711f5c96 feat(image): remote LUKS unlock via a Tor onion service in the initramfs
Encrypted image setups can now bake a Tor onion service into the initramfs
so the dropbear unlock shell stays reachable behind NAT or a dynamic IP.
When the user opts in, configure_encryption installs tor + busybox, drops
the mkinitcpio hooks (ordered `netconf tor dropbear encryptssh`), generates
the v3 onion keys offline in the image chroot, and prints the stable
.onion address. Unlock with `torsocks ssh root@<onion-address>`.

The runtime hook syncs the clock via NTP first (RTC-less boards boot at
1970, which Tor's consensus checks reject) and starts the onion service
pointing at dropbear on 127.0.0.1:22.

Hardening baked in from an adversarial review of the shipped path:
- cmdline.txt boot path (RPi4-class firmware boot) now sets the same
  ip=::::<host>:eth0:dhcp net.ifnames=0 params as the boot.txt path, so
  the initramfs actually gets a network and the onion can publish.
- the initramfs bakes in libnss_dns.so.2 so the NTP hostname resolves.
- the hook extracts DHCP DNS with sed instead of sourcing the lease files,
  which would run attacker-controlled DHCP option strings as root pre-boot.
- NTP is attempted unconditionally (bounded), not gated on DHCP-provided DNS.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-21 19:12:35 +02:00
Kevin Veen-Birkenbach
b38303b72f Release version 2.1.0
Some checks failed
tests / lint (push) Has been cancelled
tests / pytest (push) Has been cancelled
v2.1.0
2026-07-14 12:06:25 +02:00
Kevin Veen-Birkenbach
557fe159d5 Optimized Python package building 2026-07-14 12:05:08 +02:00
Kevin Veen-Birkenbach
a8c321fca1 build: rename dist to linux-image-manager, add MIRRORS
Some checks failed
tests / lint (push) Has been cancelled
tests / pytest (push) Has been cancelled
"lim" is taken on PyPI (a GLMM genomics package); linux-image-manager
is free and matches the repo name. Import package and CLI alias stay
"lim". MIRRORS follows the hetzner-arch-luks schema.
2026-07-14 11:57:02 +02:00
Kevin Veen-Birkenbach
5cf23fcdd4 Release version 2.0.0 2026-07-14 11:42:13 +02:00
Kevin Veen-Birkenbach
a9a5340ba0 chore(claude): ask on every git commit/push variant 2026-07-14 11:37:19 +02:00
Kevin Veen-Birkenbach
ccdef065df refactor!: port shell scripts to Python package
Bash scripts were untestable and duplicated device/LUKS/mount logic;
the lim/ package centralizes it behind one subprocess wrapper and a
YAML image catalog (single point of truth).

BREAKING CHANGE: scripts/*.sh removed. Use `lim --type <cmd>`; new
types mount/umount/single-boot/raid1-boot/lock/unlock/import/export
replace direct script calls. --extra is deprecated and ignored.

- distributions.yml + lim/catalog.py hold the image catalog (PyYAML)
- pytest suite: 102 tests with mocked subprocess (tests/unit) and a
  250-line max file-length guard (tests/lint)
- ruff strict (select ALL), GitHub Actions CI, Dependabot; Travis gone
- Makefile: install (symlink ~/.local/bin/lim) and test targets
- fixes over bash: SUDO_USER-aware chown, mmcblk/nvme partition paths,
  sha512 checksum support, whole-pipeline failure detection, blkid
  UUID fallback for pre-mounted images, conditional fstab seeding for
  PARTUUID/LABEL images, clean errors for missing binaries
2026-07-14 11:37:19 +02:00
Kevin Veen-Birkenbach
c420dd164d Release version 1.0.0 2026-07-14 10:19:30 +02:00
Kevin Veen-Birkenbach
509ed85fb2 chore(claude): sandbox bash, deny git push/commit 2026-07-07 09:21:59 +02:00
Kevin Veen-Birkenbach
d89a433695 Added Manjaro GNOME 25 2025-10-17 14:03:09 +02:00
Kevin Veen-Birkenbach
e60b3cf2a7 Overall optimations 2025-03-22 11:42:13 +01:00
Kevin Veen-Birkenbach
94fdcf5758 Implemented wrapper for pkgmgr and more sync for safe image transfer and manjaro gnome 24 2025-03-22 10:28:14 +01:00
Kevin Veen-Birkenbach
b4a0b50e1f Added Funding 2025-03-12 20:52:47 +01:00
Kevin Veen-Birkenbach
d613fbf262 Merge branch 'master' of github.com:kevinveenbirkenbach/linux-image-manager 2025-03-12 11:14:39 +01:00
Kevin Veen-Birkenbach
bf95ba6090 Update README.md 2025-03-12 10:49:37 +01:00
Kevin Veen-Birkenbach
7f82c6fcb9 Update README.md 2025-03-04 19:59:47 +01:00
Kevin Veen-Birkenbach
13454c7e87 Added missing keyy add 2025-02-15 12:46:40 +01:00
Kevin Veen-Birkenbach
72c4d95606 Added overview about LUKS encrypted storage devices 2025-02-15 12:03:51 +01:00
Kevin Veen-Birkenbach
3f272790d6 Update Hints 2025-02-14 15:48:01 +01:00
Kevin Veen-Birkenbach
bac3edc404 Optimized logic 2024-07-22 23:49:25 +02:00
Kevin Veen-Birkenbach
b2881c1319 Added platform 2024-07-22 23:43:02 +02:00
Kevin Veen-Birkenbach
3daed9447b Implemented automatic boot_size and .xz file management 2024-07-22 23:23:40 +02:00
Kevin Veen-Birkenbach
bd05fd4c2d Optimized setup of manjaro for raspberry pi 4 2024-07-22 22:46:02 +02:00
Kevin Veen-Birkenbach
bbb54a4237 Optimized logic for luks and implemented administrator setup 2024-07-22 21:23:03 +02:00
Kevin Veen-Birkenbach
9519b314e9 Added logic for luks memory cost 2024-07-22 17:17:37 +02:00
Kevin Veen-Birkenbach
826aa42565 Removed earlyprint 2024-07-22 02:37:59 +02:00
Kevin Veen-Birkenbach
19f5dc7178 Removed typo 2024-07-21 23:13:36 +02:00
Kevin Veen-Birkenbach
5aa8f65584 Implemented optimations for raspberry pi 4 2024-07-21 22:44:39 +02:00
Kevin Veen-Birkenbach
e37d57d569 Solved bug 2024-07-21 16:03:04 +02:00
Kevin Veen-Birkenbach
c05e804fb5 Added cleanup hints 2024-07-21 15:34:05 +02:00
Kevin Veen-Birkenbach
e40974f56d Refactored code and solved bugs 2024-07-21 15:30:17 +02:00
Kevin Veen-Birkenbach
e8581cb448 Solved replacement bug 2024-07-21 03:32:52 +02:00
Kevin Veen-Birkenbach
38a289083d Implemented search replace validation and solved password bug 2024-07-21 01:11:29 +02:00
Kevin Veen-Birkenbach
796028670f Refactored; https://chatgpt.com/share/12370808-a645-405b-bbd0-e59cf7b648c7 2024-07-20 23:21:47 +02:00
Kevin Veen-Birkenbach
265e5c6f20 Implemented count for blocks to overwrite; https://chatgpt.com/share/ac2b59af-c0f0-486f-89fe-0301d4915837 2024-07-20 22:16:51 +02:00
Kevin Veen-Birkenbach
de0090b60c Optimized logic for arch setup 2024-07-20 21:49:19 +02:00
Kevin Veen-Birkenbach
ab8b8b6e3a Optimized hints 2024-07-20 17:44:59 +02:00
Kevin Veen-Birkenbach
59f38c4089 Added correct value for raspberry pi 4 2024-07-20 17:44:12 +02:00
Kevin Veen-Birkenbach
93beadb519 Added default value for boot size partition: https://chatgpt.com/share/a27feda0-8f84-4315-95b7-686a35986a49 2024-07-20 15:14:55 +02:00
Kevin Veen-Birkenbach
c5b091e3b3 Added signature verification (untested). See AI chat: https://chatgpt.com/share/b521328b-7d7e-4b51-ae1a-9efec2f307c6 2024-07-20 12:54:04 +02:00
Kevin Veen-Birkenbach
ca6951d1fe Added md5 verification 2024-07-20 12:20:51 +02:00
Kevin Veen-Birkenbach
42e9b6bd7f Implemented manjaro for raspberry pi 2024-06-18 10:25:19 +02:00
Kevin Veen-Birkenbach
2d8a7fb3cb Implemented manjaro 22 and sha 512 check 2023-06-20 08:50:59 +02:00
Kevin Veen-Birkenbach
cd7b58d4fe Adapted physical block size and implemented new version of manjaro 2023-06-19 21:31:42 +02:00
Kevin Veen-Birkenbach
4ed8a3468d Added Android-x86 2023-06-19 18:22:58 +02:00
Kevin Veen-Birkenbach
5aae1f8a50 Updated README.md 2023-05-02 13:21:46 +02:00
Kevin Veen-Birkenbach
6e3ec5e7d0 Adapted documentary 2023-04-25 15:07:19 +02:00
Kevin Veen-Birkenbach
05ed400c32 Adapted logic for optimal blocksize 2022-10-21 15:57:42 +02:00