Hi Shawn,
Sorry for the delay. Here are some inline answers to your inline
questions. In short: removing 'geom_eli_load="YES"' from loader.conf
fixes the double prompt issue.
> My response is largely inline. Could you please show us how your zfs
> pool is sconfigured by using `zpool status`? Do you have any other
> geli-encrypted disks?
Here is the output of `zpool status`. The ZFS pool hosting the root fs
comprises 2 mirrored drives. These are the only drives of the system.
pool: zroot
state: ONLINE
scan: none requested
config:
NAME STATE READ WRITE CKSUM
zroot ONLINE 0 0 0
mirror-0 ONLINE 0 0 0
ada0p3.eli ONLINE 0 0 0
ada1p3.eli ONLINE 0 0 0
errors: No known data errors
> Note that full-disk encryption on 11-STABLE isn't truly full-disk
> encryption. Prior to 12-CURRENT, FreeBSD requires an unencrypted boot
> pool that contains the kernel and its modules.
Yes, the separate boot pool was mandatory in previous versions of
FreeBSD, but are you sure that 11-STABLE is still relying on it? I ran
all encryption tests on fresh instances of HardenedBSD 11-STABLE, and
the installer only created a single encrypted pool, as shown by the
output of the `zpool status`, above. There is no separate boot pool;
only a geom mirror for mirrored swap.
> > 2. Use the bsdinstall wizard to set up root on ZFS with GELI
> > encryption
> >
> > 3. Boot from the new installation.
> >
> > 4. Enter the passphrase when the loaded asks for it. It will
> > decrypt
> > GELI volumes, and report the following non-fatal error:
> >
> > failed to read pad2 area from primary vdev
>
> I've gotten this error, too. It seems safe to ignore.
Yes, this is also my conclusion; it seems related to the new
zfsbootcfg(8) utility. The error is not shown on FreeBSD 11.1-RELEASE
or 12-CURRENT, though.
>
> >
> > This message is not shown when one boots from a similar, fresh
> > install
> > of FreeBSD 11.1-RELEASE.
>
> Have you tried FreeBSD 12-CURRENT?
Yes, a few minutes ago. I just installed FreeBSD 12-CURRENT (r328383)
on an identical setup (root on ZFS mirror + GELI). It boots normally,
i.e.:
- GELI Passphrase is asked once by the boot loader (before showing
the boot menu)
- No 'pad2 area' error
- No module loading error from the kernel
- No need to enter the passphrase twice
> > [1] can't re-use a leaf (geom_eli)!
> > [1] module_register: cannot register g_eli from kernel; already
> > loaded
> > from geom_eli.ko
> > [1] Module g_eli failed to register: 17
>
> I've seen that before, too. It also seems safe to ignore.
Yes, that's what Oliver wrote in a previous message. This is because
GELI is included by default in the HARDENEDBSD kernel, thus trying to
load it a second time as a module leads to failure. Removing the line
from loader.conf resolves the issue, and also the second passphrase
prompt.
> >
> >
> > 9. If you enter the passphrase a second time, the boot process
> > completes normally.
>
> This can happen depending on the zfs pool configuration, hence why I
> asked for it above. If you have a second disk as a mirror vdev, for
> example, the system will prompt for the password for the second disk
> (even though the password is the same as the first disk).
Removing 'geom_eli_load="YES"' from loader.conf fixes the issue.
Now that the main issue is fixed, I have two more questions:
1. If GELI is included by default in the HardenedBSD kernel instead of
being provided as a separate module, shouldn't the version of
bsdinstall(8) shipped with HardenedBSD be amended to avoid adding a
'geom_eli_load="YES"' entry to loader.conf?
2. Tring to load GELI as a module when it is hardwired in the kernel
throws an error. So far, so good. However, it also leads the kernel to
dismiss any passphrase supplied earlier in the boot process, hence the
double prompt. Do you know if this is a bug or a security feature?
Thanks!
Marin