• Mickaël Salaün's avatar
    certs: Allow root user to append signed hashes to the blacklist keyring · 6364d106
    Mickaël Salaün authored
    Add a kernel option SYSTEM_BLACKLIST_AUTH_UPDATE to enable the root user
    to dynamically add new keys to the blacklist keyring.  This enables to
    invalidate new certificates, either from being loaded in a keyring, or
    from being trusted in a PKCS#7 certificate chain.  This also enables to
    add new file hashes to be denied by the integrity infrastructure.
    
    Being able to untrust a certificate which could have normaly been
    trusted is a sensitive operation.  This is why adding new hashes to the
    blacklist keyring is only allowed when these hashes are signed and
    vouched by the builtin trusted keyring.  A blacklist hash is stored as a
    key description.  The PKCS#7 signature of this description must be
    provided as the key payload.
    
    Marking a certificate as untrusted should be enforced while the system
    is running.  It is then forbiden to remove such blacklist keys.
    
    Update blacklist keyring, blacklist key and revoked certificate access
    rights:
    * allows the root user to search for a specific blacklisted hash, which
      make sense because the descriptions are already viewable;
    * forbids key update (blacklist and asymmetric ones);
    * restricts kernel rights on the blacklist keyring to align with the
      root user rights.
    
    See help in tools/certs/print-cert-tbs-hash.sh .
    
    Cc: David Howells <dhowells@redhat.com>
    Cc: David Woodhouse <dwmw2@infradead.org>
    Cc: Eric Snowberg <eric.snowberg@oracle.com>
    Cc: Jarkko Sakkinen <jarkko@kernel.org>
    Signed-off-by: default avatarMickaël Salaün <mic@linux.microsoft.com>
    Link: https://lore.kernel.org/r/20210712170313.884724-6-mic@digikod.netReviewed-by: default avatarJarkko Sakkinen <jarkko@kernel.org>
    Tested-by: default avatarJarkko Sakkinen <jarkko@kernel.org>
    Signed-off-by: default avatarJarkko Sakkinen <jarkko@kernel.org>
    6364d106
blacklist.c 8.9 KB