ゼロトラストアーキテクチャ - 現代のセキュリティモデル

16分 で読める | 2025.01.10

ゼロトラストとは

「Never Trust, Always Verify(決して信頼せず、常に検証する)」を原則としたセキュリティモデルです。ネットワークの内外を問わず、すべてのアクセスを検証します。

flowchart TB
    subgraph Traditional["従来の境界型モデル"]
        FW["ファイアウォール"]
        Internal["社内ネットワーク<br/>(信頼済み)"]
        External["外部<br/>(非信頼)"]
        External -->|遮断| FW
        FW -->|許可| Internal
    end

    subgraph ZeroTrust["ゼロトラストモデル"]
        User["ユーザー"]
        Device["デバイス"]
        App["アプリケーション"]
        Data["データ"]

        User -->|検証| PEP["ポリシー<br/>施行点"]
        Device -->|検証| PEP
        PEP -->|認可| App
        App -->|暗号化| Data
    end

ゼロトラストの5原則

原則説明
すべてのリソースへのアクセスを保護場所に関係なく認証・認可
最小権限アクセス必要最小限の権限のみ付与
マイクロセグメンテーションネットワークを細分化
継続的な検証セッション中も常に検証
動的ポリシーコンテキストに基づく判断

実装コンポーネント

1. アイデンティティ管理

// 多要素認証(MFA)
interface AuthContext {
  userId: string;
  deviceId: string;
  location: GeoLocation;
  timestamp: Date;
  riskScore: number;
}

async function authenticateUser(
  credentials: Credentials,
  context: AuthContext
): Promise<AuthResult> {
  // 1. 資格情報の検証
  const user = await verifyCredentials(credentials);

  // 2. リスクスコア計算
  const risk = await calculateRisk(context);

  // 3. 追加認証の判断
  if (risk > RISK_THRESHOLD) {
    await requireMFA(user);
  }

  // 4. デバイス検証
  if (!await isDeviceTrusted(context.deviceId, user.id)) {
    await requireDeviceVerification(context.deviceId);
  }

  return generateSession(user, context);
}

2. デバイス信頼性

interface DevicePosture {
  deviceId: string;
  osVersion: string;
  securityPatchLevel: string;
  encryptionEnabled: boolean;
  antivirusStatus: 'active' | 'outdated' | 'none';
  jailbroken: boolean;
}

function evaluateDevicePosture(posture: DevicePosture): DeviceRisk {
  let riskLevel = 0;

  if (posture.jailbroken) riskLevel += 50;
  if (posture.antivirusStatus !== 'active') riskLevel += 20;
  if (!posture.encryptionEnabled) riskLevel += 30;

  return {
    level: riskLevel > 50 ? 'high' : riskLevel > 20 ? 'medium' : 'low',
    score: riskLevel,
    recommendations: generateRecommendations(posture),
  };
}

3. マイクロセグメンテーション

# Kubernetes NetworkPolicy
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
  name: api-server-policy
spec:
  podSelector:
    matchLabels:
      app: api-server
  policyTypes:
    - Ingress
    - Egress
  ingress:
    - from:
        - podSelector:
            matchLabels:
              app: web-frontend
      ports:
        - port: 8080
  egress:
    - to:
        - podSelector:
            matchLabels:
              app: database
      ports:
        - port: 5432

4. 継続的検証

// セッション中の継続的リスク評価
class ContinuousVerification {
  private sessionRiskHistory: Map<string, number[]> = new Map();

  async evaluateOngoingRisk(sessionId: string, action: UserAction): Promise<RiskDecision> {
    const session = await getSession(sessionId);
    const currentRisk = await calculateRisk({
      action,
      session,
      behaviorPattern: await getBehaviorPattern(session.userId),
    });

    // リスク履歴の更新
    const history = this.sessionRiskHistory.get(sessionId) || [];
    history.push(currentRisk);
    this.sessionRiskHistory.set(sessionId, history.slice(-10));

    // 異常検出
    if (this.detectAnomaly(history)) {
      return { action: 'step_up_auth', reason: 'Anomalous behavior detected' };
    }

    // 閾値超過
    if (currentRisk > HIGH_RISK_THRESHOLD) {
      return { action: 'block', reason: 'Risk threshold exceeded' };
    }

    return { action: 'allow' };
  }

  private detectAnomaly(history: number[]): boolean {
    if (history.length < 5) return false;
    const avg = history.reduce((a, b) => a + b) / history.length;
    const latest = history[history.length - 1];
    return latest > avg * 2;
  }
}

5. 動的アクセスポリシー

interface AccessPolicy {
  resource: string;
  conditions: PolicyCondition[];
  effect: 'allow' | 'deny';
}

interface PolicyCondition {
  attribute: string;
  operator: 'equals' | 'contains' | 'greaterThan' | 'lessThan';
  value: any;
}

const policies: AccessPolicy[] = [
  {
    resource: '/api/admin/*',
    conditions: [
      { attribute: 'user.role', operator: 'equals', value: 'admin' },
      { attribute: 'device.managed', operator: 'equals', value: true },
      { attribute: 'location.country', operator: 'equals', value: 'JP' },
      { attribute: 'time.hour', operator: 'greaterThan', value: 9 },
      { attribute: 'time.hour', operator: 'lessThan', value: 18 },
    ],
    effect: 'allow',
  },
];

function evaluatePolicy(request: AccessRequest, policies: AccessPolicy[]): boolean {
  for (const policy of policies) {
    if (matchesResource(request.resource, policy.resource)) {
      const allConditionsMet = policy.conditions.every(
        condition => evaluateCondition(request.context, condition)
      );

      if (allConditionsMet) {
        return policy.effect === 'allow';
      }
    }
  }
  return false;  // デフォルト拒否
}

導入ステップ

  1. 資産の可視化 - すべてのリソースを把握
  2. アイデンティティ基盤 - IdP統合、MFA導入
  3. デバイス管理 - MDM/UEM導入
  4. ネットワークセグメンテーション - 段階的に細分化
  5. 継続的モニタリング - SIEM/SOAR連携

関連記事

まとめ

ゼロトラストは、従来の「城と堀」モデルから「常に検証」モデルへの転換です。アイデンティティ、デバイス、ネットワーク、データの各層で継続的な検証を実装しましょう。

← 一覧に戻る