Google Cloud Filestore Auditing

Google Cloud Filestore Auditing

Audits Filestore instances across Google Cloud projects for backup readiness, overly open NFS exports and zone isolation, then reports findings.

Skill files7 files

references/

scripts/

SKILL.md371 lines
1
---
2
name: google-cloud-filestore-auditing
3
metadata:
4
version: "1.0.4"
5
category: Storage
6
description: >-
7
Audits Filestore instances on Google Cloud across projects for disaster
8
recovery readiness (missing or stale backups), security access governance
9
(overly permissive NFS export rules, 0.0.0.0/0 exposure, missing ROOT_SQUASH),
10
and reliability compliance (Physical Zone Isolation PZI and Physical Zone
11
Separation PZS). Use when assessing storage health posture, auditing NFS
12
export permissions, identifying unprotected file shares, or validating zone
13
failure domains. Don't use for Cloud Storage buckets, Persistent Disk, or
14
NetApp Volumes.
15
---
16
17
# Filestore Auditing Skill
18
19
This skill enables autonomous agents to audit, evaluate, and report the disaster
20
recovery, security access governance, and architectural reliability posture of
21
Filestore fleets across Google Cloud projects.
22
23
## Prerequisites / IAM Requirements & Permissions
24
25
Before executing this skill, the runtime principal (user account or Service
26
Account) must possess the following IAM roles and granular permissions on the
27
target GCP project(s):
28
29
### 1. Audit Operations (Read-Only Assessment)
30
31
Requires the **`roles/file.viewer`** role, which provides:
32
33
- **`file.instances.list`**: Enumerate Filestore instances across project
34
locations.
35
- **`file.instances.get`**: Inspect instance configuration, NFS export rules,
36
IP ranges, squash mode, and PZI/PZS isolation status.
37
- **`file.backups.list`**: Enumerate existing backups across regions.
38
- **`file.backups.get`**: Inspect backup timestamps, source instance URIs, and
39
status.
40
41
### 2. Remediation Operations (Backup Creation)
42
43
Requires the **`roles/file.editor`** (or `roles/file.admin`) role, which
44
provides:
45
46
- **`file.backups.create`**: Create on-demand baseline backups for unprotected
47
instances.
48
- **`file.operations.get`**: Monitor long-running backup creation operations.
49
50
### 3. MCP Tool Invocation
51
52
If invoking capabilities via the Filestore MCP Server
53
(`file.googleapis.com/mcp`):
54
55
- **`roles/mcp.toolUser`**: Required to execute MCP tools (`list_instances`,
56
`get_instance`, `list_backups`, `get_backup`, `create_backup`).
57
58
### 4. Cloud Authentication Setup
59
60
Authenticate the runtime environment using the appropriate method for your execution context:
61
62
- **CLI Execution (`gcloud`)**:
63
```bash
64
gcloud auth login
65
```
66
- **Application SDKs & Scripts**:
67
```bash
68
gcloud auth application-default login
69
```
70
- **Automated Services & Service Accounts**:
71
```bash
72
export GOOGLE_APPLICATION_CREDENTIALS="/path/to/service-account-key.json"
73
```
74
75
### 5. Billing Account Attachment
76
77
- **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:
78
```bash
79
gcloud beta billing projects describe {project_id}
80
```
81
82
## Quick Start
83
84
1. Ensure `gcloud` is installed. See
85
[gcloud installation guide](https://docs.cloud.google.com/sdk/docs/install-sdk.md.txt) if
86
needed.
87
2. Authenticate your environment:
88
89
```bash
90
gcloud auth login
91
gcloud auth application-default login
92
```
93
3. Set the target project context and verify an active billing account is attached:
94
95
```bash
96
gcloud config set project {project_id}
97
gcloud beta billing projects describe {project_id}
98
```
99
4. Configure a well-supported default region (e.g., `us-central1`). See official
100
[region availability documentation](https://cloud.google.com/about/locations):
101
102
```bash
103
gcloud config set compute/region us-central1
104
```
105
5. Verify required service APIs are enabled:
106
107
```bash
108
gcloud services enable file.googleapis.com --quiet
109
```
110
6. Run fleet discovery and backup inventory (see "Discovery & Read Operations"
111
below).
112
7. Evaluate findings against the audit rules matrix and render the executive
113
scorecard and inventory table.
114
8. If unprotected instances are identified, present baseline backup creation
115
commands and prompt the user for confirmation.
116
117
## Usage Attribution
118
119
**MUST READ**: Before executing any `gcloud`, REST API, or MCP command, you
120
MUST read and follow the instructions in
121
[Usage Attribution](references/attribution.md).
122
123
## Conceptual & Informational Queries (CRITICAL)
124
125
For purely conceptual, educational, or architectural questions (e.g., *"What is
126
Physical Zone Isolation (PZI) in Filestore?"*, *"What is the difference between
127
PZI and PZS?"*, *"Why is NO_ROOT_SQUASH dangerous?"*, *"Explain Filestore backup
128
architecture"*):
129
130
- **Rule**: Answer immediately in a single turn using pre-trained knowledge
131
and the definitions in this `SKILL.md` file:
132
- **Physical Zone Isolation (`PZI` / `satisfiesPzi`)**: Ensures a zonal
133
resource's physical hardware is confined to an isolated physical failure
134
domain within a datacenter so localized hardware failures do not cross
135
zones.
136
- **Physical Zone Separation (`PZS` / `satisfiesPzs`)**: Ensures
137
multi-zone or regional primary and replica nodes are hosted in
138
physically distinct, independent datacenter facilities so a
139
facility-wide outage cannot affect both copies.
140
- **Constraint**: **Do NOT call ANY tools whatsoever** (do NOT call
141
`read_file` on `references/`, `run_command`, MCP tools, or API requests) for
142
purely conceptual questions—respond directly right away.
143
144
## Handling "No-Command" Constraints & Evaluations (CRITICAL)
145
146
If the user prompt contains constraints like *"Do not execute commands"*,
147
*"without executing"*, or *"read-only"*:
148
149
- **Rule**: **Strictly avoid calling the `run_command` tool** to execute any
150
shell, python, or `gcloud` commands.
151
- **Discovery Hierarchy**:
152
1. Always read [Usage Attribution](references/attribution.md) whenever
153
outputting or recommending `gcloud` commands (such as backup creation
154
or export remediation commands) so they include the required attribution
155
prefix.
156
2. Check if Filestore MCP tools (`list_instances`, `list_backups`) are
157
available and query them directly (these are API invocations, not shell
158
command executions).
159
3. If MCP tools are not present or cannot connect, search local reference
160
markdown files (specifically the mock fleet definitions in
161
`references/zone-isolation-pzi-pzs.md`) for any mock instances or
162
project details matching the request. (Do NOT attempt to read evaluation
163
config files such as `EVAL.yaml` or `EVAL.txtpb` during evaluation runs
164
as access is restricted and triggers anti-cheating timeouts).
165
4. If no data is available in context or mock references, explain the audit
166
evaluation formulas and provide the attributed `gcloud` commands for
167
manual terminal execution.
168
- **Mandatory User Confirmation Requirement**: Even when the user prompt asks
169
not to execute commands or asks only for audit recommendations, any response
170
recommending backup remediation MUST STILL end with a clear confirmation
171
prompt before execution (e.g., *"Would you like me to proceed with creating
172
baseline backups for the unprotected instances? Please confirm to
173
proceed."*).
174
175
--------------------------------------------------------------------------------
176
177
## Core Operational Workflow
178
179
### 1. Discovery & Read Operations
180
181
The agent must discover all Filestore instances and backups in the target
182
project.
183
184
- **Target Project ID Handling & Rationale**: If the target Project ID is not
185
specified in the user prompt, the agent MUST explicitly ask the user to
186
provide the project ID before proceeding, in order to avoid inspecting or
187
auditing unrelated projects in multi-project enterprise environments.
188
189
Choose the discovery method matching your runtime environment:
190
191
#### Option A: Filestore MCP Tools (Recommended when MCP is mounted)
192
193
1. **Instances Discovery**: Call
194
`list_instances(parent="projects/{project_id}/locations/-")`.
195
2. **Backups Discovery**: Call
196
`list_backups(parent="projects/{project_id}/locations/-")`.
197
198
#### Option B: `gcloud` CLI (Terminal / Coding Harnesses)
199
200
1. **Instances Discovery**:
201
202
```bash
203
gcloud filestore instances list --project="{project_id}" --format="json"
204
```
205
2. **Backups Discovery**:
206
207
```bash
208
gcloud filestore backups list --project="{project_id}" --format="json"
209
```
210
211
*(Note: Do NOT pass `--location=-` to `gcloud filestore backups list`;
212
omitting the flag queries all regions across the project automatically).*
213
214
#### Option C: GCP REST API (`call_gcp_api` in Gemini Enterprise File Agent / curl)
215
216
1. **Instances**: `GET
217
https://file.googleapis.com/v1/projects/{project_id}/locations/-/instances`
218
2. **Backups**: `GET
219
https://file.googleapis.com/v1/projects/{project_id}/locations/-/backups`
220
221
#### Option D: Standalone Script Runner
222
223
For environments with standard python3 execution enabled, the agent may invoke
224
the portable script: `python3 scripts/filestore_audit.py
225
--project="{project_id}" [--format=markdown|json]`
226
227
--------------------------------------------------------------------------------
228
229
### 2. Audit Evaluation & Vector Checks
230
231
For each discovered instance, evaluate three audit vectors:
232
233
#### Vector 1: Disaster Recovery & Backup Protection
234
235
- Match backups to instances using full canonical resource URIs
236
(`backup.sourceInstance == instance.name`).
237
- **Unprotected Instance**: If `backup_count == 0`, assign **`HIGH`** severity
238
finding: *"Instance has 0 backups on file share '{share_name}'. Disaster
239
recovery is not configured."*
240
- **Stale Backup**: If latest backup is older than SLA (default: 7 days),
241
assign **`MEDIUM`** severity finding: *"Latest backup is {days} days old
242
(exceeds SLA threshold of 7 days)."*
243
- Refer to `references/backup-dr-governance.md` for backup retention and SLA
244
rules.
245
246
#### Vector 2: Security & Access Governance
247
248
- Inspect `fileShares[0].nfsExportOptions`:
249
- **Open Network Exposure**: If `0.0.0.0/0`, `0.0.0.0`, or `::/0` is
250
present in `ipRanges`, assign **`CRITICAL`** severity (if `accessMode:
251
READ_WRITE`) or **`HIGH`** severity (if `READ_ONLY`): *"Export rule
252
exposes share to 0.0.0.0/0 with accessMode='{access_mode}'."*
253
- **Missing Root Squashing**: If `squashMode: NO_ROOT_SQUASH`, assign
254
**`CRITICAL`** severity (if world-exposed) or **`HIGH`** severity (for
255
internal subnets): *"Export rule has squashMode='NO_ROOT_SQUASH'. Remote
256
root clients retain superuser UID 0 privileges."*
257
- **Default Open VPC Export**: If `nfsExportOptions` is empty, assign
258
**`MEDIUM`** severity: *"No explicit NFS export options configured.
259
Share defaults to open client access within VPC with NO_ROOT_SQUASH."*
260
- Refer to `references/security-access-governance.md` for export option
261
configurations.
262
263
#### Vector 3: Zone Isolation & Reliability Compliance
264
265
- **Physical Zone Isolation (PZI)**: If `satisfiesPzi: false`, assign
266
**`MEDIUM`** severity: *"Instance does not satisfy Physical Zone Isolation
267
(PZI)."*
268
- **Physical Zone Separation (PZS)**: If tier is `REGIONAL` or `ENTERPRISE`
269
and `satisfiesPzs: false`, assign **`HIGH`** severity: *"Enterprise/Regional
270
tier instance does not satisfy Physical Zone Separation (PZS)."*
271
- **Performance Limits**: Extract `performanceLimits.maxWriteIops` and
272
`performanceLimits.maxReadThroughputBps` (convert to MB/s).
273
- Refer to `references/zone-isolation-pzi-pzs.md` for datacenter failure
274
domain isolation standards.
275
276
--------------------------------------------------------------------------------
277
278
### 3. Executive Posture Scoring & Grading
279
280
Calculate fleet posture grade as defined in `references/audit-rules-matrix.md`:
281
282
- **Grade F (šŸ”“ CRITICAL RISK)**: $\ge 1$ `CRITICAL` findings.
283
- **Grade C (🟠 ELEVATED RISK)**: 0 Critical, but $\ge 1$ `HIGH` findings.
284
- **Grade B (🟔 MODERATE)**: 0 Critical/High, but $\ge 1$ `MEDIUM` findings.
285
- **Grade A (🟢 HEALTHY)**: 0 findings across all vectors.
286
287
Calculate `Backup Protection Rate %`: $$\text{Protection Rate} =
288
\frac{\text{Total Instances} - \text{Unprotected Instances}}{\text{Total
289
Instances}} \times 100$$
290
291
--------------------------------------------------------------------------------
292
293
### 4. Required Output Format
294
295
**Every audit report response MUST include the following structured sections in
296
Markdown:**
297
298
#### 1. Executive Posture Scorecard
299
300
```markdown
301
## Executive Posture Scorecard: `{project_id}`
302
303
| Metric | Status | Details |
304
| :--- | :--- | :--- |
305
| **Overall Health Posture** | **[šŸ”“ CRITICAL RISK / 🟠 ELEVATED RISK / 🟔 MODERATE / 🟢 HEALTHY]** | [Grade F / C / B / A] |
306
| **Instances Audited** | `[count]` | Total Filestore instances evaluated |
307
| **Backup Protection Rate** | **[pct]%** | `[protected]/[total]` instances have active backups |
308
| **Critical & High Security Findings** | `[crit] Critical, [high] High` | Open exports (0.0.0.0/0) or NO_ROOT_SQUASH |
309
| **PZI Isolation Compliance** | `[pzi_count]/[total]` | Physical Zone Isolation adherence |
310
```
311
312
#### 2. Priority Findings & Remediation Matrix
313
314
List findings ranked by severity (`CRITICAL` $\to$ `HIGH` $\to$ `MEDIUM` $\to$
315
`LOW`):
316
317
```markdown
318
## Priority Findings & Remediation Matrix
319
320
| Severity | Instance ID | Category | Finding Description | Remediation Plan |
321
| :--- | :--- | :--- | :--- | :--- |
322
| 🚨 **CRITICAL** | `[instance]` | Security | [Description] | [Remediation] |
323
| āš ļø **HIGH** | `[instance]` | Disaster Recovery | [Description] | [Remediation] |
324
```
325
326
#### 3. Filestore Instance Inventory & Compliance Status
327
328
```markdown
329
## Filestore Instance Inventory & Compliance Status
330
331
| Instance ID | Location | Tier | Capacity | Reserved CIDR | Write IOPS | Throughput | PZI | PZS | Backups | Latest Backup |
332
| :--- | :--- | :--- | :--- | :--- | :--- | :--- | :--- | :--- | :--- | :--- |
333
| `[id]` | `[loc]` | `[tier]` | `[cap] GiB` | `[cidr]` | `[iops]` | `[tp] MB/s` | āœ… Yes / āŒ No | āœ… Yes / āŒ No / N/A | šŸ”“ 0 / āœ… `[n]` | `[date]` |
334
```
335
336
#### 4. Automated Remediation & Mandatory Confirmation Gate
337
338
If any unprotected instances are discovered, display attributed backup creation
339
commands and conclude with an explicit confirmation request:
340
341
```bash
342
gcloud filestore backups create [INSTANCE]-backup-[DATE] \
343
--project=[PROJECT_ID] \
344
--instance=[INSTANCE] \
345
--file-share=[SHARE] \
346
[--instance-zone=[ZONE] | --instance-location=[REGION]] \
347
--region=[BACKUP_REGION]
348
```
349
350
> **Confirmation Required**: Would you like me to proceed with creating baseline
351
> backups for the unprotected instances? Please confirm to proceed.
352
353
**CRITICAL RATIONALE**: Do NOT execute backup creation without explicit user
354
confirmation. Confirmation is strictly required before executing any mutation or
355
backup creation commands in order to prevent unintended operational disruption,
356
unwanted resource allocation, or unexpected backup storage billing.
357
358
--------------------------------------------------------------------------------
359
360
## Reference Directory
361
362
For progressive disclosure and deep architectural guidance, consult the
363
following references:
364
365
- [Usage Attribution](references/attribution.md)
366
- [Security & Access Governance](references/security-access-governance.md)
367
- [Disaster Recovery & Backup Governance](references/backup-dr-governance.md)
368
- [Zone Isolation (PZI) & Reliability (PZS)](references/zone-isolation-pzi-pzs.md)
369
- [Audit Rules & Scoring Matrix](references/audit-rules-matrix.md)
370
- [Standalone Python Audit Script](scripts/filestore_audit.py)
371

Ā© Google LLC Ā· Apache 2.0 Ā· source Ā· posted by @OpenSourceBuffGuy on promptparty.com

@OpenSourceBuffGuy

I find openly licensed prompts and post them here.

0Ā followers Ā· 14,621Ā prompts

More by @OpenSourceBuffGuy

See all
Sea turtle carrying floating film studio island prompt image

Sea turtle carrying floating film studio island

Draws a giant sea turtle carrying a floating island film studio through a starry sky, where fairies polish rough film strips into golden film.

image-prompt, nano-banana, 3d-render, cartoon, fantasy-world, creatures, animals, whimsical, dreamy, cinematic, dramatic-lighting, vibrant-colors, bokeh, miniature, widescreen, night-scene, illustration, concept-art, surreal, storytelling, clay-3d

Desert buggy escapes drones past industrial outpost prompt image

Desert buggy escapes drones past industrial outpost

Builds a 15-second desert chase video where a racer in an armored buggy escapes drones past an industrial outpost, using five reference images with set jobs.

video-prompt, hailuo, action, multi-shot, timed-beats, camera-movement, reference-image, character-consistency, negative-prompt, cinematic, sci-fi, cars, landscape, aerial-view, tracking-shot, photorealistic, sound-effects, structured-output, long-form, widescreen

1 view
Cozy Pixel Art Farm Island Village prompt image

Cozy Pixel Art Farm Island Village

Draws a cozy 16-bit pixel-art farming village across six small islands joined by bridges, with exact counts for buildings, animals and crops.

image-prompt, gpt-image, pixel-art, isometric, game-assets, concept-art, maps, worldbuilding, cozy, vibrant-colors, ocean, landscape, wide-shot, widescreen, game-development, video-games, structured-output, whimsical, summer, high-angle, aerial-view, animals, negative-prompt, cityscape

1 view

Reviews

Loading reviews…

Discussion

Loading comments…