osresearch / safeboot

Scripts to slightly improve the security of the Linux boot process with UEFI Secure Boot and TPM support
https://safeboot.dev/
GNU General Public License v2.0
270 stars 28 forks source link

Add crude policy expression language allowing for arbitrary policy complexity #133

Closed nicowilliams closed 3 years ago

nicowilliams commented 3 years ago

From the commit message:

    This allows one to express complex policies (ones with alternations)
    using a simple language.

    The pattern is simply that conjunctions are {tpm2 policy*} command-lines
    joined with a ';' argument, and alternations are {tpm2 policyor}
    commands with arguments that are themselves policies surrounded by '('
    and ')' arguments.

    For example:

        $ sbin/tpm2-policy                                                  \
            tpm2 policyor                                                   \
                '(' tpm2 policycommandcode TPM2_CC_Sign ')'                 \
                '(' tpm2 policycommandcode TPM2_CC_RSA_Decrypt ')' ';'      \
            tpm2 policypcr -l "sha256:11"

    which allows an entity sporting such a policy to be used for signing or
    decryption only, and only when PCR#11 is cleared.

There's more there.

nicowilliams commented 3 years ago

Oops, this was supposed to be to the pxe-server branch.