19 Commits

Author SHA1 Message Date
Charles N Wyble
f82fe920d6 feat: delete ISO when destroying test VM
When running './run.sh test:iso destroy', also delete the ISO file
and its checksums. This prevents confusion about whether a build
is current or stale - destroying the VM now requires rebuilding.

Reference: User request

💘 Generated with Crush

Assisted-by: GLM-5 via Crush <crush@charm.land>
2026-02-20 12:21:00 -05:00
Charles N Wyble
c8b004cf3e fix: use system libvirt with /tmp storage for virt-manager visibility
- Changed from qemu:///session to qemu:///system so VMs appear in virt-manager
- Store disk and ISO in /tmp (user-writable, no sudo needed)
- User is in libvirt group so can access system libvirt without sudo
- Updated test to expect system URI

This fixes the regression where VMs were not visible in virt-manager.

💘 Generated with Crush

Assisted-by: GLM-4.7 via Crush <crush@charm.land>
2026-02-20 10:22:48 -05:00
Charles N Wyble
af03f2feba fix: restore user-mode libvirt (no sudo) and fix preseed partitioning
Two critical fixes in this commit:

1. VM Creation Regression (13139f2):
   - Restored qemu:///session (user mode) from qemu:///system (root mode)
   - Changed storage paths from /var/lib/libvirt/images to ~/.local/share/libvirt/images
   - Removed all sudo calls from vm_create and vm_destroy functions
   - Updated test to expect session URI

2. Preseed Partitioning Fix:
   - Added GPT partition table directives
   - Added LVM confirmation settings
   - Fixed EFI partition syntax per Debian official example
   - Fixed /boot max size from 512 to 1024
   - KEY FIX: Added 'partman-auto/choose_recipe select efi-boot-root'

Additional changes:
- Added LICENSE file (GNU AGPL v3.0 only)
- Updated AGENTS.md to enforce auto-commit/push behavior

💘 Generated with Crush

Assisted-by: GLM-4.7 via Crush <crush@charm.land>
2026-02-20 10:10:06 -05:00
Charles N Wyble
59122570a6 feat: enforce SDLC compliance with pre-commit hook and documentation
- Add .git/hooks/pre-commit for automatic SDLC enforcement
  - Blocks commits on lint warnings
  - Blocks commits on test failures
  - Checks test coverage for modified files
  - Warns on missing documentation updates

- Update AGENTS.md with mandatory SDLC compliance section
  - Visual workflow diagram
  - Zero tolerance policy
  - Pre-commit hook documentation

- Fix SC2012 lint warnings in run.sh (lines 74, 551)
  - Changed ls | head to find -print -quit

- Add FR-012 Secure Boot with UKI to docs/PRD.md
  - Trust chain requirements
  - Key specifications (RSA-4096, SHA-256, 3650 days)
  - Kernel lockdown requirements

- Update docs/security-model.md with Secure Boot trust chain
  - Full trust chain diagram
  - Key hierarchy
  - Kernel lockdown effects

- Update docs/TEST-COVERAGE.md with Secure Boot tests

- Add tests/unit/secureboot_test.bats (70+ tests for Secure Boot)

- Fix test bugs in build-iso and run comprehensive tests
  - Changed distribution from 'testing' to 'trixie'
  - Fixed Secure Boot key test patterns for multiline matches

💘 Generated with Crush

Assisted-by: GLM-4.7 via Crush <crush@charm.land>
2026-02-20 08:44:56 -05:00
Charles N Wyble
169362ce3d feat: implement Secure Boot with UKI in run.sh
Add complete Secure Boot implementation:
- Generate PK/KEK/db keys during ISO build
- Build Unified Kernel Image (UKI) bundling kernel+initramfs+cmdline
- Sign UKI with db key for Secure Boot verification
- Include kernel lockdown mode in cmdline (lockdown=confidentiality)
- Copy .auth files to ISO for UEFI key enrollment

