OpenClaw v2026.2 対応 | 本稿はすべての OpenClaw ユーザー、特に本番デプロイやチーム利用を検討しているユーザーに適しています。
TL;DR: DM ペアリングで未承認アクセスを防止:"dmPolicy": "pairing"。サンドボックスで危険な操作を隔離:"sandbox": {"mode": "non-main"}。機密データフィルタリング:"security": {"sensitiveData": {"patterns": ["sk-*"]}}。リモートアクセスは Tailscale を使用し、公衆網への露出を避ける。openclaw doctor --security でセキュリティ状態を確認。
セキュリティリスク概要
主なリスクタイプ
| リスクタイプ | 説明 | 潜在的な影響 |
|---|---|---|
| 未承認アクセス | 見知らぬ人があなたの Agent を使用できる | リソースの悪用、プライバシー漏洩 |
| 権限の悪用 | Agent が想定外の操作を実行 | データ破損、システム破壊 |
| データ漏洩 | 機密情報の不適切な処理 | プライバシー漏洩、コンプライアンス問題 |
| ネットワーク攻撃 | 外部攻撃者が脆弱性を悪用 | システム侵入、データ窃取 |
| Prompt インジェクション | 悪意のある指示がセキュリティ制限を回避 | 未承認操作 |
セキュリティモデル
flowchart TB
subgraph network["ネットワーク層"]
FW[ファイアウォール]
TLS[HTTPS/TLS]
end
subgraph access["アクセス制御"]
DM[DM ペアリング]
WL[ホワイトリスト]
AUTH[認証]
end
subgraph exec["実行制御"]
SBX[サンドボックス]
PERM[権限]
AUDIT[監査]
end
subgraph core["Agent"]
AG[Agent コア]
end
network --> access --> exec --> core
DM ペアリング機構
DM ペアリングとは?
DM(Direct Message)ペアリングは、新しいユーザーが Agent と対話する前にペアリングを完了する必要がある保護機構です。
ペアリングフロー
sequenceDiagram
participant S as 見知らぬ人
participant B as Bot
participant G as Gateway
participant O as 所有者
S->>B: メッセージ送信「こんにちは」
B->>G: メッセージ到着
G->>G: ペアリング状態を確認
G-->>B: 未ペアリング、ペアリングコード生成
B-->>S: 「ペアリングしてください:コード ABC123」
S->>O: 所有者にコードを伝える
O->>G: openclaw pairing approve telegram ABC123
G->>G: ホワイトリストに追加
G-->>S: ペアリング成功
S->>B: メッセージ送信「こんにちは」
B-->>S: 正常応答
DM ペアリングの設定
{
"channels": {
"telegram": {
"botToken": "your_token",
"dmPolicy": "pairing"
},
"whatsapp": {
"dmPolicy": "pairing"
},
"discord": {
"dmPolicy": "pairing"
}
}
}
ペアリングモード
| モード | 説明 | セキュリティレベル | 適用シナリオ |
|---|---|---|---|
pairing |
ペアリングコードが必要 | ⭐⭐⭐⭐ | 個人利用(デフォルト) |
open |
誰でも利用可能 | ⭐ | 公開サービス |
whitelist |
ホワイトリストユーザーのみ | ⭐⭐⭐⭐⭐ | 高セキュリティ要件 |
ペアリング管理
# ペアリング待ちリクエストを表示
openclaw pairing list
# 出力例:
# Channel Code User Created
# telegram ABC123 @stranger 2026-02-26 10:30:00
# discord XYZ789 user#1234 2026-02-26 10:35:00
# ペアリングを承認
openclaw pairing approve telegram ABC123
# ペアリングを拒否
openclaw pairing reject telegram ABC123
# ペアリング済みユーザーを表示
openclaw pairing show telegram
ホワイトリスト設定
{
"channels": {
"telegram": {
"dmPolicy": "open",
"allowFrom": [
123456789,
987654321
]
},
"whatsapp": {
"dmPolicy": "open",
"allowFrom": [
"+8613800138000",
"+8613800138001"
]
}
}
}
ユーザー ID の取得
# Telegram: @userinfobot にメッセージを送信
# Discord: チャンネルで /id コマンドを使用するか、ユーザープロフィールを確認
# WhatsApp: 連絡先情報から取得
サンドボックスモード
サンドボックスとは?
サンドボックスは、Agent の操作範囲を制限し、意図しないまたは悪意のあるシステム変更を防ぐ隔離機構です。
サンドボックスモード
| モード | 説明 | 適用シナリオ |
|---|---|---|
off |
サンドボックスなし、完全信頼 | メインセッション、信頼環境 |
non-main |
メイン以外のセッションでサンドボックス有効 | マルチユーザー、チーム共有 |
always |
常にサンドボックス有効 | 信頼できない環境、公開サービス |
サンドボックス設定
{
"agents": {
"defaults": {
"sandbox": {
"mode": "non-main",
"allowlist": ["read", "write", "edit", "bash"],
"denylist": ["browser", "canvas", "nodes"],
"container": {
"image": "openclaw/sandbox:latest",
"timeout": 30000,
"memory": "512m",
"cpu": "0.5"
}
}
}
}
}
ツール権限制御
{
"agents": {
"defaults": {
"sandbox": {
"mode": "non-main",
"allowlist": [
"read",
"write",
"edit",
"bash",
"web_search",
"sessions_list",
"sessions_history",
"sessions_send"
],
"denylist": [
"browser",
"canvas",
"nodes",
"cron",
"discord",
"gateway"
]
}
}
}
}
ファイルシステム権限
{
"agents": {
"defaults": {
"permissions": {
"filesystem": {
"read": ["~/workspace", "~/documents"],
"write": ["~/workspace/output"],
"deny": ["~/.ssh", "~/.gnupg", "~/.openclaw/credentials"]
}
}
}
}
}
ネットワーク権限
{
"agents": {
"defaults": {
"permissions": {
"network": {
"outbound": {
"allow": [
"api.anthropic.com",
"api.openai.com",
"github.com"
],
"deny": ["*"]
}
}
}
}
}
}
Elevated 権限
Elevated 権限とは?
Elevated 権限は、より高い権限が必要な操作のための一時的な権限昇格機構です。
Elevated 権限の設定
{
"agents": {
"defaults": {
"elevatedAccess": {
"enabled": true,
"allowlist": [123456789, 987654321],
"requireConfirmation": true,
"timeout": 300000
}
}
}
}
Elevated 権限の使用
# チャットで権限昇格をリクエスト
/elevated on
# 権限昇格が必要な操作を実行
# ...
# 権限昇格を解除
/elevated off
機密データ処理
機密情報のタイプ
| タイプ | 例 | 処理方法 |
|---|---|---|
| API Keys | sk-ant-xxx, sk-xxx |
記録しない、出力しない |
| パスワード | ログインパスワード、DB パスワード | 保存しない、送信しない |
| Token | OAuth token、Session token | 暗号化して保存 |
| 個人情報 | 身分証、銀行カード | 記録しない、匿名化 |
機密情報フィルタリングの設定
{
"security": {
"sensitiveData": {
"patterns": [
"sk-[a-zA-Z0-9]{20,}",
"xox[baprs]-[a-zA-Z0-9-]+",
"[0-9]{15,19}",
"[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}"
],
"redact": true,
"log": false
}
}
}
認証情報の保存
# 認証情報の保存場所
~/.openclaw/credentials/
# 暗号化保存
# OpenClaw はシステムキーチェーンで機密認証情報を暗号化して保存します
認証情報管理
# 保存済み認証情報を表示
openclaw credentials list
# 出力例:
# Name Type Created
# telegram-bot api_key 2026-02-20
# gmail-oauth oauth 2026-02-21
# 認証情報を削除
openclaw credentials delete telegram-bot
# 認証情報をエクスポート(暗号化)
openclaw credentials export --output credentials.enc
# 認証情報をインポート
openclaw credentials import --input credentials.enc
ネットワークセキュリティ
バインド設定
{
"gateway": {
"bind": "loopback", // ローカルアクセスのみ
"port": 18789,
"tls": {
"enabled": false
}
}
}
| バインドオプション | 説明 | セキュリティレベル |
|---|---|---|
loopback |
ローカルアクセスのみ | ⭐⭐⭐⭐⭐ |
private |
プライベートネットワークアクセス | ⭐⭐⭐⭐ |
all |
すべてのインターフェースでアクセス | ⭐ |
Tailscale 設定
{
"gateway": {
"tailscale": {
"mode": "serve", // serve または funnel
"resetOnExit": true
},
"auth": {
"mode": "password",
"allowTailscale": true
}
}
}
認証設定
{
"gateway": {
"auth": {
"mode": "password",
"password": "your-secure-password",
"sessionTimeout": 3600000
}
}
}
監査とログ
操作ログ
{
"logging": {
"level": "info",
"audit": {
"enabled": true,
"events": [
"tool.invoke",
"session.create",
"session.reset",
"pairing.approve",
"pairing.reject",
"elevated.enable",
"elevated.disable"
],
"retention": 30
}
}
}
監査ログの表示
# 監査ログを表示
openclaw logs --type audit
# 出力例:
# [2026-02-26 10:30:00] INFO tool.invoke session=main tool=bash command="ls -la"
# [2026-02-26 10:30:05] INFO pairing.approve channel=telegram code=ABC123 user=123456789
# [2026-02-26 10:31:00] INFO elevated.enable session=telegram:user:123456789
# 特定イベントでフィルタ
openclaw logs --type audit --filter "tool.invoke"
# 期間指定
openclaw logs --type audit --from 2026-02-01 --to 2026-02-28
使用状況モニタリング
# 使用状況を表示
openclaw usage --today
# 出力例:
# Date: 2026-02-26
# Requests: 128
# Tokens In: 125,000
# Tokens Out: 45,000
# Cost: $2.10
# Top Tools: bash(45), read(32), write(18)
# 異常検知
openclaw usage --alerts
# 出力例:
# ⚠️ High usage detected: 1000+ requests in 1 hour
# ⚠️ Unusual tool pattern: bash commands to sensitive directories
セキュリティチェックリスト
基本セキュリティ
- DM ペアリングまたはホワイトリストを有効化
- サンドボックスモードを設定
- 適切なツール権限を設定
- 操作監査ログを有効化
- API Key を定期的に更新
高度なセキュリティ
- ファイルシステム権限制限を設定
- ネットワーク送信ホワイトリストを設定
- 機密情報フィルタリングを有効化
- Elevated 権限の確認を設定
- ペアリングユーザーを定期的にレビュー
エンタープライズセキュリティ
- Docker サンドボックスで隔離
- Tailscale プライベートネットワークを設定
- HTTPS/TLS を有効化
- 使用量アラートを設定
- 定期的なセキュリティ監査
セキュリティ診断
# セキュリティ診断を実行
openclaw doctor --security
# 出力例:
# ✅ DM Pairing: Enabled
# ✅ Sandbox Mode: non-main
# ⚠️ File Permissions: Some directories not restricted
# ✅ Network Outbound: Restricted to allowlist
# ⚠️ Elevated Access: No confirmation required
# ✅ Audit Logging: Enabled
# ✅ Credentials: Encrypted
# 推奨事項:
# - Restrict file access to ~/workspace only
# - Enable elevated access confirmation
まとめ
セキュリティ設定は OpenClaw デプロイの重要な要素です:
- DM ペアリング:未承認アクセスを防止
- サンドボックスモード:操作範囲を制限
- 権限制御:ツールとファイルのきめ細かい権限
- 機密データ:機密情報のフィルタリングと保護
- ネットワークセキュリティ:バインドと認証設定
- 監査ログ:操作の追跡とモニタリング
本稿のまとめ:
- 主なセキュリティリスクと保護機構を理解
- DM ペアリングとホワイトリスト設定を習得
- サンドボックスモードと権限制御を習得
- 機密データ処理とネットワーク設定を理解
- 監査ログとセキュリティチェックリストを習得
更新履歴:
- 2026-02-26:初版公開、OpenClaw v2026.2 に基づく
シリーズナビゲーション:
- ← 前の記事:マルチ Agent ルーティングとセッション分離
- → 次の記事:リモートデプロイメント