Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

CLI リファレンス

eds は EdgeSentry の統合 CLI です。監査コマンドはすべて eds audit サブコマンド配下にあり、スキャン点検コマンドは eds inspect 配下にあります。

eds audit <command>    — 改ざん検知付き監査レコード操作
eds inspect <command>  — 3D スキャン vs. IFC 偏差・AI 検出パイプライン

インストール

エンドユーザー向け — ビルド済みバイナリ

最新リリースを GitHub Releases ページ からダウンロードしてください。

プラットフォームファイル
Linux (x86-64)eds-{version}-x86_64-unknown-linux-gnu.tar.gz
macOS (Apple Silicon)eds-{version}-aarch64-apple-darwin.tar.gz
Windows (x86-64)eds-{version}-x86_64-pc-windows-msvc.zip

展開して eds バイナリを PATH に追加してください:

# Linux / macOS
tar -xzf eds-{version}-{target}.tar.gz
sudo mv eds /usr/local/bin/
eds --help
# Windows(PowerShell)
Expand-Archive eds-{version}-x86_64-pc-windows-msvc.zip
# eds.exe を PATH が通ったディレクトリに移動してください
eds --help

開発者向け — ソースからインストール

Rust(stable ツールチェーン)が必要です。

cargo install --git https://github.com/edgesentry/edgesentry-rs --locked --bin eds

オプションのトランスポートフィーチャーを含めてインストールする場合:

cargo install --git https://github.com/edgesentry/edgesentry-rs --locked --bin eds \
  --features transport-http,transport-tls

インストールの確認:

eds --version
eds --help

デバイスプロビジョニング

新しいデバイス用に Ed25519 キーペアを生成:

eds audit keygen

ファイルに直接保存:

eds audit keygen --out device-lift-01.key.json

既存の秘密鍵から公開鍵を導出:

eds audit inspect-key \
  --private-key-hex 0101010101010101010101010101010101010101010101010101010101010101

完全なプロビジョニングおよびローテーションのワークフローについては鍵管理を参照してください。


CLI の使い方

ヘルプを表示:

eds --help
eds audit --help

署名済みレコードを作成してrecord1.jsonに保存:

eds audit sign-record \
  --device-id lift-01 \
  --sequence 1 \
  --timestamp-ms 1700000000000 \
  --payload "door-open" \
  --object-ref "s3://bucket/lift-01/1.bin" \
  --private-key-hex 0101010101010101010101010101010101010101010101010101010101010101 \
  --out record1.json

1 件のレコードの署名を検証:

eds audit verify-record \
  --record-file record1.json \
  --public-key-hex 8a88e3dd7409f195fd52db2d3cba5d72ca6709bf1d94121bf3748801b40f6f5c

JSON 配列ファイルからチェーン全体を検証:

eds audit verify-chain --records-file records.json

エレベーター点検シナリオ( CLI エンドツーエンド)

このシナリオは 3 つのチェックによるリモートエレベーター点検をシミュレートします。

  1. ドア開閉サイクルチェック
  2. 振動チェック
  3. 非常ブレーキ応答チェック

1) 1 回の点検セッション用の署名済みチェーン全体を生成する

eds audit demo-lift-inspection \
  --device-id lift-01 \
  --out-file lift_inspection_records.json

期待される出力:

DEMO_CREATED:lift_inspection_records.json
CHAIN_VALID

2) ファイルからチェーンの完全性を検証する

eds audit verify-chain --records-file lift_inspection_records.json

期待される出力:

CHAIN_VALID

2.1) チェーンファイルを改ざんして検知されることを確認する

最初のレコードのハッシュ値をインプレースで変更:

python3 - <<'PY'
import json

path = "lift_inspection_records.json"
with open(path, "r", encoding="utf-8") as f:
  records = json.load(f)

records[0]["payload_hash"][0] ^= 0x01

with open(path, "w", encoding="utf-8") as f:
  json.dump(records, f, indent=2)
print("tampered", path)
PY

再度チェーン検証を実行:

eds audit verify-chain --records-file lift_inspection_records.json

期待される結果:コマンドが非ゼロコードで終了し、chain verification failed: invalid previous hash ...のようなエラーを出力します。

3) 1 件の署名済み点検イベントを作成して検証する

1 件の署名済みイベントを生成:

eds audit sign-record \
  --device-id lift-01 \
  --sequence 1 \
  --timestamp-ms 1700000000000 \
  --payload "scenario=lift-inspection,check=door,status=ok" \
  --object-ref "s3://bucket/lift-01/door-check-1.bin" \
  --private-key-hex 0101010101010101010101010101010101010101010101010101010101010101 \
  --out lift_single_record.json

署名を検証:

eds audit verify-record \
  --record-file lift_single_record.json \
  --public-key-hex 8a88e3dd7409f195fd52db2d3cba5d72ca6709bf1d94121bf3748801b40f6f5c

期待される出力:

VALID

3.1) 1 件のレコードの署名を改ざんして拒否されることを確認する

署名の 1 バイトを変更:

python3 - <<'PY'
import json

