On Wed, Jun 03, 2020 at 12:27:00AM +0100, Chris Narkiewicz wrote:
[...]
> My setup consist of OpenBSD 6.7 with full drive encryption using
> softraid, configured as described in FAQ:
> 
> /dev/sd0a - encrypted volume
> /dev/sd1 - decrypted 
> 
> I have additional need to mount an encrypted /var volume on boot.
> This volume is separate drive attached to be VPS "machine".
> 
> I want to mount this drive automatically on boot by adding
> relevant entries to /etc/fstab, but before this can be done,
> softraid device must be configured using bioctl.
> 
[...]
> 
> Somebody on StackOverflow advised on modifying /etc/rc
> and run bioctl before disks are mounted, but I'm not sure
> if this is a right approach, especially that attaching
> more disks might change the /dev/sd* numberign.

Don't modify /etc/rc itself.
rc(8): "Normally, rc.local contains commands and daemons that are not
part of the stock installation."

I don't fully understand your question, but I used to have an rc.local
to allow using /home from an encrypted USB drive that got loaded from
rc.local. I'm not endorsing this as a great solution, but  maybe this
will serve as inspiration for you to come up with your own method.

/etc/rc.local (REPLACE <duid> with your disk's DUID):
# CRYPTO_DEV assumes that home is on the k partition of a disk with the DUID 
<duid>.
CRYPTO_DEV=`sysctl hw.disknames | sed -n -E "s/.*(sd[0-9]{1,2}):<duid>.*/\1/p"`
fsck -y /dev/r${CRYPTO_DEV}k
mount -o softdep,nodev,nosuid <duid>.k /home

Attachment: signature.asc
Description: PGP signature

Reply via email to