diff --git a/administration/cloud_capture/aws.md b/administration/cloud_capture/aws.md
new file mode 100644
index 0000000..e04e1f2
--- /dev/null
+++ b/administration/cloud_capture/aws.md
@@ -0,0 +1,384 @@
+---
+title: "Cloud Capture on AWS"
+sidebarTitle: "AWS"
+description: "Set up Cloud Capture for your AWS accounts, choose which ECS clusters, Lambda functions, and S3 buckets it snapshots, and review the permissions it uses."
+tag: "BETA"
+---
+
+
+Cloud Capture is still in active development. Its capabilities and configuration format may change, and onboarding is done together with Kosli's Customer Success team.
+
+
+Cloud Capture snapshots the Amazon ECS clusters and AWS Lambda functions in the AWS accounts you register, and the Amazon S3 buckets you opt in. This page covers setting it up, choosing what it captures, and the permissions it uses.
+
+## Set up
+
+
+
+ In order for Cloud Capture to reach into your AWS cloud, to discover your ECS clusters, Lambdas, and S3 buckets, you need to grant permission to Kosli to do so. This requires the creation of an IAM role that Kosli can assume; the role will exist within your AWS account.
+
+ To simplify this process, Kosli has created a CloudFormation template that contains a role with the minimum set of permissions needed by Cloud Capture. The role can be assumed by Kosli and is protected by an external Id; each organization within Kosli has its own external Id. The CloudFormation template can be downloaded from the Settings page for your organization within the Kosli UI.
+
+ If you would rather create the role yourself, see [Permissions and security](#permissions-and-security) for the trust policy and the full set of permissions the role needs.
+
+ The CloudFormation template can be deployed within an AWS account, or can be attached to an AWS Organizational Unit (OU) as a StackSet; this latter option ensures the correct IAM permissions are rolled out to all AWS accounts within the OU.
+
+ The template's **S3 buckets** parameter is empty by default, and the role can then read no object in any bucket. Leave it empty unless you want S3 buckets snapshotted; see [Capturing S3 buckets](#capturing-s3-buckets).
+
+
+ When you have created the IAM role, using the CloudFormation template, you can activate Cloud Capture within the Kosli user-interface.
+
+ To check environment names, or to exclude resources, before any snapshots are recorded, switch on [Dry run](/administration/cloud_capture/getting_started#dry-run) and add [skip tags](#excluding-resources) now, before you register accounts.
+
+ Kosli is not notified when you create or delete the stack, so you then register each account yourself. Accounts can only be registered while Cloud Capture is enabled. Open your organization's **Settings**, go to **Cloud Capture**, open **AWS**, select **Register account**, and enter the ARN of the role the stack created. Choose the services to scan in the account: ECS and Lambda are selected for a new account, and S3 is not, because it needs the extra steps in [Capturing S3 buckets](#capturing-s3-buckets). If you deploy the template as a StackSet, register every account in the OU, including accounts that join it later. If you delete a stack, also remove its account from the **Registered accounts** table; until you do, scans of that account fail because the role no longer exists.
+
+ Cloud Capture scans every five minutes unless you [choose another frequency](/administration/cloud_capture/getting_started#scan-frequency), and picks up a registered account the next time it runs - you should see environments and snapshots appearing within a few minutes.
+
+
+
+## Excluding resources
+
+If there are resources you do not want Cloud Capture to snapshot, such as a test cluster or a service a vendor runs in your account, exclude them by tag. You choose the tags: in your organization's **Settings**, go to **Cloud Capture**, open **AWS**, and edit the AWS defaults. The **Skip tags** panel there takes any number of key and value pairs, and Cloud Capture skips every resource that carries one of them.
+
+1. Tag the resource in AWS, with any key and value you like. For example, to tag an ECS cluster and a Lambda function with `kosli-capture=false`:
+
+ ```bash
+ aws ecs tag-resource \
+ --resource-arn arn:aws:ecs:eu-west-1:123456789012:cluster/sandbox \
+ --tags key=kosli-capture,value=false
+
+ aws lambda tag-resource \
+ --resource arn:aws:lambda:eu-west-1:123456789012:function:scratch \
+ --tags kosli-capture=false
+ ```
+
+2. In the **Skip tags** panel, enter the key `kosli-capture` and the value `false`, select **Add**, then **Save**.
+
+How the tags are matched:
+
+- A resource is skipped when any one of its tags equals any one of the skip tags, key and value both, exactly as AWS stores them. Tags are case-sensitive, so `Env=test` does not match `env=test`. A key on its own does not match: to skip both `env=test` and `env=staging`, add both.
+- The tag is read on the resource Cloud Capture snapshots. An ECS cluster is skipped with everything in it, its services and tasks included; tags on a service or a task definition are not read. A Lambda function is skipped on its own, and the region's Lambda environment in Kosli is made up of the functions that remain. An S3 bucket is only ever snapshotted when it carries an [S3 opt-in tag](#capturing-s3-buckets); a bucket that carries an opt-in tag and a skip tag is skipped.
+- The change takes effect on the next scan. A Kosli environment that was already being captured keeps its last snapshot and receives no new ones; nothing is deleted. Remove the skip tag from the resource, and the next run picks it up again.
+- Skip tags, like the other Cloud Capture settings, can only be changed while Cloud Capture is enabled.
+- The IAM role created by the CloudFormation template already grants the permissions needed to read tags, `ecs:DescribeClusters` and `lambda:ListTags`, so no change to the role is needed.
+
+Through the API, the tags are the `aws` list of `skip_tags`; see [Using the API](/administration/cloud_capture/getting_started#using-the-api).
+
+## Capturing S3 buckets
+
+Cloud Capture reports the content of an S3 bucket as one artifact, whose fingerprint is calculated from the SHA256 checksums S3 stores for the bucket's objects. No object is downloaded, with one exception: a `.kosli_ignore` file at the root of the bucket, if there is one, which lists keys to leave out.
+
+S3 is opt-in, bucket by bucket. An account usually holds many buckets you would not want reported, such as CloudTrail and load balancer access logs, and a snapshot makes one request to AWS for every object in the bucket on every scan, which AWS bills to your account. So a bucket is snapshotted only when all of the following are true.
+
+
+
+ Deploy version `v0.2.0` or later of the CloudFormation template, or update your existing stack to it, and list the buckets in its **S3 buckets** parameter (`S3BucketNames`): a comma-separated list of bucket names in lowercase, with no spaces. A name may use `*` and `?` as wildcards, for example `acme-releases-*`.
+
+ This is the permission. The role can list and read objects in the buckets you name and in no others. See [What capturing S3 buckets grants](#what-capturing-s3-buckets-grants) for exactly what it grants.
+
+
+ In your organization's **Settings**, go to **Cloud Capture**, open **AWS**, and edit the AWS defaults. In the **S3 opt-in tags** panel, beneath **Skip tags**, add a key and a value, for example `kosli-capture-s3` and `true`, and save.
+
+ Until you set an opt-in tag, no bucket is captured.
+
+
+ ```bash
+ aws s3api put-bucket-tagging \
+ --bucket acme-releases \
+ --tagging 'TagSet=[{Key=kosli-capture-s3,Value=true}]'
+ ```
+
+ `put-bucket-tagging` replaces all of a bucket's tags, so include the tags the bucket already carries. Key and value must both match the opt-in tag exactly; tags are case-sensitive.
+
+
+ In the **Registered accounts** table, edit the account and select **s3** among its services.
+
+
+
+What to expect:
+
+- **Each bucket is its own environment**, of type S3, named by your [environment name template](/administration/cloud_capture/getting_started#environment-names) with the bucket name as `{resource}`.
+- **Each bucket reports exactly one artifact, named after the bucket.** A bucket holding several objects is fingerprinted as a directory, and a bucket holding a single object is fingerprinted as that file, so attest that file with `--artifact-type file` for the fingerprints to match. Either way the artifact carries the bucket's name, not the object's.
+- **An empty bucket is captured, not failed.** It reports one artifact, named after the bucket, with the fingerprint of an empty directory: `e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855`. Every empty bucket therefore shares that fingerprint. It is also the fingerprint of an empty file, so an empty bucket matches any artifact attested from one.
+- **A bucket needs both the tag and the permission.** A bucket that carries the opt-in tag but is not named in the stack fails its snapshot on every scan, with an access denied error. A bucket that is named in the stack but not tagged is left alone.
+- **Skipping wins.** A bucket that carries an opt-in tag and a [skip tag](#excluding-resources) is not captured.
+- **Only objects with a SHA256 checksum are fingerprinted.** S3 stores a full-object SHA256 checksum only when the upload asks for one, for example with `aws s3api put-object --checksum-algorithm SHA256`. An object without one, or one uploaded in several parts, is left out of the fingerprint, as if the bucket did not hold it. The fingerprint therefore matches an artifact you attested from the bucket's whole content only once every object carries the checksum, and a bucket where no object does is reported as an empty bucket.
+- **Buckets encrypted with a KMS key are not supported.** The role is granted no KMS permission, so a bucket whose objects use SSE-KMS fails its snapshot. S3's default encryption, SSE-S3, needs nothing more.
+- **Large buckets cost more and can time out.** A snapshot is one request per object, on every scan. At the default five minute frequency, a bucket of 100,000 objects is about 29 million requests a day. A bucket of more than roughly 100,000 objects may not finish in the time a snapshot is given, and then fails. Consider a longer [scan frequency](/administration/cloud_capture/getting_started#scan-frequency) if you capture large buckets; it applies to everything Cloud Capture scans for you.
+- **A newly tagged bucket is picked up on a later scan**, once AWS reports the tag. Removing the tag, or the opt-in tag from your settings, stops new snapshots; the environment keeps its last snapshot and nothing is deleted.
+
+Through the API, the tags are `opt_in_tags` on the [settings resource](/administration/cloud_capture/getting_started#using-the-api), with the same shape as `skip_tags`. The settings PUT replaces every setting, so a PUT that leaves `opt_in_tags` out removes them, and your buckets stop being captured.
+
+## Permissions and security
+
+For the model that is common to every cloud, see [Cloud Capture security](/administration/cloud_capture/security).
+
+Kosli publishes a CloudFormation template, for use in AWS, showing the permissions needed. The template is publicly accessible and can be used directly within an `aws cloudformation create-stack` call. The [current version](https://kosli-cloud-capture-templates.s3.eu-central-1.amazonaws.com/aws/v0.2.0/kosli-cloud-capture-access-role.yaml), `v0.2.0`, is published at `https://kosli-cloud-capture-templates.s3.eu-central-1.amazonaws.com/aws/v0.2.0/kosli-cloud-capture-access-role.yaml`, and the permissions shown on this page are taken from it. A published version is never changed; a change to the permissions is a new version, and reaches a role you have deployed only when you update your stack.
+
+Version `v0.2.0` adds one optional parameter to the earlier template, **S3 buckets** (`S3BucketNames`), for [capturing S3 buckets](#capturing-s3-buckets). Left empty, the default, the role is the same as the one the earlier template created: it can read no object and no object key in any bucket. A role created from the earlier template keeps working for ECS and Lambda.
+
+If you wish to build an IAM role for Cloud Capture without using our published CloudFormation template, the permissions needed are those shown below. The role must contain an Assume Role policy that allows the Kosli account to access the resources, and must include an externalId. Both of these values are supplied by Kosli and cannot be derived; you cannot construct the trust policy without them. Whichever way you create the role, then register the account with the role's ARN, as described in [Set up](#set-up).
+
+### Assume role
+
+The IAM role defined within the CloudFormation template includes an "assume role" policy granting permission from Kosli. This appears as:
+
+```yaml
+ KosliCloudCaptureAccessRole:
+ Type: AWS::IAM::Role
+ Properties:
+ RoleName: !Ref RoleName
+ Description: >-
+ Read-only access for Kosli Cloud Capture evidence collection.
+ Managed by CloudFormation; do not edit in place.
+ MaxSessionDuration: 3600
+ AssumeRolePolicyDocument:
+ Version: "2012-10-17"
+ Statement:
+ - Sid: AllowKosliToAssumeWithExternalId
+ Effect: Allow
+ Principal:
+ AWS: !Ref TrustedPrincipalArn
+ Action: sts:AssumeRole
+ Condition:
+ StringEquals:
+ sts:ExternalId: !Ref ExternalId
+```
+
+### All permissions needed
+
+The IAM role defined within the Cloudformation template includes a number of IAM policy statements, granting read-only access to some AWS APIs. In summary:
+
+- **ECS and Lambda**: read-only inventory calls on every cluster and function. None returns application data, and downloading a function's or a layer's code is explicitly denied.
+- **S3**: bucket-level metadata for every bucket. Object keys and objects can be read only in the buckets you name, and not at all when you name none; see [What capturing S3 buckets grants](#what-capturing-s3-buckets-grants).
+
+The statements in full, with the template's own comments:
+
+
+
+```yaml
+Statement:
+
+ # How Cloud Capture finds what to snapshot. Discovery lists the ECS
+ # clusters in the account and reads each cluster's tags from the
+ # same DescribeClusters call; a cluster carrying the exclusion
+ # tag is skipped and everything else is snapshotted. Without
+ # ListClusters and DescribeClusters a role created from this
+ # template cannot run discovery at all.
+ #
+ # Worth knowing for a security review: these are inventory calls
+ # and none of them returns application data. DescribeTaskDefinition
+ # is the widest - a task definition holds the container image, the
+ # command, and any environment variables written into the
+ # definition itself in plain text. Values injected from Secrets
+ # Manager or Parameter Store are named there rather than resolved,
+ # so what comes back is the reference and not the secret.
+ - Sid: EcsInventory
+ Effect: Allow
+ Action:
+ - ecs:DescribeCapacityProviders
+ - ecs:DescribeClusters
+ - ecs:DescribeContainerInstances
+ - ecs:DescribeServices
+ - ecs:DescribeTaskDefinition
+ - ecs:DescribeTasks
+ - ecs:ListClusters
+ - ecs:ListContainerInstances
+ - ecs:ListServices
+ - ecs:ListTagsForResource
+ - ecs:ListTaskDefinitionFamilies
+ - ecs:ListTaskDefinitions
+ - ecs:ListTasks
+ Resource: "*"
+
+ # Lambda is the next snapshot target after ECS. Granted here so
+ # that adding it needs no change to a role you have already
+ # reviewed and deployed; read-only, like everything above.
+ - Sid: LambdaInventory
+ Effect: Allow
+ Action:
+ - lambda:GetFunctionConfiguration
+ - lambda:GetPolicy
+ - lambda:ListAliases
+ - lambda:ListFunctions
+ - lambda:ListTags
+ - lambda:ListVersionsByFunction
+ Resource: "*"
+
+ # Which buckets exist in a region, and bucket-level metadata,
+ # for every bucket; no object key and no object. Cloud Capture
+ # lists the buckets of a region to confirm the ones the tagging
+ # API named (see S3FindBucketsByTag below) are there.
+ - Sid: S3BucketMetadataOnly
+ Effect: Allow
+ Action:
+ - s3:GetBucketLocation
+ - s3:GetBucketLogging
+ - s3:GetBucketPolicyStatus
+ - s3:GetBucketPublicAccessBlock
+ - s3:GetBucketTagging
+ - s3:GetBucketVersioning
+ - s3:GetEncryptionConfiguration
+ - s3:ListAllMyBuckets
+ Resource: "*"
+
+ # How Cloud Capture finds the buckets to snapshot; not granted
+ # when S3BucketNames is empty. A bucket is snapshotted only when
+ # it carries one of the S3 opt-in tags you set in Kosli, so
+ # Cloud Capture asks the Resource Groups Tagging API for the
+ # buckets carrying one, in place of reading the tags of every
+ # bucket in the account one by one on every scan.
+ #
+ # Worth knowing for a security review: AWS cannot scope this
+ # permission to S3 or to particular resources. It lets the role
+ # read the tag keys and values of every taggable resource in
+ # the account, whatever its service. Cloud Capture asks for
+ # resources of type s3:bucket carrying your opt-in tags, and
+ # for nothing else. Tags are metadata, but if yours hold
+ # anything you would not show Kosli, leave S3BucketNames empty.
+ - !If
+ - SnapshotsS3Buckets
+ - Sid: S3FindBucketsByTag
+ Effect: Allow
+ Action:
+ - tag:GetResources
+ Resource: "*"
+ - !Ref AWS::NoValue
+
+ # What an S3 snapshot reads, in the buckets named in
+ # S3BucketNames and no others; neither statement exists when
+ # that parameter is empty. A snapshot records the fingerprint of
+ # a bucket's content: Cloud Capture lists the object keys, then
+ # reads the SHA256 checksum S3 stores for each object with a
+ # HeadObject request, which returns the object's metadata and no
+ # content.
+ #
+ # Worth knowing for a security review: AWS has no permission for
+ # reading an object's checksum alone. HeadObject is authorised by
+ # s3:GetObject, the permission that also authorises downloading
+ # the object, so this role is able to read the content of every
+ # object in the buckets you name. Cloud Capture downloads one
+ # object only, and only if it exists: a `.kosli_ignore` file at
+ # the root of the bucket, which lists the keys to leave out of
+ # the fingerprint. Name only the buckets you want snapshotted.
+ #
+ # No KMS permission is granted, so objects encrypted with a KMS
+ # key (SSE-KMS) cannot be read and their bucket's snapshot
+ # fails. Objects under S3's default encryption (SSE-S3) need
+ # nothing more than this.
+ #
+ # The ARNs are built from the list by joining it: for
+ # `a,b` the first is arn:aws:s3:::a and arn:aws:s3:::b, and the
+ # second arn:aws:s3:::a/* and arn:aws:s3:::b/*.
+ - !If
+ - SnapshotsS3Buckets
+ - Sid: S3ListObjectKeysInNamedBuckets
+ Effect: Allow
+ Action:
+ - s3:ListBucket
+ Resource: !Split
+ - ","
+ - !Join
+ - ""
+ - - "arn:aws:s3:::"
+ - !Join [",arn:aws:s3:::", !Ref S3BucketNames]
+ - !Ref AWS::NoValue
+
+ - !If
+ - SnapshotsS3Buckets
+ - Sid: S3ReadObjectChecksumsInNamedBuckets
+ Effect: Allow
+ Action:
+ - s3:GetObject
+ Resource: !Split
+ - ","
+ - !Join
+ - ""
+ - - "arn:aws:s3:::"
+ - !Join ["/*,arn:aws:s3:::", !Ref S3BucketNames]
+ - "/*"
+ - !Ref AWS::NoValue
+
+ # The explicit denies below are redundant given the allow-list
+ # above, but they are here so that a security reviewer can
+ # verify the boundary without having to reason about IAM
+ # defaults, and so that any future widening of this policy cannot
+ # accidentally grant data-plane access.
+ #
+ # s3:GetObject is denied everywhere except in the buckets named
+ # in S3BucketNames, and everywhere when none is named.
+ - !If
+ - SnapshotsS3Buckets
+ - Sid: NeverReadObjectDataOutsideNamedBuckets
+ Effect: Deny
+ Action:
+ - s3:GetObject
+ NotResource: !Split
+ - ","
+ - !Join
+ - ""
+ - - "arn:aws:s3:::"
+ - !Join ["/*,arn:aws:s3:::", !Ref S3BucketNames]
+ - "/*"
+ - Sid: NeverReadObjectData
+ Effect: Deny
+ Action:
+ - s3:GetObject
+ Resource: "*"
+
+ # Every other way to read an object, its earlier versions, its
+ # ACL or its tags is denied in every bucket, named or not: a
+ # snapshot needs none of them.
+ - Sid: NeverReadObjectVersionsAclsOrTags
+ Effect: Deny
+ Action:
+ - s3:GetObjectAcl
+ - s3:GetObjectAttributes
+ - s3:GetObjectTagging
+ - s3:GetObjectTorrent
+ - s3:GetObjectVersion
+ - s3:GetObjectVersionAcl
+ - s3:GetObjectVersionAttributes
+ - s3:GetObjectVersionTagging
+ - s3:ListMultipartUploadParts
+ Resource: "*"
+
+ # lambda:GetFunction returns a pre-signed URL to the deployment
+ # package. That is source-code access, so it is denied outright.
+ # GetLayerVersion does the same for a layer's package, and it is
+ # also the IAM action behind the GetLayerVersionByArn API call,
+ # so both routes to a layer's code are denied here.
+ - Sid: NeverDownloadFunctionCode
+ Effect: Deny
+ Action:
+ - lambda:GetFunction
+ - lambda:GetLayerVersion
+ Resource: "*"
+```
+
+
+
+### What capturing S3 buckets grants
+
+The S3 statements above exist only when you name buckets in the **S3 buckets** parameter. Three things are worth knowing for a security review:
+
+- **The role can read the content of every object in the buckets you name.** Cloud Capture reads the SHA256 checksum S3 stores for each object with a `HeadObject` request, which returns metadata and no content. AWS has no permission for reading a checksum alone: `HeadObject` is authorized by `s3:GetObject`, the permission that also authorizes a download. Cloud Capture downloads one object only, a `.kosli_ignore` file at the root of a bucket if there is one. Reads of object versions, ACLs, tags, and attributes stay denied in every bucket, and `s3:GetObject` stays denied in every bucket you did not name.
+- **The role can read the tags of every taggable resource in the account.** Cloud Capture finds the buckets that carry one of your S3 opt-in tags by asking the Resource Groups Tagging API (`tag:GetResources`), which avoids reading the tags of every bucket one by one on every scan. AWS cannot scope that permission to S3 or to particular resources. Cloud Capture asks only for resources of type `s3:bucket` that carry an opt-in tag.
+- **No KMS permission is granted.** Objects encrypted with a KMS key (SSE-KMS) cannot be read, and their bucket's snapshot fails.
+
+A name in the parameter may use `*` and `?` as wildcards, as an IAM resource may. A bare `*` names every bucket in the account. Naming a bucket is a permission, not a selection: Cloud Capture snapshots a bucket only when it also carries one of your S3 opt-in tags.
+
+### Tenant isolation
+
+* A Cloud Capture worker picks up a job for your organization and assumes the role in your account
+ using your externalId. A worker running for a different tenant is unable to read the externalId
+ for your cloud account.
+* When the job finishes, the temporary credentials for your account are discarded. A worker holding
+ credentials for your cloud account has no path to anyone else's account.
+* The ExternalId lives in Kosli's Parameter Store and is readable only by the Kosli-side role for your
+ organization. The shared task role cannot read any tenant's ExternalId. Separation is enforced
+ by IAM, not by application code.
+
+The trust policy on the role in your account limits access to the AWS account in which the Cloud
+Capture is running. The ExternalId acts as a shared secret between Kosli and you, so that only
+Cloud Capture is permitted to assume the role.
diff --git a/administration/cloud_capture/azure.md b/administration/cloud_capture/azure.md
new file mode 100644
index 0000000..d53d789
--- /dev/null
+++ b/administration/cloud_capture/azure.md
@@ -0,0 +1,76 @@
+---
+title: "Cloud Capture on Azure"
+sidebarTitle: "Azure"
+description: "Set up Cloud Capture for your Azure subscriptions, choose which resource groups it snapshots, and review the access it uses."
+tag: "BETA"
+---
+
+
+Cloud Capture is still in active development. Its capabilities and configuration format may change, and onboarding is done together with Kosli's Customer Success team.
+
+
+Cloud Capture snapshots the running container-based web apps in Azure App Service, in the subscriptions you register. Azure support is in early access, so the Azure page appears in your Cloud Capture settings only once Kosli has enabled it for your organization.
+
+## Set up
+
+Nothing is deployed in Azure. Cloud Capture reads a subscription as a Kosli application registered in Microsoft Entra, which you consent to in your tenant and then grant read access on each subscription.
+
+
+
+ In your organization's **Settings**, go to **Cloud Capture**, open **Azure**, and select **Register account**. Follow the **Consent in Azure** link as a Global Administrator of your tenant. Consenting creates the application's service principal in your tenant; it has no access until you grant it some in the next step.
+
+
+ The registration form shows three Azure CLI commands with your values filled in. Run them as an owner of the subscription:
+
+ ```bash
+ az role assignment create --assignee "" --role Reader --scope "/subscriptions/"
+ az role assignment create --assignee "" --role AcrPull --scope "/subscriptions/"
+ az tag update --resource-id "/subscriptions/" --operation Merge --tags kosli-external-id=""
+ ```
+
+ `Reader` lets Cloud Capture list the App Service sites and read tags, and `AcrPull` lets it fingerprint their container images. The `kosli-external-id` tag is how Cloud Capture checks the subscription is yours to read: it refuses to list a subscription whose tag does not carry your organization's external ID.
+
+
+ Accounts can only be registered while Cloud Capture is enabled. When you have consented to the application, granted it access, and tagged the subscription, enter the **Tenant ID** and **Subscription ID** in the same registration form and save it. Register each subscription you want scanned.
+
+ Azure has no regions to choose: Cloud Capture scans the whole subscription and reports each resource group that holds running container-based web apps into its own environment.
+
+ Cloud Capture scans every five minutes unless you [choose another frequency](/administration/cloud_capture/getting_started#scan-frequency), and picks up a registered subscription the next time it runs - you should see environments and snapshots appearing within a few minutes.
+
+
+
+## Excluding resources
+
+Exclude resources by tagging the resource group that holds them. In your organization's **Settings**, go to **Cloud Capture**, open **Azure**, and add the tag to the **Skip tags** panel in the Azure defaults. Cloud Capture skips every resource group that carries one of the tags, with all of the web apps in it; tags on an individual web app are not read.
+
+Key and value must both match the resource group's tag exactly. Through the API, the tags are the `azure` list of `skip_tags`; see [Using the API](/administration/cloud_capture/getting_started#using-the-api).
+
+## Permissions and security
+
+For the model that is common to every cloud, see [Cloud Capture security](/administration/cloud_capture/security).
+
+Nothing is deployed in your Azure tenant. Kosli registers one multi-tenant application in Microsoft Entra, and Cloud Capture reads your subscription as that application. The application's credentials are Kosli's own and never leave Kosli. Access is granted in three steps, each of which you control:
+
+1. **Consent.** A Global Administrator of your tenant consents to the Kosli application, which creates its service principal in your tenant. Consent alone grants no access to any subscription.
+2. **Role assignments.** You assign the application two built-in roles on each subscription you want scanned:
+
+ | Role | What Cloud Capture uses it for |
+ |---|---|
+ | `Reader` | Listing the App Service sites in the subscription, and reading resource group tags and the subscription's own tags |
+ | `AcrPull` | Fingerprinting the container images of your web apps from your container registries |
+
+3. **A tag on the subscription.** You tag the subscription `kosli-external-id` with your organization's external ID. Cloud Capture refuses to list a subscription whose tag does not match the external ID of the organization it is working for.
+
+[Set up](#set-up) has the consent link and the command for each step.
+
+To withdraw access, remove the role assignments or the tag from the subscription, or delete the application's service principal from your tenant, and remove the subscription from your registered accounts in Kosli.
+
+### Tenant isolation
+
+* The Kosli application's credentials are held by Kosli and are not readable by the part of Cloud
+ Capture that plans work, only by the workers that carry it out.
+* Before a worker lists anything in a subscription, it reads the subscription's `kosli-external-id`
+ tag and compares it with the external ID of the organization the job is for. Only someone with
+ write access to your subscription can set that tag, so another Kosli tenant that registered your
+ subscription ID would be refused.
+* The application has access only to the subscriptions on which you assigned it a role.
diff --git a/administration/cloud_capture/getting_started.md b/administration/cloud_capture/getting_started.md
index 1b9a2a3..c52a3c8 100644
--- a/administration/cloud_capture/getting_started.md
+++ b/administration/cloud_capture/getting_started.md
@@ -1,7 +1,7 @@
---
-title: "Getting started with Cloud Capture"
-sidebarTitle: "Getting started"
-description: "Learn how to configure Cloud Capture for your organization"
+title: "Cloud Capture settings"
+sidebarTitle: "Settings"
+description: "Choose how often Cloud Capture scans, how it names the environments it reports into, and whether it runs as a dry run."
tag: "BETA"
---
@@ -9,246 +9,19 @@ tag: "BETA"
Cloud Capture is still in active development. Its capabilities and configuration format may change, and onboarding is done together with Kosli's Customer Success team.
-Cloud Capture is a managed service that runs on Kosli's infrastructure and connects to your cloud platform to observe the resources deployed there. To get set up with Cloud Capture you need to grant permissions to Kosli's cloud account and enable Cloud Capture within your Kosli org.
+These settings belong to your Kosli organization, so they apply to every cloud account Cloud Capture scans for you. Find them in your organization's **Settings**, under **Cloud Capture**.
-## Overview
-
-Getting started with Cloud Capture involves two steps. Each step has instructions for AWS, Azure and Google Cloud. Azure and Google Cloud are in early access, so their pages appear in your settings only once Kosli has enabled them for your organization.
-
-
-
-
-
- In order for Cloud Capture to reach into your AWS cloud, to discover your ECS clusters, Lambdas and S3 buckets, you need to grant permission to Kosli to do so. This requires the creation of an IAM role that Kosli can assume; the role will exist within your AWS account.
-
- To simplify this process, Kosli has created a CloudFormation template that contains a role with the minimum set of permissions needed by Cloud Capture. The role can be assumed by Kosli and is protected by an external Id; each organization within Kosli has its own external Id. The CloudFormation template can be downloaded from the Settings page for your organization within the Kosli UI.
-
- If you would rather create the role yourself, see [Cloud Capture Security](/administration/cloud_capture/security) for the trust policy and the full set of permissions the role needs.
-
- The CloudFormation template can be deployed within an AWS account, or can be attached to an AWS Organizational Unit (OU) as a StackSet; this latter option ensures the correct IAM permissions are rolled out to all AWS accounts within the OU.
-
- The template's **S3 buckets** parameter is empty by default, and the role can then read no object in any bucket. Leave it empty unless you want S3 buckets snapshotted; see [Capturing S3 buckets](#capturing-s3-buckets).
-
-
- Nothing is deployed in Azure. Cloud Capture reads a subscription as a Kosli application registered in Microsoft Entra, which you consent to in your tenant and then grant read access on each subscription.
-
-
-
- In your organization's **Settings**, go to **Cloud Capture**, open **Azure** and select **Register account**. Follow the **Consent in Azure** link as a Global Administrator of your tenant. Consenting creates the application's service principal in your tenant; it has no access until you grant it some in the next step.
-
-
- The registration form shows three Azure CLI commands with your values filled in. Run them as an owner of the subscription:
-
- ```bash
- az role assignment create --assignee "" --role Reader --scope "/subscriptions/"
- az role assignment create --assignee "" --role AcrPull --scope "/subscriptions/"
- az tag update --resource-id "/subscriptions/" --operation Merge --tags kosli-external-id=""
- ```
-
- `Reader` lets Cloud Capture list the App Service sites and read tags, and `AcrPull` lets it fingerprint their container images. The `kosli-external-id` tag is how Cloud Capture checks the subscription is yours to read: it refuses to list a subscription whose tag does not carry your organization's external ID.
-
-
-
-
- In order for Cloud Capture to reach into your Google Cloud project, to discover your Cloud Run services and jobs and your Google Kubernetes Engine (GKE) clusters, you need to grant permission to Kosli to do so. This requires a service account in your project that Cloud Capture can impersonate through workload identity federation; the service account, and the workload identity pool that guards it, exist within your own project.
-
- To simplify this process, Kosli has created a Terraform configuration that creates that service account, the read-only roles Cloud Capture needs, and a workload identity pool that accepts only the Kosli-side role created for your organization.
-
- If you would rather create these resources yourself, see [Cloud Capture Security](/administration/cloud_capture/security) for the service account, workload identity pool and roles that Cloud Capture needs.
-
-
-
- Infrastructure Manager reads a configuration from a local directory, so download the published file into an empty directory:
-
- ```bash
- mkdir kosli-capture && cd kosli-capture
- curl --fail --remote-name \
- https://kosli-cloud-capture-templates.s3.eu-central-1.amazonaws.com/gcp/v0.2.0/main.tf
- ```
-
- You also need two values from Kosli: the Kosli AWS account ID, and the name of the Kosli-side IAM role for your organization. The configuration isn't pre-filled with them. In your organization's **Settings**, go to **Cloud Capture**, open **Google Cloud** and select **Register account**; the first step of the form shows both.
-
-
- Deploy the configuration once in each project that holds Cloud Run services or jobs, or GKE clusters, you want Cloud Capture to snapshot. Run the following from the directory containing the configuration:
-
- ```bash
- gcloud infra-manager deployments apply \
- projects//locations//deployments/kosli-capture \
- --service-account=projects//serviceAccounts/@.iam.gserviceaccount.com \
- --local-source=. \
- --input-values=project_id=,kosli_aws_account_id=,kosli_role_name=
- ```
-
- Infrastructure Manager runs Terraform as the service account you name, so that service account needs permission to enable APIs and to create workload identity pools, service accounts, custom roles and project IAM bindings.
-
-
- Kosli needs two values to connect to your project. The configuration emits both as Terraform outputs:
-
- - `kosli_capture_provider`: the full resource name of the workload identity provider
- - `kosli_capture_service_account`: the email of the service account Cloud Capture impersonates
-
- You enter both when you register the project. You can read them at any time from the deployment's latest revision:
-
- ```bash
- gcloud infra-manager revisions describe \
- "$(gcloud infra-manager deployments describe \
- projects//locations//deployments/kosli-capture \
- --format='value(latestRevision)')" \
- --format='yaml(applyResults.outputs)'
- ```
-
-
-
-
-
-
-
-
- When you have created the IAM role, using the CloudFormation template, you can activate Cloud Capture within the Kosli user-interface.
-
- To check environment names, or to exclude resources, before any snapshots are recorded, switch on [Dry run](#dry-run) and add [skip tags](#excluding-resources) now, before you register accounts.
-
- Kosli is not notified when you create or delete the stack, so you then register each account yourself. Accounts can only be registered while Cloud Capture is enabled. Open your organization's **Settings**, go to **Cloud Capture**, open **AWS**, select **Register account**, and enter the ARN of the role the stack created. Choose the services to scan in the account: ECS and Lambda are selected for a new account, and S3 is not, because it needs the extra steps in [Capturing S3 buckets](#capturing-s3-buckets). If you deploy the template as a StackSet, register every account in the OU, including accounts that join it later. If you delete a stack, also remove its account from the **Registered accounts** table; until you do, scans of that account fail because the role no longer exists.
-
- Cloud Capture scans every five minutes unless you [choose another frequency](#scan-frequency), and picks up a registered account the next time it runs - you should see environments and snapshots appearing within a few minutes.
-
-
- Accounts can only be registered while Cloud Capture is enabled. When you have consented to the application, granted it access and tagged the subscription, enter the **Tenant ID** and **Subscription ID** in the same registration form and save it. Register each subscription you want scanned.
-
- Azure has no regions to choose: Cloud Capture scans the whole subscription and reports each resource group that holds running container-based web apps into its own environment.
-
- Cloud Capture scans every five minutes unless you [choose another frequency](#scan-frequency), and picks up a registered subscription the next time it runs - you should see environments and snapshots appearing within a few minutes.
-
-
- Accounts can only be registered while Cloud Capture is enabled. When you have deployed the configuration, continue the registration form: enter the project ID, the workload identity provider name and the service account email, and choose the regions and services to scan. Cloud Run is selected for a new project. GKE is not selected, so select it if you want clusters snapshotted.
-
- Cloud Capture never connects to a GKE cluster. It lists the project's clusters and reads their pods from Google's Cloud Asset Inventory, so a private cluster is snapshotted like any other and nothing is installed in it. Cloud Asset Inventory can be a few minutes behind a cluster, so a pod that lives for less time than that may never be seen.
-
- Cloud Capture scans every five minutes unless you [choose another frequency](#scan-frequency), and picks up a registered project the next time it runs - you should see environments and snapshots appearing within a few minutes.
-
-
-
-
-
-## Excluding resources
-
-
-
-
-If there are resources you do not want Cloud Capture to snapshot, such as a test cluster or a service a vendor runs in your account, exclude them by tag. You choose the tags: in your organization's **Settings**, go to **Cloud Capture**, open **AWS** and edit the AWS defaults. The **Skip tags** panel there takes any number of key and value pairs, and Cloud Capture skips every resource that carries one of them.
-
-1. Tag the resource in AWS, with any key and value you like. For example, to tag an ECS cluster and a Lambda function with `kosli-capture=false`:
-
- ```bash
- aws ecs tag-resource \
- --resource-arn arn:aws:ecs:eu-west-1:123456789012:cluster/sandbox \
- --tags key=kosli-capture,value=false
-
- aws lambda tag-resource \
- --resource arn:aws:lambda:eu-west-1:123456789012:function:scratch \
- --tags kosli-capture=false
- ```
-
-2. In the **Skip tags** panel, enter the key `kosli-capture` and the value `false`, select **Add**, then **Save**.
-
-How the tags are matched:
-
-- A resource is skipped when any one of its tags equals any one of the skip tags, key and value both, exactly as AWS stores them. Tags are case-sensitive, so `Env=test` does not match `env=test`. A key on its own does not match: to skip both `env=test` and `env=staging`, add both.
-- The tag is read on the resource Cloud Capture snapshots. An ECS cluster is skipped with everything in it, its services and tasks included; tags on a service or a task definition are not read. A Lambda function is skipped on its own, and the region's Lambda environment in Kosli is made up of the functions that remain. An S3 bucket is only ever snapshotted when it carries an [S3 opt-in tag](#capturing-s3-buckets); a bucket that carries an opt-in tag and a skip tag is skipped.
-- The change takes effect on the next scan. A Kosli environment that was already being captured keeps its last snapshot and receives no new ones; nothing is deleted. Remove the skip tag from the resource, and the next run picks it up again.
-- Skip tags, like the other Cloud Capture settings, can only be changed while Cloud Capture is enabled.
-- The IAM role created by the CloudFormation template already grants the permissions needed to read tags, `ecs:DescribeClusters` and `lambda:ListTags`, so no change to the role is needed.
-
-Skip tags can also be set through the API, as part of the organization's Cloud Capture settings. The settings PUT replaces every setting, not only the one you are changing, so start from what is stored: read the current configuration, take the `enabled`, `default_regions`, `scan_interval_minutes`, `skip_tags`, `opt_in_tags`, `dry_run` and `environment_name_template` values from its `settings` object, add your tags to `skip_tags`, and send those fields back. A field you leave out is reset: `dry_run` to `false`, `environment_name_template` to the [default template](#environment-names), and `skip_tags` and `opt_in_tags` to none, which stops your S3 buckets being captured. The response leaves out `environment_name_template` while your organization uses the default, so leave it out of the PUT in that case too. Sending the example below as it stands would also set your default regions, scan interval, S3 opt-in tags and dry run to the values shown, and your environment names to the default.
-
-```bash
-curl "https://app.kosli.com/api/v2/cloud-capture/" \
- -H "Authorization: Bearer "
-
-curl -X PUT "https://app.kosli.com/api/v2/cloud-capture//settings" \
- -H "Authorization: Bearer " \
- -H "Content-Type: application/json" \
- -d '{
- "enabled": true,
- "default_regions": {"aws": ["eu-west-1"]},
- "scan_interval_minutes": 5,
- "skip_tags": {"aws": [{"key": "kosli-capture", "value": "false"}]},
- "opt_in_tags": {"aws": [{"key": "kosli-capture-s3", "value": "true"}]},
- "dry_run": false
- }'
-```
-
-
-
-Exclude resources by tagging the resource group that holds them. In your organization's **Settings**, go to **Cloud Capture**, open **Azure** and add the tag to the **Skip tags** panel in the Azure defaults. Cloud Capture skips every resource group that carries one of the tags, with all of the web apps in it; tags on an individual web app are not read.
-
-Key and value must both match the resource group's tag exactly. Through the API, the tags are the `azure` list of `skip_tags`.
-
-
-
-Exclude resources by label. In your organization's **Settings**, go to **Cloud Capture**, open **Google Cloud** and add the label to the **Skip tags** panel in the Google Cloud defaults. Key and value must both match the resource's label exactly.
-
-- A Cloud Run service or job is skipped on its own, and the region's Cloud Run environment in Kosli is made up of the services and jobs that remain.
-- A GKE cluster is skipped with everything in it. The label is read on the cluster; labels on workloads inside it are not read.
-
-Through the API, the labels are the `gcp` list of `skip_tags`.
-
-
-
-## Capturing S3 buckets
-
-Cloud Capture reports the content of an S3 bucket as one artifact, whose fingerprint is calculated from the SHA256 checksums S3 stores for the bucket's objects. No object is downloaded, with one exception: a `.kosli_ignore` file at the root of the bucket, if there is one, which lists keys to leave out.
-
-S3 is opt-in, bucket by bucket. An account usually holds many buckets you would not want reported, such as CloudTrail and load balancer access logs, and a snapshot makes one request to AWS for every object in the bucket on every scan, which AWS bills to your account. So a bucket is snapshotted only when all of the following are true.
-
-
-
- Deploy version `v0.2.0` or later of the CloudFormation template, or update your existing stack to it, and list the buckets in its **S3 buckets** parameter (`S3BucketNames`): a comma-separated list of bucket names in lowercase, with no spaces. A name may use `*` and `?` as wildcards, for example `acme-releases-*`.
-
- This is the permission. The role can list and read objects in the buckets you name and in no others. See [Cloud Capture Security](/administration/cloud_capture/security) for exactly what it grants.
-
-
- In your organization's **Settings**, go to **Cloud Capture**, open **AWS** and edit the AWS defaults. In the **S3 opt-in tags** panel, beneath **Skip tags**, add a key and a value, for example `kosli-capture-s3` and `true`, and save.
-
- Until you set an opt-in tag, no bucket is captured.
-
-
- ```bash
- aws s3api put-bucket-tagging \
- --bucket acme-releases \
- --tagging 'TagSet=[{Key=kosli-capture-s3,Value=true}]'
- ```
-
- `put-bucket-tagging` replaces all of a bucket's tags, so include the tags the bucket already carries. Key and value must both match the opt-in tag exactly; tags are case-sensitive.
-
-
- In the **Registered accounts** table, edit the account and select **s3** among its services.
-
-
-
-What to expect:
-
-- **Each bucket is its own environment**, of type S3, named by your [environment name template](#environment-names) with the bucket name as `{resource}`.
-- **Each bucket reports exactly one artifact, named after the bucket.** A bucket holding several objects is fingerprinted as a directory, and a bucket holding a single object is fingerprinted as that file, so attest that file with `--artifact-type file` for the fingerprints to match. Either way the artifact carries the bucket's name, not the object's.
-- **An empty bucket is captured, not failed.** It reports one artifact, named after the bucket, with the fingerprint of an empty directory: `e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855`. Every empty bucket therefore shares that fingerprint. It is also the fingerprint of an empty file, so an empty bucket matches any artifact attested from one.
-- **A bucket needs both the tag and the permission.** A bucket that carries the opt-in tag but is not named in the stack fails its snapshot on every scan, with an access denied error. A bucket that is named in the stack but not tagged is left alone.
-- **Skipping wins.** A bucket that carries an opt-in tag and a [skip tag](#excluding-resources) is not captured.
-- **Only objects with a SHA256 checksum are fingerprinted.** S3 stores a full-object SHA256 checksum only when the upload asks for one, for example with `aws s3api put-object --checksum-algorithm SHA256`. An object without one, or one uploaded in several parts, is left out of the fingerprint, as if the bucket did not hold it. The fingerprint therefore matches an artifact you attested from the bucket's whole content only once every object carries the checksum, and a bucket where no object does is reported as an empty bucket.
-- **Buckets encrypted with a KMS key are not supported.** The role is granted no KMS permission, so a bucket whose objects use SSE-KMS fails its snapshot. S3's default encryption, SSE-S3, needs nothing more.
-- **Large buckets cost more and can time out.** A snapshot is one request per object, on every scan. At the default five minute frequency, a bucket of 100,000 objects is about 29 million requests a day. A bucket of more than roughly 100,000 objects may not finish in the time a snapshot is given, and then fails. Consider a longer [scan frequency](#scan-frequency) if you capture large buckets; it applies to everything Cloud Capture scans for you.
-- **A newly tagged bucket is picked up on a later scan**, once AWS reports the tag. Removing the tag, or the opt-in tag from your settings, stops new snapshots; the environment keeps its last snapshot and nothing is deleted.
-
-Through the API, the tags are `opt_in_tags` on the same settings resource as the [skip tags](#excluding-resources), with the same shape. The settings PUT replaces every setting, so a PUT that leaves `opt_in_tags` out removes them, and your buckets stop being captured.
+To connect a cloud account, and to choose which of its resources are captured, see the page for your cloud: [AWS](/administration/cloud_capture/aws), [Azure](/administration/cloud_capture/azure), or [Google Cloud](/administration/cloud_capture/google_cloud). Skip tags, and the S3 opt-in tags on AWS, are set for each cloud and are described on those pages.
## Scan frequency
Cloud Capture scans your registered accounts every five minutes unless you choose otherwise. The frequency is a setting of your Kosli organization, so it applies to every account and region Cloud Capture scans for you.
-To change it, open your organization's **Settings**, go to **Cloud Capture**, and under **Scan frequency** pick an interval from the list: every 5, 10, 15 or 30 minutes, or every 1, 2, 6, 12 or 24 hours. Select **Save**, and the next scan runs at the new interval; nothing restarts and no snapshots are lost. Like the other Cloud Capture settings, the frequency can only be changed while Cloud Capture is enabled.
+To change it, open your organization's **Settings**, go to **Cloud Capture**, and under **Scan frequency** pick an interval from the list: every 5, 10, 15, or 30 minutes, or every 1, 2, 6, 12, or 24 hours. Select **Save**, and the next scan runs at the new interval; nothing restarts and no snapshots are lost. Like the other Cloud Capture settings, the frequency can only be changed while Cloud Capture is enabled.
Each scan reports what is running in every environment Cloud Capture manages for you, and Kosli records a new snapshot when that differs from the last one. The interval is therefore how long a change can go unnoticed: a deployment that lands and is rolled back inside one interval may never be seen. Five minutes suits most teams; an estate that changes rarely can scan hourly.
-Through the API, the frequency is `scan_interval_minutes` on the same settings resource as the skip tags above: any whole number of minutes from 5 to 1440 (a day), not only the presets the settings page offers, with 5 the value when it is left out. An interval set this way that is not one of the presets is shown on the settings page as its own option, so saving another setting there keeps it. The PUT replaces every setting, so read the current configuration first and send the other settings back unchanged.
+Through the API, the frequency is `scan_interval_minutes` on the settings resource described in [Using the API](#using-the-api): any whole number of minutes from 5 to 1440 (a day), not only the presets the settings page offers, with 5 the value when it is left out. An interval set this way that is not one of the presets is shown on the settings page as its own option, so saving another setting there keeps it. The PUT replaces every setting, so read the current configuration first and send the other settings back unchanged.
## Environment names
@@ -260,18 +33,18 @@ A template is text with any of these placeholders:
| Placeholder | Value |
|-------------|-------|
-| `{cloud}` | The cloud provider: `aws`, `azure` or `gcp`. |
-| `{account_id}` | The cloud account ID: an AWS account ID, an Azure subscription ID or a Google Cloud project ID. |
+| `{cloud}` | The cloud provider: `aws`, `azure`, or `gcp`. |
+| `{account_id}` | The cloud account ID: an AWS account ID, an Azure subscription ID, or a Google Cloud project ID. |
| `{account_name}` | The name you gave the account, for example `staging`. Empty for an account with no name. See [Account names](#account-names). |
| `{account}` | The account's name where it has one, and its account ID where it does not. |
| `{region}` | The region, for example `eu-central-1`. Empty on Azure, which is scanned a subscription at a time. |
-| `{service}` | The service: `ecs`, `lambda` or `s3` on AWS, `apps` on Azure, `cloud-run` or `gke` on Google Cloud. |
-| `{resource}` | The resource's own name: the ECS cluster, S3 bucket, Azure resource group or GKE cluster. |
+| `{service}` | The service: `ecs`, `lambda`, or `s3` on AWS, `apps` on Azure, `cloud-run` or `gke` on Google Cloud. |
+| `{resource}` | The resource's own name: the ECS cluster, S3 bucket, Azure resource group, or GKE cluster. |
| `{tag:Key}` | The value of the resource's tag `Key`. For example, `aws-{tag:Env}` names a cluster tagged `Env=prod` as `aws-prod`. |
How a template is rendered:
-- The text between placeholders can only hold letters, digits, `.`, `_` and `-`, and a template must start with a letter, a digit or a placeholder. Placeholder names are case-sensitive and take no formatting.
+- The text between placeholders can only hold letters, digits, `.`, `_`, and `-`, and a template must start with a letter, a digit, or a placeholder. Placeholder names are case-sensitive and take no formatting.
- A region's Lambda functions are captured together as one resource, and so are a region's Cloud Run services and jobs, so `{resource}` and every `{tag:Key}` are empty for them. An empty placeholder removes the separator before it: with the default template, a region's Lambda functions report into `123456789012-eu-central-1-lambda`.
- `{account_name}` is empty for an account with no name, and that account is still captured. When the empty placeholder starts the template, it removes the separator after it instead, so `{account_name}-{service}-{resource}` names a cluster `app` in an unnamed account `ecs-app`. With `{account}-{resource}`, a cluster named `payments` reports into `staging-payments` in an account named `staging`, and into `222222222222-payments` in account `222222222222` with no name.
- Tag keys are case-sensitive, as AWS stores them, so `{tag:env}` does not read a tag named `Env`. A key may contain colons and spaces, as in `{tag:aws:cloudformation:stack-name}`.
@@ -281,15 +54,15 @@ How a template is rendered:
Give every resource its own name. A template that renders the same name for two resources sends both into one environment, and that environment then switches between the two resources on every scan. This happens with `aws-prod` on an account with two ECS clusters, with a template that has no `{region}` on an account scanned in two regions, and with a template that has no `{account_id}` or `{account}` when two accounts hold a cluster of the same name. A template that uses `{account_name}` without `{account_id}` sends same-named clusters in every unnamed account into one environment, so use `{account}` unless every account has a name. Account names do not have to be unique, so two accounts with the same name collide in the same way under `{account_name}` and `{account}`. It also happens when a `{tag:Key}` placeholder is the only part that would tell resources apart: tag placeholders are empty for Lambda functions, so `aws-{tag:Env}` sends every region's Lambda functions into `aws`. Run a [dry run](#dry-run) to check the names before you rely on them.
-Through the API, the template is `environment_name_template` on the same settings resource as the skip tags above. Leaving it out, or sending `null`, uses the default template. A template that breaks the rules above is refused with a `400` response.
+Through the API, the template is `environment_name_template` on the settings resource described in [Using the API](#using-the-api). Leaving it out, or sending `null`, uses the default template. A template that breaks the rules above is refused with a `400` response.
### Account names
You can give each registered account a name, such as `staging` or `prod-us`, to use in environment names through `{account_name}` and `{account}`. Naming accounts is optional, so you can name a few and leave the rest.
-To name an account, open your organization's **Settings** and go to **Cloud Capture**. In the **Registered accounts** table, open the actions menu in the account's row, select **Edit**, and enter the name in **Account name**. You can also enter it when you select **Register account**. A name starts with a letter or digit and holds only letters, digits, `.`, `_` and `-`. Clear the field and save to remove the name. A named account's row shows its name, with its account ID beneath it.
+To name an account, open your organization's **Settings** and go to **Cloud Capture**. In the **Registered accounts** table, open the actions menu in the account's row, select **Edit**, and enter the name in **Account name**. You can also enter it when you select **Register account**. A name starts with a letter or digit and holds only letters, digits, `.`, `_`, and `-`. Clear the field and save to remove the name. A named account's row shows its name, with its account ID beneath it.
-Through the API, the name is `account_name` on the account's registration, at `/api/v2/cloud-capture//accounts/aws/`. The PUT replaces the whole registration, so read it with a GET first and send its `role_arn`, `regions`, `services` and `dry_run` back with the name. A PUT without `account_name` removes the name.
+Through the API, the name is `account_name` on the account's registration, at `/api/v2/cloud-capture//accounts/aws/`. The PUT replaces the whole registration, so read it with a GET first and send its `role_arn`, `regions`, `services`, and `dry_run` back with the name. A PUT without `account_name` removes the name.
## Dry run
@@ -299,4 +72,27 @@ To turn it on for the whole organization, open **Settings**, go to **Cloud Captu
After a dry run, open the actions menu in the account's row and select **Show latest results**. The results list what the scan found in each region and service, the environment each resource would report into, which of those environments would be created, and why any resource failed. Switch dry run off to start recording snapshots.
-Through the API, the organization-wide switch is `dry_run` on the same settings resource as the skip tags above.
+Through the API, the organization-wide switch is `dry_run` on the settings resource described in [Using the API](#using-the-api).
+
+## Using the API
+
+Every setting on this page is a field of one settings resource, along with the skip tags and S3 opt-in tags described on each cloud's page. The settings PUT replaces every setting, not only the one you are changing, so start from what is stored: read the current configuration, take the `enabled`, `default_regions`, `scan_interval_minutes`, `skip_tags`, `opt_in_tags`, `dry_run`, and `environment_name_template` values from its `settings` object, change the ones you want, and send those fields back. A field you leave out is reset: `dry_run` to `false`, `environment_name_template` to the [default template](#environment-names), and `skip_tags` and `opt_in_tags` to none, which stops your S3 buckets being captured. The response leaves out `environment_name_template` while your organization uses the default, so leave it out of the PUT in that case too. Sending the example below as it stands would set your default regions, scan interval, skip tags, S3 opt-in tags, and dry run to the values shown, and your environment names to the default.
+
+```bash
+curl "https://app.kosli.com/api/v2/cloud-capture/" \
+ -H "Authorization: Bearer "
+
+curl -X PUT "https://app.kosli.com/api/v2/cloud-capture//settings" \
+ -H "Authorization: Bearer " \
+ -H "Content-Type: application/json" \
+ -d '{
+ "enabled": true,
+ "default_regions": {"aws": ["eu-west-1"]},
+ "scan_interval_minutes": 5,
+ "skip_tags": {"aws": [{"key": "kosli-capture", "value": "false"}]},
+ "opt_in_tags": {"aws": [{"key": "kosli-capture-s3", "value": "true"}]},
+ "dry_run": false
+ }'
+```
+
+`skip_tags` holds one list of tags for each cloud: `aws`, `azure`, and `gcp`.
diff --git a/administration/cloud_capture/google_cloud.md b/administration/cloud_capture/google_cloud.md
new file mode 100644
index 0000000..33827d9
--- /dev/null
+++ b/administration/cloud_capture/google_cloud.md
@@ -0,0 +1,432 @@
+---
+title: "Cloud Capture on Google Cloud"
+sidebarTitle: "Google Cloud"
+description: "Set up Cloud Capture for your Google Cloud projects, choose which Cloud Run and GKE resources it snapshots, and review the permissions it uses."
+tag: "BETA"
+---
+
+
+Cloud Capture is still in active development. Its capabilities and configuration format may change, and onboarding is done together with Kosli's Customer Success team.
+
+
+Cloud Capture snapshots the Cloud Run services and jobs, and the Google Kubernetes Engine (GKE) clusters, in the projects you register. Google Cloud support is in early access, so the Google Cloud page appears in your Cloud Capture settings only once Kosli has enabled it for your organization.
+
+## Set up
+
+In order for Cloud Capture to reach into your Google Cloud project, to discover your Cloud Run services and jobs and your Google Kubernetes Engine (GKE) clusters, you need to grant permission to Kosli to do so. This requires a service account in your project that Cloud Capture can impersonate through workload identity federation; the service account, and the workload identity pool that guards it, exist within your own project.
+
+To simplify this process, Kosli has created a Terraform configuration that creates that service account, the read-only roles Cloud Capture needs, and a workload identity pool that accepts only the Kosli-side role created for your organization.
+
+If you would rather create these resources yourself, see [Permissions and security](#permissions-and-security) for the service account, workload identity pool, and roles that Cloud Capture needs.
+
+
+
+ Infrastructure Manager reads a configuration from a local directory, so download the published file into an empty directory:
+
+ ```bash
+ mkdir kosli-capture && cd kosli-capture
+ curl --fail --remote-name \
+ https://kosli-cloud-capture-templates.s3.eu-central-1.amazonaws.com/gcp/v0.2.0/main.tf
+ ```
+
+ You also need two values from Kosli: the Kosli AWS account ID, and the name of the Kosli-side IAM role for your organization. The configuration isn't pre-filled with them. In your organization's **Settings**, go to **Cloud Capture**, open **Google Cloud**, and select **Register account**; the first step of the form shows both.
+
+
+ Deploy the configuration once in each project that holds Cloud Run services or jobs, or GKE clusters, you want Cloud Capture to snapshot. Run the following from the directory containing the configuration:
+
+ ```bash
+ gcloud infra-manager deployments apply \
+ projects//locations//deployments/kosli-capture \
+ --service-account=projects//serviceAccounts/@.iam.gserviceaccount.com \
+ --local-source=. \
+ --input-values=project_id=,kosli_aws_account_id=,kosli_role_name=
+ ```
+
+ Infrastructure Manager runs Terraform as the service account you name, so that service account needs permission to enable APIs and to create workload identity pools, service accounts, custom roles, and project IAM bindings.
+
+
+ Kosli needs two values to connect to your project. The configuration emits both as Terraform outputs:
+
+ - `kosli_capture_provider`: the full resource name of the workload identity provider
+ - `kosli_capture_service_account`: the email of the service account Cloud Capture impersonates
+
+ You enter both when you register the project. You can read them at any time from the deployment's latest revision:
+
+ ```bash
+ gcloud infra-manager revisions describe \
+ "$(gcloud infra-manager deployments describe \
+ projects//locations//deployments/kosli-capture \
+ --format='value(latestRevision)')" \
+ --format='yaml(applyResults.outputs)'
+ ```
+
+
+ Accounts can only be registered while Cloud Capture is enabled. When you have deployed the configuration, continue the registration form: enter the project ID, the workload identity provider name, and the service account email, and choose the regions and services to scan. Cloud Run is selected for a new project. GKE is not selected, so select it if you want clusters snapshotted.
+
+ Cloud Capture never connects to a GKE cluster. It lists the project's clusters and reads their pods from Google's Cloud Asset Inventory, so a private cluster is snapshotted like any other and nothing is installed in it. Cloud Asset Inventory can be a few minutes behind a cluster, so a pod that lives for less time than that may never be seen.
+
+ Cloud Capture scans every five minutes unless you [choose another frequency](/administration/cloud_capture/getting_started#scan-frequency), and picks up a registered project the next time it runs - you should see environments and snapshots appearing within a few minutes.
+
+
+
+## Excluding resources
+
+Exclude resources by label. In your organization's **Settings**, go to **Cloud Capture**, open **Google Cloud**, and add the label to the **Skip tags** panel in the Google Cloud defaults. Key and value must both match the resource's label exactly.
+
+- A Cloud Run service or job is skipped on its own, and the region's Cloud Run environment in Kosli is made up of the services and jobs that remain.
+- A GKE cluster is skipped with everything in it. The label is read on the cluster; labels on workloads inside it are not read.
+
+Through the API, the labels are the `gcp` list of `skip_tags`; see [Using the API](/administration/cloud_capture/getting_started#using-the-api).
+
+## Permissions and security
+
+For the model that is common to every cloud, see [Cloud Capture security](/administration/cloud_capture/security).
+
+Kosli publishes a Terraform configuration, for use with
+[Infrastructure Manager](https://cloud.google.com/infrastructure-manager/docs), that creates
+everything Cloud Capture needs to snapshot Cloud Run and Google Kubernetes Engine (GKE).
+Infrastructure Manager runs Terraform as a managed service inside your project, so there is no
+state file or Terraform install for you to manage. Deploy the configuration once in each project
+you want Cloud Capture to snapshot. The [current version](https://kosli-cloud-capture-templates.s3.eu-central-1.amazonaws.com/gcp/v0.2.0/main.tf),
+`v0.2.0`, is published at
+`https://kosli-cloud-capture-templates.s3.eu-central-1.amazonaws.com/gcp/v0.2.0/main.tf`, and what
+this page describes is taken from it. Everything it creates is yours, in your project.
+
+Cloud Capture runs in AWS and reaches your project through
+[Workload Identity Federation](https://cloud.google.com/iam/docs/workload-identity-federation). Cloud
+Capture exchanges its own short-lived AWS credentials for a short-lived Google token, then
+impersonates a service account that you create. No service account key is ever created or shared.
+
+Your workload identity pool makes two checks before it issues a token:
+
+1. It accepts only credentials issued by the Kosli AWS account in which Cloud Capture runs.
+2. Within that account, it accepts only the Kosli-side IAM role dedicated to your organization.
+ Every Cloud Capture job runs under the role for the organization it is working for. A job for
+ another Kosli tenant presents a different role name, so your pool refuses it, even if that
+ tenant gave Kosli your provider and service account details instead of their own.
+
+The role name is part of the credential that AWS signs and Google verifies, so the caller cannot
+forge it.
+
+For readers familiar with the AWS setup: the account check plays the part of the principal in the
+assume-role trust policy, and the role check plays the part of the external ID.
+
+### What the configuration creates
+
+| Resource | Name | What it is for |
+|---|---|---|
+| Workload identity pool | `kosli-capture` | Exchanges Cloud Capture's AWS credentials for a Google token |
+| AWS provider in the pool | `kosli-aws` | Accepts the Kosli AWS account and, within it, only the Kosli-side role for your organization |
+| Service account | `kosli-capture@.iam.gserviceaccount.com` | The identity Cloud Capture acts as in the project. Only the Kosli-side role for your organization may impersonate it |
+| Enabled APIs | IAM, IAM Credentials, Security Token Service, Cloud Run, Cloud Resource Manager, Cloud Asset | Needed to create the resources above and to make the read calls below. None is disabled if you destroy the deployment |
+
+The configuration takes three inputs, none of which has a default: `project_id`, and the two values
+Kosli supplies, `kosli_aws_account_id` and `kosli_role_name`. It emits two outputs,
+`kosli_capture_provider` and `kosli_capture_service_account`, which you enter when you register the
+project; see [Set up](#set-up).
+
+### Permissions granted to the service account
+
+All of the grants are read-only, and all are on the project.
+
+| Grant | Permissions | What Cloud Capture uses it for |
+|---|---|---|
+| `roles/run.viewer` | Google's predefined Cloud Run viewer role | Listing a region's Cloud Run services and jobs with their labels, and reading each service's revisions and images |
+| Custom role `kosliCaptureRegistry` | `artifactregistry.tags.get` | Resolving an image referenced by tag to its digest. This is a metadata read; no image layer is ever pulled |
+| Custom role `kosliCaptureGke` | `container.clusters.list`, `cloudasset.assets.listContainerPod`, `serviceusage.services.use` | Listing the project's GKE clusters with their labels, and reading the project's pods from [Cloud Asset Inventory](https://cloud.google.com/asset-inventory/docs/overview), in the same way as [`kosli snapshot gke`](/client_reference/kosli_snapshot_gke). Google requires `serviceusage.services.use` of every Cloud Asset Inventory call |
+
+Worth knowing for a security review of GKE:
+
+- Cloud Capture never calls a cluster's Kubernetes API. No Kubernetes RBAC objects are created
+ inside your clusters, nothing is installed in them, and Cloud Capture needs no network access to
+ any cluster control plane, so a private cluster is snapshotted like any other.
+- The GKE role is custom because Google's predefined roles are wider: `roles/cloudasset.viewer`
+ would list every asset type in the project, including Kubernetes Secrets.
+- The role cannot be made narrower than every pod in the project, because Cloud Asset Inventory
+ filters by neither cluster nor namespace. A pod's record holds its images, commands, arguments,
+ labels, annotations, and any environment variables written into the spec in plain text. A value
+ taken from a Kubernetes Secret appears as a reference and not as the secret.
+- A project inside a VPC Service Controls perimeter that restricts the Cloud Asset, Kubernetes
+ Engine, or Cloud Run API needs an ingress rule that admits the service account, because Cloud
+ Capture calls from outside the perimeter.
+
+If you wish to grant access for Cloud Capture without using our published configuration, create
+the resources and grants in the two tables above. The pool must accept only the Kosli AWS account
+and, within it, only the Kosli-side role for your organization, and only that role may impersonate
+the service account.
+
+### The configuration in full
+
+
+
+```hcl
+# The Google Cloud resources Kosli Cloud Capture needs in a customer's
+# project, for use with Infrastructure Manager; the README beside this
+# directory says how to deploy it and why it is shaped as it is.
+#
+# Cloud Capture runs in AWS and reaches the project through Workload Identity
+# Federation: it exchanges its own short-lived AWS credentials for a
+# short-lived Google token, then impersonates the service account created
+# here. No service account key is ever created, stored or shared. The pool
+# makes two checks before it issues a token: the credentials were issued by
+# the Kosli AWS account that serves the customer, and within that account by
+# the one IAM role Kosli keeps for the customer's organisation. A Cloud
+# Capture job for another tenant runs under a different role and is refused.
+
+terraform {
+ required_version = ">= 1.5"
+
+ required_providers {
+ google = {
+ source = "hashicorp/google"
+ version = ">= 5.0, < 8.0"
+ }
+ }
+}
+
+provider "google" {
+ project = var.project_id
+}
+
+variable "project_id" {
+ type = string
+ description = "The GCP project that holds the Cloud Run services and jobs, and the GKE clusters, Cloud Capture will snapshot."
+
+ validation {
+ condition = can(regex("^[a-z][a-z0-9-]{4,28}[a-z0-9]$", var.project_id))
+ error_message = "Must be a project id: 6 to 30 lowercase letters, digits and hyphens, starting with a letter."
+ }
+}
+
+variable "kosli_aws_account_id" {
+ type = string
+ description = <<-EOT
+ The AWS account in which Cloud Capture runs, supplied by Kosli. It differs
+ per tenant because more than one Kosli account serves tenants. There
+ is no default and no value you can derive yourself.
+ EOT
+
+ validation {
+ condition = can(regex("^[0-9]{12}$", var.kosli_aws_account_id))
+ error_message = "Must be the 12-digit AWS account id issued to you by Kosli."
+ }
+}
+
+variable "kosli_role_name" {
+ type = string
+ description = <<-EOT
+ The name of the IAM role, in the Kosli AWS account, that Cloud Capture
+ uses when working for your organisation. Supplied by Kosli. Each Kosli
+ organisation has its own role, and the workload identity pool accepts
+ only this one, so only Cloud Capture jobs run on behalf of your
+ organisation can obtain a token from your project. In the AWS setup,
+ the external ID plays the same part.
+ EOT
+
+ validation {
+ condition = can(regex("^[A-Za-z0-9+=,.@_-]{1,64}$", var.kosli_role_name))
+ error_message = "Must be the IAM role name issued to you by Kosli."
+ }
+}
+
+# The APIs the exchange and the inventory go through. Cloud Run is enabled
+# already in a project with services in it; the IAM ones are what creating a
+# pool, a service account and the custom roles, and impersonating the account,
+# need; Cloud Resource Manager is what granting the project roles below
+# needs, and a fresh project does not have it on; Cloud Asset is the
+# inventory a GKE snapshot reads the project's pods from, and costs nothing
+# to have on. None is disabled on destroy: they may well be in use by
+# something else in the project.
+#
+# The Kubernetes Engine API is not in the list. A project with clusters has
+# it on already, and enabling it in a project without them would switch on
+# Compute Engine and its other dependencies for nothing.
+resource "google_project_service" "needed" {
+ for_each = toset([
+ "iam.googleapis.com",
+ "iamcredentials.googleapis.com",
+ "sts.googleapis.com",
+ "run.googleapis.com",
+ "cloudresourcemanager.googleapis.com",
+ "cloudasset.googleapis.com",
+ ])
+
+ project = var.project_id
+ service = each.key
+ disable_on_destroy = false
+}
+
+resource "google_iam_workload_identity_pool" "kosli_capture" {
+ project = var.project_id
+ workload_identity_pool_id = "kosli-capture"
+ display_name = "Cloud Capture"
+ description = <<-EOT
+ Read-only access for Cloud Capture SDLC compliance evidence collection.
+ Managed by Infrastructure Manager; do not edit in place.
+ EOT
+
+ depends_on = [google_project_service.needed]
+}
+
+resource "google_iam_workload_identity_pool_provider" "kosli_aws" {
+ project = var.project_id
+ workload_identity_pool_id = google_iam_workload_identity_pool.kosli_capture.workload_identity_pool_id
+ workload_identity_pool_provider_id = "kosli-aws"
+ display_name = "Cloud Capture (AWS)"
+
+ aws {
+ account_id = var.kosli_aws_account_id
+ }
+
+ # The role is read out of the assumed-role ARN AWS signed, less its
+ # session name, so every session of the role is the one principal. The
+ # subject is the role as well, and not the whole ARN: a subject is at most
+ # 127 bytes, and the ARN carries the account, the session name and the
+ # role's name, which can be 64 characters, so a long role name would put
+ # the ARN over the limit and every exchange would fail.
+ attribute_mapping = {
+ "google.subject" = "assertion.arn.extract('assumed-role/{role}/')"
+ "attribute.account" = "assertion.account"
+ "attribute.aws_role" = "assertion.arn.extract('assumed-role/{role}/')"
+ }
+
+ # Two checks before the pool issues a token. The account check accepts only
+ # credentials issued by the Kosli AWS account, however the token reaches
+ # Google. The role check accepts, within that account, only the Kosli-side
+ # role dedicated to your organisation. A Cloud Capture job for another tenant
+ # runs under a different role and is refused here. In the AWS setup, these
+ # checks correspond to the trust policy principal and the external ID.
+ attribute_condition = join(" && ", [
+ "attribute.account == \"${var.kosli_aws_account_id}\"",
+ "attribute.aws_role == \"${var.kosli_role_name}\"",
+ ])
+}
+
+resource "google_service_account" "kosli_capture" {
+ project = var.project_id
+ account_id = "kosli-capture"
+ display_name = "Cloud Capture"
+ description = "Impersonated by Cloud Capture to snapshot Cloud Run services and jobs, and GKE clusters. Managed by Infrastructure Manager."
+
+ # Ordered after the APIs, as the pool is: creating a service account needs
+ # iam.googleapis.com, which a project may not have enabled before this, and
+ # the four bindings below follow through their references to the account.
+ depends_on = [google_project_service.needed]
+}
+
+# Only the Kosli-side role for your organisation may impersonate the service
+# account. The pool's attribute condition already refuses every other identity;
+# naming the role here as well keeps the binding correct even if that condition
+# is later loosened.
+resource "google_service_account_iam_member" "kosli_impersonation" {
+ service_account_id = google_service_account.kosli_capture.name
+ role = "roles/iam.workloadIdentityUser"
+ member = "principalSet://iam.googleapis.com/${google_iam_workload_identity_pool.kosli_capture.name}/attribute.aws_role/${var.kosli_role_name}"
+}
+
+# What the service account may read. Discovery lists the region's Cloud Run
+# services and jobs and reads each one's labels from the same listing, and
+# the snapshot reads each service's revisions and the images they run: all
+# of it is in roles/run.viewer, the predefined read-only role, and none of it
+# returns application data. A revision's spec is the widest: it holds the
+# container image, the command, and any environment variables written into
+# the spec in plain text; a value taken from a Secret is named there rather
+# than resolved, so what comes back is the reference and not the secret.
+resource "google_project_iam_member" "kosli_capture_run" {
+ project = var.project_id
+ role = "roles/run.viewer"
+ member = google_service_account.kosli_capture.member
+}
+
+# The snapshot also resolves each image pinned by a tag to its digest, which
+# the Kosli CLI (2.57.0 on) reads from the Artifact Registry API: metadata
+# about the tag, and never the image. The predefined read-only role would
+# also grant downloadArtifacts, which pulls image layers, so a custom role
+# grants the one read the lookup makes and nothing that returns a layer.
+# The CLI's other lookup, a tag for an image pinned by digest, is behind a
+# flag Cloud Capture does not pass, so its permission
+# (artifactregistry.dockerimages.get) is not granted either. The CLI falls
+# back to reading the manifest when the API call fails; under this grant
+# that fallback cannot succeed, and nothing depends on it, since the
+# registries it could read are the ones the API lookup reads. Cloud Run
+# reports a service's image already pinned by digest, which the CLI takes
+# from the name, so what this grant resolves in practice is a job's image.
+# Without this grant a snapshot still succeeds, with an empty digest for
+# each tag-pinned image the account could not read.
+resource "google_project_iam_custom_role" "kosli_capture_registry" {
+ project = var.project_id
+ role_id = "kosliCaptureRegistry"
+ title = "Cloud Capture registry metadata"
+ description = "Read-only image tag metadata for Cloud Capture SDLC compliance evidence collection."
+
+ permissions = ["artifactregistry.tags.get"]
+
+ depends_on = [google_project_service.needed]
+}
+
+resource "google_project_iam_member" "kosli_capture_registry" {
+ project = var.project_id
+ role = google_project_iam_custom_role.kosli_capture_registry.id
+ member = google_service_account.kosli_capture.member
+}
+
+# What the service account may read of the project's GKE clusters (beta).
+# Cloud Capture never connects to a cluster: it needs no network path to one,
+# no kubeconfig and no Kubernetes RBAC. Discovery lists the project's
+# clusters, with their labels, through the Kubernetes Engine API; the
+# snapshot reads the project's pods from Cloud Asset Inventory, Google's own
+# record of what is in the project, and Google requires
+# serviceusage.services.use of every call to it.
+#
+# A custom role because the predefined ones are wider than this:
+# roles/cloudasset.viewer lists every asset type in the project, and
+# roles/container.clusterViewer more than the one listing. It cannot be
+# narrower than every pod in the project, since Cloud Asset Inventory filters
+# by neither cluster nor namespace. A pod's record holds its spec and status:
+# the images, commands and arguments, its labels and annotations, and any
+# environment variables written into the spec in plain text; a value taken
+# from a Secret is named there rather than resolved, so what comes back is
+# the reference and not the secret. A cluster's listing holds its
+# configuration and no credentials.
+resource "google_project_iam_custom_role" "kosli_capture_gke" {
+ project = var.project_id
+ role_id = "kosliCaptureGke"
+ title = "Cloud Capture (GKE)"
+ description = "Lists GKE clusters, and their pods from Cloud Asset Inventory, for Cloud Capture. Managed by Infrastructure Manager."
+
+ permissions = [
+ "container.clusters.list",
+ "cloudasset.assets.listContainerPod",
+ "serviceusage.services.use",
+ ]
+
+ depends_on = [google_project_service.needed]
+}
+
+resource "google_project_iam_member" "kosli_capture_gke" {
+ project = var.project_id
+ role = google_project_iam_custom_role.kosli_capture_gke.id
+ member = google_service_account.kosli_capture.member
+}
+
+# Kosli needs these two values to connect. Infrastructure Manager records them
+# on the deployment's latest revision, under applyResults.outputs.
+output "kosli_capture_provider" {
+ description = "Full resource name of the workload identity provider; give this to Kosli."
+ value = google_iam_workload_identity_pool_provider.kosli_aws.name
+}
+
+output "kosli_capture_service_account" {
+ description = "Email of the service account Cloud Capture impersonates; give this to Kosli."
+ value = google_service_account.kosli_capture.email
+}
+```
+
+
+
+### Tenant isolation
+
+Each Cloud Capture job for your organization runs under the Kosli-side IAM role dedicated to your
+organization. The workload identity pool in your project accepts only that role, so a job running
+for a different tenant cannot obtain a token from your project or impersonate your service account.
+Separation is enforced by the identity provider, not by application code.
diff --git a/administration/cloud_capture/overview.md b/administration/cloud_capture/overview.md
index 74ebd9f..6509a90 100644
--- a/administration/cloud_capture/overview.md
+++ b/administration/cloud_capture/overview.md
@@ -13,7 +13,7 @@ Cloud Capture is a managed service that runs on Kosli's infrastructure and conne
Kosli also supports reporting from your own cloud accounts by running the Kosli CLI on a schedule. Cloud Capture inverts this, with Kosli running the regular [snapshots](/getting_started/environments) so there is no software for you to install.
-To set it up for your organization, see [Getting started with Cloud Capture](/administration/cloud_capture/getting_started).
+To set it up for your organization, follow the page for your cloud: [AWS](/administration/cloud_capture/aws), [Azure](/administration/cloud_capture/azure), or [Google Cloud](/administration/cloud_capture/google_cloud).
## Overview
@@ -35,7 +35,19 @@ Cloud Capture connects to your cloud accounts using permissions that you manage.
| Google Cloud | Google Kubernetes Engine (GKE) | Early access | One environment per cluster |
| Azure | Azure Kubernetes Service (AKS) | Planned | |
-Kosli's Customer Success team enables Cloud Capture for your organization. You then set it up yourself from your organization's Settings page, as described in [Getting started](/administration/cloud_capture/getting_started).
+Kosli's Customer Success team enables Cloud Capture for your organization. You then set it up yourself from your organization's Settings page, following the page for your cloud:
+
+
+
+ Amazon ECS, AWS Lambda, and Amazon S3
+
+
+ Azure App Service
+
+
+ Cloud Run and GKE
+
+
**Beta** platforms are ready to use once Cloud Capture is enabled for your organization.
@@ -53,7 +65,7 @@ on your subscription that carries the same external ID. On Kosli's side, each Cl
scoped to your organization alone, so a worker running for another tenant cannot reach your cloud
account. Cloud Capture holds no tenant data; snapshots go straight to Kosli through the same ingest
path as your existing pipelines. See [Cloud Capture Security](/administration/cloud_capture/security)
-for the isolation model and the full list of permissions.
+for the isolation model, and the page for your cloud for the full list of permissions.
## Hands-off operation
@@ -63,15 +75,15 @@ Cloud Capture has been designed to operate with no on-going support from you. O
Cloud Capture finds the [supported resources](#supported-platforms) within your cloud accounts, in the services you select for each account, and determines which Kosli environment should hold the snapshots. Cloud Capture will create physical environments for you inside Kosli. You choose how those environments are named; see [Environment names](/administration/cloud_capture/getting_started#environment-names).
-You can keep a resource out of Cloud Capture by tagging it with any tag you have listed in your Cloud Capture settings; see [Excluding resources](/administration/cloud_capture/getting_started#excluding-resources).
+You can keep a resource out of Cloud Capture by tagging it with any tag you have listed in your Cloud Capture settings; see excluding resources on [AWS](/administration/cloud_capture/aws#excluding-resources), [Azure](/administration/cloud_capture/azure#excluding-resources), or [Google Cloud](/administration/cloud_capture/google_cloud#excluding-resources).
-Amazon S3 works the other way round. A bucket is snapshotted only when you opt it in, by tagging it with one of the S3 opt-in tags in your Cloud Capture settings, because a snapshot makes one request to AWS for every object in the bucket and most buckets hold data you would not want reported; see [Capturing S3 buckets](/administration/cloud_capture/getting_started#capturing-s3-buckets).
+Amazon S3 works the other way round. A bucket is snapshotted only when you opt it in, by tagging it with one of the S3 opt-in tags in your Cloud Capture settings, because a snapshot makes one request to AWS for every object in the bucket and most buckets hold data you would not want reported; see [Capturing S3 buckets](/administration/cloud_capture/aws#capturing-s3-buckets).
As your cloud environment evolves, such as the addition of new AWS ECS clusters or GKE clusters, or the retirement of existing Lambdas, Cloud Capture automatically detects the changes. Because Cloud Capture creates physical environments as needed, when your infrastructure changes, Kosli will keep up. No changes to the configuration created during the initial setup are required.
## Multiple cloud accounts
-Cloud Capture can operate across multiple regions and cloud accounts, such as AWS accounts, Azure subscriptions and Google Cloud projects, allowing you to snapshot development, QA, pre-production, and production workloads with the same process.
+Cloud Capture can operate across multiple regions and cloud accounts, such as AWS accounts, Azure subscriptions, and Google Cloud projects, allowing you to snapshot development, QA, pre-production, and production workloads with the same process.
## Operation
diff --git a/administration/cloud_capture/security.md b/administration/cloud_capture/security.md
index 8f835c2..3668840 100644
--- a/administration/cloud_capture/security.md
+++ b/administration/cloud_capture/security.md
@@ -13,683 +13,20 @@ Cloud Capture is still in active development. Its capabilities and configuration
The Cloud Capture managed service uses the public cloud APIs to extract information about your cloud environments. In order to do this, you need to provide Kosli with an identity in your cloud account that Kosli can use to call these APIs. The identity is created and managed by you. It must be protected by a trust condition that allows only Kosli to use it, and it must hold the read-only permissions Kosli needs to find and snapshot your resources. On Azure the identity is a Kosli application that you consent to and grant access; on AWS and Google Cloud it is a role or service account you create.
-
-
-Kosli publishes a CloudFormation template, for use in AWS, showing the permissions needed. The template is publicly accessible and can be used directly within an `aws cloudformation create-stack` call. The [current version](https://kosli-cloud-capture-templates.s3.eu-central-1.amazonaws.com/aws/v0.2.0/kosli-cloud-capture-access-role.yaml), `v0.2.0`, is published at `https://kosli-cloud-capture-templates.s3.eu-central-1.amazonaws.com/aws/v0.2.0/kosli-cloud-capture-access-role.yaml`, and the permissions shown on this page are taken from it. A published version is never changed; a change to the permissions is a new version, and reaches a role you have deployed only when you update your stack.
+Each cloud's page gives the full detail: what you create, the exact permissions, and how the trust condition works.
-Version `v0.2.0` adds one optional parameter to the earlier template, **S3 buckets** (`S3BucketNames`), for [capturing S3 buckets](/administration/cloud_capture/getting_started#capturing-s3-buckets). Left empty, the default, the role is the same as the one the earlier template created: it can read no object and no object key in any bucket. A role created from the earlier template keeps working for ECS and Lambda.
-
-If you wish to build an IAM role for Cloud Capture without using our published CloudFormation template, the permissions needed are those shown below. The role must contain an Assume Role policy that allows the Kosli account to access the resources, and must include an externalId. Both of these values are supplied by Kosli and cannot be derived; you cannot construct the trust policy without them. Whichever way you create the role, then register the account with the role's ARN, as described in [Getting started](/administration/cloud_capture/getting_started).
-
-### Assume role
-
-The IAM role defined within the CloudFormation template includes an "assume role" policy granting permission from Kosli. This appears as:
-
-```yaml
- KosliCloudCaptureAccessRole:
- Type: AWS::IAM::Role
- Properties:
- RoleName: !Ref RoleName
- Description: >-
- Read-only access for Kosli Cloud Capture evidence collection.
- Managed by CloudFormation; do not edit in place.
- MaxSessionDuration: 3600
- AssumeRolePolicyDocument:
- Version: "2012-10-17"
- Statement:
- - Sid: AllowKosliToAssumeWithExternalId
- Effect: Allow
- Principal:
- AWS: !Ref TrustedPrincipalArn
- Action: sts:AssumeRole
- Condition:
- StringEquals:
- sts:ExternalId: !Ref ExternalId
-```
-
-### All permissions needed
-
-The IAM role defined within the Cloudformation template includes a number of IAM policy statements, granting read-only access to some AWS APIs. The statements are:
-
-```yaml
-Statement:
-
- # How Cloud Capture finds what to snapshot. Discovery lists the ECS
- # clusters in the account and reads each cluster's tags from the
- # same DescribeClusters call; a cluster carrying the exclusion
- # tag is skipped and everything else is snapshotted. Without
- # ListClusters and DescribeClusters a role created from this
- # template cannot run discovery at all.
- #
- # Worth knowing for a security review: these are inventory calls
- # and none of them returns application data. DescribeTaskDefinition
- # is the widest - a task definition holds the container image, the
- # command, and any environment variables written into the
- # definition itself in plain text. Values injected from Secrets
- # Manager or Parameter Store are named there rather than resolved,
- # so what comes back is the reference and not the secret.
- - Sid: EcsInventory
- Effect: Allow
- Action:
- - ecs:DescribeCapacityProviders
- - ecs:DescribeClusters
- - ecs:DescribeContainerInstances
- - ecs:DescribeServices
- - ecs:DescribeTaskDefinition
- - ecs:DescribeTasks
- - ecs:ListClusters
- - ecs:ListContainerInstances
- - ecs:ListServices
- - ecs:ListTagsForResource
- - ecs:ListTaskDefinitionFamilies
- - ecs:ListTaskDefinitions
- - ecs:ListTasks
- Resource: "*"
-
- # Lambda is the next snapshot target after ECS. Granted here so
- # that adding it needs no change to a role you have already
- # reviewed and deployed; read-only, like everything above.
- - Sid: LambdaInventory
- Effect: Allow
- Action:
- - lambda:GetFunctionConfiguration
- - lambda:GetPolicy
- - lambda:ListAliases
- - lambda:ListFunctions
- - lambda:ListTags
- - lambda:ListVersionsByFunction
- Resource: "*"
-
- # Which buckets exist in a region, and bucket-level metadata,
- # for every bucket; no object key and no object. Cloud Capture
- # lists the buckets of a region to confirm the ones the tagging
- # API named (see S3FindBucketsByTag below) are there.
- - Sid: S3BucketMetadataOnly
- Effect: Allow
- Action:
- - s3:GetBucketLocation
- - s3:GetBucketLogging
- - s3:GetBucketPolicyStatus
- - s3:GetBucketPublicAccessBlock
- - s3:GetBucketTagging
- - s3:GetBucketVersioning
- - s3:GetEncryptionConfiguration
- - s3:ListAllMyBuckets
- Resource: "*"
-
- # How Cloud Capture finds the buckets to snapshot; not granted
- # when S3BucketNames is empty. A bucket is snapshotted only when
- # it carries one of the S3 opt-in tags you set in Kosli, so
- # Cloud Capture asks the Resource Groups Tagging API for the
- # buckets carrying one, in place of reading the tags of every
- # bucket in the account one by one on every scan.
- #
- # Worth knowing for a security review: AWS cannot scope this
- # permission to S3 or to particular resources. It lets the role
- # read the tag keys and values of every taggable resource in
- # the account, whatever its service. Cloud Capture asks for
- # resources of type s3:bucket carrying your opt-in tags, and
- # for nothing else. Tags are metadata, but if yours hold
- # anything you would not show Kosli, leave S3BucketNames empty.
- - !If
- - SnapshotsS3Buckets
- - Sid: S3FindBucketsByTag
- Effect: Allow
- Action:
- - tag:GetResources
- Resource: "*"
- - !Ref AWS::NoValue
-
- # What an S3 snapshot reads, in the buckets named in
- # S3BucketNames and no others; neither statement exists when
- # that parameter is empty. A snapshot records the fingerprint of
- # a bucket's content: Cloud Capture lists the object keys, then
- # reads the SHA256 checksum S3 stores for each object with a
- # HeadObject request, which returns the object's metadata and no
- # content.
- #
- # Worth knowing for a security review: AWS has no permission for
- # reading an object's checksum alone. HeadObject is authorised by
- # s3:GetObject, the permission that also authorises downloading
- # the object, so this role is able to read the content of every
- # object in the buckets you name. Cloud Capture downloads one
- # object only, and only if it exists: a `.kosli_ignore` file at
- # the root of the bucket, which lists the keys to leave out of
- # the fingerprint. Name only the buckets you want snapshotted.
- #
- # No KMS permission is granted, so objects encrypted with a KMS
- # key (SSE-KMS) cannot be read and their bucket's snapshot
- # fails. Objects under S3's default encryption (SSE-S3) need
- # nothing more than this.
- #
- # The ARNs are built from the list by joining it: for
- # `a,b` the first is arn:aws:s3:::a and arn:aws:s3:::b, and the
- # second arn:aws:s3:::a/* and arn:aws:s3:::b/*.
- - !If
- - SnapshotsS3Buckets
- - Sid: S3ListObjectKeysInNamedBuckets
- Effect: Allow
- Action:
- - s3:ListBucket
- Resource: !Split
- - ","
- - !Join
- - ""
- - - "arn:aws:s3:::"
- - !Join [",arn:aws:s3:::", !Ref S3BucketNames]
- - !Ref AWS::NoValue
-
- - !If
- - SnapshotsS3Buckets
- - Sid: S3ReadObjectChecksumsInNamedBuckets
- Effect: Allow
- Action:
- - s3:GetObject
- Resource: !Split
- - ","
- - !Join
- - ""
- - - "arn:aws:s3:::"
- - !Join ["/*,arn:aws:s3:::", !Ref S3BucketNames]
- - "/*"
- - !Ref AWS::NoValue
-
- # The explicit denies below are redundant given the allow-list
- # above, but they are here so that a security reviewer can
- # verify the boundary without having to reason about IAM
- # defaults, and so that any future widening of this policy cannot
- # accidentally grant data-plane access.
- #
- # s3:GetObject is denied everywhere except in the buckets named
- # in S3BucketNames, and everywhere when none is named.
- - !If
- - SnapshotsS3Buckets
- - Sid: NeverReadObjectDataOutsideNamedBuckets
- Effect: Deny
- Action:
- - s3:GetObject
- NotResource: !Split
- - ","
- - !Join
- - ""
- - - "arn:aws:s3:::"
- - !Join ["/*,arn:aws:s3:::", !Ref S3BucketNames]
- - "/*"
- - Sid: NeverReadObjectData
- Effect: Deny
- Action:
- - s3:GetObject
- Resource: "*"
-
- # Every other way to read an object, its earlier versions, its
- # ACL or its tags is denied in every bucket, named or not: a
- # snapshot needs none of them.
- - Sid: NeverReadObjectVersionsAclsOrTags
- Effect: Deny
- Action:
- - s3:GetObjectAcl
- - s3:GetObjectAttributes
- - s3:GetObjectTagging
- - s3:GetObjectTorrent
- - s3:GetObjectVersion
- - s3:GetObjectVersionAcl
- - s3:GetObjectVersionAttributes
- - s3:GetObjectVersionTagging
- - s3:ListMultipartUploadParts
- Resource: "*"
-
- # lambda:GetFunction returns a pre-signed URL to the deployment
- # package. That is source-code access, so it is denied outright.
- # GetLayerVersion does the same for a layer's package, and it is
- # also the IAM action behind the GetLayerVersionByArn API call,
- # so both routes to a layer's code are denied here.
- - Sid: NeverDownloadFunctionCode
- Effect: Deny
- Action:
- - lambda:GetFunction
- - lambda:GetLayerVersion
- Resource: "*"
-```
-
-### What capturing S3 buckets grants
-
-The S3 statements above exist only when you name buckets in the **S3 buckets** parameter. Three things are worth knowing for a security review:
-
-- **The role can read the content of every object in the buckets you name.** Cloud Capture reads the SHA256 checksum S3 stores for each object with a `HeadObject` request, which returns metadata and no content. AWS has no permission for reading a checksum alone: `HeadObject` is authorized by `s3:GetObject`, the permission that also authorizes a download. Cloud Capture downloads one object only, a `.kosli_ignore` file at the root of a bucket if there is one. Reads of object versions, ACLs, tags and attributes stay denied in every bucket, and `s3:GetObject` stays denied in every bucket you did not name.
-- **The role can read the tags of every taggable resource in the account.** Cloud Capture finds the buckets that carry one of your S3 opt-in tags by asking the Resource Groups Tagging API (`tag:GetResources`), which avoids reading the tags of every bucket one by one on every scan. AWS cannot scope that permission to S3 or to particular resources. Cloud Capture asks only for resources of type `s3:bucket` that carry an opt-in tag.
-- **No KMS permission is granted.** Objects encrypted with a KMS key (SSE-KMS) cannot be read, and their bucket's snapshot fails.
-
-A name in the parameter may use `*` and `?` as wildcards, as an IAM resource may. A bare `*` names every bucket in the account. Naming a bucket is a permission, not a selection: Cloud Capture snapshots a bucket only when it also carries one of your S3 opt-in tags.
-
-
-
-
-Azure support is in early access.
-
-Nothing is deployed in your Azure tenant. Kosli registers one multi-tenant application in Microsoft Entra, and Cloud Capture reads your subscription as that application. The application's credentials are Kosli's own and never leave Kosli. Access is granted in three steps, each of which you control:
-
-1. **Consent.** A Global Administrator of your tenant consents to the Kosli application, which creates its service principal in your tenant. Consent alone grants no access to any subscription.
-2. **Role assignments.** You assign the application two built-in roles on each subscription you want scanned:
-
- | Role | What Cloud Capture uses it for |
- |---|---|
- | `Reader` | Listing the App Service sites in the subscription, and reading resource group tags and the subscription's own tags |
- | `AcrPull` | Fingerprinting the container images of your web apps from your container registries |
-
-3. **A tag on the subscription.** You tag the subscription `kosli-external-id` with your organization's external ID. Cloud Capture refuses to list a subscription whose tag does not match the external ID of the organization it is working for.
-
-The registration form in the Kosli UI shows the consent link and the three Azure CLI commands with your values filled in; see [Getting started](/administration/cloud_capture/getting_started).
-
-To withdraw access, remove the role assignments or the tag from the subscription, or delete the application's service principal from your tenant, and remove the subscription from your registered accounts in Kosli.
-
-
-
-
-Google Cloud support is in early access.
-
-Kosli publishes a Terraform configuration, for use with
-[Infrastructure Manager](https://cloud.google.com/infrastructure-manager/docs), that creates
-everything Cloud Capture needs to snapshot Cloud Run and Google Kubernetes Engine (GKE).
-Infrastructure Manager runs Terraform as a managed service inside your project, so there is no
-state file or Terraform install for you to manage. Deploy the configuration once in each project
-you want Cloud Capture to snapshot. The [current version](https://kosli-cloud-capture-templates.s3.eu-central-1.amazonaws.com/gcp/v0.2.0/main.tf),
-`v0.2.0`, is published at
-`https://kosli-cloud-capture-templates.s3.eu-central-1.amazonaws.com/gcp/v0.2.0/main.tf`, and what
-this page describes is taken from it. Everything it creates is yours, in your project.
-
-Cloud Capture runs in AWS and reaches your project through
-[Workload Identity Federation](https://cloud.google.com/iam/docs/workload-identity-federation). Cloud
-Capture exchanges its own short-lived AWS credentials for a short-lived Google token, then
-impersonates a service account that you create. No service account key is ever created or shared.
-
-Your workload identity pool makes two checks before it issues a token:
-
-1. It accepts only credentials issued by the Kosli AWS account in which Cloud Capture runs.
-2. Within that account, it accepts only the Kosli-side IAM role dedicated to your organization.
- Every Cloud Capture job runs under the role for the organization it is working for. A job for
- another Kosli tenant presents a different role name, so your pool refuses it, even if that
- tenant gave Kosli your provider and service account details instead of their own.
-
-The role name is part of the credential that AWS signs and Google verifies, so the caller cannot
-forge it.
-
-For readers familiar with the AWS setup: the account check plays the part of the principal in the
-assume-role trust policy, and the role check plays the part of the external ID.
-
-### What the configuration creates
-
-| Resource | Name | What it is for |
-|---|---|---|
-| Workload identity pool | `kosli-capture` | Exchanges Cloud Capture's AWS credentials for a Google token |
-| AWS provider in the pool | `kosli-aws` | Accepts the Kosli AWS account and, within it, only the Kosli-side role for your organization |
-| Service account | `kosli-capture@.iam.gserviceaccount.com` | The identity Cloud Capture acts as in the project. Only the Kosli-side role for your organization may impersonate it |
-| Enabled APIs | IAM, IAM Credentials, Security Token Service, Cloud Run, Cloud Resource Manager, Cloud Asset | Needed to create the resources above and to make the read calls below. None is disabled if you destroy the deployment |
-
-The configuration takes three inputs, none of which has a default: `project_id`, and the two values
-Kosli supplies, `kosli_aws_account_id` and `kosli_role_name`. It emits two outputs,
-`kosli_capture_provider` and `kosli_capture_service_account`, which you enter when you register the
-project; see [Getting started](/administration/cloud_capture/getting_started).
-
-### Permissions granted to the service account
-
-All of the grants are read-only, and all are on the project.
-
-| Grant | Permissions | What Cloud Capture uses it for |
-|---|---|---|
-| `roles/run.viewer` | Google's predefined Cloud Run viewer role | Listing a region's Cloud Run services and jobs with their labels, and reading each service's revisions and images |
-| Custom role `kosliCaptureRegistry` | `artifactregistry.tags.get` | Resolving an image referenced by tag to its digest. This is a metadata read; no image layer is ever pulled |
-| Custom role `kosliCaptureGke` | `container.clusters.list`, `cloudasset.assets.listContainerPod`, `serviceusage.services.use` | Listing the project's GKE clusters with their labels, and reading the project's pods from [Cloud Asset Inventory](https://cloud.google.com/asset-inventory/docs/overview), in the same way as [`kosli snapshot gke`](/client_reference/kosli_snapshot_gke). Google requires `serviceusage.services.use` of every Cloud Asset Inventory call |
-
-Worth knowing for a security review of GKE:
-
-- Cloud Capture never calls a cluster's Kubernetes API. No Kubernetes RBAC objects are created
- inside your clusters, nothing is installed in them, and Cloud Capture needs no network access to
- any cluster control plane, so a private cluster is snapshotted like any other.
-- The GKE role is custom because Google's predefined roles are wider: `roles/cloudasset.viewer`
- would list every asset type in the project, including Kubernetes Secrets.
-- The role cannot be made narrower than every pod in the project, because Cloud Asset Inventory
- filters by neither cluster nor namespace. A pod's record holds its images, commands, arguments,
- labels, annotations, and any environment variables written into the spec in plain text. A value
- taken from a Kubernetes Secret appears as a reference and not as the secret.
-- A project inside a VPC Service Controls perimeter that restricts the Cloud Asset, Kubernetes
- Engine or Cloud Run API needs an ingress rule that admits the service account, because Cloud
- Capture calls from outside the perimeter.
-
-If you wish to grant access for Cloud Capture without using our published configuration, create
-the resources and grants in the two tables above. The pool must accept only the Kosli AWS account
-and, within it, only the Kosli-side role for your organization, and only that role may impersonate
-the service account.
-
-### The configuration in full
-
-
-
-```hcl
-# The Google Cloud resources Kosli Cloud Capture needs in a customer's
-# project, for use with Infrastructure Manager; the README beside this
-# directory says how to deploy it and why it is shaped as it is.
-#
-# Cloud Capture runs in AWS and reaches the project through Workload Identity
-# Federation: it exchanges its own short-lived AWS credentials for a
-# short-lived Google token, then impersonates the service account created
-# here. No service account key is ever created, stored or shared. The pool
-# makes two checks before it issues a token: the credentials were issued by
-# the Kosli AWS account that serves the customer, and within that account by
-# the one IAM role Kosli keeps for the customer's organisation. A Cloud
-# Capture job for another tenant runs under a different role and is refused.
-
-terraform {
- required_version = ">= 1.5"
-
- required_providers {
- google = {
- source = "hashicorp/google"
- version = ">= 5.0, < 8.0"
- }
- }
-}
-
-provider "google" {
- project = var.project_id
-}
-
-variable "project_id" {
- type = string
- description = "The GCP project that holds the Cloud Run services and jobs, and the GKE clusters, Cloud Capture will snapshot."
-
- validation {
- condition = can(regex("^[a-z][a-z0-9-]{4,28}[a-z0-9]$", var.project_id))
- error_message = "Must be a project id: 6 to 30 lowercase letters, digits and hyphens, starting with a letter."
- }
-}
-
-variable "kosli_aws_account_id" {
- type = string
- description = <<-EOT
- The AWS account in which Cloud Capture runs, supplied by Kosli. It differs
- per tenant because more than one Kosli account serves tenants. There
- is no default and no value you can derive yourself.
- EOT
-
- validation {
- condition = can(regex("^[0-9]{12}$", var.kosli_aws_account_id))
- error_message = "Must be the 12-digit AWS account id issued to you by Kosli."
- }
-}
-
-variable "kosli_role_name" {
- type = string
- description = <<-EOT
- The name of the IAM role, in the Kosli AWS account, that Cloud Capture
- uses when working for your organisation. Supplied by Kosli. Each Kosli
- organisation has its own role, and the workload identity pool accepts
- only this one, so only Cloud Capture jobs run on behalf of your
- organisation can obtain a token from your project. In the AWS setup,
- the external ID plays the same part.
- EOT
-
- validation {
- condition = can(regex("^[A-Za-z0-9+=,.@_-]{1,64}$", var.kosli_role_name))
- error_message = "Must be the IAM role name issued to you by Kosli."
- }
-}
-
-# The APIs the exchange and the inventory go through. Cloud Run is enabled
-# already in a project with services in it; the IAM ones are what creating a
-# pool, a service account and the custom roles, and impersonating the account,
-# need; Cloud Resource Manager is what granting the project roles below
-# needs, and a fresh project does not have it on; Cloud Asset is the
-# inventory a GKE snapshot reads the project's pods from, and costs nothing
-# to have on. None is disabled on destroy: they may well be in use by
-# something else in the project.
-#
-# The Kubernetes Engine API is not in the list. A project with clusters has
-# it on already, and enabling it in a project without them would switch on
-# Compute Engine and its other dependencies for nothing.
-resource "google_project_service" "needed" {
- for_each = toset([
- "iam.googleapis.com",
- "iamcredentials.googleapis.com",
- "sts.googleapis.com",
- "run.googleapis.com",
- "cloudresourcemanager.googleapis.com",
- "cloudasset.googleapis.com",
- ])
-
- project = var.project_id
- service = each.key
- disable_on_destroy = false
-}
-
-resource "google_iam_workload_identity_pool" "kosli_capture" {
- project = var.project_id
- workload_identity_pool_id = "kosli-capture"
- display_name = "Cloud Capture"
- description = <<-EOT
- Read-only access for Cloud Capture SDLC compliance evidence collection.
- Managed by Infrastructure Manager; do not edit in place.
- EOT
-
- depends_on = [google_project_service.needed]
-}
-
-resource "google_iam_workload_identity_pool_provider" "kosli_aws" {
- project = var.project_id
- workload_identity_pool_id = google_iam_workload_identity_pool.kosli_capture.workload_identity_pool_id
- workload_identity_pool_provider_id = "kosli-aws"
- display_name = "Cloud Capture (AWS)"
-
- aws {
- account_id = var.kosli_aws_account_id
- }
-
- # The role is read out of the assumed-role ARN AWS signed, less its
- # session name, so every session of the role is the one principal. The
- # subject is the role as well, and not the whole ARN: a subject is at most
- # 127 bytes, and the ARN carries the account, the session name and the
- # role's name, which can be 64 characters, so a long role name would put
- # the ARN over the limit and every exchange would fail.
- attribute_mapping = {
- "google.subject" = "assertion.arn.extract('assumed-role/{role}/')"
- "attribute.account" = "assertion.account"
- "attribute.aws_role" = "assertion.arn.extract('assumed-role/{role}/')"
- }
-
- # Two checks before the pool issues a token. The account check accepts only
- # credentials issued by the Kosli AWS account, however the token reaches
- # Google. The role check accepts, within that account, only the Kosli-side
- # role dedicated to your organisation. A Cloud Capture job for another tenant
- # runs under a different role and is refused here. In the AWS setup, these
- # checks correspond to the trust policy principal and the external ID.
- attribute_condition = join(" && ", [
- "attribute.account == \"${var.kosli_aws_account_id}\"",
- "attribute.aws_role == \"${var.kosli_role_name}\"",
- ])
-}
-
-resource "google_service_account" "kosli_capture" {
- project = var.project_id
- account_id = "kosli-capture"
- display_name = "Cloud Capture"
- description = "Impersonated by Cloud Capture to snapshot Cloud Run services and jobs, and GKE clusters. Managed by Infrastructure Manager."
-
- # Ordered after the APIs, as the pool is: creating a service account needs
- # iam.googleapis.com, which a project may not have enabled before this, and
- # the four bindings below follow through their references to the account.
- depends_on = [google_project_service.needed]
-}
-
-# Only the Kosli-side role for your organisation may impersonate the service
-# account. The pool's attribute condition already refuses every other identity;
-# naming the role here as well keeps the binding correct even if that condition
-# is later loosened.
-resource "google_service_account_iam_member" "kosli_impersonation" {
- service_account_id = google_service_account.kosli_capture.name
- role = "roles/iam.workloadIdentityUser"
- member = "principalSet://iam.googleapis.com/${google_iam_workload_identity_pool.kosli_capture.name}/attribute.aws_role/${var.kosli_role_name}"
-}
-
-# What the service account may read. Discovery lists the region's Cloud Run
-# services and jobs and reads each one's labels from the same listing, and
-# the snapshot reads each service's revisions and the images they run: all
-# of it is in roles/run.viewer, the predefined read-only role, and none of it
-# returns application data. A revision's spec is the widest: it holds the
-# container image, the command, and any environment variables written into
-# the spec in plain text; a value taken from a Secret is named there rather
-# than resolved, so what comes back is the reference and not the secret.
-resource "google_project_iam_member" "kosli_capture_run" {
- project = var.project_id
- role = "roles/run.viewer"
- member = google_service_account.kosli_capture.member
-}
-
-# The snapshot also resolves each image pinned by a tag to its digest, which
-# the Kosli CLI (2.57.0 on) reads from the Artifact Registry API: metadata
-# about the tag, and never the image. The predefined read-only role would
-# also grant downloadArtifacts, which pulls image layers, so a custom role
-# grants the one read the lookup makes and nothing that returns a layer.
-# The CLI's other lookup, a tag for an image pinned by digest, is behind a
-# flag Cloud Capture does not pass, so its permission
-# (artifactregistry.dockerimages.get) is not granted either. The CLI falls
-# back to reading the manifest when the API call fails; under this grant
-# that fallback cannot succeed, and nothing depends on it, since the
-# registries it could read are the ones the API lookup reads. Cloud Run
-# reports a service's image already pinned by digest, which the CLI takes
-# from the name, so what this grant resolves in practice is a job's image.
-# Without this grant a snapshot still succeeds, with an empty digest for
-# each tag-pinned image the account could not read.
-resource "google_project_iam_custom_role" "kosli_capture_registry" {
- project = var.project_id
- role_id = "kosliCaptureRegistry"
- title = "Cloud Capture registry metadata"
- description = "Read-only image tag metadata for Cloud Capture SDLC compliance evidence collection."
-
- permissions = ["artifactregistry.tags.get"]
-
- depends_on = [google_project_service.needed]
-}
-
-resource "google_project_iam_member" "kosli_capture_registry" {
- project = var.project_id
- role = google_project_iam_custom_role.kosli_capture_registry.id
- member = google_service_account.kosli_capture.member
-}
-
-# What the service account may read of the project's GKE clusters (beta).
-# Cloud Capture never connects to a cluster: it needs no network path to one,
-# no kubeconfig and no Kubernetes RBAC. Discovery lists the project's
-# clusters, with their labels, through the Kubernetes Engine API; the
-# snapshot reads the project's pods from Cloud Asset Inventory, Google's own
-# record of what is in the project, and Google requires
-# serviceusage.services.use of every call to it.
-#
-# A custom role because the predefined ones are wider than this:
-# roles/cloudasset.viewer lists every asset type in the project, and
-# roles/container.clusterViewer more than the one listing. It cannot be
-# narrower than every pod in the project, since Cloud Asset Inventory filters
-# by neither cluster nor namespace. A pod's record holds its spec and status:
-# the images, commands and arguments, its labels and annotations, and any
-# environment variables written into the spec in plain text; a value taken
-# from a Secret is named there rather than resolved, so what comes back is
-# the reference and not the secret. A cluster's listing holds its
-# configuration and no credentials.
-resource "google_project_iam_custom_role" "kosli_capture_gke" {
- project = var.project_id
- role_id = "kosliCaptureGke"
- title = "Cloud Capture (GKE)"
- description = "Lists GKE clusters, and their pods from Cloud Asset Inventory, for Cloud Capture. Managed by Infrastructure Manager."
-
- permissions = [
- "container.clusters.list",
- "cloudasset.assets.listContainerPod",
- "serviceusage.services.use",
- ]
-
- depends_on = [google_project_service.needed]
-}
-
-resource "google_project_iam_member" "kosli_capture_gke" {
- project = var.project_id
- role = google_project_iam_custom_role.kosli_capture_gke.id
- member = google_service_account.kosli_capture.member
-}
-
-# Kosli needs these two values to connect. Infrastructure Manager records them
-# on the deployment's latest revision, under applyResults.outputs.
-output "kosli_capture_provider" {
- description = "Full resource name of the workload identity provider; give this to Kosli."
- value = google_iam_workload_identity_pool_provider.kosli_aws.name
-}
-
-output "kosli_capture_service_account" {
- description = "Email of the service account Cloud Capture impersonates; give this to Kosli."
- value = google_service_account.kosli_capture.email
-}
-```
-
-
-
-### Deploying with Infrastructure Manager
-
-Download the configuration into an empty directory and run the following from it. Infrastructure
-Manager runs Terraform as the service account you name, so that service account needs permission to
-enable APIs and to create workload identity pools, service accounts, custom roles and project IAM
-bindings. The Kosli AWS account ID and role name are shown in the first step of the Google Cloud
-registration form in the Kosli UI.
-
-```bash
-gcloud infra-manager deployments apply \
- projects//locations//deployments/kosli-capture \
- --service-account=projects//serviceAccounts/@.iam.gserviceaccount.com \
- --local-source=. \
- --input-values=project_id=,kosli_aws_account_id=,kosli_role_name=
-```
-
-
-
+| Cloud | Identity in your account | Trust condition | Access granted | Details |
+|---|---|---|---|---|
+| AWS | An IAM role you create | Only Kosli's AWS account can assume the role, and only with the external ID of your organization | Read-only ECS and Lambda inventory, and bucket-level S3 metadata. If you name S3 buckets, the role can also read objects in those buckets and the tags of every taggable resource in the account | [AWS](/administration/cloud_capture/aws#permissions-and-security) |
+| Azure | A Kosli application you consent to | A `kosli-external-id` tag on the subscription that must match the external ID of your organization | The `Reader` and `AcrPull` roles on each subscription you choose | [Azure](/administration/cloud_capture/azure#permissions-and-security) |
+| Google Cloud | A service account you create | A workload identity pool that accepts only Kosli's AWS account and, within it, only the Kosli-side role for your organization | The Cloud Run viewer role and two read-only custom roles | [Google Cloud](/administration/cloud_capture/google_cloud#permissions-and-security) |
## How Kosli isolates tenants
Cloud Capture runs as a shared, autoscaled service, but each job runs under a role that is scoped to
one tenant.
-
-
-
-* A Cloud Capture worker picks up a job for your organization and assumes the role in your account
- using your externalId. A worker running for a different tenant is unable to read the externalId
- for your cloud account.
-* When the job finishes, the temporary credentials for your account are discarded. A worker holding
- credentials for your cloud account has no path to anyone else's account.
-* The ExternalId lives in Kosli's Parameter Store and is readable only by the Kosli-side role for your
- organization. The shared task role cannot read any tenant's ExternalId. Separation is enforced
- by IAM, not by application code.
-
-The trust policy on the role in your account limits access to the AWS account in which the Cloud
-Capture is running. The ExternalId acts as a shared secret between Kosli and you, so that only
-Cloud Capture is permitted to assume the role.
-
-
-
-
-* The Kosli application's credentials are held by Kosli and are not readable by the part of Cloud
- Capture that plans work, only by the workers that carry it out.
-* Before a worker lists anything in a subscription, it reads the subscription's `kosli-external-id`
- tag and compares it with the external ID of the organization the job is for. Only someone with
- write access to your subscription can set that tag, so another Kosli tenant that registered your
- subscription ID would be refused.
-* The application has access only to the subscriptions on which you assigned it a role.
-
-
-
-
-Each Cloud Capture job for your organization runs under the Kosli-side IAM role dedicated to your
-organization. The workload identity pool in your project accepts only that role, so a job running
-for a different tenant cannot obtain a token from your project or impersonate your service account.
-Separation is enforced by the identity provider, not by application code.
-
-
-
+How that scoping is enforced depends on the cloud; see tenant isolation on [AWS](/administration/cloud_capture/aws#tenant-isolation), [Azure](/administration/cloud_capture/azure#tenant-isolation), and [Google Cloud](/administration/cloud_capture/google_cloud#tenant-isolation).
Cloud Capture itself does not hold any tenant data. Snapshots taken by Cloud Capture are
immediately sent to Kosli through the same ingest path as your existing pipelines.
diff --git a/config/navigation.json b/config/navigation.json
index 276a28a..1ba96e1 100644
--- a/config/navigation.json
+++ b/config/navigation.json
@@ -204,6 +204,9 @@
"group": "Cloud Capture",
"pages": [
"administration/cloud_capture/overview",
+ "administration/cloud_capture/aws",
+ "administration/cloud_capture/azure",
+ "administration/cloud_capture/google_cloud",
"administration/cloud_capture/getting_started",
"administration/cloud_capture/security"
]