installation(1)

Installation

Building, installing, loading and removing Wrong Boot and a reference for every Makefile target. Wrong Boot builds as a standard out-of-tree kernel module.

5 of 11

Requirements

  • Root on the machine. Installing, loading and removing the module need it.
  • Headers for the running kernel: linux-headers on Arch and linux-headers-$(uname -r) on Debian and Ubuntu.
  • gcc and make.
  • pahole on kernels built with BTF (Arch, Fedora and recent Ubuntu). Debian and Ubuntu ship it in dwarves. The module link fails without it.

The build reads its configuration with the kernel's own Kconfig tool (scripts/kconfig/conf). Distribution header packages ship it prebuilt and nothing else needs installing.

1. Clone the repository

$ git clone https://github.com/0x48piraj/wrong8007.git
$ cd wrong8007/

2. Build the module

Build it with every trigger:

$ make

The first build copies the default profile configs/defconfig to .config. That profile compiles in every trigger and holds no secrets.

Pick your own triggers with the menu:

$ make menuconfig

A trigger you leave out adds no code to your kernel. The menu needs a writable kernel build tree. Run it as root or point KDIR at a kernel tree you own. Editing .config by hand and running make works too. Configuration lists every option.

3. Write the parameters

Install the parameter template as a root-only file:

$ make params-init

It creates /etc/wrong8007/ with mode 0700 and the file with mode 0600. An existing file stays as it is. Fill it in:

$ sudoedit /etc/wrong8007/wrong8007.conf

Check it against your build:

$ make params-check

exec is required. The other parameters arm triggers and params-check wants at least one armed. Configuration covers the file format and every parameter. Payloads covers the executable exec points at.

4. Install and load

Install the module into the running kernel's module tree:

$ make install

Load it:

$ make load-installed

It runs params-check first and then modprobe -C /etc/wrong8007/wrong8007.conf wrong8007. A plain modprobe wrong8007 reads no parameters and the module refuses to load without exec.

The kernel log confirms it. With only a phrase set in the default profile:

$ sudo dmesg | grep wrong8007
wrong8007: keyboard trigger initialized
wrong8007: USB trigger disabled (no USB rules)
wrong8007: network trigger disabled (no network parameters)
wrong8007: loaded

Run make install again after every kernel upgrade. The module is built for one kernel version and there is no DKMS support yet.

Loading a build without installing it

For development you can load the module you just built:

$ make load

It checks the parameters and passes them to insmod on the command line. Other users can briefly read them in the process list. Keep it for test machines. make reload unloads the module and runs make load again.

Unloading and uninstalling

Unload the module:

$ make remove

It does nothing when the module isn't loaded. A real failure (a module still in use) stops it with an error.

Remove the installed module:

$ make uninstall

It unloads the module first through make remove. A module that can't be unloaded stops the uninstall before any file goes. A loaded module is never left armed with its files gone. It then removes every installed copy and refreshes the module index.

Unloading never waits for a running payload and never stops one. See design.

The companion tool

wrong8007ctl sends the network trigger's magic packet and heartbeats and lists USB devices with their IDs. Build it:

$ make -C tools

Install it to /usr/local/bin (optional):

$ sudo make -C tools install

Activation triggers shows each command in use.

Makefile reference

targetwhat it does
all, buildGenerates the configuration and builds wrong8007.ko. A profile with CONFIG_WRONG8007 off builds nothing and cleans the tree.
configTurns .config into the files the build reads. A missing .config comes from $(CONFIG). Every build runs it.
defconfigCopies $(CONFIG) to .config, regenerates and prints a summary of the profile.
menuconfig, nconfig, oldconfigThe kernel's configuration interfaces for .config. They need a writable kernel build tree. Each regenerates and validates afterwards.
validateChecks the build profile. A profile with no trigger fails.
params-initInstalls the parameter template at $(PARAMS) with mode 0600 in a 0700 directory. Never overwrites.
params-checkChecks $(PARAMS) against the build profile.
installBuilds, installs the module into the running kernel's module tree and refreshes the module index.
load-installedRuns params-check and loads the installed module with modprobe -C $(PARAMS).
loadBuilds, checks the parameters and loads the local build with insmod. Development only.
removeUnloads the module when it is loaded.
uninstallRuns remove, removes every installed copy and refreshes the module index.
reloadRuns remove and then load.
cleanRemoves build artifacts and the generated configuration files.

Variables

variabledefaultuse
KDIR/lib/modules/$(uname -r)/buildKernel build tree to build against
CONFIGconfigs/defconfigProfile that seeds .config (make defconfig CONFIG=myprofile)
PARAMS/etc/wrong8007/wrong8007.confParameter file for params-*, load and load-installed
WB_EXTRA_CFLAGSemptyExtra compiler flags for the module's own sources (CI passes -Werror)

Notes

  • Configuration without root. config runs the prebuilt conf binary from your kernel headers and writes every generated file inside the repository. It needs no write access to the kernel tree. A missing binary stops it with the command that builds one.
  • Where the module lands. Kernels before 6.3 install external modules to extra/ and later ones to updates/. A kernel built with module compression adds .zst, .xz or .gz. uninstall finds every one of them.
  • modprobe -C with a file. The kmod manual describes -C as a configuration directory. kmod has accepted a single file since version 17 (2014) and every current distribution ships a later one. A file makes modprobe read exactly what params-check validated and nothing else.

Secure Boot

The module isn't signed. A kernel that requires signed modules refuses to load it until you sign it with a key enrolled in your machine's MOK list. Secure Boot often turns that requirement on. The kernel's scripts/sign-file does the signing.

Known limitations

  • No DKMS support. Rebuild and install after every kernel upgrade.
  • Not packaged for any distribution.
  • Not signed for Secure Boot.