Bagikan melalui


Memvalidasi penandatanganan gambar

Azure IoT Operations menandatangani gambar docker dan helm-nya untuk memungkinkan pengguna memverifikasi integritas dan asal gambar yang mereka gunakan. Penandatanganan menggunakan pasangan kunci publik/privat untuk membuktikan bahwa Microsoft membangun gambar kontainer dengan membuat tanda tangan digital dan menambahkannya ke gambar. Artikel ini menyediakan langkah-langkah untuk memverifikasi bahwa gambar ditandatangani oleh Microsoft.

  1. Unduh Notasi.

    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. Unduh sertifikat publik penandatanganan Microsoft: https://www.microsoft.com/pkiops/certs/Microsoft%20Supply%20Chain%20RSA%20Root%20CA%202022.crt.

    Pastikan disimpan sebagai msft_signing_cert.crt.

  3. Tambahkan sertifikat ke notasi cli.

    notation cert add --type ca --store supplychain msft_signing_cert.crt
    
  4. Periksa sertifikat dalam notasi.

    notation cert ls
    

    Output perintah terlihat seperti contoh berikut:

    STORE TYPE  STORE NAME  CERTIFICATE 
    ca          supplychain msft_signing_cert.crt
    
  5. Buat file trustpolicy dengan cakupan gambar Anda.

    {
        "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"
                ]
            }
        ]
    }
    
    • Kami mengizinkan semua cakupan registri untuk menghindari daftar setiap gambar yang dibundel dengan Operasi Azure IoT dan untuk menghindari modifikasi di masa mendatang.
    • CN=Azure IoT Operations mencakup semua gambar Operasi Azure IoT. Namun, gambar Microsoft lainnya membutuhkan CN=Microsoft SCD Products RSA Signing.
  6. Gunakan notasi untuk memverifikasi gambar yang diunduh terhadap trustpolicy.

    Ganti tempat penampung versi dengan nomor versi gambar yang ingin Anda periksa. Untuk instans Operasi Azure IoT yang ada, Anda dapat menemukan nomor versi pada halaman gambaran umum instans di portal Azure atau dengan menjalankan az iot ops show. Untuk daftar lengkap versi yang tersedia, lihat rilis azure-iot-operations.

    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>
    

    Output perintah terlihat seperti contoh berikut:

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