GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix: address reports #62–#72 (build, version, log, update hardening) by tmiland-labs · Pull Request #73 · tmiland/kernel-installer

Conversation

@tmiland-labs

@tmiland-labs tmiland-labs commented Nov 10, 2026 •
edited by tmiland
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Summary

Fixes the 11 reports from @davmonk (#62–#72) on a branch from main @ 8cbf9f2.

Security / input hardening

  • Kernel version is only checked at its start, then run through eval #63 Kernel versions are validated against a full whitelist (^[0-9]+\.[0-9]+[0-9A-Za-z.+~_-]*$) in chk_version and -k, before any run_ok eval. Still accepts 7.0.0-38-generic, 6.17.1-300.fc44.x86_64, -rc, -test, + and ~ versions.
  • --dir in a shared folder: the build folder's owner is never checked, and an existing tarball skips verification #62 prepare_install_dir creates the build dir with mkdir (no -p), refuses symlinks, non-caller-owned dirs, and group/other-writable non-sticky parents, then verifies the new dir's owner/mode. get_verified_tarball no longer treats an existing tarball as verified.
  • Checksum line is read from all of sha256sums.asc, including text outside the signed part #67 Checksum lines are read from gpgv --output (signed content only), never from text appended after the clearsigned block.
  • Tarball signing keys come from root's own keyring and are matched by substring #68 GNUPGHOME defaults to a throwaway keyring; keys are selected by exact <address> and exported by primary fingerprint, so a UID that merely contains [email protected]/[email protected] is not trusted.
  • Log in /var/log is written and renamed without checking for symlinks (/var/log is group-writable on Ubuntu) #64 Default log is /var/log/kernel-installer/kernel_installer.log in a 0700 root-owned dir. A custom LOGFILE and .1 are refused if they are symlinks, not regular files owned by root, or in a group/other-writable directory.
  • slib writes unitest.txt (and stopspinning) into the current folder as root #65 shell_has_unicode no longer writes unitest.txt; run_ok keeps its spinner stop file in a private mktemp -d directory and cleans it up.

Robustness

  • Deleting the build folder can remove the marker first (btrfs), so an interrupted cleanup blocks the next run #69 Cleanup deletes the marker last, so an interrupted delete (notably on btrfs) leaves a folder the next run can reuse.
  • No lock: a second run deletes the first run's build folder #70 flock on /run/kernel_installer.lock for install and uninstall, before log rotation. Lock failure exits directly instead of calling fatal() (which would delete the active run's build tree).
  • Debian: headers and image are installed in two apt calls, so a failure leaves headers without a kernel #71 Debian/Ubuntu headers and image are installed in one apt-get transaction, matching the existing single dnf transaction on Fedora/RHEL.

Update path

  • --update replaces the script without a checksum (and v1.3.0 has no asset to update from) #66 / --update copies the new script across filesystems, so it can be left half-written #72 --update now selects the .sh release asset explicitly, requires a SHA256SUMS asset, verifies the download before replacing the script, creates the temp file next to the script (atomic mv), and refuses a piped run (no file to replace). New .github/workflows/release.yml attaches kernel_installer.sh + SHA256SUMS on release publish and supports workflow_dispatch for backfilling v1.3.0.

Testing

  • 22/22 tests/test_*.sh pass (9 new test files; test_logging.sh updated for the new spinner behavior).
  • shellcheck kernel_installer.sh src/slib.sh scripts/update-slib.sh → exit 0.
  • bash -n clean.
  • Diff: 14 files, +1074/−89.

After merge (not in this PR)

  1. slib pin phase 2: src/slib.sh changed but SLIB_REV/SLIB_SHA256 were deliberately left untouched. Run scripts/update-slib.sh --finalize <merge commit>; piped runs keep the old pinned slib until then.
  2. Backfill release assets: dispatch .github/workflows/release.yml with tag v1.3.0 after this is on main.
  3. Log in /var/log is written and renamed without checking for symlinks (/var/log is group-writable on Ubuntu) #64 residual: /var/log itself is group-writable on Ubuntu, so a syslog-group process can still rename the 0700 subdirectory; file symlink/ownership checks are in place. Moving the default to /var/lib/kernel-installer would remove that caveat.
  4. --dir behaviour: caller-owned group-writable parents (e.g. umask 002) are refused unless sticky; the error asks for chmod g-w. This can be relaxed to reject only parents owned by another user if preferred.
  5. Watch the test-install matrix on Debian 12 / Ubuntu 22.04 for gpgv --output support.

