🛡️ ネットワークセキュリティ設計指針 - 多層防御とゼロトラスト

概要

現代のネットワークセキュリティは、従来の境界防御から多層防御・ゼロトラストアーキテクチャへと進化しています。本記事では、GCPにおける実践的なネットワークセキュリティ設計パターン、ファイアウォールルールの体系的設計、ゼロトラストの実装手法について詳しく解説します。

セキュリティ階層の基本概念

従来の境界防御 vs 多層防御

従来の境界防御(城郭モデル)

1
2
3
4
5
Internet → [Firewall] → Internal Network (trusted)
問題:
- 内部に侵入されると全て危険
- 内部通信が無防備
- リモートワーク対応困難

多層防御(Defense in Depth)

1
2
3
4
5
Internet → [WAF] → [LB] → [App FW] → [DB FW] → Database
各層で独立したセキュリティ制御
- 段階的な脅威軽減
- 単一障害点の排除
- 詳細な監視・制御

ネットワーク層別セキュリティ設計

Layer 1: DMZ(非武装地帯)

目的: インターネットとの接点を最小化

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
DMZ_Configuration:
  Subnet: dmz-subnet (10.0.1.0/24)
  Purpose: 
    - WAF / Cloud Armor
    - Load Balancer
    - Reverse Proxy
  
  Security_Controls:
    - DDoS保護
    - Rate Limiting
    - IP allowlist/blocklist
    - SSL/TLS終端

ファイアウォール設定:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# Internet → DMZ (HTTPSのみ)
gcloud compute firewall-rules create allow-dmz-https \
    --direction=INGRESS \
    --priority=1000 \
    --source-ranges=0.0.0.0/0 \
    --target-tags=dmz \
    --allow=tcp:443

# HTTP→HTTPS リダイレクトのみ
gcloud compute firewall-rules create allow-dmz-http-redirect \
    --direction=INGRESS \
    --priority=1001 \
    --source-ranges=0.0.0.0/0 \
    --target-tags=dmz \
    --allow=tcp:80

# 他全てのポートをブロック
gcloud compute firewall-rules create deny-dmz-all \
    --direction=INGRESS \
    --priority=65534 \
    --source-ranges=0.0.0.0/0 \
    --target-tags=dmz \
    --action=DENY \
    --rules=all

Layer 2: Application Layer

目的: アプリケーション固有の脅威対策

1
2
3
4
5
6
7
8
9
App_Layer_Security:
  Subnet: app-subnet (10.0.2.0/24)
  Access: DMZ経由のみ
  
  Security_Controls:
    - Application-level authentication
    - Input validation
    - SQL injection防止
    - XSS対策

アプリケーションファイアウォール:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
# DMZ → Application (認証済み通信)
gcloud compute firewall-rules create allow-dmz-to-app \
    --direction=INGRESS \
    --priority=1000 \
    --source-tags=dmz \
    --target-tags=application \
    --allow=tcp:8080,tcp:8443

# 直接外部アクセスを完全ブロック
gcloud compute firewall-rules create deny-app-external \
    --direction=INGRESS \
    --priority=999 \
    --source-ranges=0.0.0.0/0 \
    --target-tags=application \
    --action=DENY \
    --rules=all

Layer 3: Data Layer

目的: データへの最終防御線

1
2
3
4
5
6
7
8
9
Data_Layer_Security:
  Subnet: data-subnet (10.0.3.0/24)
  Access: Application経由のみ
  
  Security_Controls:
    - Database-level authentication
    - Column-level encryption
    - Audit logging
    - Backup encryption

データベースファイアウォール:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
# Application → Database (最小権限)
gcloud compute firewall-rules create allow-app-to-db \
    --direction=INGRESS \
    --priority=1000 \
    --source-tags=application \
    --target-tags=database \
    --allow=tcp:5432,tcp:3306

# 全外部アクセス拒否
gcloud compute firewall-rules create deny-db-all \
    --direction=INGRESS \
    --priority=999 \
    --source-ranges=0.0.0.0/0 \
    --target-tags=database \
    --action=DENY \
    --rules=all

ゼロトラストアーキテクチャ実装

ゼロトラストの基本原則

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
Zero_Trust_Principles:
  1_Never_Trust_Always_Verify:
    - 全通信を認証・認可
    - 場所に関係なく検証
    
  2_Least_Privilege_Access:
    - 必要最小限の権限
    - Just-in-Time access
    
  3_Assume_Breach:
    - 侵害を前提とした設計
    - 横展開の防止

