diff --git a/efi/preinstall/preinstall_test.go b/efi/preinstall/preinstall_test.go index 40102cfc..06214fbe 100644 --- a/efi/preinstall/preinstall_test.go +++ b/efi/preinstall/preinstall_test.go @@ -45,16 +45,20 @@ var ( //go:embed testdata/MicrosoftUefiCA2023.crt msUefiCACert2023PEM []byte + //go:embed testdata/MicrosoftOptionROMUefiCA2023.crt + msOptionROMUefiCACert2023PEM []byte + //go:embed testdata/shim-signed_1.54+15.7-0ubuntu1_amd64_latest.pk7 shimUbuntuSig4PEM []byte //go:embed testdata/PkKek-1-snakeoil.pem snakeoilCertPEM []byte - msUefiCACert []byte - msUefiCACert2023 []byte - shimUbuntuSig4 []byte - snakeoilCert []byte + msUefiCACert []byte + msUefiCACert2023 []byte + msOptionROMUefiCACert2023 []byte + shimUbuntuSig4 []byte + snakeoilCert []byte ) func init() { @@ -62,6 +66,7 @@ func init() { msUefiCACert = testutil.MustDecodePEMType("CERTIFICATE", msUefiCACertPEM) msUefiCACert2023 = testutil.MustDecodePEMType("CERTIFICATE", msUefiCACert2023PEM) + msOptionROMUefiCACert2023 = testutil.MustDecodePEMType("CERTIFICATE", msOptionROMUefiCACert2023PEM) shimUbuntuSig4 = testutil.MustDecodePEMType("PKCS7", shimUbuntuSig4PEM) snakeoilCert = testutil.MustDecodePEMType("CERTIFICATE", snakeoilCertPEM) } diff --git a/efi/preinstall/profile.go b/efi/preinstall/profile.go index 47f94b84..8e6baa37 100644 --- a/efi/preinstall/profile.go +++ b/efi/preinstall/profile.go @@ -103,8 +103,27 @@ type authorityTrustData struct { var ( knownCAs = authorityTrustDataSet{ + // The 2011 UEFI CA was used to sign both drivers and boot code. Because + // what is signed isn't audit-able, and we know it signed boot code that + // doesn't meet our requirements for FDE, we distrust it for both drivers + // and boot code. {internal_efi.MSUefiCA2011, 0}, - {internal_efi.MSUefiCA2023, 0}, // be conservative here for now, but will we be able to set the authorityTrustDrivers flag for the MS2023 CA? + + // The 2023 UEFI CA is only used for signing boot code. Like with the 2011 + // UEFI CA, the boot code that is signed isn't audit-able so we distrust + // it for signing boot code because we can't be sure that everything it + // signed meets our requirements for FDE. We trust it for signing drivers + // based on the fact it isn't used for this, which allows us to optimise + // the PCR selection for this CA. + {internal_efi.MSUefiCA2023, authorityTrustDrivers}, + + // The 2023 option ROM UEFI CA is only used for signing drivers. Like with + // the 2011 UEFI CA, the drivers that are signed aren't audit-able so we + // distrust it for signing drivers because we can't be sure that everything + // it signed meets our requirements for FDE. We trust it for signing boot + // code based on the fact it isn't used for this, which allows us to optimise + // the PCR selection for this CA. + {internal_efi.MSOptionROMUefiCA2023, authorityTrustBootCode}, } ) diff --git a/efi/preinstall/profile_test.go b/efi/preinstall/profile_test.go index 1a3fdef4..9bb93b4e 100644 --- a/efi/preinstall/profile_test.go +++ b/efi/preinstall/profile_test.go @@ -209,12 +209,6 @@ func (s *profileSuite) TestWithAutoTCGPCRProfilePCRSelectionLockToPlatformFirmar //} func (s *profileSuite) TestWithAutoTCGPCRProfilePCRSelectionDefaultCAsTrustedForDrivers(c *C) { - restore := MockKnownCAs(AuthorityTrustDataSet{ - {internal_efi.MSUefiCA2011, 0}, - {internal_efi.MSUefiCA2023, AuthorityTrustDrivers}, - }) - defer restore() - s.testWithAutoTCGPCRProfilePCRSelection(c, &testWithAutoTCGPCRProfilePCRSelectionParams{ usedSecureBootCAs: [][]byte{msUefiCACert2023}, expectedPcrs: tpm2.HandleList{4, 7}, @@ -222,12 +216,6 @@ func (s *profileSuite) TestWithAutoTCGPCRProfilePCRSelectionDefaultCAsTrustedFor } func (s *profileSuite) TestWithAutoTCGPCRProfilePCRSelectionLockToDriversAndApps(c *C) { - restore := MockKnownCAs(AuthorityTrustDataSet{ - {internal_efi.MSUefiCA2011, 0}, - {internal_efi.MSUefiCA2023, AuthorityTrustDrivers}, - }) - defer restore() - s.testWithAutoTCGPCRProfilePCRSelection(c, &testWithAutoTCGPCRProfilePCRSelectionParams{ usedSecureBootCAs: [][]byte{msUefiCACert2023}, opts: PCRProfileOptionLockToDriversAndApps, @@ -270,27 +258,15 @@ func (s *profileSuite) TestWithAutoTCGPCRProfilePCRSelectionTrustSecureBootAutho //} func (s *profileSuite) TestWithAutoTCGPCRProfilePCRSelectionDefaultCAsTrustedForBootCode(c *C) { - restore := MockKnownCAs(AuthorityTrustDataSet{ - {internal_efi.MSUefiCA2011, 0}, - {internal_efi.MSUefiCA2023, AuthorityTrustBootCode}, - }) - defer restore() - s.testWithAutoTCGPCRProfilePCRSelection(c, &testWithAutoTCGPCRProfilePCRSelectionParams{ - usedSecureBootCAs: [][]byte{msUefiCACert2023}, + usedSecureBootCAs: [][]byte{msOptionROMUefiCACert2023}, expectedPcrs: tpm2.HandleList{2, 7}, }) } func (s *profileSuite) TestWithAutoTCGPCRProfilePCRSelectionLockToBootManagerCode(c *C) { - restore := MockKnownCAs(AuthorityTrustDataSet{ - {internal_efi.MSUefiCA2011, 0}, - {internal_efi.MSUefiCA2023, AuthorityTrustBootCode}, - }) - defer restore() - s.testWithAutoTCGPCRProfilePCRSelection(c, &testWithAutoTCGPCRProfilePCRSelectionParams{ - usedSecureBootCAs: [][]byte{msUefiCACert2023}, + usedSecureBootCAs: [][]byte{msOptionROMUefiCACert2023}, opts: PCRProfileOptionLockToBootManagerCode, expectedPcrs: tpm2.HandleList{2, 4, 7}, }) diff --git a/efi/preinstall/testdata/MicrosoftOptionROMUefiCA2023.crt b/efi/preinstall/testdata/MicrosoftOptionROMUefiCA2023.crt new file mode 100644 index 00000000..139ca445 --- /dev/null +++ b/efi/preinstall/testdata/MicrosoftOptionROMUefiCA2023.crt @@ -0,0 +1,33 @@ +-----BEGIN CERTIFICATE----- +MIIFrzCCA5egAwIBAgITMwAAABez7E2PAeJwBQAAAAAAFzANBgkqhkiG9w0BAQsF +ADBaMQswCQYDVQQGEwJVUzEeMBwGA1UEChMVTWljcm9zb2Z0IENvcnBvcmF0aW9u +MSswKQYDVQQDEyJNaWNyb3NvZnQgUlNBIERldmljZXMgUm9vdCBDQSAyMDIxMB4X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MjEuY3J0MA0GCSqGSIb3DQEBCwUAA4ICAQBKS4D8cbGH3QaLJBDR +dvgQ5GU0obuBCH1w1BUk+ZA7SG9uTiP+hVPsopkfieQ0vtCYr/H4LfNH0bUyZJ7e +csAXfoEgesFfkfVOOqZ7adnQ1vD6gGPFwERn04snYcHl3FGZbiPJKRj+Nb1FIawP ++WDiD9FfcA+SK1hOz6xkLwlz7VAIyOGFc0AsMam0tiNLwBk7/RX408t0VM3au30E +hZ9wFXX5t/RhS/7kn0UO9YLpxfN4u6pq4fe7hZIrr0u1J06aySlvDsjSZGObXRQG +zHh/5BLdluOcBELsF/qSIafe9WmPILJk8z8Vo1GvJ2+3YlevdBfsq7HuqFDvr4OC +q2EEeT9JjEBWwDyv+ypaGR6q5i5nJCGsM/DXSosKJDAQplI+Hcj8kZyHG/qG4Z5r +5QlhdaijOV/in2wOhSHmvXal6kWDaB4vNr/gaIpCzh+4jeFg5pOK7rpKrbNJTO6j +A8mnooZxnIEBZ2kP3oBV1sDecoXARmDwzmAqiAiNnDDrqYtA82ElCeHhgjIEpSn4 +WewmtsjXI/AL02xjatov0tOlJZqaXqX9AqXsopCBaD49RY58BbIu6pkBRf0JMJQm +10os/n2CRDNDVctaQ9KSkv5OR8ZJPzUbIZxq2oL8ZDf7J+r0MN9l7ND8UAE4auzc +Ufb17psmzO5t/i9WDjroOCKOqg== +-----END CERTIFICATE----- diff --git a/internal/efi/known_secureboot_cas.go b/internal/efi/known_secureboot_cas.go index aa7c13df..7b5d3d99 100644 --- a/internal/efi/known_secureboot_cas.go +++ b/internal/efi/known_secureboot_cas.go @@ -119,4 +119,42 @@ var ( }, SignatureAlgorithm: x509.SHA256WithRSA, } + + MSOptionROMUefiCA2023 = &SecureBootAuthorityIdentity{ + // CN=Microsoft Option ROM UEFI CA 2023,O=Microsoft Corporation,C=US + Subject: []byte{ + 0x30, 0x59, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, + 0x06, 0x13, 0x02, 0x55, 0x53, 0x31, 0x1e, 0x30, 0x1c, 0x06, + 0x03, 0x55, 0x04, 0x0a, 0x13, 0x15, 0x4d, 0x69, 0x63, 0x72, + 0x6f, 0x73, 0x6f, 0x66, 0x74, 0x20, 0x43, 0x6f, 0x72, 0x70, + 0x6f, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x31, 0x2a, 0x30, + 0x28, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13, 0x21, 0x4d, 0x69, + 0x63, 0x72, 0x6f, 0x73, 0x6f, 0x66, 0x74, 0x20, 0x4f, 0x70, + 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x52, 0x4f, 0x4d, 0x20, 0x55, + 0x45, 0x46, 0x49, 0x20, 0x43, 0x41, 0x20, 0x32, 0x30, 0x32, + 0x33, + }, + SubjectKeyId: []byte{ + 0x51, 0x4f, 0xbf, 0x93, 0x7f, 0xa4, 0x6f, 0xb5, 0x7b, 0xf0, + 0x7a, 0xf8, 0xbe, 0xd8, 0x4b, 0x3b, 0x86, 0x4b, 0x17, 0x11, + }, + PublicKeyAlgorithm: x509.RSA, + Issuer: []byte{ + 0x30, 0x5a, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, + 0x06, 0x13, 0x02, 0x55, 0x53, 0x31, 0x1e, 0x30, 0x1c, 0x06, + 0x03, 0x55, 0x04, 0x0a, 0x13, 0x15, 0x4d, 0x69, 0x63, 0x72, + 0x6f, 0x73, 0x6f, 0x66, 0x74, 0x20, 0x43, 0x6f, 0x72, 0x70, + 0x6f, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x31, 0x2b, 0x30, + 0x29, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13, 0x22, 0x4d, 0x69, + 0x63, 0x72, 0x6f, 0x73, 0x6f, 0x66, 0x74, 0x20, 0x52, 0x53, + 0x41, 0x20, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x73, 0x20, + 0x52, 0x6f, 0x6f, 0x74, 0x20, 0x43, 0x41, 0x20, 0x32, 0x30, + 0x32, 0x31, + }, + AuthorityKeyId: []byte{ + 0x84, 0x44, 0x86, 0x06, 0x00, 0x98, 0x3f, 0x2c, 0xaa, 0xb3, + 0xc5, 0x89, 0xf3, 0xac, 0x2e, 0xc9, 0xe6, 0x9d, 0x09, 0x03, + }, + SignatureAlgorithm: x509.SHA256WithRSA, + } )