implementing-gcp-organization-policy-constraints
यह क्या करती है
यह टूल आपके Google Cloud अकाउंट के लिए सिक्योरिटी नियम तय करने में मदद करता है। इससे आप नियंत्रित कर सकते हैं कि कौन-से रिसोर्स बनाए जा सकते हैं और उन्हें कैसे कॉन्फ़िगर किया जा सकता है, ताकि सब कुछ स्थापित सिक्योरिटी मानकों के अनुसार रहे।
कब इस्तेमाल करें
- ✓जब पहली बार अपने Google Cloud अकाउंट के लिए सिक्योरिटी सेट करनी हो।
- ✓जब पक्का करना हो कि सभी नए रिसोर्स किसी खास सिक्योरिटी नियम का पालन करें।
- ✓जब सिक्योरिटी ऑडिट करके जाँचना हो कि कॉन्फ़िगरेशन सही है।
Skill का लिंक
https://github.com/mukul975/Anthropic-Cybersecurity-Skills/blob/main/skills/implementing-gcp-organization-policy-constraints/SKILL.mdइसे कॉपी करके अपने AI (Claude, ChatGPT या Cursor) में पेस्ट करें और निर्देशों का पालन करने को कहें।
कैसे इस्तेमाल करें
सबसे आसान तरीका: मैसेज कॉपी करके अपने AI में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।
पेस्ट करने के लिए तैयार मैसेज
Claude Code, Codex या Cursor के लिए: प्रोजेक्ट फ़ोल्डर में चलाएँ और skill इंस्टॉल हो जाएगी।
SKILL.md डाउनलोड करें और अपने एजेंट के skills फ़ोल्डर में रखें।
AI से क्या माँगें: उदाहरण
“मेरी संस्था में सभी virtual machines पर बाहरी IP एड्रेस के इस्तेमाल को रोकने का नियम बनाओ।”
हर हफ़्ते 5 नई skills, 1 मिनट में पढ़ें।
यह कैसे काम करती है
आप तय करते हैं कि कौन-से सिक्योरिटी नियम लागू करने हैं (जैसे बाहरी IP पर रोक) और टूल इन्हें खास Google Cloud कमांड या Terraform जैसे टूल से लागू करता है। यह आपको नियम लागू करने से पहले उन्हें 'dry-run' मोड में टेस्ट करने देता है।
तकनीकी सामग्री (मूल SKILL.md)
लेखक का मूल टेक्स्ट, अंग्रेज़ी में, सीधे GitHub से।
Implementing GCP Organization Policy Constraints
Overview
The GCP Organization Policy Service provides centralized and programmatic control over cloud resources. Organization policies configure constraints that restrict one or more Google Cloud services, enforced at organization, folder, or project levels. They improve security by blocking external IPs, requiring encryption, and minimizing unauthorized access. Changes can take up to 15 minutes to propagate.
When to Use
- When deploying or configuring implementing gcp organization policy constraints capabilities in your environment
- When establishing security controls aligned to compliance requirements
- When building or improving security architecture for this domain
- When conducting security assessments that require this implementation
Prerequisites
- GCP Organization with Organization Administrator role
gcloudCLI configured and authenticated- Terraform or gcloud for policy management
- Organization Policy Administrator IAM role (
roles/orgpolicy.policyAdmin)
Core Concepts
Constraint Types
- List Constraints: Allow or deny specific values (e.g., allowed regions)
- Boolean Constraints: Enable or disable a capability (e.g., disable serial port access)
- Custom Constraints: User-defined rules targeting specific resource fields (Preview)
Policy Inheritance
Policies inherit from the lowest ancestor with an enforced policy. If no ancestor has a policy, Google's managed default behavior applies.
Essential Security Constraints
Restrict VM External IP Addresses
# Deny external IP addresses on all VMs
gcloud resource-manager org-policies set-policy \
--organization=ORGANIZATION_ID \
policy.yaml
policy.yaml:
constraint: constraints/compute.vmExternalIpAccess
listPolicy:
allValues: DENY
Restrict Resource Locations
gcloud org-policies set-policy \
--organization=ORGANIZATION_ID \
location-policy.yaml
location-policy.yaml:
constraint: constraints/gcp.resourceLocations
listPolicy:
allowedValues:
- "in:us-locations"
- "in:eu-locations"
Disable Default Service Account Creation
constraint: constraints/iam.automaticIamGrantsForDefaultServiceAccounts
booleanPolicy:
enforced: true
Require OS Login for SSH
constraint: constraints/compute.requireOsLogin
booleanPolicy:
enforced: true
Disable Serial Port Access
constraint: constraints/compute.disableSerialPortAccess
booleanPolicy:
enforced: true
Enforce Uniform Bucket-Level Access
constraint: constraints/storage.uniformBucketLevelAccess
booleanPolicy:
enforced: true
Restrict Public IP on Cloud SQL
constraint: constraints/sql.restrictPublicIp
booleanPolicy:
enforced: true
Disable Service Account Key Creation
constraint: constraints/iam.disableServiceAccountKeyCreation
booleanPolicy:
enforced: true
Terraform Implementation
resource "google_organization_policy" "restrict_vm_external_ip" {
org_id = var.org_id
constraint = "constraints/compute.vmExternalIpAccess"
list_policy {
deny {
all = true
}
}
}
resource "google_organization_policy" "restrict_locations" {
org_id = var.org_id
constraint = "constraints/gcp.resourceLocations"
list_policy {
allow {
values = ["in:us-locations", "in:eu-locations"]
}
}
}
resource "google_organization_policy" "require_os_login" {
org_id = var.org_id
constraint = "constraints/compute.requireOsLogin"
boolean_policy {
enforced = true
}
}
resource "google_folder_organization_policy" "dev_folder_external_ip" {
folder = google_folder.dev.name
constraint = "constraints/compute.vmExternalIpAccess"
list_policy {
allow {
values = ["projects/dev-project/zones/us-central1-a/instances/bastion-host"]
}
}
}
Dry-Run Testing
Use Policy Intelligence tools to test changes before enforcement:
# Create a dry-run policy to monitor impact
gcloud org-policies set-policy \
--organization=ORGANIZATION_ID \
dry-run-policy.yaml
dry-run-policy.yaml:
constraint: constraints/compute.vmExternalIpAccess
listPolicy:
allValues: DENY
dryRunSpec: true
# Check violations against dry-run policy
gcloud org-policies list-custom-constraints \
--organization=ORGANIZATION_ID
Custom Constraints
# custom-constraint.yaml
…
अक्सर पूछे जाने वाले सवाल
'constraints' क्या हैं?
ये वे नियम या सीमाएँ हैं जो आप तय करते हैं ताकि Google Cloud रिसोर्स के इस्तेमाल पर नियंत्रण रहे। उदाहरण के लिए, एक नियम यह तय कर सकता है कि रिसोर्स कहाँ बनाए जा सकते हैं।
क्या नियम लागू करने से पहले उन्हें टेस्ट कर सकते हैं?
हाँ, टूल आपको 'dry-run' मोड में नियमों का असर देखने देता है, उसके बाद ही उन्हें अनिवार्य बनाया जाता है।
नियम लागू होने में कितना समय लगता है?
पॉलिसी में बदलाव सभी रिसोर्स पर लागू होने में 15 मिनट तक लग सकते हैं।
जानकारी
लेखक का मूल विवरण
Implements GCP Organization Policy constraints via gcloud and Terraform, such as restricting external IPs, resource locations, default service accounts, and service account keys, plus dry-run testing of policy impact before enforcement. Use when enforcing security guardrails across an org's resource hierarchy, or hardening GCP config at the org, folder, or project level.
लोकप्रियता
- GitHub स्टार
- 35k
- रैंकिंग में स्थान
- #8043
- लाइसेंस
- Apache-2.0
- अपडेट की गई
- 31/8/2026
कमेंट
- …
इस repository की और skills
abusing-dpapi-for-credential-access
35kआपके AI एजेंट को किसी खास काम के लिए तैयार instructions देता है, ताकि वह उसे बेहतर और तेज़ी से कर सके।
abusing-shadow-credentials-for-privesc
35kआपके AI एजेंट को साफ़ और अच्छी तरह से व्यवस्थित लिखना सिखाता है।
achieving-cmmc-level-2-compliance
35kयह आपके एजेंट को CMMC Level 2 compliance के लिए environment तैयार करने में मदद करता है। यह security requirements लागू करता है और ज़रूरी documentation संभालता है।
acquiring-disk-image-with-dd-and-dcfldd
35kआपके एजेंट को hard drives की exact copies बनाने में मदद करता है। जाँच के दौरान किसी भी जानकारी के खोने या बदलने से बचाने के लिए यह उपयोगी है।
मिलती-जुलती skills
openclaw-update
394kयह आपके एजेंट को चल रहे OpenClaw Gateway को अपडेट करने में मदद करती है, इंस्टॉल के तरीके के अनुसार सही विधि चुनकर और सेशन बनाए रखकर।
diagnose-gateway
394kयह आपके एजेंट को सेटिंग्स, चैनल और पोर्ट जांचकर पता लगाने देती है कि OpenClaw Gateway क्यों फ़ेल हो रहा है, बिना कुछ बदले।
crabbox-apps
394kयह आपके एजेंट को किसी अस्थायी क्लाउड मशीन पर ऐप खोलने और चलाने देती है, फिर उसका व्यू आपके चैट के साइड पैनल में दिखाती है।