Identity-Aware Proxy (IAP) 実装

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
# IAP有効化
gcloud iap web enable \
    --resource-type=backend-services \
    --service=web-app-backend

# OAuth設定
gcloud iap oauth-brands create \
    --application_title="Corporate Web App" \
    --support_email="security@company.com"

# アクセス制御
gcloud projects add-iam-policy-binding PROJECT_ID \
    --member="user:employee@company.com" \
    --role="roles/iap.httpsResourceAccessor"

BeyondCorp実装例

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
BeyondCorp_Configuration:
  User_Authentication:
    - Google Workspace SSO
    - Multi-factor authentication
    - Device certificates
  
  Device_Verification:
    - Device inventory management
    - Security policy compliance
    - Real-time risk assessment
  
  Application_Access:
    - Context-aware access
    - Risk-based authentication
    - Session management

脅威別対策パターン

DDoS攻撃対策

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
DDoS_Protection:
  Layer_3_4_Protection:
    Service: Google Cloud Armor
    Features:
      - Volumetric attack mitigation
      - Protocol attack filtering
      - Geographic blocking
  
  Layer_7_Protection:
    Features:
      - HTTP flood protection
      - Slow HTTP attack mitigation
      - Bot detection

Cloud Armor設定:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
# Security Policy作成
gcloud compute security-policies create web-app-policy \
    --description="DDoS protection for web application"

# Rate limiting rule
gcloud compute security-policies rules create 1000 \
    --security-policy=web-app-policy \
    --expression="true" \
    --action="rate-based-ban" \
    --rate-limit-threshold-count=100 \
    --rate-limit-threshold-interval-sec=60 \
    --ban-duration-sec=600

# Geo blocking
gcloud compute security-policies rules create 2000 \
    --security-policy=web-app-policy \
    --expression="origin.region_code == 'CN'" \
    --action="deny-403"

内部脅威対策

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
Insider_Threat_Mitigation:
  Network_Segmentation:
    - Micro-segmentation
    - East-west traffic inspection
    - Privileged access monitoring
  
  Data_Protection:
    - Data classification
    - DLP (Data Loss Prevention)
    - Encryption key management
  
  Behavioral_Analysis:
    - User behavior analytics
    - Anomaly detection
    - Risk scoring

Advanced Persistent Threat (APT) 対策

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
APT_Defense:
  Detection_Capabilities:
    - Network traffic analysis
    - Endpoint detection and response
    - Threat hunting
  
  Response_Automation:
    - Incident response playbooks
    - Automated containment
    - Forensic data collection

監視・ログ設計

セキュリティ監視の設計

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
Security_Monitoring:
  VPC_Flow_Logs:
    - 全ネットワーク通信記録
    - 異常トラフィック検出
    - フォレンジック分析
  
  Firewall_Logs:
    - ルール適用履歴
    - ブロック通信分析
    - ポリシー効果測定
  
  Cloud_Audit_Logs:
    - 管理操作記録
    - 権限変更追跡
    - コンプライアンス証跡

ログ分析設定:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
# VPC Flow Logs有効化
gcloud compute networks subnets update app-subnet \
    --enable-flow-logs \
    --logging-flow-sampling=1.0 \
    --logging-aggregation-interval=interval-1-min

# BigQuery エクスポート
gcloud logging sinks create security-analysis \
    bigquery.googleapis.com/projects/PROJECT_ID/datasets/security_logs \
    --log-filter='resource.type="gce_subnetwork"'

SIEM統合

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# Cloud Functions セキュリティアラート
import json
from google.cloud import monitoring_v3

def security_alert_handler(event, context):
    """セキュリティイベント処理"""
    
    # ログ解析
    log_entry = json.loads(event['data'])
    
    # 脅威判定
    if detect_suspicious_activity(log_entry):
        
        # アラート生成
        send_security_alert(log_entry)
        
        # 自動対応実行
        trigger_incident_response(log_entry)

def detect_suspicious_activity(log_entry):
    """異常検知ロジック"""
    suspicious_patterns = [
        'Multiple failed login attempts',
        'Unusual data transfer volume',
        'Access from blacklisted IP'
    ]
    
    return any(pattern in str(log_entry) for pattern in suspicious_patterns)