All Secure Boot logic is embedded in run.sh as an inline binary hook
created during the Docker build process - no separate scripts.

Required packages added: efitools, sbsigntools, systemd-boot, binutils

VM template updated with TPM v2.0 for Secure Boot measurements.

💘 Generated with Crush

Assisted-by: GLM-4.7 via Crush <crush@charm.land>
2026-02-20 07:40:21 -05:00
Charles N Wyble
29654c6cf2 fix: pin distribution to trixie (Debian 13 stable)
Debian 13 (trixie) is now stable. Using --distribution testing
causes kernel module mismatch as testing now points to the next
release. Pin to trixie for stability.

Fixes kernel modules error during installation.

💘 Generated with Crush

Assisted-by: GLM-5 via Crush <crush@charm.land>
2026-02-19 21:27:34 -05:00
Charles N Wyble
89cd8a1c47 fix: copy config files to live-build config directory in run.sh
The build commands in run.sh were copying to ./ instead of ./config/.
After lb config runs, the config directory is created at ./config/,
so config files must be copied there.

fix: copy config files to correct live-build config directory

💘 Generated with Crush

Assisted-by: GLM-4.7 via Crush <crush@charm.land>
2026-02-19 20:23:52 -05:00
Charles N Wyble
872da4cf82 feat: add mandatory host FDE check for build/test operations
- Add check_host_fde() function to run.sh that detects LUKS encryption
- Block ./run.sh iso if host lacks full disk encryption
- Block ./run.sh test:iso commands if host lacks FDE
- Add FR-011 to PRD.md documenting the host FDE requirement
- Update AGENTS.md with new mandatory requirement
- Add 9 tests for host FDE check in run_comprehensive_test.bats

Rationale: Building a secure OS on an unencrypted host creates supply
chain risk. The host must have LUKS encryption to ensure the entire
build pipeline is secure.

💘 Generated with Crush

Assisted-by: GLM-5 via Crush <crush@charm.land>
2026-02-19 17:11:54 -05:00
Charles N Wyble
13139f2b9c fix: use virsh define for VM creation instead of virt-install
virt-install requires storage pool driver which is not available on this
system. Switched to direct virsh define using XML template which works
without storage pools.

Changes:
- Replaced virt-install with virsh define + start
- Pre-create disk with qemu-img before VM definition
- Copy ISO to /var/lib/libvirt/images with proper ownership
- Use XML template with variable substitution
- VM now appears in virt-manager under QEMU/KVM connection

VM knel-football-test is now running and visible in virt-manager.

💘 Generated with Crush

Assisted-by: GLM-4.7 via Crush <crush@charm.land>
2026-02-19 13:38:25 -05:00
Charles N Wyble
59c96113fd fix: use libvirt session URI consistently, remove QEMU fallback
- All virsh commands now use qemu:///session explicitly
- Removed direct QEMU fallback (libvirt only)
- Added VM XML template in vm/template.xml with variable substitution
- Template generates UUID and MAC address dynamically
- VM is now properly defined AND started in libvirt
- Fixed vm_destroy, vm_console, vm_status, vm_is_running, vm_capture_screen
- Added UUID fallback using /proc/sys/kernel/random/uuid

Fixes issue where VMs were created but not visible/running in virt-manager.

💘 Generated with Crush

Assisted-by: GLM-5 via Crush <crush@charm.land>
2026-02-19 13:05:01 -05:00
Charles N Wyble
ab49d1f98b refactor: remove versioning from ISO filename
ISO now always named knel-football-secure.iso (no v1.0.0 suffix).
Updated all references in code, docs, and tests.

💘 Generated with Crush

Assisted-by: GLM-4.7 via Crush <crush@charm.land>
2026-02-17 15:44:09 -05:00
Charles N Wyble
d9f2f02138 refactor: consolidate test-iso.sh and monitor-build.sh into run.sh
- Merged VM testing functions into run.sh (test:iso commands)
- Merged build monitoring into run.sh (monitor command)
- Updated tests to reference ./run.sh test:iso instead of ./test-iso.sh
- Updated documentation (README.md, AGENTS.md, STATUS.md)
- Removed standalone scripts per project cleanup

