mcpField
I
implementing-google-workspace-admin-security

implementing-google-workspace-admin-security

github.com/mukul975セキュリティ35.2k48 回インストール8 週間前に更新
リポジトリ

implementing-google-workspace-admin-security について

Google Workspace 管理者やセキュリティチーム向けに、環境の強化を支援するセキュリティスキルです。アカウント保護、フィッシング耐性 MFA、メール認証、DLP、OAuth アクセス、Drive 共有を扱います。

主な機能

  1. 01Super Admin アカウントの強化
  2. 02フィッシング耐性 MFA の設定
  3. 03SPF、DKIM、DMARC の設定
  4. 04Gmail と Drive の DLP ルール作成
  5. 05OAuth アプリと外部共有の制限

活用シーン

  1. 01買収した Google Workspace テナントの保護
  2. 02CIS ベンチマークに基づく設定評価
  3. 03フィッシングやビジネスメール詐欺のリスク低減
  4. 04組織データへのサードパーティアプリのアクセス制限

インストール

コマンドをコピーしてターミナルで実行します。

$npx skills add https://github.com/mukul975/anthropic-cybersecurity-skills --skill implementing-google-workspace-admin-security

インストール後、Claude Code で/implementing-google-workspace-admin-securityを入力して読み込まれたか確認します。

同梱ファイル

SKILL.md と一緒にインストールされる参考資料やスクリプト。

LICENSE
references/
api-reference.md
scripts/
agent.py

詳細

Google Workspace 管理者セキュリティの実装

使用するタイミング

  • エンタープライズ利用向けに Google Workspace 環境を導入または強化するとき
  • Google Workspace の構成について CIS ベンチマークへの準拠を評価するとき
  • Google アカウントを狙うビジネスメール詐欺(BEC)およびフィッシング攻撃から保護するとき
  • Gmail と Google ドライブに対してデータ損失防止(DLP)の制御を実装するとき
  • OAuth アプリケーションへのアクセスとサードパーティ連携を制限するとき
  • Advanced Protection Program への登録によって管理者アカウントのセキュリティを構成するとき

使用しないでください: Microsoft 365 環境では使用しないでください。Google Workspace には、Azure AD/Entra ID の制御とは異なる管理コンソールの設定や API 構成があります。

前提条件

  • Google Workspace Business Plus、Enterprise Standard、または Enterprise Plus のライセンス
  • Google 管理コンソール(admin.google.com)へのスーパー管理者アクセス権
  • SPF、DKIM、DMARC レコードを構成するための DNS 管理アクセス権
  • 高度なセキュリティ機能を利用するための Google Cloud Identity または Cloud Identity Premium
  • スーパー管理者アカウント用の FIDO2 セキュリティキー(YubiKey 5 Series 推奨)

ワークフロー

ステップ 1: スーパー管理者アカウントを強化する

Google Workspace テナントで最も高い権限を持つアカウントを保護します。

# Google Workspace Admin SDK - configure admin account security
# Using gam (Google Apps Manager) CLI tool

# List all super admin accounts for audit
gam print admins role "Super Admin" > super_admins.csv
echo "Review and minimize super admin count (recommended: 2-3 maximum)"

# Enforce Advanced Protection Program for super admins
# APP provides strongest account protections:
# - Requires FIDO2 security key for sign-in
# - Blocks third-party app access to Gmail and Drive
# - Enhanced account recovery verification
gam update user [email protected] \
    advanced_protection true

# Create dedicated break-glass admin account
gam create user [email protected] \
    firstname "Break" lastname "Glass Admin" \
    password "$(openssl rand -base64 32)" \
    changepassword true \
    org "/Emergency Accounts"

# Assign super admin role to break-glass account
gam create admin [email protected] "Super Admin"

# Configure admin activity alerts
# Alert Center API - create alert for admin actions
cat > admin_alert_policy.json << 'EOF'
{
  "alertPolicies": [
    {
      "name": "Super Admin Sign-In Alert",
      "conditions": {
        "eventType": "login",
        "filterCriteria": "actor.adminRole=SUPER_ADMIN"
      },
      "notifications": {
        "email": ["[email protected]"],
        "webhook": "https://siem.corp.com/webhook/google-admin"
      }
    },
    {
      "name": "Admin Role Change Alert",
      "conditions": {
        "eventType": "admin_role_change"
      },
      "notifications": {
        "email": ["[email protected]"]
      }
    }
  ]
}
EOF
ステップ 2: フィッシング耐性のある多要素認証を適用する

フィッシングされうる認証要素を排除する MFA ポリシーを構成します。

# Enforce 2-Step Verification for all organizational units
# Using Admin SDK Directory API

