Skip to content

sakura-internet/confidential-computing

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 

Repository files navigation

本リポジトリについて

さくらのクラウド 機密 VM プラン で使用できるサンプルコードなどを含むリポジトリです。

注意

  • 本リポジトリに含まれるコードについては さくらのクラウド 機密 VM プラン 上での動作のみを目的として記述・公開されています。他環境での動作は確認しておりません。
    • 一般的な PC 上で実行すると回復不能なデータ損失を引き起こす可能性があるコードも含まれます。 内容物について を参照頂いた上で、適切にご利用ください。
  • 本リポジトリは直接開発に使用されておらず、外部からの参照を目的として作成されています。そのため Pull Request 等は予告なく close する場合がありますのであらかじめご了承ください。

想定する動作環境

  • AMD SEV-SNP に基づく機密 VM ゲスト
  • Linux kernel 6.16 以降が動作していること
  • COCONUT-SVSM による vTPM が動作していること

内容物について

check-attestation.sh

Linux 6.16 以降と SVSM vTPM を組み合わせてアテステーションレポートを取得するためのサンプルスクリプトです。アテステーションレポートの発行要求と取得が簡単に行えます。

本スクリプトは機密 VM 以外のサーバーや PC 上では絶対に実行しないでください。 スクリプト中に TPM の初期化処理を含んでいるため、実行すると TPM 内に保管されている暗号鍵などが消去されます。 tpm_svsm モジュールがロードされていない環境では動作を停止するようにしていますが、簡易的なチェックのため事故を完全に防げるものではありません。 実行時はご自身の責任でお願いいたします。

手元の信頼できるコンピューターで生成した 512bit の乱数からなる nonce ファイルを安全な通信路を介して転送した後、sudo コマンドを通してcheck-attestation.shを実行すると、以下のような出力がされた後、アテステーションレポートを含む成果物として report-(日時)/report-(日時).tar.gz が出力されます。

取得したアテステーションレポートは virtee/snpguest を用いて検証が可能です。snpguest の利用方法については 参考リンク で示す記事のリンク先をご覧ください。

# 手元の信頼できるコンピューター上で実行
$ head -c 64 /dev/urandom > nonce.bin


# 機密 VM 上で実行
$ sudo ./check-attestation.sh nonce.bin

>>> Create ephemeral EK
persistent-handle: 0x81010001
action: persisted

>>> Initialize configfs-tsm

>>> Set TSM service_provider to svsm

>>> Set VMPL to 2

>>> Write nonce.bin as inblob

>>> Read attestation report
attestation report (./report-2511200320/attestation_report.bin): 1184 bytes

>>> Read service manifest
service manifest (./report-2511200320/services_manifest.bin): 362 bytes

>>> Create ./report-2511200320.tar.gz
./report-2511200320.tar.gz created

>>> Changing ownership to ubuntu





================================
Done - Report archive saved.
Send ./report-2511200320.tar.gz to the remote machine, and run the following scripts (requires virtee/snpguest binary).
================================

rsync -av ATTESTATION_TARGET:/home/ubuntu/report-2511200320.tar.gz .
tar xvf ./report-2511200320.tar.gz
snpguest fetch vcek der fetched_certs ./report-2511200320/attestation_report.bin
snpguest verify attestation fetched_certs/ ./report-2511200320/attestation_report.bin
snpguest display report ./report-2511200320/attestation_report.bin
$

参考リンク

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages