google-cloud-filestore-auditing
Audits Filestore instances on Google Cloud across projects for disaster recovery readiness (missing or stale backups), security access governance (overly permissive NFS export rules, 0.0.0.0/0 exposure, missing ROOT_SQUASH), and reliability compliance (Physical Zone Isolation PZI and Physical Zone Separation PZS). Use when assessing storage health posture, auditing NFS export permissions, identifying unprotected file shares, or validating zone failure domains. Don't use for Cloud Storage buckets, Persistent Disk, or NetApp Volumes.
- License 许可
- Apache-2.0
- 所属仓库
- google/skills
- 最近更新
- 2026-11-13
- Stars
- ★ 2.4w
- Forks
- 2.0k
01 前言 Front Matter
- name
- google-cloud-filestore-auditing
- metadata
- { "version": "1.0.3", "category": "Storage" }
- description
- Audits Filestore instances on Google Cloud across projects for disaster recovery readiness (missing or stale backups), security access governance (overly permissive NFS export rules, 0.0.0.0/0 exposure, missing ROOT_SQUASH), and reliability compliance (Physical Zone Isolation PZI and Physical Zone Separation PZS). Use when assessing storage health posture, auditing NFS export permissions, identifying unprotected file shares, or validating zone failure domains. Don't use for Cloud Storage buckets, Persistent Disk, or NetApp Volumes.
02 资源文件 6
- 参考文档references/attribution.md1.9 KB
- 参考文档references/audit-rules-matrix.md8.8 KB
- 参考文档references/backup-dr-governance.md6.7 KB
- 参考文档references/security-access-governance.md5.9 KB
- 参考文档references/zone-isolation-pzi-pzs.md9.0 KB
- 脚本scripts/filestore_audit.py22.0 KB
03 SKILL.md 正文
Filestore Auditing Skill
This skill enables autonomous agents to audit, evaluate, and report the disaster recovery, security access governance, and architectural reliability posture of Filestore fleets across Google Cloud projects.
Prerequisites / IAM Requirements & Permissions
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):
1. Audit Operations (Read-Only Assessment)
Requires the roles/file.viewer role, which provides:
file.instances.list: Enumerate Filestore instances across project locations.file.instances.get: Inspect instance configuration, NFS export rules, IP ranges, squash mode, and PZI/PZS isolation status.file.backups.list: Enumerate existing backups across regions.file.backups.get: Inspect backup timestamps, source instance URIs, and status.
2. Remediation Operations (Backup Creation)
Requires the roles/file.editor (or roles/file.admin) role, which
provides:
file.backups.create: Create on-demand baseline backups for unprotected instances.file.operations.get: Monitor long-running backup creation operations.
3. MCP Tool Invocation
If invoking capabilities via the Filestore MCP Server
(file.googleapis.com/mcp):
roles/mcp.toolUser: Required to execute MCP tools (list_instances,get_instance,list_backups,get_backup,create_backup).
4. Cloud Authentication Setup
Authenticate the runtime environment using the appropriate method for your execution context:
- CLI Execution (
gcloud):gcloud auth login - Application SDKs & Scripts:
gcloud auth application-default login - Automated Services & Service Accounts:
export GOOGLE_APPLICATION_CREDENTIALS="/path/to/service-account-key.json"
5. Billing Account Attachment
- 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:
gcloud beta billing projects describe {project_id}
Quick Start
-
Ensure
gcloudis installed. See gcloud installation guide if needed. -
Authenticate your environment:
gcloud auth login gcloud auth application-default login -
Set the target project context and verify an active billing account is attached:
gcloud config set project {project_id} gcloud beta billing projects describe {project_id} -
Configure a well-supported default region (e.g.,
us-central1). See official region availability documentation:gcloud config set compute/region us-central1 -
Verify required service APIs are enabled:
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.
Usage Attribution
MUST READ: Before executing any gcloud, REST API, or MCP command, you
MUST read and follow the instructions in
Usage Attribution.
Conceptual & Informational Queries (CRITICAL)
For purely conceptual, educational, or architectural questions (e.g., "What is Physical Zone Isolation (PZI) in Filestore?", "What is the difference between PZI and PZS?", "Why is NO_ROOT_SQUASH dangerous?", "Explain Filestore backup architecture"):
- Rule: Answer immediately in a single turn using pre-trained knowledge
and the definitions in this
SKILL.mdfile:- Physical Zone Isolation (
PZI/satisfiesPzi): Ensures a zonal resource's physical hardware is confined to an isolated physical failure domain within a datacenter so localized hardware failures do not cross zones. - Physical Zone Separation (
PZS/satisfiesPzs): Ensures multi-zone or regional primary and replica nodes are hosted in physically distinct, independent datacenter facilities so a facility-wide outage cannot affect both copies.
- Physical Zone Isolation (
- Constraint: Do NOT call ANY tools whatsoever (do NOT call
read_fileonreferences/,run_command, MCP tools, or API requests) for purely conceptual questions—respond directly right away.
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
run_commandtool to execute any shell, python, orgcloudcommands. - Discovery Hierarchy:
- Always read Usage Attribution whenever
outputting or recommending
gcloudcommands (such as backup creation or export remediation commands) so they include the required attribution prefix. - Check if Filestore MCP tools (
list_instances,list_backups) are available and query them directly (these are API invocations, not shell command executions). - If MCP tools are not present or cannot connect, search local reference
markdown files (specifically the mock fleet definitions in
references/zone-isolation-pzi-pzs.md) for any mock instances or project details matching the request. (Do NOT attempt to read evaluation config files such asEVAL.yamlorEVAL.txtpbduring evaluation runs as access is restricted and triggers anti-cheating timeouts). - If no data is available in context or mock references, explain the audit
evaluation formulas and provide the attributed
gcloudcommands for manual terminal execution.
- Always read Usage Attribution whenever
outputting or recommending
- 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.").
Core Operational Workflow
1. Discovery & Read Operations
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:
Option A: Filestore MCP Tools (Recommended when MCP is mounted)
- Instances Discovery: Call
list_instances(parent="projects/{project_id}/locations/-"). - Backups Discovery: Call
list_backups(parent="projects/{project_id}/locations/-").
Option B: gcloud CLI (Terminal / Coding Harnesses)
-
Instances Discovery:
gcloud filestore instances list --project="{project_id}" --format="json" -
Backups Discovery:
gcloud filestore backups list --project="{project_id}" --format="json"(Note: Do NOT pass
--location=-togcloud filestore backups list; omitting the flag queries all regions across the project automatically).
Option C: GCP REST API (call_gcp_api in Gemini Enterprise File Agent / curl)
- Instances:
GET https://file.googleapis.com/v1/projects/{project_id}/locations/-/instances - Backups:
GET https://file.googleapis.com/v1/projects/{project_id}/locations/-/backups
Option D: Standalone Script Runner
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]
2. Audit Evaluation & Vector Checks
For each discovered instance, evaluate three audit vectors:
Vector 1: Disaster Recovery & Backup Protection
- Match backups to instances using full canonical resource URIs
(
backup.sourceInstance == instance.name). - Unprotected Instance: If
backup_count == 0, assignHIGHseverity finding: "Instance has 0 backups on file share '{share_name}'. Disaster recovery is not configured." - Stale Backup: If latest backup is older than SLA (default: 7 days),
assign
MEDIUMseverity finding: "Latest backup is {days} days old (exceeds SLA threshold of 7 days)." - Refer to
references/backup-dr-governance.mdfor backup retention and SLA rules.
Vector 2: Security & Access Governance
- Inspect
fileShares[0].nfsExportOptions:- Open Network Exposure: If
0.0.0.0/0,0.0.0.0, or::/0is present inipRanges, assignCRITICALseverity (ifaccessMode: READ_WRITE) orHIGHseverity (ifREAD_ONLY): "Export rule exposes share to 0.0.0.0/0 with accessMode='{access_mode}'." - Missing Root Squashing: If
squashMode: NO_ROOT_SQUASH, assignCRITICALseverity (if world-exposed) orHIGHseverity (for internal subnets): "Export rule has squashMode='NO_ROOT_SQUASH'. Remote root clients retain superuser UID 0 privileges." - Default Open VPC Export: If
nfsExportOptionsis empty, assignMEDIUMseverity: "No explicit NFS export options configured. Share defaults to open client access within VPC with NO_ROOT_SQUASH."
- Open Network Exposure: If
- Refer to
references/security-access-governance.mdfor export option configurations.
Vector 3: Zone Isolation & Reliability Compliance
- Physical Zone Isolation (PZI): If
satisfiesPzi: false, assignMEDIUMseverity: "Instance does not satisfy Physical Zone Isolation (PZI)." - Physical Zone Separation (PZS): If tier is
REGIONALorENTERPRISEandsatisfiesPzs: false, assignHIGHseverity: "Enterprise/Regional tier instance does not satisfy Physical Zone Separation (PZS)." - Performance Limits: Extract
performanceLimits.maxWriteIopsandperformanceLimits.maxReadThroughputBps(convert to MB/s). - Refer to
references/zone-isolation-pzi-pzs.mdfor datacenter failure domain isolation standards.
3. Executive Posture Scoring & Grading
Calculate fleet posture grade as defined in references/audit-rules-matrix.md:
- Grade F (🔴 CRITICAL RISK): $\ge 1$
CRITICALfindings. - Grade C (🟠 ELEVATED RISK): 0 Critical, but $\ge 1$
HIGHfindings. - Grade B (🟡 MODERATE): 0 Critical/High, but $\ge 1$
MEDIUMfindings. - Grade A (🟢 HEALTHY): 0 findings across all vectors.
Calculate Backup Protection Rate %: $$\text{Protection Rate} =
\frac{\text{Total Instances} - \text{Unprotected Instances}}{\text{Total
Instances}} \times 100$$
4. Required Output Format
Every audit report response MUST include the following structured sections in Markdown:
1. Executive Posture Scorecard
## Executive Posture Scorecard: `{project_id}`
| Metric | Status | Details |
| :--- | :--- | :--- |
| **Overall Health Posture** | **[🔴 CRITICAL RISK / 🟠 ELEVATED RISK / 🟡 MODERATE / 🟢 HEALTHY]** | [Grade F / C / B / A] |
| **Instances Audited** | `[count]` | Total Filestore instances evaluated |
| **Backup Protection Rate** | **[pct]%** | `[protected]/[total]` instances have active backups |
| **Critical & High Security Findings** | `[crit] Critical, [high] High` | Open exports (0.0.0.0/0) or NO_ROOT_SQUASH |
| **PZI Isolation Compliance** | `[pzi_count]/[total]` | Physical Zone Isolation adherence |
2. Priority Findings & Remediation Matrix
List findings ranked by severity (CRITICAL $\to$ HIGH $\to$ MEDIUM $\to$
LOW):
## Priority Findings & Remediation Matrix
| Severity | Instance ID | Category | Finding Description | Remediation Plan |
| :--- | :--- | :--- | :--- | :--- |
| 🚨 **CRITICAL** | `[instance]` | Security | [Description] | [Remediation] |
| ⚠️ **HIGH** | `[instance]` | Disaster Recovery | [Description] | [Remediation] |
3. Filestore Instance Inventory & Compliance Status
## Filestore Instance Inventory & Compliance Status
| Instance ID | Location | Tier | Capacity | Reserved CIDR | Write IOPS | Throughput | PZI | PZS | Backups | Latest Backup |
| :--- | :--- | :--- | :--- | :--- | :--- | :--- | :--- | :--- | :--- | :--- |
| `[id]` | `[loc]` | `[tier]` | `[cap] GiB` | `[cidr]` | `[iops]` | `[tp] MB/s` | ✅ Yes / ❌ No | ✅ Yes / ❌ No / N/A | 🔴 0 / ✅ `[n]` | `[date]` |
4. Automated Remediation & Mandatory Confirmation Gate
If any unprotected instances are discovered, display attributed backup creation commands and conclude with an explicit confirmation request:
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.
Reference Directory
For progressive disclosure and deep architectural guidance, consult the following references:
04 同仓库更多 Skills
sign-in-with-google-web
Implement, configure, and secure Sign In With Google (SiwG) using Google Identity Services (GIS / `https://accounts.google.com/gsi/client`) across web architectures. Use when creating Google sign-in buttons, implementing Google One Tap with FedCM, integrating GIS in React/Next.js/Angular/HTML, verifying ID tokens on backend runtimes (Python/Node.js/Go/Java), enforcing Google Workspace domain restrictions (`hd`), securing client-side ID tokens via WebCrypto nonces or encrypted IndexedDB, embedding in cross-origin iframes via the Intermediate Iframe API (`https://accounts.google.com/gsi/intermediate`), configuring Content Security Policy (CSP), COOP, and Permissions Policy (`identity-credentials-get`) headers, or handling sign-out and revocation. Don't use for legacy Google Sign-In (`gapi.auth2`), Google Cloud IAM service accounts, or Android/iOS native Credential Manager.
dpop-adoption
Implement and debug OAuth 2.0 DPoP (RFC 9449) refresh token sender-constraining for WebCrypto, Node.js ES6, and browser runtimes integrating with Google's OAuth platform. Use when configuring non-extractable asymmetric key pairs (P-256), generating DPoP Proof JWTs for authorization code exchange and token refresh, or handling 400 use_dpop_nonce challenge retry loops at oauth2.googleapis.com/token. Don't use for unconstrained OAuth 2.0 flows (where refresh tokens are not bound to a client key pair), or for Google Cloud IAM / service account authentication.
retrieving-developer-knowledge
Searches, retrieves, and synthesizes official Google developer documentation across Google Cloud, AI/Gemini, Android, Chrome, Web, Flutter, Go, Firebase, and other Google developer platforms. Integrates with the Developer Knowledge MCP server (search_documents, get_documents, answer_query) or the Developer Knowledge REST API fallback. Use when searching for gcloud CLI commands, API syntax, IAM permissions, official documentation, architectural comparisons, or product choice overviews. Don't use for local filesystem lookups or non-Google documentation.
migrate-to-rust
Clones, analyzes, plans, and migrates legacy codebases (C++, Fortran, Java, Python, C, Shell) from a GitHub URL or local directory to a modern, high-performance, deterministic, 100% Safe Rust architecture, tracking live telemetry across every task bucket, test failure/fix cycle, and Profile-Guided Optimization (PGO) stage, and producing a first-person AI storytelling report and interactive HTML infographic. Use when migrating a GitHub repository or local codebase to Rust, porting legacy C++, Fortran, Python, or Java workloads to memory-safe Rust, designing Struct-of-Arrays (SoA) or SIMD Rust architectures, or optimizing Rust ports with LLVM PGO. Don't use for unrelated non-Rust refactoring or single-line syntax questions.
finding-google-skills
Google platform decision and setup guidance, loaded on demand from Google's skill catalog. Use when a developer is choosing or setting up part of their stack, such as where to run a service, a database, storage, messaging, authentication, analytics, ads, or AI model serving, and a Google product is a reasonable candidate - whether or not a vendor is named - or when a request names a Google product or API. Brings in the matching Google skill so the answer can weigh Google options, their trade-offs, and when they are not the right fit. Skip when the stack is already settled on another provider and no Google product is named, or the task involves no platform choice.
workload-manager-basics
Use this skill to manage Google Cloud Workload Manager evaluations, rules, scanned resources, and validation results by using public client libraries and the REST API. Use when you need to inspect workload best-practice rules, create and run evaluations for Google Cloud general best practices, SAP, SQL Server, or custom organizational rules, review violations, export results to BigQuery, or automate Workload Manager through client libraries because no service-specific public CLI or MCP server is available. Don't use for general Google Compute Engine instance management, VPC configuration, or standard IAM auditing.