Red Hat Trusted Profile Analyzer を使用した SBOM の検査


Red Hat Trusted Application Pipeline 1.3

SBOM をスキャンして、アプリケーションのセキュリティー体制に関する実用的な情報を取得する方法を説明します。

Red Hat Customer Content Services

概要

このドキュメントでは、SBOM を確認してアプリケーションのセキュリティー体制に関する実用的な情報を取得する方法を説明します。

はじめに

Red Hat Trusted Application Pipeline は、アプリケーションイメージをビルドするときに、Software Bill of Materials (SBOM) も提供します。SBOM には、イメージが使用するすべてのソフトウェアライブラリーがリストされます。SBOM を使用すると、セキュリティーの脆弱性を特定できます。

しかし、SBOM は長くて判読が困難です。未処理の SBOM を実用的な情報に変換するには、Trusted Profile Analyzer (TPA) を使用できます。たとえば、TPA は、Common Vulnerabilities and Exploits (CVE) の対象となるイメージ内の依存関係を識別できます。

第1章 SBOM のダウンロード、変換、分析

次の手順では、TPA を使用して SBOM を検査する方法を説明します。具体的には、SBOM をダウンロードし、SBOM を互換性のある形式に変換して、TPA で SBOM を分析する方法を説明します。

注記

RHTAP 1.3 では、サポートされている CI プロバイダー (Tekton、Jenkins、GitLab CI、GitHub Actions) を使用してアプリケーションをビルドするときに、SBOM が TPA に自動的に公開されるため、この手順は必要ありません。GitHub Actions は テクノロジープレビュー 機能であり、完全にはテストされていないことに注意してください。

SBOM を手動で展開し、ローカルコピーを保持する場合は、次の手順に従ってください。

前提条件:

手順:

  1. コンテナーレジストリーで、SBOM 検査の対象とするコンテナーイメージの完全なアドレスを確認します。アドレスの形式は、registry/namespace/image:tag です。たとえば、quay.io/app/app-image:ff59e21cc などです。

    注記

    SBOM イメージのアドレス (末尾が .sbom のもの) は使用しないでください。実際のアプリケーションイメージのアドレスを使用してください。

  2. CLI で、cosign を使用して SBOM をダウンロードします。出力を、後で参照できるファイルにリダイレクトします。必ず新しいファイル名の末尾を .json にします。

    cosign download sbom quay.io/redhat/rhtap-app:8d34c03188cf294a77339b2a733b1f6811263a369b309e6b170d9b489abc0334 > /tmp/sbom.json
  3. (オプション) SBOM は、最終的にこの .json ファイルにリストされている名前で TPA UI に表示されます。デフォルトでは、Syft によって SBOM のファイルパスに基づいてその名前が作成されます。SBOM をわかりやすい名前で TPA UI に表示する場合は、ダウンロードした .json ファイルで名前を手動で変更する必要があります。具体的には、.metadata.component オブジェクト内の名前を置き換える必要があります。必要に応じて、ここで version フィールドを追加することもできます。

    $ vim /tmp/sbom.json
    "component": {
          "bom-ref": "fdef64df97f1d419",
          "type": "file",
          "name": "/var/lib/containers/storage/vfs/dir/3b3009adcd335d2b3902c5a7014d22b2beb6392b1958f1d9c7aabe24acab2deb" #Replace this with a meaningful name
        }
  4. 次のコマンドを実行して、Bombastic API URL を環境変数として保存します。

    $ bombastic_api_url="https://$(oc -n rhtap get route --selector app.kubernetes.io/name=bombastic-api -o jsonpath='{.items[].spec.host}')"
    注記

    このコマンドと次のコマンドでは、-n の後に、RHTAP をインストールした名前空間を必ず入力してください。この例では、rhtap という名前空間を使用していると想定しています。

  5. CLI で、次の値を持つ新しい token_issuer_url 環境変数を作成します。

    $ token_issuer_url=https://$(oc -n rhtap get route --selector app.kubernetes.io/name=keycloak -o  jsonpath='{.items[].spec.host}')/realms/chicken/protocol/openid-connect/token
  6. 次に、TPA__OIDC__WALKER_CLIENT_SECRET 環境変数を設定する必要があります。RHTAP のインストール中に組織が生成した private.env ファイルにアクセスできる場合は、そのファイルをソースとして取得します。そのファイルにアクセスできない場合は、RHTAP をインストールした担当者に TPA OIDC Walker クライアントシークレットを提供するよう依頼してください。

    1. private.env ファイルにアクセスできる場合は、以下を実行します。

      $ source private.env
    2. または、RHTAP をインストールした担当者からシークレットを入手したら、以下を実行します。

      $ TPA__OIDC__WALKER_CLIENT_SECRET=<secret value>
  7. 次のコマンドを実行して BOMbastic API のトークンを取得します。このトークンを使用すると、SBOM をアップロードできます。

    $ tpa_token=$(curl \
        -d 'client_id=walker' \
        -d "client_secret=$TPA__OIDC__WALKER_CLIENT_SECRET" \
        -d 'grant_type=client_credentials' \
        "$token_issuer_url" \
    | jq -r .access_token)
  8. SBOM のアップロードを試行します。

    curl \
        -H "authorization: Bearer $tpa_token" \
        -H "transfer-encoding: chunked" \
        -H "content-type: application/json" \
        --data @/tmp/sbom.json \
        "$bombastic_api_url/api/v1/sbom?id=my-sbom"
    1. エラーメッセージ storage error: invalid storage content が表示された場合は、Syft を使用して SBOM を以前の CycloneDX 1.4 に変換します。異なる pURL を持つパッケージのマージに関する警告は、無視しても問題ありません。この警告は、Syft が元の SBOM の一部のデータを破棄する可能性があることを示していますが、そのデータは重要ではありません。

      $ syft convert /tmp/sbom.json -o cyclonedx-json@1.4=/tmp/sbom-1-4.json
    2. SBOM の再アップロードを試行します。

      $ curl \
          -H "authorization: Bearer $tpa_token" \
          -H "transfer-encoding: chunked" \
          -H "content-type: application/json" \
          --data @/tmp/sbom-1-4.json \
          "$bombastic_api_url/api/v1/sbom?id=my-sbom"
  9. OpenShift コンソールから、RHTAP を実行しているクラスターにアクセスします。
  10. rhtap プロジェクトで、Networking > Routes に移動します。spog-ui サービスと同じ行にリストされている URL を開きます。
  11. Register ボタンを使用して新しいアカウントを作成し、TPA に対して認証します。
  12. SBOM (直近にアップロードしたもの) を選択し、その SBOM に基づいて TPA が提供した、アプリケーションに関する分析情報を確認します。

    1. 依存関係分析レポートタブに移動して、脆弱性と修復を表示します。





改訂日時: 2024-12-11

法律上の通知

Copyright © 2024 Red Hat, Inc.
The text of and illustrations in this document are licensed by Red Hat under a Creative Commons Attribution–Share Alike 3.0 Unported license ("CC-BY-SA"). An explanation of CC-BY-SA is available at http://creativecommons.org/licenses/by-sa/3.0/. In accordance with CC-BY-SA, if you distribute this document or an adaptation of it, you must provide the URL for the original version.
Red Hat, as the licensor of this document, waives the right to enforce, and agrees not to assert, Section 4d of CC-BY-SA to the fullest extent permitted by applicable law.
Red Hat, Red Hat Enterprise Linux, the Shadowman logo, the Red Hat logo, JBoss, OpenShift, Fedora, the Infinity logo, and RHCE are trademarks of Red Hat, Inc., registered in the United States and other countries.
Linux® is the registered trademark of Linus Torvalds in the United States and other countries.
Java® is a registered trademark of Oracle and/or its affiliates.
XFS® is a trademark of Silicon Graphics International Corp. or its subsidiaries in the United States and/or other countries.
MySQL® is a registered trademark of MySQL AB in the United States, the European Union and other countries.
Node.js® is an official trademark of Joyent. Red Hat is not formally related to or endorsed by the official Joyent Node.js open source or commercial project.
The OpenStack® Word Mark and OpenStack logo are either registered trademarks/service marks or trademarks/service marks of the OpenStack Foundation, in the United States and other countries and are used with the OpenStack Foundation's permission. We are not affiliated with, endorsed or sponsored by the OpenStack Foundation, or the OpenStack community.
All other trademarks are the property of their respective owners.
Red Hat logoGithubRedditYoutubeTwitter

詳細情報

試用、購入および販売

コミュニティー

Red Hat ドキュメントについて

Red Hat をお使いのお客様が、信頼できるコンテンツが含まれている製品やサービスを活用することで、イノベーションを行い、目標を達成できるようにします。

多様性を受け入れるオープンソースの強化

Red Hat では、コード、ドキュメント、Web プロパティーにおける配慮に欠ける用語の置き換えに取り組んでいます。このような変更は、段階的に実施される予定です。詳細情報: Red Hat ブログ.

会社概要

Red Hat は、企業がコアとなるデータセンターからネットワークエッジに至るまで、各種プラットフォームや環境全体で作業を簡素化できるように、強化されたソリューションを提供しています。

© 2024 Red Hat, Inc.