path = "lift_single_record.json"
with open(path, "r", encoding="utf-8") as f:
  record = json.load(f)

record["signature"][0] ^= 0x01

with open(path, "w", encoding="utf-8") as f:
  json.dump(record, f, indent=2)
print("tampered", path)
PY

再度署名を検証:

eds audit verify-record \
  --record-file lift_single_record.json \
  --public-key-hex 8a88e3dd7409f195fd52db2d3cba5d72ca6709bf1d94121bf3748801b40f6f5c

期待される出力:

INVALID

サーバーコマンド

eds audit serve — HTTP インジェストサーバー

transport-http Cargo フィーチャーが必要です。

フラグデフォルト説明
--addr0.0.0.0:8080バインドするソケットアドレス
--allowed-sources127.0.0.1接続を許可する CIDR / IP のカンマ区切りリスト
--device ID=PUBKEY_HEX(なし)デバイスを登録;複数デバイスは繰り返し指定
eds audit serve \
  --addr 0.0.0.0:8080 \
  --allowed-sources 10.0.0.0/8 \
  --device lift-01=<PUBLIC_KEY_HEX>

ポート 8080 でプレーン HTTP を提供します。TLS 終端リバースプロキシの背後で使用するか、組み込み TLS には eds audit serve-tls を使用してください。


eds audit serve-tls — HTTPS インジェストサーバー(TLS 1.2/1.3)

transport-tls Cargo フィーチャーが必要です。

フラグデフォルト説明
--addr0.0.0.0:8443バインドするソケットアドレス
--allowed-sources127.0.0.1接続を許可する CIDR / IP のカンマ区切りリスト
--device ID=PUBKEY_HEX(なし)デバイスを登録;複数デバイスは繰り返し指定
--tls-cert(必須)PEM 証明書チェーンのパス(リーフ証明書を先頭に)
--tls-key(必須)PEM 秘密鍵のパス(PKCS #8 または PKCS #1 RSA)
eds audit serve-tls \
  --addr 0.0.0.0:8443 \
  --allowed-sources 10.0.0.0/8 \
  --device lift-01=<PUBLIC_KEY_HEX> \
  --tls-cert /etc/edgesentry/server.crt \
  --tls-key  /etc/edgesentry/server.key

rustls の TLS 1.2/1.3 を使用します。ネットワークポリシー(IP アローリスト)は TLS ハンドシェイク前の TCP 接続受け入れ時点で適用されます。


eds audit serve-mqtt — MQTT インジェストサブスクライバー

transport-mqtt Cargo フィーチャーが必要です。MQTTS には transport-mqtt-tls も追加してください。

フラグデフォルト説明
--brokerlocalhostMQTT ブローカーホスト
--port1883MQTT ブローカーポート(MQTTS には 8883 を使用)
--topicedgesentry/ingestインジェストレコードを受信するトピック
--client-ideds-serverMQTT クライアント識別子
--device ID=PUBKEY_HEX(なし)デバイスを登録;複数デバイスは繰り返し指定
--tls-ca-cert(なし)MQTTS ブローカー検証用 PEM CA 証明書のパス(transport-mqtt-tls のみ)
# プレーン MQTT(ポート 1883)
eds audit serve-mqtt \
  --broker broker.example.com \
  --port 1883 \
  --topic edgesentry/ingest \
  --device lift-01=<PUBLIC_KEY_HEX>

# MQTTS(ポート 8883、transport-mqtt-tls フィーチャーが必要)
eds audit serve-mqtt \
  --broker broker.example.com \
  --port 8883 \
  --tls-ca-cert /etc/edgesentry/ca.crt \
  --device lift-01=<PUBLIC_KEY_HEX>

レスポンスは <topic>/responsestatus: "accepted" または status: "rejected" の JSON として発行されます。


インジェストデモ( PostgreSQL + MinIO )

s3およびpostgresの Cargo フィーチャーと、実行中の PostgreSQL + MinIO インスタンスが必要です(docker compose -f docker-compose.local.yml up -dを使用)。

1) ペイロードファイル付きのチェーンを生成する

eds audit demo-lift-inspection \
  --device-id lift-01 \
  --out-file lift_inspection_records.json \
  --payloads-file lift_inspection_payloads.json

2) IngestService 経由でレコードをインジェストする

eds audit demo-ingest \
  --records-file lift_inspection_records.json \
  --payloads-file lift_inspection_payloads.json \
  --device-id lift-01 \
  --pg-url postgresql://trace:trace@localhost:5433/trace_audit \
  --minio-endpoint http://localhost:9000 \
  --minio-bucket bucket \
  --minio-access-key minioadmin \
  --minio-secret-key minioadmin \
  --reset

--resetはインジェスト前にaudit_recordsoperation_logsを truncate します。既存の実行に追記するにはこのオプションを省略してください。

同じIngestServiceを通じた改ざんされたチェーンの拒否もデモするには--tampered-records-file <path>を渡してください。

PostgreSQL と MinIO を使った完全なガイド付きウォークスルーはインタラクティブデモを参照してください。