コンプライアンス対応

SOC 2 Type II 対応

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
SOC2_Controls:
  CC6_1_Logical_Access:
    - Multi-factor authentication
    - Privileged access management
    - Access review procedures
  
  CC6_2_Authentication:
    - Identity verification
    - Password policies
    - Session management
  
  CC6_3_Authorization:
    - Role-based access control
    - Segregation of duties
    - Least privilege principle

GDPR対応

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
GDPR_Compliance:
  Data_Protection:
    - Encryption in transit/at rest
    - Pseudonymization techniques
    - Data minimization
  
  Privacy_By_Design:
    - Default privacy settings
    - Privacy impact assessments
    - Data protection documentation
  
  Individual_Rights:
    - Right to access
    - Right to rectification
    - Right to be forgotten

インシデント対応

セキュリティインシデント対応フロー

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
Incident_Response:
  Phase_1_Preparation:
    - Response team formation
    - Playbook development
    - Tool configuration
  
  Phase_2_Detection:
    - Automated alerting
    - Manual monitoring
    - Threat intelligence
  
  Phase_3_Containment:
    - Immediate isolation
    - Evidence preservation
    - Communication plan
  
  Phase_4_Recovery:
    - System restoration
    - Security hardening
    - Lessons learned

自動対応スクリプト

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
#!/bin/bash
# セキュリティインシデント自動対応

# 1. 異常な通信を検知
suspicious_ip="$1"

# 2. 緊急ブロック実行
gcloud compute firewall-rules create emergency-block-$(date +%s) \
    --source-ranges="$suspicious_ip/32" \
    --action=DENY \
    --rules=all \
    --priority=1

# 3. インシデントチームに通知
curl -X POST "$SLACK_WEBHOOK" \
    -d "{'text':'Security incident detected: $suspicious_ip blocked'}"

# 4. 詳細調査データ収集
gcloud logging read "resource.type=\"gce_instance\" AND \"$suspicious_ip\"" \
    --limit=100 --format=json > incident_logs.json

パフォーマンスとセキュリティのバランス

セキュリティ設定の最適化

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
Performance_Security_Balance:
  Firewall_Rules:
    - ルール数最小化
    - 優先順位最適化
    - 定期的なルール見直し
  
  Encryption_Overhead:
    - 適切な暗号化レベル選択
    - Hardware acceleration活用
    - ネットワーク暗号化vs性能
  
  Monitoring_Efficiency:
    - サンプリング率調整
    - ログ retention最適化
    - リアルタイム vs バッチ処理

ベストプラクティス

セキュリティ設計原則

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
Security_Design_Principles:
  1_Defense_in_Depth:
    - 多層防御の実装
    - 単一障害点の排除
    - 独立したセキュリティ制御
  
  2_Fail_Secure:
    - 障害時のセキュアな動作
    - Default deny policies
    - Graceful degradation
  
  3_Least_Privilege:
    - 最小権限の原則
    - Role-based access control
    - Regular access reviews
  
  4_Security_by_Design:
    - 設計段階からのセキュリティ考慮
    - Threat modeling
    - Security requirements definition

継続的セキュリティ改善

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
Continuous_Security_Improvement:
  Regular_Assessments:
    - Penetration testing
    - Vulnerability scanning
    - Security audits
  
  Threat_Intelligence:
    - Latest threat landscape
    - Industry-specific threats
    - Proactive defense updates
  
  Team_Training:
    - Security awareness training
    - Incident response drills
    - Technology updates

まとめ

効果的なネットワークセキュリティ設計の要点:

多層防御の実装:

  • DMZ: インターネット境界での脅威軽減
  • Application: アプリケーション固有の保護
  • Data: データへの最終防御線

ゼロトラストアーキテクチャ:

  • 全通信の認証・認可
  • 最小権限アクセス制御
  • 継続的な検証

運用の自動化:

  • リアルタイム脅威検知
  • 自動インシデント対応
  • 継続的監視・改善

現代の脅威に対抗するには、従来の境界防御を超えた包括的なセキュリティアプローチが不可欠です。


📅 作成日: 2025年09月09日

参考リンク:

技術ネタ、趣味や備忘録などを書いているブログです
Hugo で構築されています。
テーマ StackJimmy によって設計されています。