Fixes #62
Fixes #63
Fixes #64
Fixes #65
Fixes #66
Fixes #67
Fixes #68
Fixes #69
Fixes #70
Fixes #71
Fixes #72

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
tmiland-lab Bot added 12 commits November 10, 2026 20:29
@tmiland-lab
fix: validate kernel versions and harden the build directory (tmiland#63
3810bd7
, tmiland#62, tmiland#69)

Version strings are checked against a full whitelist before they reach run_ok eval, the build directory is recreated with mkdir (no -p) and checked for symlinks/ownership shared parents, and cleanup deletes the marker last so an interrupted delete is retryable. An existing tarball is no longer trusted without verification.
@tmiland-lab
fix: take an flock before an install or uninstall (tmiland#70)
d77e7c0
A second run used to delete the first run's build folder and rotate its log. The lock is taken before rotate_log and in the uninstall path; a lock failure prints a message and exits without running fatal() (which would remove the active build tree).
@tmiland-lab
fix(debian): install headers and image in one apt transaction (tmilan…
2aa0ace
…d#71)

A failure in the second apt call used to leave headers installed for a kernel whose image never landed. Both package globs now go to a single apt-get invocation, matching the existing single dnf transaction on Fedora/RHEL.
@tmiland-lab
fix(logging): keep the log out of the group-writable /var/log root (t…
c357a08
…miland#64)

The default is now /var/log/kernel-installer/kernel_installer.log in a 0700 root-owned directory. A custom LOGFILE is refused if it is a symlink, not a regular file owned by the caller, or in a group/other-writable directory, and .1 is checked before rotation.
@tmiland-lab
fix(verify): read checksums from gpgv output, not the clearsigned file (
f3dbc43
tmiland#67)

Text appended after the signature block still yields a good gpgv signature. The checksum line is now taken from gpgv --output, which contains only the signed content; the status lines are counted from a separate file.
@tmiland-lab
fix(verify): select kernel signing keys by exact address and fingerpr…
353db65
…int (tmiland#68)

The default GNUPGHOME is now a throwaway keyring instead of root's ~/.gnupg. Keys are listed with an exact <address> match and exported by primary fingerprint, so a key whose UID merely contains [email protected] or [email protected] is not trusted.
@tmiland-lab
fix(update): verify release checksums and replace the script atomical…
90f8fef
…ly (tmiland#66, tmiland#72)

The .sh release asset is selected explicitly, a SHA256SUMS asset is required and verified before replacement, and the download is created next to the script so mv is a rename. Piped runs (no script file) are refused. A release workflow attaches kernel_installer.sh and SHA256SUMS to published releases; dispatch it with v1.3.0 to backfill the existing release.
@tmiland-lab
fix(slib): keep unicode detection and spinner files out of the caller…
74ab0b0
… cwd (tmiland#65)

shell_has_unicode no longer writes unitest.txt, and run_ok creates the spinner stop file in a private mktemp -d directory that it removes afterwards. The vendored slib changes need the usual phase-2 pin bump after this branch lands.
@tmiland-lab
fix(verify): export the temporary keyring from GNUPGHOME (tmiland#68 …
cbae41a
…regression)

The throwaway GNUPGHOME default exposed that the --export building USEKEYRING did not pass --homedir, so it read root's ~/.gnupg (empty in CI) and every distro job failed with "Could not find the expected kernel.org signing keys". Pass --homedir, point the test fakes at gpg2/gpgv2 (CI has real ones), and update the test-install log tail/artifact paths to the new default.
@tmiland-lab
fix(verify): select signing keys from a homedir, not a keyring file (t…
72783e2
…miland#68 regression)

Fedora gpg enables use-keyboxd, which makes --keyring on a file ignored for --list-keys, so the exact-address lookup failed there. List keys from a private homedir instead, import a custom USEKEYRING into one, and export the final gpgv keyrings from the same homedir. Retry the WKD locate a few times for dirmngr startup flakes, install ca-certificates for WKD, and update the README dependency list.
@tmiland-lab
fix(verify): bundle kernel.org keys with pinned fingerprints for chec…
d9aac02
…kout runs

Ubuntu 24.04 CI repeatedly failed to start dirmngr / complete WKD (TLS general error), and Fedora gpg use-keyboxd ignores keyring files. Checkout runs now import the public keys from src/keys/kernel.org.asc into a private homedir and require the pinned Torvalds/GregKH/autosigner fingerprints; piped runs keep the WKD fallback with retries. A custom USEKEYRING is imported into a homedir and checked against the same fingerprints. Tests cover the bundle, pin check, exact selection, and private-key absence.
@tmiland-lab
fix(verify): keep temporary GnuPG homes under /tmp (tmiland#68 long-p…
be7fdcf
…ath regression)

The Ubuntu 24.04 job is the only one using --dir ki-build, which put the verification TMPDIR (and therefore the gpg homedir) at 124 characters. gpg-agent sockets have a ~108-character path limit, so importing the bundled keys failed there. Create a private mktemp -d under ${GPG_TMPDIR:-/tmp}, use it for the bundled/custom/WKD homedirs, and remove it on success or verify_fail.
@tmiland
tmiland merged commit e6d7da7 into tmiland:main Nov 10, 2026
14 checks passed

Uh oh!

There was an error while loading. Please reload this page.

tmiland pushed a commit that referenced this pull request Nov 10, 2026
@tmiland-lab
chore: pin slib to e6d7da7
40cdd2d
Phase 2 after #73. The pinned raw URL was verified to serve sha256 694784527d354eb264df24e399a693124fe0df6cb5037a7af218677772cf47c5.

[skip ci]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

--update replaces the script without a checksum (and v1.3.0 has no asset to update from) slib writes unitest.txt (and stopspinning) into the current folder as root Log in /var/log is written and renamed without checking for symlinks (/var/log is group-writable on Ubuntu) Kernel version is only checked at its start, then run through eval --dir in a shared folder: the build folder's owner is never checked, and an existing tarball skips verification
Checksum line is read from all of sha256sums.asc, including text outside the signed part Tarball signing keys come from root's own keyring and are matched by substring Deleting the build folder can remove the marker first (btrfs), so an interrupted cleanup blocks the next run No lock: a second run deletes the first run's build folder Debian: headers and image are installed in two apt calls, so a failure leaves headers without a kernel

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@tmiland-labs @tmiland
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.