DragonFlyBSD Kernel Audit
DF-2698 / setup.sh
← back to finding ↓ download raw
#!/bin/sh
# DF-2697 + DF-2698 root-side guest setup.
# - creates POSIX mqueue /svgidtest (root:wheel 0660) with umask 0
# - installs /gdrop (setgid wheel) and /gdrop_plain (control)
# - creates a 1G sparse image, vnconfig vn0, newfs_hammer, mounts /hmnt
#   with a long visible-flag string
# - compiles the PoCs (as maxx, into /tmp)
# Run:  vm.sh run_root 'sh /root/df_setup.sh'
set -e
cd /tmp

umask 000
/tmp/mqcreate

cp /tmp/gdrop /gdrop && chown root:wheel /gdrop && chmod 2755 /gdrop
cp /tmp/gdrop /gdrop_plain && chown root:wheel /gdrop_plain && chmod 755 /gdrop_plain

dd if=/dev/zero of=/h.img bs=1m count=0 seek=1024 2>/dev/null
vnconfig -c -T -S 1g /dev/vn0 /h.img
newfs_hammer -f -L leakfs /dev/vn0 >/dev/null
mkdir -p /hmnt
mount -t hammer /dev/vn0 /hmnt
mount -u -o noatime,noexec,nosuid,nosymfollow,nodev,noclusterr,noclusterw /hmnt
mount | grep hmnt
echo SETUP-OK