GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing wiki.netbsd.org — Full Disk Encryption
NetBSD Wiki/security/
Full Disk Encryption
NetBSD supports full disk encryption with cgd(4). Disk encryption prevents disclosure of secrets stored on encrypted partitions while the machine is powered off in the event of theft, or if you recycle the disk later. With partial disk encryption, e.g. encrypting just the /home partition but not the / partition in a laptop's internal disk, there may be some secrets stored in unencrypted parts of the disk, such as wifi keys in /etc/wpa_supplicant.conf, IPsec keys in /etc/ipsec.conf or /etc/racoon/psk.txt, or hashed passphrases in /etc/master.passwd. Full disk encryption covers the whole disk, including the / partition. The mechanism described here still requires one unencrypted partition to boot from. This partition can be on a removable medium such as a USB flash drive, which can be removed after boot. Note: Disk encryption does not defend against tampering with a disk. See also the NetBSD Guide chapter on disk encryption. The boot process
The boot partition on disk must contain:
Additionally, there must be a config partition, which is either named
The The boot partition and the config partition may be one and the same, either wd0a or ld0a—this way, you can just use the first partition of a disklabel-formatted internal ATA disk (wd0a) or NVME module (ld0a). Alternatively, you can use a GPT-formatted disk with separate boot and In practice the memory disk remains the real root, and the regular system is
really run from a chroot in Obtaining the ramdiskThe Configuring the ramdiskThe ramdisk needs to be available in the boot partition, alongside the desired kernel. The bootloader configuration in menu=Boot normally:rndseed /etc/entropy-file;fs /ramdisk-cgdroot.fs;boot /netbsd.gz Building the ramdiskThe ramdisk can be compiled from the source tree for the NetBSD base system, once the distribution has been built. Change to the src/distrib/amd64/ramdisks/ramdisk-cgdroot$ /path/to/tooldir/bin/nbmake-amd64
[...]
create ramdisk-cgdroot/ramdisk-cgdroot.fs
Calculated size of `ramdisk-cgdroot.fs.tmp': 5120000 bytes, 85 inodes
Extent size set to 4096
ramdisk-cgdroot.fs.tmp: 4.9MB (10000 sectors) block size 4096, fragment size 512
using 1 cylinder groups of 4.88MB, 1250 blks, 96 inodes.
super-block backups (for fsck -b #) at:
32,
Populating `ramdisk-cgdroot.fs.tmp'
Image `ramdisk-cgdroot.fs.tmp' complete
CaveatsThe biggest (known) issue with this setup occurs when firmware needs to be loaded early in the boot process (such as graphics drivers for the console). At the moment they need to be provided as part of the memory disk. Some network interfaces, of which some wireless devices in particular, also require loading firmware to work properly. Firmware that can be loaded later (e.g. microcode in It is also possible to boot a Xen DOM0 system with full disk encryption. However, Xen-enabled NetBSD kernels currently do not support loading ramdisks at boot-time. The memory disk has to be placed directly inside the kernel instead (with mdconfig(8) or a new kernel configuration). It should really be possible to install NetBSD this way with sysinst(8). Unfortunately this is not supported yet. Customized Boot and unlocking via pkgsrc toolsIt is relatively straight forward to customize the ramdisk contents and set up a different process to unlock the cgd root via for example tools form pkgsrc and a FIDO key. References
Last edited late Sunday night, July 20th, 2026
Preferences | Logout
|
| You are visitor 01402503 — 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. |