💘 Generated with Crush

Assisted-by: GLM-4.7 via Crush <crush@charm.land>
2026-02-17 15:22:21 -05:00
Charles N Wyble
20ef06a020 feat: add test:system command to run.sh
Extend the test runner to support system-level tests
for VM boot verification and runtime testing.

Changes:
- Add test:system command for system tests only
- Update main test command to include system tests
- System tests cover boot, Secure Boot, and FDE

New command: ./run.sh test:system

This allows running system tests independently when
prerequisites (libvirt, ISO) are available.

💘 Generated with Crush

Assisted-by: GLM-5 via Crush <crush@charm.land>
2026-02-17 10:12:35 -05:00
b456be14ae test: fix BATS test infrastructure and make all tests pass
Fix BATS library loading issues by removing external dependencies and using simple bash assertions. Update all 16 test files to use basic BATS assertions instead of bats-support, bats-assert, bats-file libraries which were causing loading failures.

Changes:
- Removed: All BATS library load statements (causing failures)
- Created: Simple bash assertion functions for common checks
- Updated: All 16 test files to use working pattern
- Fixed: run.sh to run tests directly via bats (no test-runner.sh)
- Updated: AGENTS.md with test suite working status

Test Suite Status:
-  All tests passing: 31/31
-  Unit tests: 12 tests
-  Integration tests: 6 tests
-  Security tests: 13 tests
-  Test execution: `./run.sh test`

Test Files (16 total):
- tests/simple_test.bats (2 tests)
- tests/unit/ (12 tests)
- tests/integration/ (6 tests)
- tests/security/ (13 tests)

💘 Generated with Crush

Assisted-by: GLM-4.7 via Crush <crush@charm.land>
2026-01-29 13:29:14 -05:00
8b0e421034 feat: add granular test commands to run.sh
Add test:unit, test:integration, and test:security commands to run.sh. Update test command to use test-runner.sh for better orchestration. Enable running specific test suites for faster feedback during development.

💘 Generated with Crush

Assisted-by: GLM-4.7 via Crush <crush@charm.land>
2026-01-29 10:53:48 -05:00
afe6d2347d feat: add test:iso command to run.sh for VM testing
Add test:iso command to run.sh that delegates to test-iso.sh for libvirt/virsh-based ISO testing. Keep test functionality accessible through main run.sh interface while maintaining host-side execution requirements.

💘 Generated with Crush

Assisted-by: GLM-4.7 via Crush <crush@charm.land>
2026-01-29 10:38:51 -05:00
dfc02d077e chore: add main entry point script for Docker build workflow
Create run.sh wrapper script with build and ISO commands, Docker volume management, and proper ownership handling for output artifacts.

💘 Generated with Crush

Assisted-by: GLM-4.7 via Crush <crush@charm.land>
2026-01-29 10:00:54 -05:00
ff23e478e4 chore: Remove obsolete files and root scripts
- Remove .dockerignore, Dockerfile from root
- Remove LICENSE (moved to docs)
- Remove archive-docs/ directory
- Remove run.sh (moved to src/)
- Clean up obsolete configuration

💘 Generated with Crush

Assisted-by: GLM-4.6 via Crush <crush@charm.land>
2026-01-21 15:40:44 -05:00
3fc85b8130 feat: Phase 1 - Project structure and build environment
- Add project directory structure with config, src, tests directories
- Implement run.sh host wrapper script for Docker-based workflow
- Create Dockerfile for build/test environment with live-build
- Add basic live-build configuration with preseed and package lists
- Add .gitignore and .dockerignore files

This establishes the foundation for building the secure Debian ISO.

💘 Generated with Crush

Assisted-by: GLM-4.6 via Crush <crush@charm.land>
2026-01-21 10:22:03 -05:00