Dela via


Verifiera avbildningssignering

Azure IoT Operations signerar sina docker- och helm-avbildningar så att användarna kan verifiera integriteten och ursprunget för de avbildningar de använder. Signering använder ett offentligt/privat nyckelpar för att bevisa att Microsoft har skapat en containeravbildning genom att skapa en digital signatur och lägga till den i avbildningen. Den här artikeln innehåller stegen för att kontrollera att en avbildning har signerats av Microsoft.

  1. Ladda ned Notation.

    export NOTATION_VERSION=1.1.0
    curl -LO https://github.com/notaryproject/notation/releases/download/v$NOTATION_VERSION/notation_$NOTATION_VERSION\_linux_amd64.tar.gz
    sudo tar xvzf notation_1.1.0_linux_amd64.tar.gz -C /usr/bin/ notation
    
  2. Ladda ned det offentliga Certifikatet för Microsoft-signering: https://www.microsoft.com/pkiops/certs/Microsoft%20Supply%20Chain%20RSA%20Root%20CA%202022.crt.

    Kontrollera att den har sparats som msft_signing_cert.crt.

  3. Lägg till certifikatet i notation cli.

    notation cert add --type ca --store supplychain msft_signing_cert.crt
    
  4. Kontrollera certifikatet i notationen.

    notation cert ls
    

    Kommandots utdata ser ut som i följande exempel:

    STORE TYPE  STORE NAME  CERTIFICATE 
    ca          supplychain msft_signing_cert.crt
    
  5. Skapa en säkerhetsprincipfil med avbildningsomfånget.

    {
        "version": "1.0",
        "trustPolicies": [
            {
                "name": "supplychain",
                "registryScopes": [ "*" ],
                "signatureVerification": {
                    "level" : "strict" 
                },
                "trustStores": [ "ca:supplychain" ],
                "trustedIdentities": [
                    "x509.subject: CN=Azure IoT Operations,O=Microsoft Corporation,L=Redmond,ST=Washington,C=US",
                    "x509.subject: CN=Microsoft SCD Products RSA Signing,O=Microsoft Corporation,L=Redmond,ST=Washington,C=US"
                ]
            }
        ]
    }
    
    • Vi tillåter att alla registryScopes undviker att lista alla avbildningar som paketeras med Azure IoT-åtgärder och för att undvika framtida ändringar.
    • CN=Azure IoT Operations omfattar alla Azure IoT Operations-avbildningar. Andra Microsoft-avbildningar behöver CN=Microsoft SCD Products RSA Signingdock .
  6. Använd notation för att verifiera dina nedladdade bilder mot förtroendepolicyn.

    Ersätt versionsplatshållaren med versionsnumret för den avbildning som du vill kontrollera. För en befintlig instans av Azure IoT Operations kan du hitta versionsnumret på översiktssidan för instansen i Azure Portal eller genom att köra az iot ops show. En fullständig lista över tillgängliga versioner finns i azure-iot-operations-versioner.

    notation policy import <TRUSTPOLICY_FILE>.json
    export NOTATION_EXPERIMENTAL=1
    notation verify --allow-referrers-api mcr.microsoft.com/azureiotoperations/aio-operator:<AZURE_IOT_OPERATIONS_VERSION>
    

    Kommandots utdata ser ut som i följande exempel:

    Successfully verified signature for mcr.microsoft.com/azureiotoperations/aio-operator@sha256:09cbca56a2149d624cdc4ec952abe9a92ee88c347790c6657e3dd2a0fcc12d10