service_perimeter.proto 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465
  1. // Copyright 2021 Google LLC
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. syntax = "proto3";
  15. package google.identity.accesscontextmanager.v1;
  16. import "google/api/resource.proto";
  17. import "google/protobuf/timestamp.proto";
  18. import "google/api/annotations.proto";
  19. option csharp_namespace = "Google.Identity.AccessContextManager.V1";
  20. option go_package = "google.golang.org/genproto/googleapis/identity/accesscontextmanager/v1;accesscontextmanager";
  21. option java_multiple_files = true;
  22. option java_outer_classname = "ServicePerimeterProto";
  23. option java_package = "com.google.identity.accesscontextmanager.v1";
  24. option objc_class_prefix = "GACM";
  25. option php_namespace = "Google\\Identity\\AccessContextManager\\V1";
  26. option ruby_package = "Google::Identity::AccessContextManager::V1";
  27. // `ServicePerimeter` describes a set of Google Cloud resources which can freely
  28. // import and export data amongst themselves, but not export outside of the
  29. // `ServicePerimeter`. If a request with a source within this `ServicePerimeter`
  30. // has a target outside of the `ServicePerimeter`, the request will be blocked.
  31. // Otherwise the request is allowed. There are two types of Service Perimeter -
  32. // Regular and Bridge. Regular Service Perimeters cannot overlap, a single
  33. // Google Cloud project can only belong to a single regular Service Perimeter.
  34. // Service Perimeter Bridges can contain only Google Cloud projects as members,
  35. // a single Google Cloud project may belong to multiple Service Perimeter
  36. // Bridges.
  37. message ServicePerimeter {
  38. option (google.api.resource) = {
  39. type: "accesscontextmanager.googleapis.com/ServicePerimeter"
  40. pattern: "accessPolicies/{access_policy}/servicePerimeters/{service_perimeter}"
  41. };
  42. // Specifies the type of the Perimeter. There are two types: regular and
  43. // bridge. Regular Service Perimeter contains resources, access levels, and
  44. // restricted services. Every resource can be in at most ONE
  45. // regular Service Perimeter.
  46. //
  47. // In addition to being in a regular service perimeter, a resource can also
  48. // be in zero or more perimeter bridges. A perimeter bridge only contains
  49. // resources. Cross project operations are permitted if all effected
  50. // resources share some perimeter (whether bridge or regular). Perimeter
  51. // Bridge does not contain access levels or services: those are governed
  52. // entirely by the regular perimeter that resource is in.
  53. //
  54. // Perimeter Bridges are typically useful when building more complex toplogies
  55. // with many independent perimeters that need to share some data with a common
  56. // perimeter, but should not be able to share data among themselves.
  57. enum PerimeterType {
  58. // Regular Perimeter.
  59. PERIMETER_TYPE_REGULAR = 0;
  60. // Perimeter Bridge.
  61. PERIMETER_TYPE_BRIDGE = 1;
  62. }
  63. // Required. Resource name for the ServicePerimeter. The `short_name`
  64. // component must begin with a letter and only include alphanumeric and '_'.
  65. // Format:
  66. // `accessPolicies/{access_policy}/servicePerimeters/{service_perimeter}`
  67. string name = 1;
  68. // Human readable title. Must be unique within the Policy.
  69. string title = 2;
  70. // Description of the `ServicePerimeter` and its use. Does not affect
  71. // behavior.
  72. string description = 3;
  73. // Output only. Time the `ServicePerimeter` was created in UTC.
  74. google.protobuf.Timestamp create_time = 4;
  75. // Output only. Time the `ServicePerimeter` was updated in UTC.
  76. google.protobuf.Timestamp update_time = 5;
  77. // Perimeter type indicator. A single project is
  78. // allowed to be a member of single regular perimeter, but multiple service
  79. // perimeter bridges. A project cannot be a included in a perimeter bridge
  80. // without being included in regular perimeter. For perimeter bridges,
  81. // the restricted service list as well as access level lists must be
  82. // empty.
  83. PerimeterType perimeter_type = 6;
  84. // Current ServicePerimeter configuration. Specifies sets of resources,
  85. // restricted services and access levels that determine perimeter
  86. // content and boundaries.
  87. ServicePerimeterConfig status = 7;
  88. // Proposed (or dry run) ServicePerimeter configuration. This configuration
  89. // allows to specify and test ServicePerimeter configuration without enforcing
  90. // actual access restrictions. Only allowed to be set when the
  91. // "use_explicit_dry_run_spec" flag is set.
  92. ServicePerimeterConfig spec = 8;
  93. // Use explicit dry run spec flag. Ordinarily, a dry-run spec implicitly
  94. // exists for all Service Perimeters, and that spec is identical to the
  95. // status for those Service Perimeters. When this flag is set, it inhibits the
  96. // generation of the implicit spec, thereby allowing the user to explicitly
  97. // provide a configuration ("spec") to use in a dry-run version of the Service
  98. // Perimeter. This allows the user to test changes to the enforced config
  99. // ("status") without actually enforcing them. This testing is done through
  100. // analyzing the differences between currently enforced and suggested
  101. // restrictions. use_explicit_dry_run_spec must bet set to True if any of the
  102. // fields in the spec are set to non-default values.
  103. bool use_explicit_dry_run_spec = 9;
  104. }
  105. // `ServicePerimeterConfig` specifies a set of Google Cloud resources that
  106. // describe specific Service Perimeter configuration.
  107. message ServicePerimeterConfig {
  108. // Specifies how APIs are allowed to communicate within the Service
  109. // Perimeter.
  110. message VpcAccessibleServices {
  111. // Whether to restrict API calls within the Service Perimeter to the list of
  112. // APIs specified in 'allowed_services'.
  113. bool enable_restriction = 1;
  114. // The list of APIs usable within the Service Perimeter. Must be empty
  115. // unless 'enable_restriction' is True. You can specify a list of individual
  116. // services, as well as include the 'RESTRICTED-SERVICES' value, which
  117. // automatically includes all of the services protected by the perimeter.
  118. repeated string allowed_services = 2;
  119. }
  120. // An allowed method or permission of a service specified in [ApiOperation]
  121. // [google.identity.accesscontextmanager.v1.ServicePerimeterConfig.ApiOperation].
  122. message MethodSelector {
  123. // The API method name or Cloud IAM permission name to allow.
  124. oneof kind {
  125. // Value for `method` should be a valid method name for the corresponding
  126. // `service_name` in [ApiOperation]
  127. // [google.identity.accesscontextmanager.v1.ServicePerimeterConfig.ApiOperation].
  128. // If `*` used as value for `method`, then ALL methods and permissions are
  129. // allowed.
  130. string method = 1;
  131. // Value for `permission` should be a valid Cloud IAM permission for the
  132. // corresponding `service_name` in [ApiOperation]
  133. // [google.identity.accesscontextmanager.v1.ServicePerimeterConfig.ApiOperation].
  134. string permission = 2;
  135. }
  136. }
  137. // Identification for an API Operation.
  138. message ApiOperation {
  139. // The name of the API whose methods or permissions the [IngressPolicy]
  140. // [google.identity.accesscontextmanager.v1.ServicePerimeterConfig.IngressPolicy]
  141. // or [EgressPolicy]
  142. // [google.identity.accesscontextmanager.v1.ServicePerimeterConfig.EgressPolicy]
  143. // want to allow. A single [ApiOperation]
  144. // [google.identity.accesscontextmanager.v1.ServicePerimeterConfig.ApiOperation]
  145. // with `service_name` field set to `*` will allow all methods AND
  146. // permissions for all services.
  147. string service_name = 1;
  148. // API methods or permissions to allow. Method or permission must belong to
  149. // the service specified by `service_name` field. A single [MethodSelector]
  150. // [google.identity.accesscontextmanager.v1.ServicePerimeterConfig.MethodSelector]
  151. // entry with `*` specified for the `method` field will allow all methods
  152. // AND permissions for the service specified in `service_name`.
  153. repeated MethodSelector method_selectors = 2;
  154. }
  155. // The source that [IngressPolicy]
  156. // [google.identity.accesscontextmanager.v1.ServicePerimeterConfig.IngressPolicy]
  157. // authorizes access from.
  158. message IngressSource {
  159. // Allowed ingress source. It can be one of [AccessLevel]
  160. // [google.identity.accesscontextmanager.v1.AccessLevel] or Google
  161. // Cloud resource.
  162. oneof source {
  163. // An [AccessLevel]
  164. // [google.identity.accesscontextmanager.v1.AccessLevel] resource
  165. // name that allow resources within the [ServicePerimeters]
  166. // [google.identity.accesscontextmanager.v1.ServicePerimeter] to be
  167. // accessed from the internet. [AccessLevels]
  168. // [google.identity.accesscontextmanager.v1.AccessLevel] listed must
  169. // be in the same policy as this [ServicePerimeter]
  170. // [google.identity.accesscontextmanager.v1.ServicePerimeter].
  171. // Referencing a nonexistent [AccessLevel]
  172. // [google.identity.accesscontextmanager.v1.AccessLevel] will cause
  173. // an error. If no [AccessLevel]
  174. // [google.identity.accesscontextmanager.v1.AccessLevel] names are
  175. // listed, resources within the perimeter can only be accessed via Google
  176. // Cloud calls with request origins within the perimeter. Example:
  177. // `accessPolicies/MY_POLICY/accessLevels/MY_LEVEL`. If a single `*` is
  178. // specified for `access_level`, then all [IngressSources]
  179. // [google.identity.accesscontextmanager.v1.ServicePerimeterConfig.IngressSource]
  180. // will be allowed.
  181. string access_level = 1;
  182. // A Google Cloud resource that is allowed to ingress the perimeter.
  183. // Requests from these resources will be allowed to access perimeter data.
  184. // Currently only projects are allowed.
  185. // Format: `projects/{project_number}`
  186. // The project may be in any Google Cloud organization, not just the
  187. // organization that the perimeter is defined in. `*` is not allowed, the
  188. // case of allowing all Google Cloud resources only is not supported.
  189. string resource = 2;
  190. }
  191. }
  192. // Defines the conditions under which an [EgressPolicy]
  193. // [google.identity.accesscontextmanager.v1.ServicePerimeterConfig.EgressPolicy]
  194. // matches a request. Conditions are based on information about the
  195. // [ApiOperation]
  196. // [google.identity.accesscontextmanager.v1.ServicePerimeterConfig.ApiOperation]
  197. // intended to be performed on the `resources` specified. Note that if the
  198. // destination of the request is also protected by a [ServicePerimeter]
  199. // [google.identity.accesscontextmanager.v1.ServicePerimeter], then that
  200. // [ServicePerimeter]
  201. // [google.identity.accesscontextmanager.v1.ServicePerimeter] must have
  202. // an [IngressPolicy]
  203. // [google.identity.accesscontextmanager.v1.ServicePerimeterConfig.IngressPolicy]
  204. // which allows access in order for this request to succeed. The request must
  205. // match `operations` AND `resources` fields in order to be allowed egress out
  206. // of the perimeter.
  207. message EgressTo {
  208. // A list of resources, currently only projects in the form
  209. // `projects/<projectnumber>`, that are allowed to be accessed by sources
  210. // defined in the corresponding [EgressFrom]
  211. // [google.identity.accesscontextmanager.v1.ServicePerimeterConfig.EgressFrom].
  212. // A request matches if it contains a resource in this list. If `*` is
  213. // specified for `resources`, then this [EgressTo]
  214. // [google.identity.accesscontextmanager.v1.ServicePerimeterConfig.EgressTo]
  215. // rule will authorize access to all resources outside the perimeter.
  216. repeated string resources = 1;
  217. // A list of [ApiOperations]
  218. // [google.identity.accesscontextmanager.v1.ServicePerimeterConfig.ApiOperation]
  219. // allowed to be performed by the sources specified in the corresponding
  220. // [EgressFrom]
  221. // [google.identity.accesscontextmanager.v1.ServicePerimeterConfig.EgressFrom].
  222. // A request matches if it uses an operation/service in this list.
  223. repeated ApiOperation operations = 2;
  224. }
  225. // Defines the conditions under which an [IngressPolicy]
  226. // [google.identity.accesscontextmanager.v1.ServicePerimeterConfig.IngressPolicy]
  227. // matches a request. Conditions are based on information about the source of
  228. // the request. The request must satisfy what is defined in `sources` AND
  229. // identity related fields in order to match.
  230. message IngressFrom {
  231. // Sources that this [IngressPolicy]
  232. // [google.identity.accesscontextmanager.v1.ServicePerimeterConfig.IngressPolicy]
  233. // authorizes access from.
  234. repeated IngressSource sources = 1;
  235. // A list of identities that are allowed access through this ingress
  236. // policy. Should be in the format of email address. The email address
  237. // should represent individual user or service account only.
  238. repeated string identities = 2;
  239. // Specifies the type of identities that are allowed access from outside the
  240. // perimeter. If left unspecified, then members of `identities` field will
  241. // be allowed access.
  242. IdentityType identity_type = 3;
  243. }
  244. // Defines the conditions under which an [IngressPolicy]
  245. // [google.identity.accesscontextmanager.v1.ServicePerimeterConfig.IngressPolicy]
  246. // matches a request. Conditions are based on information about the
  247. // [ApiOperation]
  248. // [google.identity.accesscontextmanager.v1.ServicePerimeterConfig.ApiOperation]
  249. // intended to be performed on the target resource of the request. The request
  250. // must satisfy what is defined in `operations` AND `resources` in order to
  251. // match.
  252. message IngressTo {
  253. // A list of [ApiOperations]
  254. // [google.identity.accesscontextmanager.v1.ServicePerimeterConfig.ApiOperation]
  255. // allowed to be performed by the sources specified in corresponding
  256. // [IngressFrom]
  257. // [google.identity.accesscontextmanager.v1.ServicePerimeterConfig.IngressFrom]
  258. // in this [ServicePerimeter]
  259. // [google.identity.accesscontextmanager.v1.ServicePerimeter].
  260. repeated ApiOperation operations = 1;
  261. // A list of resources, currently only projects in the form
  262. // `projects/<projectnumber>`, protected by this [ServicePerimeter]
  263. // [google.identity.accesscontextmanager.v1.ServicePerimeter] that are
  264. // allowed to be accessed by sources defined in the corresponding
  265. // [IngressFrom]
  266. // [google.identity.accesscontextmanager.v1.ServicePerimeterConfig.IngressFrom].
  267. // If a single `*` is specified, then access to all resources inside the
  268. // perimeter are allowed.
  269. repeated string resources = 2;
  270. }
  271. // Policy for ingress into [ServicePerimeter]
  272. // [google.identity.accesscontextmanager.v1.ServicePerimeter].
  273. //
  274. // [IngressPolicies]
  275. // [google.identity.accesscontextmanager.v1.ServicePerimeterConfig.IngressPolicy]
  276. // match requests based on `ingress_from` and `ingress_to` stanzas. For an
  277. // ingress policy to match, both the `ingress_from` and `ingress_to` stanzas
  278. // must be matched. If an [IngressPolicy]
  279. // [google.identity.accesscontextmanager.v1.ServicePerimeterConfig.IngressPolicy]
  280. // matches a request, the request is allowed through the perimeter boundary
  281. // from outside the perimeter.
  282. //
  283. // For example, access from the internet can be allowed either
  284. // based on an [AccessLevel]
  285. // [google.identity.accesscontextmanager.v1.AccessLevel] or, for traffic
  286. // hosted on Google Cloud, the project of the source network. For access from
  287. // private networks, using the project of the hosting network is required.
  288. //
  289. // Individual ingress policies can be limited by restricting which
  290. // services and/or actions they match using the `ingress_to` field.
  291. message IngressPolicy {
  292. // Defines the conditions on the source of a request causing this
  293. // [IngressPolicy]
  294. // [google.identity.accesscontextmanager.v1.ServicePerimeterConfig.IngressPolicy]
  295. // to apply.
  296. IngressFrom ingress_from = 1;
  297. // Defines the conditions on the [ApiOperation]
  298. // [google.identity.accesscontextmanager.v1.ServicePerimeterConfig.ApiOperation]
  299. // and request destination that cause this [IngressPolicy]
  300. // [google.identity.accesscontextmanager.v1.ServicePerimeterConfig.IngressPolicy]
  301. // to apply.
  302. IngressTo ingress_to = 2;
  303. }
  304. // Policy for egress from perimeter.
  305. //
  306. // [EgressPolicies]
  307. // [google.identity.accesscontextmanager.v1.ServicePerimeterConfig.EgressPolicy]
  308. // match requests based on `egress_from` and `egress_to` stanzas. For an
  309. // [EgressPolicy]
  310. // [google.identity.accesscontextmanager.v1.ServicePerimeterConfig.EgressPolicy]
  311. // to match, both `egress_from` and `egress_to` stanzas must be matched. If an
  312. // [EgressPolicy]
  313. // [google.identity.accesscontextmanager.v1.ServicePerimeterConfig.EgressPolicy]
  314. // matches a request, the request is allowed to span the [ServicePerimeter]
  315. // [google.identity.accesscontextmanager.v1.ServicePerimeter] boundary.
  316. // For example, an [EgressPolicy]
  317. // [google.identity.accesscontextmanager.v1.ServicePerimeterConfig.EgressPolicy]
  318. // can be used to allow VMs on networks within the [ServicePerimeter]
  319. // [google.identity.accesscontextmanager.v1.ServicePerimeter] to access a
  320. // defined set of projects outside the perimeter in certain contexts (e.g. to
  321. // read data from a Cloud Storage bucket or query against a BigQuery dataset).
  322. //
  323. // [EgressPolicies]
  324. // [google.identity.accesscontextmanager.v1.ServicePerimeterConfig.EgressPolicy]
  325. // are concerned with the *resources* that a request relates as well as the
  326. // API services and API actions being used. They do not related to the
  327. // direction of data movement. More detailed documentation for this concept
  328. // can be found in the descriptions of [EgressFrom]
  329. // [google.identity.accesscontextmanager.v1.ServicePerimeterConfig.EgressFrom]
  330. // and [EgressTo]
  331. // [google.identity.accesscontextmanager.v1.ServicePerimeterConfig.EgressTo].
  332. message EgressPolicy {
  333. // Defines conditions on the source of a request causing this [EgressPolicy]
  334. // [google.identity.accesscontextmanager.v1.ServicePerimeterConfig.EgressPolicy]
  335. // to apply.
  336. EgressFrom egress_from = 1;
  337. // Defines the conditions on the [ApiOperation]
  338. // [google.identity.accesscontextmanager.v1.ServicePerimeterConfig.ApiOperation]
  339. // and destination resources that cause this [EgressPolicy]
  340. // [google.identity.accesscontextmanager.v1.ServicePerimeterConfig.EgressPolicy]
  341. // to apply.
  342. EgressTo egress_to = 2;
  343. }
  344. // Defines the conditions under which an [EgressPolicy]
  345. // [google.identity.accesscontextmanager.v1.ServicePerimeterConfig.EgressPolicy]
  346. // matches a request. Conditions based on information about the source of the
  347. // request. Note that if the destination of the request is also protected by a
  348. // [ServicePerimeter]
  349. // [google.identity.accesscontextmanager.v1.ServicePerimeter], then that
  350. // [ServicePerimeter]
  351. // [google.identity.accesscontextmanager.v1.ServicePerimeter] must have
  352. // an [IngressPolicy]
  353. // [google.identity.accesscontextmanager.v1.ServicePerimeterConfig.IngressPolicy]
  354. // which allows access in order for this request to succeed.
  355. message EgressFrom {
  356. // A list of identities that are allowed access through this [EgressPolicy].
  357. // Should be in the format of email address. The email address should
  358. // represent individual user or service account only.
  359. repeated string identities = 1;
  360. // Specifies the type of identities that are allowed access to outside the
  361. // perimeter. If left unspecified, then members of `identities` field will
  362. // be allowed access.
  363. IdentityType identity_type = 2;
  364. }
  365. // Specifies the types of identities that are allowed access in either
  366. // [IngressFrom]
  367. // [google.identity.accesscontextmanager.v1.ServicePerimeterConfig.IngressFrom]
  368. // or [EgressFrom]
  369. // [google.identity.accesscontextmanager.v1.ServicePerimeterConfig.EgressFrom]
  370. // rules.
  371. enum IdentityType {
  372. // No blanket identity group specified.
  373. IDENTITY_TYPE_UNSPECIFIED = 0;
  374. // Authorize access from all identities outside the perimeter.
  375. ANY_IDENTITY = 1;
  376. // Authorize access from all human users outside the perimeter.
  377. ANY_USER_ACCOUNT = 2;
  378. // Authorize access from all service accounts outside the perimeter.
  379. ANY_SERVICE_ACCOUNT = 3;
  380. }
  381. // A list of Google Cloud resources that are inside of the service perimeter.
  382. // Currently only projects are allowed. Format: `projects/{project_number}`
  383. repeated string resources = 1;
  384. // A list of `AccessLevel` resource names that allow resources within the
  385. // `ServicePerimeter` to be accessed from the internet. `AccessLevels` listed
  386. // must be in the same policy as this `ServicePerimeter`. Referencing a
  387. // nonexistent `AccessLevel` is a syntax error. If no `AccessLevel` names are
  388. // listed, resources within the perimeter can only be accessed via Google
  389. // Cloud calls with request origins within the perimeter. Example:
  390. // `"accessPolicies/MY_POLICY/accessLevels/MY_LEVEL"`.
  391. // For Service Perimeter Bridge, must be empty.
  392. repeated string access_levels = 2;
  393. // Google Cloud services that are subject to the Service Perimeter
  394. // restrictions. For example, if `storage.googleapis.com` is specified, access
  395. // to the storage buckets inside the perimeter must meet the perimeter's
  396. // access restrictions.
  397. repeated string restricted_services = 4;
  398. // Configuration for APIs allowed within Perimeter.
  399. VpcAccessibleServices vpc_accessible_services = 10;
  400. // List of [IngressPolicies]
  401. // [google.identity.accesscontextmanager.v1.ServicePerimeterConfig.IngressPolicy]
  402. // to apply to the perimeter. A perimeter may have multiple [IngressPolicies]
  403. // [google.identity.accesscontextmanager.v1.ServicePerimeterConfig.IngressPolicy],
  404. // each of which is evaluated separately. Access is granted if any [Ingress
  405. // Policy]
  406. // [google.identity.accesscontextmanager.v1.ServicePerimeterConfig.IngressPolicy]
  407. // grants it. Must be empty for a perimeter bridge.
  408. repeated IngressPolicy ingress_policies = 8;
  409. // List of [EgressPolicies]
  410. // [google.identity.accesscontextmanager.v1.ServicePerimeterConfig.EgressPolicy]
  411. // to apply to the perimeter. A perimeter may have multiple [EgressPolicies]
  412. // [google.identity.accesscontextmanager.v1.ServicePerimeterConfig.EgressPolicy],
  413. // each of which is evaluated separately. Access is granted if any
  414. // [EgressPolicy]
  415. // [google.identity.accesscontextmanager.v1.ServicePerimeterConfig.EgressPolicy]
  416. // grants it. Must be empty for a perimeter bridge.
  417. repeated EgressPolicy egress_policies = 9;
  418. }