# Enable 2SV enforcement for the entire organization
gam update org "/" settings \
    2sv_enforcement true \
    2sv_enrollment_grace_period 14 \
    2sv_new_user_enrollment_period 1

# Configure allowed 2SV methods - restrict to phishing-resistant only
# For high-security OUs: Security keys only
gam update org "/Executive" settings \
    2sv_allowed_methods "SECURITY_KEY_ONLY"

# For general staff: Security keys or phone prompts (no SMS/voice)
gam update org "/" settings \
    2sv_allowed_methods "SECURITY_KEY,PHONE_PROMPT" \
    2sv_disallowed_methods "SMS,VOICE_CALL,BACKUP_CODES"

# Bulk check 2SV enrollment status
gam print users \
    fields primaryEmail,isEnrolledIn2Sv,isEnforcedIn2Sv \
    query "isEnrolledIn2Sv=false" > users_without_2sv.csv

# Count users without 2SV
echo "Users without 2SV enrolled:"
wc -l < users_without_2sv.csv

# Configure context-aware access policies
# Require 2SV + managed device for sensitive apps
cat > context_aware_policy.json << 'EOF'
{
  "accessLevels": [
    {
      "name": "Managed Device Required",
      "conditions": {
        "devicePolicy": {
          "requireScreenLock": true,
          "requireAdminApproval": true,
          "allowedEncryptionStatuses": ["ENCRYPTED"],
          "requireCorpOwned": false
        },
        "requiredAccessLevels": ["VERIFIED_2SV"]
      }
    }
  ],
  "applicationPolicies": [
    {
      "applications": ["Google Drive", "Gmail", "Admin Console"],
      "accessLevel": "Managed Device Required"
    }
  ]
}
EOF
ステップ 3: メール認証とフィッシング対策を構成する

SPF、DKIM、DMARC と高度なフィッシング対策を設定します。

# Step 3a: Configure SPF record
# Add to DNS TXT record for corp.com
echo 'DNS TXT Record for SPF:'
echo 'corp.com TXT "v=spf1 include:_spf.google.com ~all"'
echo ''
echo 'After testing, change ~all to -all (hard fail) for enforcement'

# Step 3b: Generate and configure DKIM signing
# Generate 2048-bit DKIM key via Admin Console or API
gam create dkim domain corp.com selector google bitlength 2048

echo 'Add DKIM DNS TXT record:'
echo 'google._domainkey.corp.com TXT "v=DKIM1; k=rsa; p=<public_key_from_admin_console>"'

# Verify DKIM is working
gam info dkim domain corp.com

# Step 3c: Configure DMARC policy
echo 'DNS TXT Record for DMARC (start with monitoring):'
echo '_dmarc.corp.com TXT "v=DMARC1; p=none; rua=mailto:[email protected]; ruf=mailto:[email protected]; pct=100; adkim=s; aspf=s"'
echo ''
echo 'After 30 days monitoring, escalate to quarantine then reject:'
echo '_dmarc.corp.com TXT "v=DMARC1; p=reject; rua=mailto:[email protected]; pct=100; adkim=s; aspf=s"'

# Step 3d: Enable advanced phishing and malware protection
# Configure in Admin Console > Security > Email Safety
gam update settings email_safety \
    protect_against_domain_spoofing true \
    protect_against_employee_spoofing true \
    protect_against_inbound_spoofing true \
    protect_unauthenticated_email true \
    identify_spoofed_groups true \
    auto_move_suspicious_to_spam true

# Configure attachment security
gam update settings email_safety \
    protect_encrypted_attachments true \
    protect_anomalous_attachment_types true \
    protect_scripts_from_untrusted true \
    whitelist_sender_domains "" \
    apply_future_recommended_settings true
ステップ 4: データ損失防止(DLP)を実装する

機密データの持ち出しを防ぐ DLP ルールを構成します。

# Create DLP rules for Gmail and Drive
# Using Google Workspace DLP API

