DragonFlyBSD Kernel Audit
DF-2940 / setup.sh
← back to finding ↓ download raw
#!/bin/sh
# DF-2940 setup: build a dm-crypt volume on a vn(4) memory-backed disk.
# Run as root on the DF guest.
set -x
kldload dm 2>/dev/null
kldload dm_target_crypt 2>/dev/null
kldstat | grep -E 'dm|crypt'

dd if=/dev/urandom of=/root/img bs=1m count=64 2>/dev/null
ls -l /root/img

vnconfig -c -S 64m -T vn0 /root/img || vnconfig -c vn0 /root/img
ls -l /dev/vn0

# 64 MB = 131072 sectors; aes-256-cbc with plain IV generator
dmsetup create vol --table "0 131072 crypt aes-cbc-plain 0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef 0 /dev/vn0 0"
dmsetup ls
dmsetup table
ls -l /dev/mapper/