בדף הזה מוסבר איך להשתמש באילוצים מותאמים אישית של Organization Policy Service כדי להגביל פעולות ספציפיות במשאבים הבאים של Google Cloud :
compute.googleapis.com/BackendBucketcompute.googleapis.com/BackendServicecompute.googleapis.com/ForwardingRulecompute.googleapis.com/HealthCheckcompute.googleapis.com/NetworkEndpointGroupnetworkservices.googleapis.com/ServiceLbPolicycompute.googleapis.com/SslPolicycompute.googleapis.com/TargetInstancecompute.googleapis.com/TargetPoolcompute.googleapis.com/TargetTcpProxycompute.googleapis.com/TargetSslProxycompute.googleapis.com/TargetHttpProxycompute.googleapis.com/TargetHttpsProxycompute.googleapis.com/TargetGrpcProxycompute.googleapis.com/UrlMap
מידע נוסף על מדיניות הארגון זמין במאמר בנושא מדיניות ארגונית בהתאמה אישית.
מידע על מדיניות הארגון ואילוצים
שירות מדיניות הארגון של Google Cloud מאפשר לכם לקבל שליטה מרוכזת ופרוגרמטית על המשאבים של הארגון. בתור אדמינים של מדיניות הארגון, אתם יכולים להגדיר מדיניות ארגונית, שהיא קבוצה של הגבלות שנקראות אילוצים שחלות על משאבים ב-Google Cloud ועל משאבים שנגזרים מהם בGoogle Cloud היררכיית המשאבים. אפשר לאכוף את מדיניות הארגון ברמת הארגון, התיקייה או הפרויקט.
במסגרת מדיניות הארגון מוצעים אילוצים מנוהלים מובנים עבור שירותים שונים של Google Cloud . עם זאת, אם אתם רוצים שליטה מדויקת יותר בשדות הספציפיים שמוגבלים במדיניות הארגון, אתם יכולים גם ליצור אילוצים בהתאמה אישית ולהשתמש בהם במדיניות הארגון.
העברה בירושה של מדיניות
כברירת מחדל, מדיניות הארגון עוברת בירושה לצאצאים של המשאבים שבהם אתם אוכפים את המדיניות. לדוגמה, אם אוכפים מדיניות בתיקייה, Google Cloud המדיניות נאכפת בכל הפרויקטים בתיקייה. מידע נוסף על ההתנהגות הזו ועל שינוי שלה זמין במאמר בנושא כללי הערכה היררכיים.
יתרונות
- ניהול עלויות: שימוש במדיניות ארגונית מותאמת אישית כדי להגביל את התדירות של בדיקת תקינות.
אבטחה, תאימות וניהול: אפשר להשתמש במדיניות ארגונית מותאמת אישית כדי לאכוף מדיניות. לדוגמה:
- כדי לאכוף את השימוש בפרוטוקולים ספציפיים של בדיקות תקינות או בטווחים של יציאות
- כדי לאסור פרוטוקולים מסוימים של תנועת גולשים בשרת העורפי
- כדי לדרוש הפעלה של Cloud CDN בקטגוריות קצה עורפי
- כדי לדרוש שכללי ההעברה ישתמשו במסלולי שירות רשת ספציפיים
מגבלות
אין תמיכה בבדיקות תקינות מדור קודם (Legacy global (HTTP) ו-Legacy global (HTTPS)).
במשאבי מדיניות SSL של Compute Engine, האילוצים המותאמים אישית נאכפים גם בשיטה
UPDATE.
לפני שמתחילים
- נכנסים לחשבון Google Cloud . אם אתם משתמשים חדשים ב- Google Cloud, צרו חשבון כדי שתוכלו להעריך את הביצועים של המוצרים שלנו בתרחישים מהעולם האמיתי. לקוחות חדשים מקבלים בחינם גם קרדיט בשווי 300$ להרצה, לבדיקה ולפריסה של עומסי העבודה.
-
In the Google Cloud console, on the project selector page, select or create a Google Cloud project.
Roles required to select or create a project
- Select a project: Selecting a project doesn't require a specific IAM role—you can select any project that you've been granted a role on.
-
Create a project: To create a project, you need the Project Creator role
(
roles/resourcemanager.projectCreator), which contains theresourcemanager.projects.createpermission. Learn how to grant roles.
-
Verify that billing is enabled for your Google Cloud project.
-
התקינו את ה-CLI של Google Cloud.
-
אם אתם משתמשים בספק זהויות חיצוני (IdP), קודם אתם צריכים להיכנס ל-CLI של gcloud באמצעות המאגר המאוחד לניהול זהויות.
-
כדי לאתחל את ה-CLI של gcloud, הריצו את הפקודה הבאה:
gcloud init -
In the Google Cloud console, on the project selector page, select or create a Google Cloud project.
Roles required to select or create a project
- Select a project: Selecting a project doesn't require a specific IAM role—you can select any project that you've been granted a role on.
-
Create a project: To create a project, you need the Project Creator role
(
roles/resourcemanager.projectCreator), which contains theresourcemanager.projects.createpermission. Learn how to grant roles.
-
Verify that billing is enabled for your Google Cloud project.
-
התקינו את ה-CLI של Google Cloud.
-
אם אתם משתמשים בספק זהויות חיצוני (IdP), קודם אתם צריכים להיכנס ל-CLI של gcloud באמצעות המאגר המאוחד לניהול זהויות.
-
כדי לאתחל את ה-CLI של gcloud, הריצו את הפקודה הבאה:
gcloud init - חשוב לוודא שאתם יודעים מהו מספר הארגון שלכם.
התפקידים הנדרשים
כדי לקבל את ההרשאות שדרושות לניהול של כללי מדיניות ארגוניים בהתאמה אישית, צריך לבקש מהאדמין להקצות לכם את תפקיד ה-IAM 'אדמין של כללי מדיניות ארגוניים' (`roles/orgpolicy.policyAdmin`) במשאב הארגון. להסבר על מתן תפקידים, ראו איך מנהלים את הגישה ברמת הפרויקט, התיקייה והארגון.
יכול להיות שאפשר לקבל את ההרשאות הנדרשות גם באמצעות תפקידים בהתאמה אישית או תפקידים מוגדרים מראש.
משאבים נתמכים ב-Cloud Load Balancing
ב-Cloud Load Balancing, אפשר להגדיר אילוצים מותאמים אישית במשאבים ובשדות הבאים.
| משאב | שדה |
|---|---|
| compute.googleapis.com/BackendBucket |
resource.bucketName
|
resource.cdnPolicy.bypassCacheOnRequestHeaders.headerName
| |
resource.cdnPolicy.cacheKeyPolicy.includeHttpHeaders
| |
resource.cdnPolicy.cacheKeyPolicy.queryStringWhitelist
| |
resource.cdnPolicy.cacheMode
| |
resource.cdnPolicy.clientTtl
| |
resource.cdnPolicy.defaultTtl
| |
resource.cdnPolicy.maxTtl
| |
resource.cdnPolicy.negativeCaching
| |
resource.cdnPolicy.negativeCachingPolicy.code
| |
resource.cdnPolicy.negativeCachingPolicy.ttl
| |
resource.cdnPolicy.requestCoalescing
| |
resource.cdnPolicy.serveWhileStale
| |
resource.cdnPolicy.signedUrlCacheMaxAgeSec
| |
resource.compressionMode
| |
resource.customResponseHeaders
| |
resource.description
| |
resource.enableCdn
| |
resource.loadBalancingScheme
| |
resource.name
| |
| compute.googleapis.com/BackendService |
resource.affinityCookieTtlSec
|
resource.backends.balancingMode
| |
resource.backends.capacityScaler
| |
resource.backends.description
| |
resource.backends.failover
| |
resource.backends.maxConnections
| |
resource.backends.maxConnectionsPerEndpoint
| |
resource.backends.maxConnectionsPerInstance
| |
resource.backends.maxRate
| |
resource.backends.maxRatePerEndpoint
| |
resource.backends.maxRatePerInstance
| |
resource.backends.maxSessions
| |
resource.backends.maxSessionsPerEndpoint
| |
resource.backends.maxSessionsPerInstance
| |
resource.backends.maxUtilization
| |
resource.backends.preference
| |
resource.backends.trafficDuration
| |
resource.cdnPolicy.bypassCacheOnRequestHeaders.headerName
| |
resource.cdnPolicy.cacheKeyPolicy.includeHost
| |
resource.cdnPolicy.cacheKeyPolicy.includeHttpHeaders
| |
resource.cdnPolicy.cacheKeyPolicy.includeNamedCookies
| |
resource.cdnPolicy.cacheKeyPolicy.includeProtocol
| |
resource.cdnPolicy.cacheKeyPolicy.includeQueryString
| |
resource.cdnPolicy.cacheKeyPolicy.queryStringBlacklist
| |
resource.cdnPolicy.cacheKeyPolicy.queryStringWhitelist
| |
resource.cdnPolicy.cacheMode
| |
resource.cdnPolicy.clientTtl
| |
resource.cdnPolicy.defaultTtl
| |
resource.cdnPolicy.maxTtl
| |
resource.cdnPolicy.negativeCaching
| |
resource.cdnPolicy.negativeCachingPolicy.code
| |
resource.cdnPolicy.negativeCachingPolicy.ttl
| |
resource.cdnPolicy.requestCoalescing
| |
resource.cdnPolicy.serveWhileStale
| |
resource.cdnPolicy.signedUrlCacheMaxAgeSec
| |
resource.circuitBreakers.maxConnections
| |
resource.circuitBreakers.maxPendingRequests
| |
resource.circuitBreakers.maxRequests
| |
resource.circuitBreakers.maxRequestsPerConnection
| |
resource.circuitBreakers.maxRetries
| |
resource.compressionMode
| |
resource.connectionDraining.drainingTimeoutSec
| |
resource.connectionTrackingPolicy.connectionPersistenceOnUnhealthyBackends
| |
resource.connectionTrackingPolicy.enableStrongAffinity
| |
resource.connectionTrackingPolicy.idleTimeoutSec
| |
resource.connectionTrackingPolicy.trackingMode
| |
resource.consistentHash.httpCookie.name
| |
resource.consistentHash.httpCookie.path
| |
resource.consistentHash.httpCookie.ttl.nanos
| |
resource.consistentHash.httpCookie.ttl.seconds
| |
resource.consistentHash.minimumRingSize
| |
resource.customRequestHeaders
| |
resource.customResponseHeaders
| |
resource.description
| |
resource.enableCDN
| |
resource.failoverPolicy.disableConnectionDrainOnFailover
| |
resource.failoverPolicy.dropTrafficIfUnhealthy
| |
resource.failoverPolicy.failoverRatio
| |
resource.haPolicy.fastIPMove
| |
resource.haPolicy.leader.backendGroup
| |
resource.haPolicy.leader.networkEndpoint.instance
| |
resource.iap.enabled
| |
resource.iap.oauth2ClientId
| |
resource.ipAddressSelectionPolicy
| |
resource.loadBalancingScheme
| |
resource.localityLbPolicies.customPolicy.data
| |
resource.localityLbPolicies.customPolicy.name
| |
resource.localityLbPolicies.policy.name
| |
resource.logConfig.enable
| |
resource.logConfig.optionalFields
| |
resource.logConfig.optionalMode
| |
resource.logConfig.sampleRate
| |
resource.maxStreamDuration.nanos
| |
resource.maxStreamDuration.seconds
| |
resource.name
| |
resource.outlierDetection.baseEjectionTime.nanos
| |
resource.outlierDetection.baseEjectionTime.seconds
| |
resource.outlierDetection.consecutiveGatewayFailure
| |
resource.outlierDetection.enforcingConsecutiveErrors
| |
resource.outlierDetection.enforcingConsecutiveGatewayFailure
| |
resource.outlierDetection.enforcingSuccessRate
| |
resource.outlierDetection.maxEjectionPercent
| |
resource.outlierDetection.successRateMinimumHosts
| |
resource.outlierDetection.successRateRequestVolume
| |
resource.outlierDetection.successRateStdevFactor
| |
resource.portName
| |
resource.protocol
| |
resource.securitySettings.awsV4Authentication.accessKeyId
| |
resource.securitySettings.awsV4Authentication.accessKeyVersion
| |
resource.securitySettings.subjectAltNames
| |
resource.sessionAffinity
| |
resource.strongSessionAffinityCookie.name
| |
resource.strongSessionAffinityCookie.path
| |
resource.strongSessionAffinityCookie.ttl.nanos
| |
resource.strongSessionAffinityCookie.ttl.seconds
| |
resource.subsetting.policy
| |
resource.timeoutSec
| |
| compute.googleapis.com/ForwardingRule |
resource.allowGlobalAccess
|
resource.allowPscGlobalAccess
| |
resource.allPorts
| |
resource.description
| |
resource.IPProtocol
| |
resource.ipVersion
| |
resource.isMirroringCollector
| |
resource.loadBalancingScheme
| |
resource.metadataFilters.filterLabels.name
| |
resource.metadataFilters.filterLabels.value
| |
resource.metadataFilters.filterMatchCriteria
| |
resource.name
| |
resource.networkTier
| |
resource.noAutomateDnsZone
| |
resource.portRange
| |
resource.ports
| |
resource.serviceDirectoryRegistrations.namespace
| |
resource.serviceDirectoryRegistrations.service
| |
resource.serviceDirectoryRegistrations.serviceDirectoryRegion
| |
resource.serviceLabel
| |
resource.sourceIpRanges
| |
resource.target
| |
| compute.googleapis.com/HealthCheck |
resource.checkIntervalSec
|
resource.description
| |
resource.grpcHealthCheck.grpcServiceName
| |
resource.grpcHealthCheck.port
| |
resource.grpcHealthCheck.portSpecification
| |
resource.healthyThreshold
| |
resource.http2HealthCheck.host
| |
resource.http2HealthCheck.port
| |
resource.http2HealthCheck.portSpecification
| |
resource.http2HealthCheck.proxyHeader
| |
resource.http2HealthCheck.requestPath
| |
resource.http2HealthCheck.response
| |
resource.httpHealthCheck.host
| |
resource.httpHealthCheck.port
| |
resource.httpHealthCheck.portSpecification
| |
resource.httpHealthCheck.proxyHeader
| |
resource.httpHealthCheck.requestPath
| |
resource.httpHealthCheck.response
| |
resource.httpsHealthCheck.host
| |
resource.httpsHealthCheck.port
| |
resource.httpsHealthCheck.portSpecification
| |
resource.httpsHealthCheck.proxyHeader
| |
resource.httpsHealthCheck.requestPath
| |
resource.httpsHealthCheck.response
| |
resource.logConfig.enable
| |
resource.name
| |
resource.sourceRegions
| |
resource.sslHealthCheck.port
| |
resource.sslHealthCheck.portSpecification
| |
resource.sslHealthCheck.proxyHeader
| |
resource.sslHealthCheck.request
| |
resource.sslHealthCheck.response
| |
resource.tcpHealthCheck.port
| |
resource.tcpHealthCheck.portSpecification
| |
resource.tcpHealthCheck.proxyHeader
| |
resource.tcpHealthCheck.request
| |
resource.tcpHealthCheck.response
| |
resource.timeoutSec
| |
resource.type
| |
resource.unhealthyThreshold
| |
| compute.googleapis.com/NetworkEndpointGroup |
resource.annotations
|
resource.appEngine.service
| |
resource.appEngine.urlMask
| |
resource.appEngine.version
| |
resource.cloudFunction.function
| |
resource.cloudFunction.urlMask
| |
resource.cloudRun.service
| |
resource.cloudRun.tag
| |
resource.cloudRun.urlMask
| |
resource.defaultPort
| |
resource.description
| |
resource.name
| |
resource.network
| |
resource.networkEndpointType
| |
resource.pscData.producerPort
| |
resource.pscTargetService
| |
resource.subnetwork
| |
| compute.googleapis.com/SslPolicy |
resource.customFeatures
|
resource.description
| |
resource.minTlsVersion
| |
resource.name
| |
resource.profile
| |
| compute.googleapis.com/TargetGrpcProxy |
resource.description
|
resource.name
| |
resource.validateForProxyless
| |
| compute.googleapis.com/TargetHttpProxy |
resource.description
|
resource.httpKeepAliveTimeoutSec
| |
resource.name
| |
resource.proxyBind
| |
| compute.googleapis.com/TargetHttpsProxy |
resource.description
|
resource.httpKeepAliveTimeoutSec
| |
resource.name
| |
resource.proxyBind
| |
resource.quicOverride
| |
resource.tlsEarlyData
| |
| compute.googleapis.com/TargetInstance |
resource.description
|
resource.name
| |
resource.natPolicy
| |
| compute.googleapis.com/TargetPool |
resource.description
|
resource.failoverRatio
| |
resource.name
| |
resource.sessionAffinity
| |
| compute.googleapis.com/TargetSslProxy |
resource.description
|
resource.name
| |
resource.proxyHeader
| |
| compute.googleapis.com/TargetTcpProxy |
resource.description
|
resource.name
| |
resource.proxyBind
| |
resource.proxyHeader
| |
| compute.googleapis.com/UrlMap |
resource.defaultCustomErrorResponsePolicy.errorResponseRules.matchResponseCodes
|
resource.defaultCustomErrorResponsePolicy.errorResponseRules.overrideResponseCode
| |
resource.defaultCustomErrorResponsePolicy.errorResponseRules.path
| |
resource.defaultRouteAction.corsPolicy.allowCredentials
| |
resource.defaultRouteAction.corsPolicy.allowHeaders
| |
resource.defaultRouteAction.corsPolicy.allowMethods
| |
resource.defaultRouteAction.corsPolicy.allowOriginRegexes
| |
resource.defaultRouteAction.corsPolicy.allowOrigins
| |
resource.defaultRouteAction.corsPolicy.disabled
| |
resource.defaultRouteAction.corsPolicy.exposeHeaders
| |
resource.defaultRouteAction.corsPolicy.maxAge
| |
resource.defaultRouteAction.faultInjectionPolicy.abort.httpStatus
| |
resource.defaultRouteAction.faultInjectionPolicy.abort.percentage
| |
resource.defaultRouteAction.faultInjectionPolicy.delay.fixedDelay.nanos
| |
resource.defaultRouteAction.faultInjectionPolicy.delay.fixedDelay.seconds
| |
resource.defaultRouteAction.faultInjectionPolicy.delay.percentage
| |
resource.defaultRouteAction.maxStreamDuration.nanos
| |
resource.defaultRouteAction.maxStreamDuration.seconds
| |
resource.defaultRouteAction.retryPolicy.numRetries
| |
resource.defaultRouteAction.retryPolicy.perTryTimeout.nanos
| |
resource.defaultRouteAction.retryPolicy.perTryTimeout.seconds
| |
resource.defaultRouteAction.retryPolicy.retryConditions
| |
resource.defaultRouteAction.timeout.nanos
| |
resource.defaultRouteAction.timeout.seconds
| |
resource.defaultRouteAction.urlRewrite.hostRewrite
| |
resource.defaultRouteAction.urlRewrite.pathPrefixRewrite
| |
resource.defaultRouteAction.urlRewrite.pathTemplateRewrite
| |
resource.defaultRouteAction.weightedBackendServices.headerAction.requestHeadersToAdd.headerName
| |
resource.defaultRouteAction.weightedBackendServices.headerAction.requestHeadersToAdd.headerValue
| |
resource.defaultRouteAction.weightedBackendServices.headerAction.requestHeadersToAdd.replace
| |
resource.defaultRouteAction.weightedBackendServices.headerAction.requestHeadersToRemove
| |
resource.defaultRouteAction.weightedBackendServices.headerAction.responseHeadersToAdd.headerName
| |
resource.defaultRouteAction.weightedBackendServices.headerAction.responseHeadersToAdd.headerValue
| |
resource.defaultRouteAction.weightedBackendServices.headerAction.responseHeadersToAdd.replace
| |
resource.defaultRouteAction.weightedBackendServices.headerAction.responseHeadersToRemove
| |
resource.defaultRouteAction.weightedBackendServices.weight
| |
resource.defaultUrlRedirect.hostRedirect
| |
resource.defaultUrlRedirect.httpsRedirect
| |
resource.defaultUrlRedirect.pathRedirect
| |
resource.defaultUrlRedirect.prefixRedirect
| |
resource.defaultUrlRedirect.redirectResponseCode
| |
resource.defaultUrlRedirect.stripQuery
| |
resource.description
| |
resource.headerAction.requestHeadersToAdd.headerName
| |
resource.headerAction.requestHeadersToAdd.headerValue
| |
resource.headerAction.requestHeadersToAdd.replace
| |
resource.headerAction.requestHeadersToRemove
| |
resource.headerAction.responseHeadersToAdd.headerName
| |
resource.headerAction.responseHeadersToAdd.headerValue
| |
resource.headerAction.responseHeadersToAdd.replace
| |
resource.headerAction.responseHeadersToRemove
| |
resource.hostRules.description
| |
resource.hostRules.hosts
| |
resource.hostRules.pathMatcher
| |
resource.name
| |
resource.pathMatchers.defaultCustomErrorResponsePolicy.errorResponseRules.matchResponseCodes
| |
resource.pathMatchers.defaultCustomErrorResponsePolicy.errorResponseRules.overrideResponseCode
| |
resource.pathMatchers.defaultCustomErrorResponsePolicy.errorResponseRules.path
| |
resource.pathMatchers.defaultRouteAction.corsPolicy.allowCredentials
| |
resource.pathMatchers.defaultRouteAction.corsPolicy.allowHeaders
| |
resource.pathMatchers.defaultRouteAction.corsPolicy.allowMethods
| |
resource.pathMatchers.defaultRouteAction.corsPolicy.allowOriginRegexes
| |
resource.pathMatchers.defaultRouteAction.corsPolicy.allowOrigins
| |
resource.pathMatchers.defaultRouteAction.corsPolicy.disabled
| |
resource.pathMatchers.defaultRouteAction.corsPolicy.exposeHeaders
| |
resource.pathMatchers.defaultRouteAction.corsPolicy.maxAge
| |
resource.pathMatchers.defaultRouteAction.faultInjectionPolicy.abort.httpStatus
| |
resource.pathMatchers.defaultRouteAction.faultInjectionPolicy.abort.percentage
| |
resource.pathMatchers.defaultRouteAction.faultInjectionPolicy.delay.fixedDelay.nanos
| |
resource.pathMatchers.defaultRouteAction.faultInjectionPolicy.delay.fixedDelay.seconds
| |
resource.pathMatchers.defaultRouteAction.faultInjectionPolicy.delay.percentage
| |
resource.pathMatchers.defaultRouteAction.maxStreamDuration.nanos
| |
resource.pathMatchers.defaultRouteAction.maxStreamDuration.seconds
| |
resource.pathMatchers.defaultRouteAction.retryPolicy.numRetries
| |
resource.pathMatchers.defaultRouteAction.retryPolicy.perTryTimeout.nanos
| |
resource.pathMatchers.defaultRouteAction.retryPolicy.perTryTimeout.seconds
| |
resource.pathMatchers.defaultRouteAction.retryPolicy.retryConditions
| |
resource.pathMatchers.defaultRouteAction.timeout.nanos
| |
resource.pathMatchers.defaultRouteAction.timeout.seconds
| |
resource.pathMatchers.defaultRouteAction.urlRewrite.hostRewrite
| |
resource.pathMatchers.defaultRouteAction.urlRewrite.pathPrefixRewrite
| |
resource.pathMatchers.defaultRouteAction.urlRewrite.pathTemplateRewrite
| |
resource.pathMatchers.defaultRouteAction.weightedBackendServices.headerAction.requestHeadersToAdd.headerName
| |
resource.pathMatchers.defaultRouteAction.weightedBackendServices.headerAction.requestHeadersToAdd.headerValue
| |
resource.pathMatchers.defaultRouteAction.weightedBackendServices.headerAction.requestHeadersToAdd.replace
| |
resource.pathMatchers.defaultRouteAction.weightedBackendServices.headerAction.requestHeadersToRemove
| |
resource.pathMatchers.defaultRouteAction.weightedBackendServices.headerAction.responseHeadersToAdd.headerName
| |
resource.pathMatchers.defaultRouteAction.weightedBackendServices.headerAction.responseHeadersToAdd.headerValue
| |
resource.pathMatchers.defaultRouteAction.weightedBackendServices.headerAction.responseHeadersToAdd.replace
| |
resource.pathMatchers.defaultRouteAction.weightedBackendServices.headerAction.responseHeadersToRemove
| |
resource.pathMatchers.defaultRouteAction.weightedBackendServices.weight
| |
resource.pathMatchers.defaultUrlRedirect.hostRedirect
| |
resource.pathMatchers.defaultUrlRedirect.httpsRedirect
| |
resource.pathMatchers.defaultUrlRedirect.pathRedirect
| |
resource.pathMatchers.defaultUrlRedirect.prefixRedirect
| |
resource.pathMatchers.defaultUrlRedirect.redirectResponseCode
| |
resource.pathMatchers.defaultUrlRedirect.stripQuery
| |
resource.pathMatchers.description
| |
resource.pathMatchers.headerAction.requestHeadersToAdd.headerName
| |
resource.pathMatchers.headerAction.requestHeadersToAdd.headerValue
| |
resource.pathMatchers.headerAction.requestHeadersToAdd.replace
| |
resource.pathMatchers.headerAction.requestHeadersToRemove
| |
resource.pathMatchers.headerAction.responseHeadersToAdd.headerName
| |
resource.pathMatchers.headerAction.responseHeadersToAdd.headerValue
| |
resource.pathMatchers.headerAction.responseHeadersToAdd.replace
| |
resource.pathMatchers.headerAction.responseHeadersToRemove
| |
resource.pathMatchers.name
| |
resource.pathMatchers.pathRules.customErrorResponsePolicy.errorResponseRules.matchResponseCodes
| |
resource.pathMatchers.pathRules.customErrorResponsePolicy.errorResponseRules.overrideResponseCode
| |
resource.pathMatchers.pathRules.customErrorResponsePolicy.errorResponseRules.path
| |
resource.pathMatchers.pathRules.paths
| |
resource.pathMatchers.pathRules.routeAction.corsPolicy.allowCredentials
| |
resource.pathMatchers.pathRules.routeAction.corsPolicy.allowHeaders
| |
resource.pathMatchers.pathRules.routeAction.corsPolicy.allowMethods
| |
resource.pathMatchers.pathRules.routeAction.corsPolicy.allowOriginRegexes
| |
resource.pathMatchers.pathRules.routeAction.corsPolicy.allowOrigins
| |
resource.pathMatchers.pathRules.routeAction.corsPolicy.disabled
| |
resource.pathMatchers.pathRules.routeAction.corsPolicy.exposeHeaders
| |
resource.pathMatchers.pathRules.routeAction.corsPolicy.maxAge
| |
resource.pathMatchers.pathRules.routeAction.faultInjectionPolicy.abort.httpStatus
| |
resource.pathMatchers.pathRules.routeAction.faultInjectionPolicy.abort.percentage
| |
resource.pathMatchers.pathRules.routeAction.faultInjectionPolicy.delay.fixedDelay.nanos
| |
resource.pathMatchers.pathRules.routeAction.faultInjectionPolicy.delay.fixedDelay.seconds
| |
resource.pathMatchers.pathRules.routeAction.faultInjectionPolicy.delay.percentage
| |
resource.pathMatchers.pathRules.routeAction.maxStreamDuration.nanos
| |
resource.pathMatchers.pathRules.routeAction.maxStreamDuration.seconds
| |
resource.pathMatchers.pathRules.routeAction.retryPolicy.numRetries
| |
resource.pathMatchers.pathRules.routeAction.retryPolicy.perTryTimeout.nanos
| |
resource.pathMatchers.pathRules.routeAction.retryPolicy.perTryTimeout.seconds
| |
resource.pathMatchers.pathRules.routeAction.retryPolicy.retryConditions
| |
resource.pathMatchers.pathRules.routeAction.timeout.nanos
| |
resource.pathMatchers.pathRules.routeAction.timeout.seconds
| |
resource.pathMatchers.pathRules.routeAction.urlRewrite.hostRewrite
| |
resource.pathMatchers.pathRules.routeAction.urlRewrite.pathPrefixRewrite
| |
resource.pathMatchers.pathRules.routeAction.urlRewrite.pathTemplateRewrite
| |
resource.pathMatchers.pathRules.routeAction.weightedBackendServices.headerAction.requestHeadersToAdd.headerName
| |
resource.pathMatchers.pathRules.routeAction.weightedBackendServices.headerAction.requestHeadersToAdd.headerValue
| |
resource.pathMatchers.pathRules.routeAction.weightedBackendServices.headerAction.requestHeadersToAdd.replace
| |
resource.pathMatchers.pathRules.routeAction.weightedBackendServices.headerAction.requestHeadersToRemove
| |
resource.pathMatchers.pathRules.routeAction.weightedBackendServices.headerAction.responseHeadersToAdd.headerName
| |
resource.pathMatchers.pathRules.routeAction.weightedBackendServices.headerAction.responseHeadersToAdd.headerValue
| |
resource.pathMatchers.pathRules.routeAction.weightedBackendServices.headerAction.responseHeadersToAdd.replace
| |
resource.pathMatchers.pathRules.routeAction.weightedBackendServices.headerAction.responseHeadersToRemove
| |
resource.pathMatchers.pathRules.routeAction.weightedBackendServices.weight
| |
resource.pathMatchers.pathRules.urlRedirect.hostRedirect
| |
resource.pathMatchers.pathRules.urlRedirect.httpsRedirect
| |
resource.pathMatchers.pathRules.urlRedirect.pathRedirect
| |
resource.pathMatchers.pathRules.urlRedirect.prefixRedirect
| |
resource.pathMatchers.pathRules.urlRedirect.redirectResponseCode
| |
resource.pathMatchers.pathRules.urlRedirect.stripQuery
| |
resource.pathMatchers.routeRules.customErrorResponsePolicy.errorResponseRules.matchResponseCodes
| |
resource.pathMatchers.routeRules.customErrorResponsePolicy.errorResponseRules.overrideResponseCode
| |
resource.pathMatchers.routeRules.customErrorResponsePolicy.errorResponseRules.path
| |
resource.pathMatchers.routeRules.description
| |
resource.pathMatchers.routeRules.headerAction.requestHeadersToAdd.headerName
| |
resource.pathMatchers.routeRules.headerAction.requestHeadersToAdd.headerValue
| |
resource.pathMatchers.routeRules.headerAction.requestHeadersToAdd.replace
| |
resource.pathMatchers.routeRules.headerAction.requestHeadersToRemove
| |
resource.pathMatchers.routeRules.headerAction.responseHeadersToAdd.headerName
| |
resource.pathMatchers.routeRules.headerAction.responseHeadersToAdd.headerValue
| |
resource.pathMatchers.routeRules.headerAction.responseHeadersToAdd.replace
| |
resource.pathMatchers.routeRules.headerAction.responseHeadersToRemove
| |
resource.pathMatchers.routeRules.matchRules.fullPathMatch
| |
resource.pathMatchers.routeRules.matchRules.headerMatches.exactMatch
| |
resource.pathMatchers.routeRules.matchRules.headerMatches.headerName
| |
resource.pathMatchers.routeRules.matchRules.headerMatches.invertMatch
| |
resource.pathMatchers.routeRules.matchRules.headerMatches.prefixMatch
| |
resource.pathMatchers.routeRules.matchRules.headerMatches.presentMatch
| |
resource.pathMatchers.routeRules.matchRules.headerMatches.rangeMatch.rangeEnd
| |
resource.pathMatchers.routeRules.matchRules.headerMatches.rangeMatch.rangeStart
| |
resource.pathMatchers.routeRules.matchRules.headerMatches.regexMatch
| |
resource.pathMatchers.routeRules.matchRules.headerMatches.suffixMatch
| |
resource.pathMatchers.routeRules.matchRules.ignoreCase
| |
resource.pathMatchers.routeRules.matchRules.metadataFilters.filterLabels.name
| |
resource.pathMatchers.routeRules.matchRules.metadataFilters.filterLabels.value
| |
resource.pathMatchers.routeRules.matchRules.metadataFilters.filterMatchCriteria
| |
resource.pathMatchers.routeRules.matchRules.pathTemplateMatch
| |
resource.pathMatchers.routeRules.matchRules.prefixMatch
| |
resource.pathMatchers.routeRules.matchRules.queryParameterMatches.exactMatch
| |
resource.pathMatchers.routeRules.matchRules.queryParameterMatches.name
| |
resource.pathMatchers.routeRules.matchRules.queryParameterMatches.presentMatch
| |
resource.pathMatchers.routeRules.matchRules.queryParameterMatches.regexMatch
| |
resource.pathMatchers.routeRules.matchRules.regexMatch
| |
resource.pathMatchers.routeRules.priority
| |
resource.pathMatchers.routeRules.routeAction.corsPolicy.allowCredentials
| |
resource.pathMatchers.routeRules.routeAction.corsPolicy.allowHeaders
| |
resource.pathMatchers.routeRules.routeAction.corsPolicy.allowMethods
| |
resource.pathMatchers.routeRules.routeAction.corsPolicy.allowOriginRegexes
| |
resource.pathMatchers.routeRules.routeAction.corsPolicy.allowOrigins
| |
resource.pathMatchers.routeRules.routeAction.corsPolicy.disabled
| |
resource.pathMatchers.routeRules.routeAction.corsPolicy.exposeHeaders
| |
resource.pathMatchers.routeRules.routeAction.corsPolicy.maxAge
| |
resource.pathMatchers.routeRules.routeAction.faultInjectionPolicy.abort.httpStatus
| |
resource.pathMatchers.routeRules.routeAction.faultInjectionPolicy.abort.percentage
| |
resource.pathMatchers.routeRules.routeAction.faultInjectionPolicy.delay.fixedDelay.nanos
| |
resource.pathMatchers.routeRules.routeAction.faultInjectionPolicy.delay.fixedDelay.seconds
| |
resource.pathMatchers.routeRules.routeAction.faultInjectionPolicy.delay.percentage
| |
resource.pathMatchers.routeRules.routeAction.maxStreamDuration.nanos
| |
resource.pathMatchers.routeRules.routeAction.maxStreamDuration.seconds
| |
resource.pathMatchers.routeRules.routeAction.retryPolicy.numRetries
| |
resource.pathMatchers.routeRules.routeAction.retryPolicy.perTryTimeout.nanos
| |
resource.pathMatchers.routeRules.routeAction.retryPolicy.perTryTimeout.seconds
| |
resource.pathMatchers.routeRules.routeAction.retryPolicy.retryConditions
| |
resource.pathMatchers.routeRules.routeAction.timeout.nanos
| |
resource.pathMatchers.routeRules.routeAction.timeout.seconds
| |
resource.pathMatchers.routeRules.routeAction.urlRewrite.hostRewrite
| |
resource.pathMatchers.routeRules.routeAction.urlRewrite.pathPrefixRewrite
| |
resource.pathMatchers.routeRules.routeAction.urlRewrite.pathTemplateRewrite
| |
resource.pathMatchers.routeRules.routeAction.weightedBackendServices.headerAction.requestHeadersToAdd.headerName
| |
resource.pathMatchers.routeRules.routeAction.weightedBackendServices.headerAction.requestHeadersToAdd.headerValue
| |
resource.pathMatchers.routeRules.routeAction.weightedBackendServices.headerAction.requestHeadersToAdd.replace
| |
resource.pathMatchers.routeRules.routeAction.weightedBackendServices.headerAction.requestHeadersToRemove
| |
resource.pathMatchers.routeRules.routeAction.weightedBackendServices.headerAction.responseHeadersToAdd.headerName
| |
resource.pathMatchers.routeRules.routeAction.weightedBackendServices.headerAction.responseHeadersToAdd.headerValue
| |
resource.pathMatchers.routeRules.routeAction.weightedBackendServices.headerAction.responseHeadersToAdd.replace
| |
resource.pathMatchers.routeRules.routeAction.weightedBackendServices.headerAction.responseHeadersToRemove
| |
resource.pathMatchers.routeRules.routeAction.weightedBackendServices.weight
| |
resource.pathMatchers.routeRules.urlRedirect.hostRedirect
| |
resource.pathMatchers.routeRules.urlRedirect.httpsRedirect
| |
resource.pathMatchers.routeRules.urlRedirect.pathRedirect
| |
resource.pathMatchers.routeRules.urlRedirect.prefixRedirect
| |
resource.pathMatchers.routeRules.urlRedirect.redirectResponseCode
| |
resource.pathMatchers.routeRules.urlRedirect.stripQuery
| |
resource.tests.description
| |
resource.tests.expectedOutputUrl
| |
resource.tests.expectedRedirectResponseCode
| |
resource.tests.headers.name
| |
resource.tests.headers.value
| |
resource.tests.host
| |
resource.tests.path
| |
| networkservices.googleapis.com/ServiceLbPolicy |
resource.autoCapacityDrain.enable
|
resource.description
| |
resource.failoverConfig.failoverHealthThreshold
| |
resource.loadBalancingAlgorithm
| |
resource.name
|
הגדרת אילוץ בהתאמה אישית
אילוץ בהתאמה אישית מוגדר בקובץ YAML לפי המשאבים, השיטות, התנאים והפעולות שנתמכים על ידי השירות שבו אתם אוכפים את מדיניות הארגון. התנאים להגבלות המותאמות אישית מוגדרים באמצעות Common Expression Language (CEL). מידע נוסף על יצירת תנאים באילוצים מותאמים אישית באמצעות CEL זמין בקטע על CEL במאמר יצירה וניהול של אילוצים מותאמים אישית.
המסוף
כדי ליצור אילוץ בהתאמה אישית:
- במסוף Google Cloud , נכנסים לדף מדיניות הארגון.
- בכלי לבחירת פרויקטים, בוחרים את הפרויקט שרוצים להגדיר לו את מדיניות הארגון.
- לוחצים על Custom constraint (הגבלה מותאמת אישית).
- בתיבה שם לתצוגה, מזינים שם שאנשים יכולים לקרוא למגבלה. השם הזה משמש בהודעות שגיאה, ואפשר להשתמש בו לצורך זיהוי וניפוי באגים. אל תשתמשו בפרטים אישיים מזהים (PII) או במידע אישי רגיש בשמות לתצוגה, כי השם הזה עלול להיחשף בהודעות שגיאה. השדה הזה יכול להכיל עד 200 תווים.
-
בתיבה Constraint ID (מזהה ההגבלה), מזינים את המזהה שרוצים להגדיר להגבלה החדשה בהתאמה אישית. אילוץ מותאם אישית יכול להכיל רק אותיות (כולל אותיות גדולות וקטנות) או מספרים, למשל
custom.enforceTCPHealthCheckPort1024. השדה הזה יכול להכיל עד 70 תווים, לא כולל הקידומת (custom.), לדוגמה,organizations/123456789/customConstraints/custom. אל תכללו פרטים אישיים מזהים (PII) או נתונים רגישים במזהה האילוץ, כי הם עלולים להיחשף בהודעות שגיאה. - בתיבה Description, מזינים תיאור של האילוץ שכתוב בצורה שקריאה לאנשים. התיאור הזה משמש כהודעת שגיאה כשמתבצעת הפרה של המדיניות. לכלול פרטים על הסיבה להפרת המדיניות ואיך לפתור אותה. אל תכללו בתיאור פרטים אישיים מזהים (PII) או מידע אישי רגיש, כי הם עלולים להיחשף בהודעות שגיאה. השדה הזה יכול להכיל עד 2,000 תווים.
-
בתיבה Resource type, בוחרים את השם של משאב REST Google Cloud שמכיל את האובייקט והשדה שרוצים להגביל – לדוגמה,
container.googleapis.com/NodePool. רוב סוגי המשאבים תומכים בעד 20 אילוצים מותאמים אישית. אם תנסו ליצור עוד אילוצים בהתאמה אישית, הפעולה תיכשל. -
בקטע שיטת אכיפה, בוחרים אם לאכוף את ההגבלה על שיטת REST
CREATEאו על שיטותCREATEו-UPDATE. אם אוכפים את האילוץ באמצעות השיטהUPDATEבמשאב שמפר את האילוץ, מדיניות הארגון חוסמת שינויים במשאב הזה, אלא אם השינוי פותר את ההפרה. - כדי להגדיר תנאי, לוחצים על Edit condition.
-
בחלונית Add condition, יוצרים תנאי CEL שמתייחס למשאב שירות נתמך, לדוגמה,
resource.management.autoUpgrade == false. השדה הזה יכול להכיל עד 1,000 תווים. פרטים על השימוש ב-CEL זמינים במאמר בנושא Common Expression Language. מידע נוסף על משאבי השירות שאפשר להשתמש בהם באילוצים בהתאמה אישית זמין במאמר שירותים שתומכים באילוצים בהתאמה אישית. - לוחצים על Save.
- בקטע פעולה, בוחרים אם לאשר או לדחות את השיטה שנבדקה אם התנאי מתקיים.
- לוחצים על יצירת אילוץ.
כדי לראות את השיטות הנתמכות לכל שירות, מחפשים את השירות בקטע שירותים שתומכים באילוצים בהתאמה אישית.
הפעולה deny (דחייה) פירושה שהפעולה ליצירה או לעדכון של המשאב נחסמת אם התנאי מוערך כ-True.
הפעולה allow (אישור) אומרת שהפעולה ליצירה או לעדכון של המשאב מותרת רק אם התנאי מחזיר את הערך true. כל מקרה אחר, מלבד אלה שמפורטים במפורש בתנאי, נחסם.
אחרי שמזינים ערך בכל שדה, מופיעה משמאל הגדרת ה-YAML המקבילה לאילוץ המותאם אישית הזה.
gcloud
- כדי ליצור אילוץ בהתאמה אישית, יוצרים קובץ YAML בפורמט הבא:
-
ORGANIZATION_ID: מזהה הארגון, למשל123456789. -
CONSTRAINT_NAME: השם שרוצים לתת לאילוץ המותאם אישית החדש. אילוץ מותאם אישית יכול להכיל רק אותיות (כולל אותיות רישיות וקטנות) או מספרים, למשל,custom.enforceTCPHealthCheckPort1024. השדה הזה יכול להכיל עד 70 תווים, לא כולל הקידומת (custom.) – לדוגמה,organizations/123456789/customConstraints/custom. אל תכללו פרטים אישיים מזהים (PII) או נתונים רגישים במזהה האילוץ, כי הם עלולים להיחשף בהודעות שגיאה. -
RESOURCE_NAME: השם מוגדר במלואו של המשאב Google Cloudשמכיל את האובייקט והשדה שרוצים להגביל. לדוגמה:compute.googleapis.com/HealthCheck. רוב סוגי המשאבים תומכים בעד 20 אילוצים מותאמים אישית. אם תנסו ליצור עוד אילוצים בהתאמה אישית, הפעולה תיכשל. -
methodTypes: שיטות ה-REST שבהן האילוץ נאכף. הערך יכול להיותCREATEאו גםCREATEוגםUPDATE. אם אוכפים את האילוץ באמצעות השיטהUPDATEעל משאב שמפר את האילוץ, שינויים במשאב הזה נחסמים על ידי מדיניות הארגון, אלא אם השינוי פותר את ההפרה. -
CONDITION: תנאי CEL שנכתב על סמך ייצוג של משאב שירות נתמך. השדה הזה יכול להכיל עד 1,000 תווים. לדוגמה:"resource.tcpHealthCheck.port >= 1024". -
ACTION: הפעולה שתתבצע אם התנאיconditionיתקיים. הערכים האפשריים הםALLOWו-DENY. -
DISPLAY_NAME: שם קריא לאנשים של האילוץ. השם הזה מופיע בהודעות שגיאה ויכול לשמש לזיהוי ולניפוי באגים. אל תשתמשו בפרטים אישיים מזהים (PII) או במידע אישי רגיש בשמות המוצגים, כי השם הזה עלול להיחשף בהודעות שגיאה. השדה הזה יכול להכיל עד 200 תווים. -
DESCRIPTION: תיאור ידידותי למשתמש של האילוץ שיוצג כהודעת שגיאה אם המדיניות תופר. השדה הזה יכול להכיל עד 2,000 תווים. -
אחרי שיוצרים קובץ YAML לאילוץ חדש בהתאמה אישית, צריך להגדיר אותו כדי שיהיה זמין למדיניות הארגון בארגון. כדי להגדיר אילוץ בהתאמה אישית, משתמשים בפקודה
gcloud org-policies set-custom-constraint: -
כדי לוודא שהאילוץ המותאם אישית קיים, משתמשים בפקודה
gcloud org-policies list-custom-constraints:
name: organizations/ORGANIZATION_ID/customConstraints/CONSTRAINT_NAME resourceTypes: RESOURCE_NAME methodTypes: - CREATE
- UPDATE condition: "CONDITION" actionType: ACTION displayName: DISPLAY_NAME description: DESCRIPTION
מחליפים את מה שכתוב בשדות הבאים:
כדי לראות את השיטות הנתמכות לכל שירות, מחפשים את השירות ב שירותים שתומכים באילוצים בהתאמה אישית.
מידע נוסף על המשאבים שאפשר לכתוב תנאים לגביהם זמין במאמר משאבים נתמכים.
הפעולה allow (אישור) אומרת שאם התנאי מקבל את הערך True, הפעולה ליצירה או לעדכון של המשאב מותרת. המשמעות היא שכל מקרה אחר, חוץ מהמקרה שמופיע במפורש בתנאי, ייחסם.
הפעולה deny (דחייה) פירושה שאם התנאי מחזיר את הערך True, הפעולה ליצירה או לעדכון של המשאב נחסמת.
gcloud org-policies set-custom-constraint CONSTRAINT_PATH
מחליפים את CONSTRAINT_PATH בנתיב המלא לקובץ האילוצים המותאמים אישית. לדוגמה, /home/user/customconstraint.yaml.
אחרי שהפעולה הזו תושלם, האילוצים המותאמים אישית יהיו זמינים כמדיניות ארגונית ברשימת Google Cloud מדיניות הארגון.
gcloud org-policies list-custom-constraints --organization=ORGANIZATION_ID
מחליפים את ORGANIZATION_ID במזהה של משאב הארגון.
מידע נוסף זמין במאמר בנושא צפייה במדיניות הארגון.
אכיפה של מדיניות ארגון מותאמת אישית
כדי לאכוף אילוץ, יוצרים מדיניות ארגון שמפנה אליו, ואז מחילים את מדיניות הארגון הזו על משאב Google Cloud .המסוף
- במסוף Google Cloud , נכנסים לדף מדיניות הארגון.
- מכלי לבחירת פרויקטים, בוחרים את הפרויקט שרוצים להגדיר לו את מדיניות הארגון.
- מהרשימה בדף מדיניות הארגון, בוחרים את האילוץ כדי לראות את הדף פרטי המדיניות של האילוץ הזה.
- כדי להגדיר את מדיניות הארגון עבור המשאב הזה, לוחצים על ניהול מדיניות.
- בדף עריכת מדיניות, בוחרים באפשרות במקום המדיניות של המשאב הראשי.
- לוחצים על Add a rule.
- בקטע Enforcement (אכיפה), בוחרים אם מדיניות הארגון הזו נאכפת או לא.
- אופציונלי: כדי להגדיר את מדיניות הארגון כתלויה בתג, לוחצים על הוספת תנאי. הערה: אם מוסיפים כלל מותנה למדיניות ארגון, צריך להוסיף לפחות כלל לא מותנה אחד, אחרת אי אפשר לשמור את המדיניות. מידע נוסף על מדיניות ארגונית עם תגים
- לוחצים על בדיקת שינויים כדי לדמות את ההשפעה של מדיניות הארגון. מידע נוסף זמין במאמר בדיקת שינויים במדיניות הארגון באמצעות סימולטור המדיניות.
- כדי לאכוף את המדיניות של הארגון במצב פרימטר לבדיקות, לוחצים על הגדרת המדיניות להרצת בדיקה. מידע נוסף זמין במאמר בנושא בדיקת מדיניות הארגון.
- אחרי שמוודאים שמדיניות הארגון במצב הרצה יבשה פועלת כמו שרוצים, לוחצים על הגדרת מדיניות כדי להגדיר את המדיניות הפעילה.
gcloud
- כדי ליצור מדיניות ארגונית עם כללים בוליאניים, יוצרים קובץ YAML של מדיניות שמפנה לאילוץ:
-
PROJECT_ID: הפרויקט שבו רוצים לאכוף את האילוץ. -
CONSTRAINT_NAME: השם שהגדרתם לאילוץ המותאם אישית. לדוגמה,custom.enforceTCPHealthCheckPort1024. -
כדי לאכוף את מדיניות הארגון במצב הרצה יבשה, מריצים את הפקודה הבאה עם הדגל
dryRunSpec: -
אחרי שמוודאים שמדיניות הארגון במצב הרצה יבשה פועלת כמו שרוצים, מגדירים את המדיניות הפעילה באמצעות הפקודה
org-policies set-policyוהדגלspec:
name: projects/PROJECT_ID/policies/CONSTRAINT_NAME spec: rules: - enforce: true dryRunSpec: rules: - enforce: true
מחליפים את מה שכתוב בשדות הבאים:
gcloud org-policies set-policy POLICY_PATH --update-mask=dryRunSpec
מחליפים את POLICY_PATH בנתיב המלא לקובץ ה-YAML של מדיניות הארגון. יחלפו עד 15 דקות לפני שהמדיניות תיכנס לתוקף.
gcloud org-policies set-policy POLICY_PATH --update-mask=spec
מחליפים את POLICY_PATH בנתיב המלא לקובץ ה-YAML של מדיניות הארגון. יחלפו עד 15 דקות לפני שהמדיניות תיכנס לתוקף.
בדיקה של מדיניות הארגון המותאמת אישית
בדוגמה הבאה נוצרת אילוץ בהתאמה אישית שדורש שפורטים של בדיקות תקינות TCP יהיו 1024 ומעלה, כדי למנוע שימוש בפורטים מוכרים (0 עד 1023).
יצירת האילוץ המותאם אישית
כדי להגדיר אילוץ מותאם אישית, יוצרים קובץ בשם
constraint-tcp-health-check-ports.yaml.name: organizations/ORGANIZATION_ID/customConstraints/custom.enforceTCPHealthCheckPort1024 resource_types: – compute.googleapis.com/HealthCheck condition: "resource.tcpHealthCheck.port >= 1024" method_types: – CREATE – UPDATE action_type: ALLOW display_name: Only TCP health check ports >= 1024 allowed. description: Prevent TCP health checks on well-known ports.
מחליפים את ORGANIZATION_ID במזהה הארגון.
החלת האילוץ המותאם אישית.
gcloud org-policies set-custom-constraint constraint-tcp-health-check-ports
יצירת מדיניות הארגון
כדי להגדיר מדיניות ארגון, יוצרים קובץ בשם
policy-tcp-health-check-ports.yaml. בדוגמה הזו אנחנו אוכפים את האילוץ הזה ברמת הפרויקט, אבל אפשר גם להגדיר אותו ברמת הארגון או התיקייה.name: projects/PROJECT_ID/policies/custom.enforceTCPHealthCheckPort1024 spec: rules: – enforce: true
מחליפים את
PROJECT_IDבמזהה הפרויקט.אוכפים את מדיניות הארגון.
gcloud org-policies set-policy policy-tcp-health-check-ports
מוודאים שמדיניות הארגון קיימת.
gcloud org-policies list --project PROJECT_ID
הפלט אמור להיראות כך:
CONSTRAINT: custom.enforceTCPHealthCheckPort1024 LIST_POLICY: SET BOOLEAN_POLICY: - ETAG: CNHuh7kGEJiatFo=-
בדיקת המדיניות
כדי לבדוק את האילוץ, יוצרים בדיקת תקינות של TCP ביציאה 80.
gcloud compute health-checks create tcp my-tcp-health-check \ --project=PROJECT_ID \ --region=us-central1 \ --port=80 \ --check-interval=5s \ --timeout=5s \ --healthy-threshold=4 \ --unhealthy-threshold=5 \הפעולה אסורה והפלט אמור להיראות כך:
ERROR: (gcloud.compute.healthChecks.create) Could not fetch resource: – Operation denied by custom org policies: [customConstraints/custom.enforceTCPHealthCheckPort1024]: Only TCP health check ports >= 1024 allowed.
דוגמאות למדיניות הארגון מותאמת אישית לתרחישים נפוצים
בטבלה הבאה מפורט התחביר של כמה אילוצים מותאמים אישית נפוצים.
| תיאור | תחביר של אילוצים |
|---|---|
| דרישה שכל קטגוריות הקצה העורפי יפעילו את Cloud CDN |
name: organizations/ORGANIZATION_ID/customConstraints/custom.backendBucketEnableCdn resourceTypes: - compute.googleapis.com/BackendBucket methodTypes: - CREATE - UPDATE condition: "resource.enableCdn == true" actionType: ALLOW displayName: Require all backend buckets to have Cloud CDN enabled description: All backend buckets must have Cloud CDN enabled. |
| איסור השימוש ב-HTTP וב-TCP כפרוטוקולים של שירות לקצה העורפי |
name: organizations/ORGANIZATION_ID/customConstraints/custom.backendBucketEnableCdn resourceTypes: - compute.googleapis.com/BackendService methodTypes: - CREATE - UPDATE condition: "resource.protocol == 'HTTP' || resource.protocol == 'TCP'" actionType: DENY displayName: Disallow the use of HTTP and TCP as backend service protocols description: Backend services cannot configure HTTP or TCP as the backend service protocol. |
| דרישה לשימוש במסלול הרגיל בכללי העברה |
name: organizations/ORGANIZATION_ID/customConstraints/custom.forwardingRulesStandardTier resourceTypes: - compute.googleapis.com/ForwardingRule methodTypes: - CREATE - UPDATE condition: "resource.networkTier == 'STANDARD'" actionType: ALLOW displayName: Require forwarding rules to use Standard Tier description: Forwarding rules must use the Standard Network Service Tier. |
| דרישה שכל הפרוטוקולים של בדיקות התקינות יתבצעו ביציאה 1024 ומעלה |
name: organizations/ORGANIZATION_ID/customConstraints/custom.healthCheckPortMin1024 resourceTypes: - compute.googleapis.com/HealthCheck methodTypes: - CREATE - UPDATE condition: "resource.tcpHealthCheck.port >= 1024 && resource.httpHealthCheck.port >= 1024 && resource.httpsHealthCheck.port >= 1024 && resource.sslHealthCheck.port >= 1024 && resource.sslHealthCheck.port >= 1024 &&resource.http2HealthCheck.port >= 1024 && resource.grpcHealthCheck.port >= 1024" actionType: ALLOW displayName: Require port 1024 or greater for all health checks description: All health check protocols must use a port of 1024 or higher, to avoid well-known ports. |
| איסור בדיקות תקינות של gRPC |
name: organizations/ORGANIZATION_ID/customConstraints/custom.disallowGRPCHealthChecks resourceTypes: - compute.googleapis.com/HealthCheck methodTypes: - CREATE - UPDATE condition: "resource.type == 'GRPC'" actionType: DENY displayName: Disallow GRPC health checks description: Health checks aren't allowed to use GRPC. |
| מניעת בדיקות תקינות בתדירות גבוהה |
name: organizations/ORGANIZATION_ID/customConstraints/custom.minHealthCheckFrequency resourceTypes: - compute.googleapis.com/HealthCheck methodTypes: - CREATE - UPDATE condition: "resource.checkIntervalSec >= 30" actionType: ALLOW displayName: Disallow fast health check probes description: Prevent health checks from having a probe frequency under 30 seconds. |
| אי אפשר להגדיר ערכים של זמן קצוב לתפוגה של חיבור HTTPS פעיל בלקוח שגדולים מ-1,000 שניות |
name: organizations/ORGANIZATION_ID/customConstraints/custom.clientHTTPSKeepalive1000Sec resourceTypes: - compute.googleapis.com/TargetHttpsProxy methodTypes: - CREATE - UPDATE condition: "resource.httpKeepAliveTimeoutSec > 1000" actionType: DENY displayName: Disallow client HTTPS keepalive timeout greater than 1000 seconds description: Disallow client HTTPS keepalive timeout values greater than 1000 seconds. |
דרישה של מיפוי כתובות URL להחזיק מדיניות מותאמת אישית של תגובות שגיאה לקודי סטטוס HTTP 500 |
name: organizations/ORGANIZATION_ID/customConstraints/custom.urlMapCustomResponseHTTP500 resourceTypes: - compute.googleapis.com/UrlMaps methodTypes: - CREATE - UPDATE condition: "resource.defaultCustomErrorResponsePolicy.errorResponseRule.exists(value, value.matchResponseCode == 500)" actionType: ALLOW displayName: Require URL maps to have a custom error response policy for HTTP 500 errors description: URL maps must have a custom error response policy configured for HTTP 500 errors. |
| דרישה ששם מופעי היעד יתחיל במחרוזת targetInstance |
name: organizations/ORGANIZATION_ID/customConstraints/custom.targetInstanceConstraint resourceTypes: - compute.googleapis.com/TargetInstance methodTypes: - CREATE - UPDATE condition: "resource.name.startsWith('targetInstance')" actionType: ALLOW displayName: Require target instances to have a name that starts with the string "targetInstance" description: Target instances must have resource names that start with the string "targetInstance" |
| דרישה של זיקה לסשן CLIENT_IP במאגרי יעד |
name: organizations/ORGANIZATION_ID/customConstraints/custom.targetPoolConstraint resourceTypes: - compute.googleapis.com/TargetPool methodTypes: - CREATE - UPDATE condition: "resource.sessionAffinity == 'CLIENT_IP'" actionType: ALLOW displayName: Require target pools to use CLIENT_IP session affinity description: Target pools must use CLIENT_IP session affinity |
| הגבלת גרסת ה-TLS המינימלית ל-1.2 |
name: organizations/ORGANIZATION_ID/customConstraints/custom.restrictLbTlsVersion resource_types: compute.googleapis.com/SslPolicy methodTypes: - CREATE - UPDATE condition: resource.minTlsVersion == "TLS_1_2" action_type: ALLOW display_name: Restrict Load Balancing TLS version to 1.2 description: Only allow SSL policies to be created or updated if the minimum TLS version is 1.2 where this custom constraint is enforced. |
|
אפשר ליצור משאב SSL אם התנאים הבאים מתקיימים:
|
name: organizations/ORGANIZATION_ID/customConstraints/custom.restrictLbTlsCapabilities resourceTypes: - compute.googleapis.com/SslPolicy methodTypes: - CREATE - UPDATE condition: resource.minTlsVersion == "TLS_1_2" && resource.profile == "CUSTOM" && !resource.customFeatures.exists(feature, feature.contains("CHACHA20_POLY1305")) actionType: ALLOW displayName: Restrict Load Balancing TLS Capabilities description: Only allow SSL Policy resources to be created or updated if the minimum TLS version is 1.2, profile is CUSTOM, and no ChaCha20-Poly1305 cipher suite is used where this custom constraint is enforced. |
המאמרים הבאים
- מידע נוסף על השירות של מדיניות הארגון
- מידע נוסף על יצירה וניהול של כללי מדיניות לארגון
- כאן אפשר לראות את הרשימה המלאה של אילוצים מנוהלים של מדיניות הארגון.