cat > dlp_rules.json << 'EOF'
{
  "dlpRules": [
    {
      "name": "PII Detection - SSN",
      "description": "Detect Social Security Numbers in outbound email and Drive sharing",
      "trigger": {
        "contentMatchers": [
          {
            "infoType": "US_SOCIAL_SECURITY_NUMBER",
            "likelihood": "LIKELY",
            "minMatchCount": 1
          }
        ],
        "scope": ["GMAIL_OUTBOUND", "DRIVE_EXTERNAL_SHARE"]
      },
      "action": {
        "blockAction": "QUARANTINE",
        "notifyAdmin": true,
        "notifyUser": true,
        "userMessage": "This message contains a Social Security Number and has been quarantined for review.",
        "auditLog": true
      }
    },
    {
      "name": "Credit Card Number Detection",
      "description": "Block credit card numbers in outbound communications",
      "trigger": {
        "contentMatchers": [
          {
            "infoType": "CREDIT_CARD_NUMBER",
            "likelihood": "LIKELY",
            "minMatchCount": 1
          }
        ],
        "scope": ["GMAIL_OUTBOUND", "DRIVE_EXTERNAL_SHARE", "CHAT"]
      },
      "action": {
        "blockAction": "BLOCK",
        "notifyAdmin": true,
        "notifyUser": true,
        "auditLog": true
      }
    },
    {
      "name": "Confidential Document Detection",
      "description": "Detect documents marked as Confidential or Internal Only",
      "trigger": {
        "contentMatchers": [
          {
            "customRegex": "(?i)(CONFIDENTIAL|INTERNAL ONLY|DO NOT DISTRIBUTE|RESTRICTED)",
            "minMatchCount": 2
          }
        ],
        "metadataMatchers": [
          {
            "driveLabels": ["Confidential", "Restricted"]
          }
        ],
        "scope": ["DRIVE_EXTERNAL_SHARE"]
      },
      "action": {
        "blockAction": "WARN",
        "requireJustification": true,
        "auditLog": true
      }
    }
  ]
}
EOF

echo "Apply DLP rules via Admin Console > Security > Data Protection"
echo "Or use the Google Workspace DLP API for programmatic deployment"
ステップ 5: OAuth アプリケーションとサードパーティアクセスを制御する

組織のデータにアクセスできるサードパーティアプリケーションを制限します。

# Configure OAuth app access control
# Admin Console > Security > API Controls > App Access Control

# Block all third-party apps by default, then allowlist approved ones
gam update org "/" settings \
    third_party_app_access "BLOCKED" \
    allow_users_to_install_apps false

# Allowlist approved applications
cat > approved_apps.json << 'EOF'
{
  "allowedApps": [
    {
      "appId": "slack-app-id",
      "name": "Slack",
      "scopes": ["gmail.readonly", "calendar.readonly"],
      "approvedBy": "security-team",
      "reviewDate": "2026-01-15"
    },
    {
      "appId": "zoom-app-id",
      "name": "Zoom",
      "scopes": ["calendar.events"],
      "approvedBy": "security-team",
      "reviewDate": "2026-01-15"
    },
    {
      "appId": "salesforce-app-id",
      "name": "Salesforce",
      "scopes": ["gmail.send", "contacts.readonly"],
      "approvedBy": "security-team",
      "reviewDate": "2026-01-15"
    }
  ]
}
EOF

# Audit current OAuth tokens granted by users
gam all users print tokens > oauth_tokens_audit.csv
echo "Review oauth_tokens_audit.csv for unauthorized third-party access"

# Revoke tokens for unapproved applications
gam all users deprovision tokens \
    clientid "unapproved-app-client-id"

# Configure API scopes restriction
# Limit which API scopes third-party apps can request
gam update org "/" settings \
    api_access_restricted true \
    allowed_api_scopes "gmail.readonly,calendar.readonly,drive.readonly"
ステップ 6: 外部共有とドライブのセキュリティを構成する

データ共有の制御を厳格化します。

# Configure Google Drive sharing restrictions
gam update org "/" settings \
    drive_sharing_outside_domain "WHITELISTED_DOMAINS" \
    drive_sharing_whitelisted_domains "partner1.com,partner2.com" \
    drive_allow_file_requests false \
    drive_shared_drive_creation "ADMIN_ONLY" \
    drive_default_link_sharing "RESTRICTED"

# Configure sharing alerts
gam create alert \
    name "External Sharing Alert" \
    type "drive_external_share" \
    condition "shared_outside_domain=true AND file_type IN ('spreadsheet','document','presentation')" \
    action "notify_admin [email protected]"

# Audit current external shares
gam all users print filelist \
    fields id,name,owners,permissions \
    query "visibility='anyoneWithLink' or visibility='anyoneCanFind'" \
    > external_shares_audit.csv

echo "External shares requiring review:"
wc -l < external_shares_audit.csv

# Configure Google Groups security
gam update org "/" settings \
    groups_external_members false \
    groups_external_posting false \
    groups_creation "ADMIN_ONLY" \
    groups_allow_external_invitations false

主要な概念

