Re: [systemd-devel] Fedora 38 and signed PCR binding

2023-11-17 Thread Dan Streetman
On Sat, Nov 11, 2023 at 5:10 PM Aleksandar Kostadinov
 wrote:
>
> On Thu, Oct 12, 2023 at 1:14 AM Dan Streetman  wrote:
> > On Sun, Oct 8, 2023 at 8:09 AM Aleksandar Kostadinov  
> > wrote:
> > ...
> > > Here's what I did:
> > > > sudo systemd-cryptenroll --wipe-slot=tpm2 --tpm2-device=auto 
> > > > --tpm2-public-key-pcrs=11 /dev/sda3
> >
> > This probably isn't what you want, because you're specifying
> > --tpm2-public-key-pcrs= but not --tpm2-public-key=, so the
> > --tpm2-public-key-pcrs= doesn't actually do anything (it should
> > probably either fail or at least print a warning).
>
> in man pages I see:
> --tpm2-public-key= option accepts a path to a PEM encoded RSA
>public key, to bind the encryption to. If this is not specified
>explicitly, but a file tpm2-pcr-public-key.pem exists in one of the
>directories /etc/systemd/, /run/systemd/, /usr/lib/systemd/
>(searched in this order), it is automatically used.
>
> I do have such a file.

ah ok, yeah that should be fine then.

>
> > Since you didn't specify --tpm2-pcrs=, it will default to use only
> > PCR7, using the current value (at the time you ran
> > systemd-cryptenroll).
>
> I specify --tpm2-public-key-pcrs=11, should I specify also
> --tpm2-pcrs? I don't want to bind to plain PCRs.

If you don't specify --tpm2-pcrs= at all, it will bind to PCR 7, even
if you bind to a signature as well (at least this is the current
behavior).

If you want to bind only to a signature, you should use --tpm2-pcrs=""
(i.e. empty string) to prevent binding to PCR 7.

This is probably not the most intuitive default behavior, which we
might want to change...

>
> > Just for testing, can you try:
> > sudo systemd-cryptenroll --tpm2-device=auto --tpm2-pcrs="" /dev/sda3
> >
> > That will enroll your tpm with *no* pcr values, so it should always
> > successfully unlock your volume using the tpm (note, you probably
> > don't want to do this other than for testing). Then see if it uses the
> > tpm to unlock the volume on boot. If so, you just need to get the
> > specific PCR parameters correct (and make sure to supply your PEM
> > public key to systemd-cryptenroll using --tpm2-public-key=), and
> > provide the correct signature.
>
> This is a nice check actually. And in fact it does not open the volume
> automatically. Which is super strange. As it worked with the normal
> grub based boot process.
>
> sudo systemd-cryptenroll --wipe-slot=tpm2 --tpm2-device=auto
> --tpm2-pcrs= /dev/sda3
> then removed `tpm2-measure-pcr=yes` from /etc/crypttab, then
> `dracut-f` and finally `ukify ..` with the exact same arguments as
> before.
>
> Did I miss something?

let's try manually unlocking it just to make sure the enrollment was
ok, so after enrolling it try:

systemd-cryptsetup test /dev/sda3 - tpm2-device=auto,headless=true

(you don't need headless=true, that only skips asking you for the luks
password if the tpm unlocking didn't work)

that should unlock the luks device and create the /dev/mapper/test
device. if that doesn't work, then there's some problem with the tpm
enrollment into your luks device. if it does work, then the problem is
with your boot setup. my guess would be you aren't building the initrd
with all the right bits needed to unlock it (you'll probably have to
manually add in some crypt modules to the dracut call)

>
> Strange is that in `journalctl -b` I still see "Couldn't find
> signature for this PCR bank, PCR index and public key." So I wonder
> what could be broken and how to fix it. How to inspect the initrd
> inside the UKI?

well you built the initrd before running ukify, so just take a look at
it before you build the uki

>
> <...>
>


Re: [systemd-devel] Does coredumpctl info support minidebuginfo / gnu_debugdata ?

2023-11-17 Thread Lennart Poettering
On Do, 16.11.23 18:37, Etienne Cordonnier (ecordonn...@snap.com) wrote:

> Hello,
> I am testing a yocto based system, where it seems that "coredumpctl info"
> isn't able to use minidebuginfo / gnu_debugdata to extract a symbolized
> call-stack. I saw in the code that coredumpctl uses elfutils / libdwfl in
> order to extract a call-stack, and as far as I understand libdwfl supports
> minidebuginfo since this commit (
> https://sourceware.org/git/?p=elfutils.git;a=commit;h=5083a70d3b64946fa47ea5766943a15a3ecc6891
> ).
>
> Is there a configuration / build-option / etc. to enable support for
> minidebuginfo in coredumpctl? If no is it on the roadmap? The advantage of
> minidebuginfo is that it is much smaller than full debug symbols.

Fedora has been using minidebuginfo since ~10y or so, and
coredumctl/libdwfl has been working fine with it. So it certainly
works, it's how this all works on my local machine since forever.

Maybe ask your distro for help, it's generally an integration issue of
distributions i this doesn't work.

Lennart

--
Lennart Poettering, Berlin