A minimal initrd implementation using aria2 for downloading files during the early boot process. This project is designed for environments where fetching large files (e.g., container images or boot configurations) from remote sources is essential.
- Containerized Build Process: Uses a Docker container to ensure a consistent and reproducible build environment.
- Efficient File Downloads: Utilizes aria2, a lightweight and high-performance download utility supporting HTTP(S), FTP, and BitTorrent protocols.
- Lightweight Design: Aimed at minimal environments, keeping the initrd as small as possible.
- Highly Configurable: Supports passing custom download URLs and options through kernel parameters.
- Parallelism: Leverages aria2's ability to perform concurrent downloads for faster bootstrapping.
- TPM Attestation Support: Verifies the integrity of the boot process using TPM-based attestation.
- HPC Cluster Bootstrapping: Fetching configuration files or images for stateless node setups.
- Diskless Systems: Loading operating system components or tools directly into memory.
- Custom Deployment Workflows: Downloading initialization resources for custom boot environments.
- Secure Boot Environments: Ensuring integrity with TPM attestation.
- Docker installed on your system.
A pre-built container image is available on GitHub Container Registry (GHCR) to simplify the initrd building process.
-
Pull the pre-built container:
docker pull ghcr.io/openchami/aria2-initrd:latest
-
Run the container to build the initrd:
docker run --rm -v "$(pwd)/output:/workspace/output" ghcr.io/openchami/aria2-initrd:latestThe generated
initrd.imgwill be located in theoutput/directory. -
Customize the kernel command line to include download parameters and attestation settings:
initrd=initrd.img url=http://example.com/resource1,http://example.com/resource2 tpm_attestation=1 attestation_server=http://attestation.example.comReplace
http://example.com/resourceXwith the URLs of the files you want to download and provide the appropriate attestation server URL.
Comma-separated list of URLs to download. Example:
url=http://example.com/file1,http://example.com/file2
Optional. Directory where files will be stored. Defaults to /tmp.
Optional. Custom aria2 options passed directly to the downloader. Example:
aria2_options="--max-concurrent-downloads=4 --timeout=60"
Optional. Enables TPM-based attestation when set to 1. Example:
tpm_attestation=1
Required if tpm_attestation=1. Specifies the server to which TPM attestation data will be sent. Example:
attestation_server=http://attestation.example.com
Allows specifying kernel parameters for the next boot phase.
Example:
next_kernel_params="url=http://example.com/new-initrd.img new_param=value quiet"
During the boot process, the initrd will:
- Parse
next_kernel_paramsfrom the kernel command line. - Pass these parameters to the next kernel during the next boot phase, enabling workflows such as:
- Stateless Systems: Dynamically configure the next kernel boot.
- Multiphase Boot Scenarios: Apply different parameters for subsequent boot phases.
- Parse kernel parameters (
tpm_attestationandattestation_server). - Initialize TPM and generate cryptographic keys.
- Collect PCR values and create a nonce for the attestation process.
- Generate a TPM quote and send it along with the attestation data to the specified
attestation_server. - If the server responds with "OK", the boot process continues. Otherwise, the system halts.
Use QEMU or another virtualization platform to test the generated initrd:
qemu-system-x86_64 -kernel /path/to/vmlinuz -initrd output/initrd.img -append "url=http://example.com/resource"-
Run QEMU with attestation parameters:
qemu-system-x86_64 -kernel /path/to/vmlinuz -initrd output/initrd.img -append "tpm_attestation=1 attestation_server=http://attestation.example.com" -
Verify the attestation server receives the TPM quote and responds appropriately.
This project is licensed under the MIT License.
- Inspired by the flexibility and power of
aria2. - Designed with HPC cluster bootstrapping, secure deployments, and custom workflows in mind.