用語定義
Advanced Protection Program (APP)Google の最も強力なアカウントセキュリティ。FIDO2 セキュリティキーを必須とし、サードパーティアプリのアクセスをブロックし、アカウント回復時に強化された本人確認を行う
Context-Aware Accessデバイスの状態、所在地、ユーザーIDを評価してから Google Workspace アプリケーションへのアクセスを許可するセキュリティポリシーの枠組み
DMARCSPF と DKIM の整合性を検証することで、メールドメインのなりすましを防ぐドメインベースのメール認証、レポート、適合性プロトコル
DLP ルールGmail、ドライブ、Chat のコンテンツを機密データのパターンについてスキャンし、ブロック、隔離、または警告のアクションを実行するデータ損失防止ポリシー
OAuth アプリの許可リスト化Google OAuth API スコープを通じて、組織のデータにアクセスできるサードパーティアプリケーションを制限する管理者向けの制御
2 段階認証(2SV)セキュリティキー、電話への通知、TOTP、バックアップコードを第 2 要素としてサポートする Google の多要素認証の実装

ツールとシステム

  • Google 管理コンソール: すべての Google Workspace のセキュリティ設定、ユーザー、組織単位を管理するためのウェブベースの管理ポータル
  • GAM(Google Apps Manager): Google Workspace の一括管理と自動化のためのオープンソースのコマンドラインツール
  • Google Workspace Alert Center: 不審なログインアクティビティ、DLP 違反、デバイスの侵害などのセキュリティアラートを集約するダッシュボード
  • Google BeyondCorp Enterprise: コンテキストアウェアなアクセスポリシーのために Google Workspace と統合されたゼロトラストアクセスソリューション

一般的なシナリオ

シナリオ: 買収した Google Workspace テナントのセキュリティ確保

コンテキスト: 買収後のセキュリティ監査で、買収先企業の Google Workspace には MFA の強制が設定されておらず、外部共有が開放され、DLP ポリシーもなく、ユーザーデータにアクセスする未承認の OAuth アプリケーションが複数存在することが判明しました。

アプローチ:

  1. FIDO2 セキュリティキーを使用して、すべてのスーパー管理者アカウントに対して直ちに 2SV を強制します
  2. スーパー管理者の数を 3 名(プライマリ、セカンダリ、緊急時用の break-glass)に減らします
  3. SPF、DKIM、DMARC を、監視モード(p=none)から導入します
  4. Email Safety で、すべてのアンチフィッシングおよびアンチスプーフィング設定を有効にします
  5. 未承認の OAuth アプリケーションのトークンをすべて監査し、取り消します
  6. サードパーティアプリのアクセスをブロックに設定し、承認済みアプリケーションのみを許可リストに登録します
  7. 外部への Drive 共有を、承認済みのパートナードメインのみに制限します
  8. PII、財務データ、機密文書を対象とした DLP ルールを導入します
  9. 機密性の高いアプリケーションに対して、管理対象デバイスを必須とするコンテキスト認識型アクセスを有効にします
  10. 継続的な監視のために、セキュリティアラートと SIEM 連携を設定します

注意点:

  • 登録猶予期間を設けずに MFA を強制すると、ユーザーがアカウントからロックアウトされます
  • 監視期間の前に DMARC を reject に設定すると、正規のメール配信が失敗する原因になります
  • 業務上重要な連携を特定せずにすべての OAuth アプリをブロックすると、ワークフローが中断されます
  • 既存の外部共有を監査せずに共有を制限すると、データが露出したままになります

出力形式

GOOGLE WORKSPACE SECURITY ASSESSMENT REPORT
=============================================
Tenant:            corp.com
License:           Enterprise Plus
Total Users:       3,847
Organizational Units: 12

AUTHENTICATION SECURITY
2SV Enforced:           YES (all OUs)
2SV Enrollment:         3,712 / 3,847 (96.5%)
Security Keys Only:     Executive OU (47 users)
Advanced Protection:    3 super admin accounts
Super Admin Count:      3 (within recommended limit)

EMAIL AUTHENTICATION
SPF:                    CONFIGURED (hard fail: -all)
DKIM:                   CONFIGURED (2048-bit, selector: google)
DMARC:                  ENFORCED (p=reject, 100%)
Anti-Phishing:          ALL PROTECTIONS ENABLED
Anti-Spoofing:          ENABLED (domain + employee name)

DATA PROTECTION
DLP Rules Active:       7
  PII Detection:        SSN, Credit Card, Passport
  Content Labels:       Confidential, Restricted
  Custom Patterns:      3 organization-specific rules
DLP Violations (30d):   89 (67 blocked, 22 warned)

APPLICATION CONTROL
Third-Party App Policy: BLOCKED (allowlist mode)
Approved Apps:          12
Unauthorized Tokens:    0 (all revoked)
API Scope Restrictions: ENABLED

SHARING CONTROLS
External Sharing:       RESTRICTED (allowlisted domains only)
Public Link Sharing:    DISABLED
External Group Members: DISABLED
Shared Drive Creation:  ADMIN ONLY

コメント