Files
linux-image-manager/pyproject.toml
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

70 lines
2.3 KiB
TOML

[build-system]
# 77+ for PEP 639 SPDX `license = "..."` + `license-files`.
requires = ["setuptools>=77"]
build-backend = "setuptools.build_meta"
[project]
name = "linux-image-manager"
version = "2.1.0"
description = "CLI (`lim`) for downloading, verifying and flashing Linux images, LUKS/Btrfs encrypted storage (single drive and RAID1), image backups and chroot maintenance"
readme = "README.md"
requires-python = ">=3.10"
authors = [{ name = "Kevin Veen-Birkenbach", email = "kevin@veen.world" }]
maintainers = [{ name = "Kevin Veen-Birkenbach", email = "kevin@veen.world" }]
license = "GPL-3.0-only"
license-files = ["LICENSE.txt"]
urls = { Homepage = "https://veen.world", Repository = "https://github.com/kevinveenbirkenbach/linux-image-manager" }
classifiers = [
"Environment :: Console",
"Operating System :: POSIX :: Linux",
"Programming Language :: Python :: 3",
]
dependencies = ["PyYAML>=6"]
[project.scripts]
lim = "lim.cli:main"
[tool.setuptools.packages.find]
include = ["lim*"]
[tool.setuptools.package-data]
lim = [
"distributions.yml",
"configuration/packages/**/*.txt",
"configuration/initcpio/*",
]
[tool.pytest.ini_options]
testpaths = ["tests"]
[tool.ruff]
target-version = "py310"
line-length = 100
[tool.ruff.lint]
select = ["ALL"]
ignore = [
# This tool's UI is print/prompt based and its purpose is orchestrating
# system commands — these rules contradict the design:
"T201", # print used as console UI
"S603", # subprocess without shell is exactly what runner.py wraps
"S607", # system tools are resolved via PATH on purpose
# Style choices:
"D203", # conflicts with D211 (blank line before class docstring)
"D213", # conflicts with D212 (multi-line docstring summary position)
"D1", # docstrings are not required on every symbol
"COM812", # trailing commas are handled by the formatter
"TRY003", # exception messages are written inline
"EM101", # literal exception messages are fine
"EM102", # f-string exception messages are fine
]
[tool.ruff.lint.per-file-ignores]
"tests/*" = [
"S101", # pytest asserts
"ANN", # test signatures need no annotations
"PLR2004", # literal expectations in assertions
"ARG", # fixtures are injected even when unused
"SLF001", # tests may exercise internal helpers directly
]