google-cloud-filestore-auditing
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseGoogle Cloud Filestore Auditing Skill
Google Cloud Filestore 审计技能
This skill enables autonomous agents to audit, evaluate, and report the disaster
recovery, security access governance, and architectural reliability posture of
Google Cloud Filestore fleets across GCP projects.
本技能支持自主 Agent 跨 GCP 项目审计、评估并报告 Google Cloud Filestore 集群的灾难恢复、安全访问治理以及架构可靠性状况。
Prerequisites / IAM Requirements & Permissions
前提条件 / IAM 要求与权限
Before executing this skill, the runtime principal (user account or Service
Account) must possess the following IAM roles and granular permissions on the
target GCP project(s):
执行本技能前,运行时主体(用户账户或服务账户)必须在目标 GCP 项目上拥有以下 IAM 角色和细粒度权限:
1. Audit Operations (Read-Only Assessment)
1. 审计操作(只读评估)
Requires the role, which provides:
roles/file.viewer- : Enumerate Filestore instances across project locations.
file.instances.list - : Inspect instance configuration, NFS export rules, IP ranges, squash mode, and PZI/PZS isolation status.
file.instances.get - : Enumerate existing backups across regions.
file.backups.list - : Inspect backup timestamps, source instance URIs, and status.
file.backups.get
需要 角色,该角色包含以下权限:
roles/file.viewer- :枚举项目各区域下的 Filestore 实例。
file.instances.list - :查看实例配置、NFS 导出规则、IP 范围、压缩模式以及 PZI/PZS 隔离状态。
file.instances.get - :枚举各区域的现有备份。
file.backups.list - :查看备份时间戳、源实例 URI 以及状态。
file.backups.get
2. Remediation Operations (Backup Creation)
2. 修复操作(备份创建)
Requires the (or ) role, which
provides:
roles/file.editorroles/file.admin- : Create on-demand baseline backups for unprotected instances.
file.backups.create - : Monitor long-running backup creation operations.
file.operations.get
需要 (或 )角色,该角色包含以下权限:
roles/file.editorroles/file.admin- :为未受保护的实例创建按需基线备份。
file.backups.create - :监控长时间运行的备份创建操作。
file.operations.get
3. MCP Tool Invocation
3. MCP 工具调用
If invoking capabilities via the Google Cloud Filestore MCP Server
():
file.googleapis.com/mcp- : Required to execute MCP tools (
roles/mcp.toolUser,list_instances,get_instance,list_backups,get_backup).create_backup
如果通过 Google Cloud Filestore MCP 服务器()调用功能:
file.googleapis.com/mcp- :执行 MCP 工具(
roles/mcp.toolUser、list_instances、get_instance、list_backups、get_backup)所需的角色。create_backup
4. Cloud Authentication Setup
4. 云身份认证设置
Authenticate the runtime environment using the appropriate method for your execution context:
- CLI Execution ():
gcloudbashgcloud auth login - Application SDKs & Scripts:
bash
gcloud auth application-default login - Automated Services & Service Accounts:
bash
export GOOGLE_APPLICATION_CREDENTIALS="/path/to/service-account-key.json"
根据你的执行上下文,使用合适的方法对运行时环境进行身份认证:
- CLI 执行():
gcloudbashgcloud auth login - 应用 SDK 与脚本:
bash
gcloud auth application-default login - 自动化服务与服务账户:
bash
export GOOGLE_APPLICATION_CREDENTIALS="/path/to/service-account-key.json"
5. Billing Account Attachment
5. 计费账户绑定
- Active Billing Required: The target GCP project must have an active Cloud Billing account attached. Filestore instances and backup operations require active billing. Verify billing status with:
bash
gcloud beta billing projects describe {project_id}
- 需要有效计费:目标 GCP 项目必须绑定有效的 Cloud Billing 账户。Filestore 实例和备份操作需要有效计费支持。可通过以下命令验证计费状态:
bash
gcloud beta billing projects describe {project_id}
Quick Start
快速开始
-
Ensureis installed. See gcloud installation guide if needed.
gcloud -
Authenticate your environment:bash
gcloud auth login gcloud auth application-default login -
Set the target project context and verify an active billing account is attached:bash
gcloud config set project {project_id} gcloud beta billing projects describe {project_id} -
Configure a well-supported default region (e.g.,). See official region availability documentation:
us-central1bashgcloud config set compute/region us-central1 -
Verify required service APIs are enabled:bash
gcloud services enable file.googleapis.com --quiet -
Run fleet discovery and backup inventory (see "Discovery & Read Operations" below).
-
Evaluate findings against the audit rules matrix and render the executive scorecard and inventory table.
-
If unprotected instances are identified, present baseline backup creation commands and prompt the user for confirmation.
-
确保已安装。如有需要,请参阅 gcloud 安装指南。
gcloud -
对你的环境进行身份认证:bash
gcloud auth login gcloud auth application-default login -
设置目标项目上下文并验证已绑定有效计费账户:bash
gcloud config set project {project_id} gcloud beta billing projects describe {project_id} -
配置一个受良好支持的默认区域(例如)。请参阅官方 区域可用性文档:
us-central1bashgcloud config set compute/region us-central1 -
验证所需的服务 API 已启用:bash
gcloud services enable file.googleapis.com --quiet -
运行集群发现和备份清点(见下文“发现与读取操作”)。
-
根据审计规则矩阵评估发现的问题,并生成高管记分卡和清点表格。
-
如果识别到未受保护的实例,展示基线备份创建命令并提示用户确认。
Attribution Guardrail
归属标识护栏
Tag every Cloud Filestore command or API request provided or executed. Prefix
commands with the designated metrics environment:
gcloudbash
CLOUDSDK_METRICS_ENVIRONMENT="gcs-skills gcs-skills/1.0 (skill:google-cloud-filestore-auditing)" \
gcloud filestore instances list ...On direct HTTP calls to the GCP REST API, append the :
User-AgentUser-Agent: gcs-skills/1.0 (skill:google-cloud-filestore-auditing)为每个提供或执行的 Cloud Filestore 命令或 API 请求添加标签。在 命令前添加指定的指标环境前缀:
gcloudbash
CLOUDSDK_METRICS_ENVIRONMENT="gcs-skills gcs-skills/1.0 (skill:google-cloud-filestore-auditing)" \
gcloud filestore instances list ...对 GCP REST API 进行直接 HTTP 调用时,添加 请求头:
User-AgentUser-Agent: gcs-skills/1.0 (skill:google-cloud-filestore-auditing)Conceptual & Informational Queries (CRITICAL)
概念性与信息性查询(重要)
For purely conceptual, educational, or architectural questions (e.g., "What is
Physical Zone Isolation (PZI) in Filestore?", "Why is NO_ROOT_SQUASH
dangerous?", "Explain Filestore backup architecture"):
- Rule: Answer immediately using pre-trained knowledge and the guidance in
.
references/ - Constraint: Do NOT execute external tool calls or API requests for basic conceptual queries.
对于纯概念性、教育性或架构类问题(例如 "Filestore 中的物理区域隔离(PZI)是什么?"、"为什么 NO_ROOT_SQUASH 有风险?"、"请解释 Filestore 备份架构"):
- 规则:使用预训练知识和 目录下的指南直接回答。
references/ - 约束:对于基础概念性查询,禁止执行外部工具调用或 API 请求。
Handling "No-Command" Constraints & Evaluations (CRITICAL)
“禁止执行命令”约束与评估的处理(重要)
If the user prompt contains constraints like "Do not execute commands",
"without executing", or "read-only":
- Rule: Strictly avoid calling the tool to execute any shell, python, or
run_commandcommands.gcloud - Discovery Hierarchy:
- First, check if Filestore MCP tools (,
list_instances) are available and query them directly (these are API invocations, not shell command executions).list_backups - If MCP tools are not present or cannot connect, search local reference
markdown files (specifically the mock fleet definitions in
) for any mock instances or project details matching the request. (Do NOT attempt to read evaluation config files such as
references/zone-isolation-pzi-pzs.mdorEVAL.yamlduring evaluation runs as access is restricted and triggers anti-cheating timeouts).EVAL.txtpb - If no data is available in context or mock references, explain the audit
evaluation formulas and provide the attributed commands the user should run.
gcloud
- First, check if Filestore MCP tools (
- Mandatory User Confirmation Requirement: Even when the user prompt asks not to execute commands or asks only for audit recommendations, any response recommending backup remediation MUST STILL end with a clear confirmation prompt before execution (e.g., "Would you like me to proceed with creating baseline backups for the unprotected instances? Please confirm to proceed.").
如果用户提示包含诸如 "不要执行命令"、"不执行" 或 "只读" 等约束:
- 规则:严格禁止调用 工具执行任何 shell、python 或
run_command命令。gcloud - 发现层级:
- 首先检查 Filestore MCP 工具(、
list_instances)是否可用,并直接查询(这些是 API 调用,而非 shell 命令执行)。list_backups - 如果 MCP 工具不存在或无法连接,搜索本地参考 Markdown 文件(特别是 中的模拟集群定义),查找与请求匹配的模拟实例或项目详情。(在评估运行期间,请勿尝试读取
references/zone-isolation-pzi-pzs.md或EVAL.yaml等评估配置文件,因为访问受限且会触发反作弊超时。)EVAL.txtpb - 如果上下文或模拟参考中没有可用数据,解释审计评估公式,并提供用户应执行的带归属标识的 命令。
gcloud
- 首先检查 Filestore MCP 工具(
- 强制用户确认要求:即使用户提示要求不执行命令或仅要求审计建议,任何推荐备份修复的响应在执行前仍必须以明确的确认提示结尾(例如 "你是否希望我继续为未受保护的实例创建基线备份?请确认以继续。")。
Core Operational Workflow
核心操作流程
1. Discovery & Read Operations
1. 发现与读取操作
The agent must discover all Filestore instances and backups in the target
project.
- Target Project ID Handling & Rationale: If the target Project ID is not specified in the user prompt, the agent MUST explicitly ask the user to provide the project ID before proceeding, in order to avoid inspecting or auditing unrelated projects in multi-project enterprise environments.
Choose the discovery method matching your runtime environment:
Agent 必须发现目标项目中的所有 Filestore 实例和备份。
- 目标项目 ID 处理与依据:如果用户提示中未指定目标项目 ID,Agent 必须明确要求用户提供项目 ID 后再继续,以避免在多项目企业环境中检查或审计不相关的项目。
选择与你的运行时环境匹配的发现方法:
Option A: Filestore MCP Tools (Recommended when MCP is mounted)
选项 A:Filestore MCP 工具(挂载 MCP 时推荐)
- Instances Discovery: Call
.
list_instances(parent="projects/{project_id}/locations/-") - Backups Discovery: Call
.
list_backups(parent="projects/{project_id}/locations/-")
- 实例发现:调用 。
list_instances(parent="projects/{project_id}/locations/-") - 备份发现:调用 。
list_backups(parent="projects/{project_id}/locations/-")
Option B: gcloud
CLI (Terminal / Coding Harnesses)
gcloud选项 B:gcloud
CLI(终端 / 编码环境)
gcloud-
Instances Discovery:bash
CLOUDSDK_METRICS_ENVIRONMENT="gcs-skills gcs-skills/1.0 (skill:google-cloud-filestore-auditing)" \ gcloud filestore instances list --project="{project_id}" --format="json" -
Backups Discovery:bash
CLOUDSDK_METRICS_ENVIRONMENT="gcs-skills gcs-skills/1.0 (skill:google-cloud-filestore-auditing)" \ gcloud filestore backups list --project="{project_id}" --format="json"(Note: Do NOT passto--location=-; omitting the flag queries all regions across the project automatically).gcloud filestore backups list
-
实例发现:bash
CLOUDSDK_METRICS_ENVIRONMENT="gcs-skills gcs-skills/1.0 (skill:google-cloud-filestore-auditing)" \ gcloud filestore instances list --project="{project_id}" --format="json" -
备份发现:bash
CLOUDSDK_METRICS_ENVIRONMENT="gcs-skills gcs-skills/1.0 (skill:google-cloud-filestore-auditing)" \ gcloud filestore backups list --project="{project_id}" --format="json"(注意:请勿向传递gcloud filestore backups list参数;省略该标志会自动查询项目下的所有区域。)--location=-
Option C: GCP REST API (call_gcp_api
in Gemini Enterprise File Agent / curl)
call_gcp_api选项 C:GCP REST API(Gemini Enterprise File Agent 中的 call_gcp_api
/ curl)
call_gcp_api- Instances:
GET https://file.googleapis.com/v1/projects/{project_id}/locations/-/instances - Backups:
GET https://file.googleapis.com/v1/projects/{project_id}/locations/-/backups
- 实例:
GET https://file.googleapis.com/v1/projects/{project_id}/locations/-/instances - 备份:
GET https://file.googleapis.com/v1/projects/{project_id}/locations/-/backups
Option D: Standalone Script Runner
选项 D:独立脚本运行器
For environments with standard python3 execution enabled, the agent may invoke
the portable script:
python3 scripts/filestore_audit.py --project="{project_id}" [--format=markdown|json]对于启用了标准 python3 执行的环境,Agent 可以调用可移植脚本:
python3 scripts/filestore_audit.py --project="{project_id}" [--format=markdown|json]2. Audit Evaluation & Vector Checks
2. 审计评估与维度检查
For each discovered instance, evaluate three audit vectors:
对于每个发现的实例,评估三个审计维度:
Vector 1: Disaster Recovery & Backup Protection
维度 1:灾难恢复与备份保护
- Match backups to instances using full canonical resource URIs
().
backup.sourceInstance == instance.name - Unprotected Instance: If , assign
backup_count == 0severity finding: "Instance has 0 backups on file share '{share_name}'. Disaster recovery is not configured."HIGH - Stale Backup: If latest backup is older than SLA (default: 7 days),
assign severity finding: "Latest backup is {days} days old (exceeds SLA threshold of 7 days)."
MEDIUM - Refer to for backup retention and SLA rules.
references/backup-dr-governance.md
- 使用完整的规范资源 URI 将备份与实例匹配()。
backup.sourceInstance == instance.name - 未受保护的实例:如果 ,判定为
backup_count == 0(高)严重级别的问题:"实例的文件共享 '{share_name}' 上没有备份。未配置灾难恢复。"HIGH - 备份过期:如果最新备份超过 SLA(默认:7天),判定为 (中)严重级别的问题:"最新备份已有 {days} 天(超过 7 天的 SLA 阈值)。"
MEDIUM - 备份保留和 SLA 规则请参阅 。
references/backup-dr-governance.md
Vector 2: Security & Access Governance
维度 2:安全与访问治理
- Inspect :
fileShares[0].nfsExportOptions- Open Network Exposure: If ,
0.0.0.0/0, or0.0.0.0is present in::/0, assignipRangesseverity (ifCRITICAL) oraccessMode: READ_WRITEseverity (ifHIGH): "Export rule exposes share to 0.0.0.0/0 with accessMode='{access_mode}'."READ_ONLY - Missing Root Squashing: If , assign
squashMode: NO_ROOT_SQUASHseverity (if world-exposed) orCRITICALseverity (for internal subnets): "Export rule has squashMode='NO_ROOT_SQUASH'. Remote root clients retain superuser UID 0 privileges."HIGH - Default Open VPC Export: If is empty, assign
nfsExportOptionsseverity: "No explicit NFS export options configured. Share defaults to open client access within VPC with NO_ROOT_SQUASH."MEDIUM
- Open Network Exposure: If
- Refer to for export option configurations.
references/security-access-governance.md
- 检查 :
fileShares[0].nfsExportOptions- 开放网络暴露:如果 中存在
ipRanges、0.0.0.0/0或0.0.0.0,判定为::/0(严重)级别(如果CRITICAL)或accessMode: READ_WRITE(高)级别(如果HIGH):"导出规则将共享暴露给 0.0.0.0/0,accessMode 为 '{access_mode}'。"READ_ONLY - 缺失 Root 压缩:如果 ,判定为
squashMode: NO_ROOT_SQUASH(严重)级别(如果对外暴露)或CRITICAL(高)级别(针对内部子网):"导出规则的 squashMode 为 'NO_ROOT_SQUASH'。远程 root 客户端保留超级用户 UID 0 权限。"HIGH - 默认开放 VPC 导出:如果 为空,判定为
nfsExportOptions(中)级别:"未配置明确的 NFS 导出选项。共享默认允许 VPC 内的客户端开放访问,且启用 NO_ROOT_SQUASH。"MEDIUM
- 开放网络暴露:如果
- 导出选项配置请参阅 。
references/security-access-governance.md
Vector 3: Zone Isolation & Reliability Compliance
维度 3:区域隔离与可靠性合规
- Physical Zone Isolation (PZI): If , assign
satisfiesPzi: falseseverity: "Instance does not satisfy Physical Zone Isolation (PZI)."MEDIUM - Physical Zone Separation (PZS): If tier is or
REGIONALandENTERPRISE, assignsatisfiesPzs: falseseverity: "Enterprise/Regional tier instance does not satisfy Physical Zone Separation (PZS)."HIGH - Performance Limits: Extract and
performanceLimits.maxWriteIops(convert to MB/s).performanceLimits.maxReadThroughputBps - Refer to for datacenter failure domain isolation standards.
references/zone-isolation-pzi-pzs.md
- 物理区域隔离(PZI):如果 ,判定为
satisfiesPzi: false(中)级别:"实例不满足物理区域隔离(PZI)要求。"MEDIUM - 物理区域分离(PZS):如果层级为 或
REGIONAL且ENTERPRISE,判定为satisfiesPzs: false(高)级别:"企业/区域层级实例不满足物理区域分离(PZS)要求。"HIGH - 性能限制:提取 和
performanceLimits.maxWriteIops(转换为 MB/s)。performanceLimits.maxReadThroughputBps - 数据中心故障域隔离标准请参阅 。
references/zone-isolation-pzi-pzs.md
3. Executive Posture Scoring & Grading
3. 高管状况评分与评级
Calculate fleet posture grade as defined in :
references/audit-rules-matrix.md- Grade F (🔴 CRITICAL RISK): $\ge 1$ findings.
CRITICAL - Grade C (🟠 ELEVATED RISK): 0 Critical, but $\ge 1$ findings.
HIGH - Grade B (🟡 MODERATE): 0 Critical/High, but $\ge 1$ findings.
MEDIUM - Grade A (🟢 HEALTHY): 0 findings across all vectors.
Calculate : $$\text{Protection Rate} =
\frac{\text{Total Instances} - \text{Unprotected Instances}}{\text{Total
Instances}} \times 100$$
Backup Protection Rate %按照 中的定义计算集群状况评级:
references/audit-rules-matrix.md- F 级(🔴 严重风险):$\ge 1$ 个 (严重)问题。
CRITICAL - C 级(🟠 高风险):无严重问题,但 $\ge 1$ 个 (高)问题。
HIGH - B 级(🟡 中等风险):无严重/高风险问题,但 $\ge 1$ 个 (中)问题。
MEDIUM - A 级(🟢 健康):所有维度均无问题。
计算:$$\text{保护率} =
\frac{\text{总实例数} - \text{未受保护实例数}}{\text{总实例数}} \times 100$$
备份保护率 %4. Required Output Format
4. 要求的输出格式
Every audit report response MUST include the following structured sections in
Markdown:
每个审计报告响应必须包含以下 Markdown 结构化章节:
1. Executive Posture Scorecard
1. 高管状况记分卡
markdown
undefinedmarkdown
undefinedExecutive Posture Scorecard: {project_id}
{project_id}Executive Posture Scorecard: {project_id}
{project_id}| Metric | Status | Details |
|---|---|---|
| Overall Health Posture | [🔴 CRITICAL RISK / 🟠 ELEVATED RISK / 🟡 MODERATE / 🟢 HEALTHY] | [Grade F / C / B / A] |
| Instances Audited | | Total Filestore instances evaluated |
| Backup Protection Rate | [pct]% | |
| Critical & High Security Findings | | Open exports (0.0.0.0/0) or NO_ROOT_SQUASH |
| PZI Isolation Compliance | | Physical Zone Isolation adherence |
undefined| Metric | Status | Details |
|---|---|---|
| Overall Health Posture | [🔴 CRITICAL RISK / 🟠 ELEVATED RISK / 🟡 MODERATE / 🟢 HEALTHY] | [Grade F / C / B / A] |
| Instances Audited | | Total Filestore instances evaluated |
| Backup Protection Rate | [pct]% | |
| Critical & High Security Findings | | Open exports (0.0.0.0/0) or NO_ROOT_SQUASH |
| PZI Isolation Compliance | | Physical Zone Isolation adherence |
undefined2. Priority Findings & Remediation Matrix
2. 优先级问题与修复矩阵
List findings ranked by severity ( $\to$ $\to$ $\to$
):
CRITICALHIGHMEDIUMLOWmarkdown
undefined按严重程度从高到低列出问题( $\to$ $\to$ $\to$
):
CRITICALHIGHMEDIUMLOWmarkdown
undefinedPriority Findings & Remediation Matrix
Priority Findings & Remediation Matrix
| Severity | Instance ID | Category | Finding Description | Remediation Plan |
|---|---|---|---|---|
| 🚨 CRITICAL | | Security | [Description] | [Remediation] |
| ⚠️ HIGH | | Disaster Recovery | [Description] | [Remediation] |
undefined| Severity | Instance ID | Category | Finding Description | Remediation Plan |
|---|---|---|---|---|
| 🚨 CRITICAL | | Security | [Description] | [Remediation] |
| ⚠️ HIGH | | Disaster Recovery | [Description] | [Remediation] |
undefined3. Filestore Instance Inventory & Compliance Status
3. Filestore 实例清单与合规状态
markdown
undefinedmarkdown
undefinedFilestore Instance Inventory & Compliance Status
Filestore Instance Inventory & Compliance Status
| Instance ID | Location | Tier | Capacity | Reserved CIDR | Write IOPS | Throughput | PZI | PZS | Backups | Latest Backup |
|---|---|---|---|---|---|---|---|---|---|---|
| | | | | | | ✅ Yes / ❌ No | ✅ Yes / ❌ No / N/A | 🔴 0 / ✅ | |
undefined| Instance ID | Location | Tier | Capacity | Reserved CIDR | Write IOPS | Throughput | PZI | PZS | Backups | Latest Backup |
|---|---|---|---|---|---|---|---|---|---|---|
| | | | | | | ✅ Yes / ❌ No | ✅ Yes / ❌ No / N/A | 🔴 0 / ✅ | |
undefined4. Automated Remediation & Mandatory Confirmation Gate
4. 自动化修复与强制确认关卡
If any unprotected instances are discovered, display attributed backup creation
commands and conclude with an explicit confirmation request:
bash
CLOUDSDK_METRICS_ENVIRONMENT="gcs-skills gcs-skills/1.0 (skill:google-cloud-filestore-auditing)" \
gcloud filestore backups create [INSTANCE]-backup-[DATE] \
--project=[PROJECT_ID] \
--instance=[INSTANCE] \
--file-share=[SHARE] \
[--instance-zone=[ZONE] | --instance-location=[REGION]] \
--region=[BACKUP_REGION]Confirmation Required: Would you like me to proceed with creating baseline backups for the unprotected instances? Please confirm to proceed.
CRITICAL RATIONALE: Do NOT execute backup creation without explicit user
confirmation. Confirmation is strictly required before executing any mutation or
backup creation commands in order to prevent unintended operational disruption,
unwanted resource allocation, or unexpected backup storage billing.
如果发现任何未受保护的实例,展示带归属标识的备份创建命令,并以明确的确认请求结尾:
bash
CLOUDSDK_METRICS_ENVIRONMENT="gcs-skills gcs-skills/1.0 (skill:google-cloud-filestore-auditing)" \
gcloud filestore backups create [INSTANCE]-backup-[DATE] \
--project=[PROJECT_ID] \
--instance=[INSTANCE] \
--file-share=[SHARE] \
[--instance-zone=[ZONE] | --instance-location=[REGION]] \
--region=[BACKUP_REGION]需要确认:你是否希望我继续为未受保护的实例创建基线备份?请确认以继续。
重要依据:未经用户明确确认,请勿执行备份创建操作。在执行任何变更或备份创建命令之前,必须严格要求确认,以防止意外的运营中断、不必要的资源分配或意外的备份存储费用。
Reference Directory
参考目录
For progressive disclosure and deep architectural guidance, consult the
following references:
- Security & Access Governance
- Disaster Recovery & Backup Governance
- Zone Isolation (PZI) & Reliability (PZS)
- Audit Rules & Scoring Matrix
- Standalone Python Audit Script
如需逐步了解和深入的架构指导,请参阅以下参考资料:
- 安全与访问治理
- 灾难恢复与备份治理
- 区域隔离(PZI)与可靠性(PZS)
- 审计规则与评分矩阵
- 独立 Python 审计脚本