Configuring different projects with different Identity and Access Management (IAM) roles
establishes [separation of duties](https://docs.cloud.google.com/kms/docs/separation-of-duties.md.txt) among
individuals or teams for typical activities associated with using
Binary Authorization.

## Project types

The following table describes types of projects and the resources they contain.
Depending on your setup, a single project might serve multiple purposes. For
example, a project that contains your runtime and the images that you deploy to
the runtime is both a Deployer project and an Image project.

| Project type | Description |
|---|---|
| **Deployer** | A project that manages the Google Kubernetes Engine (GKE) clusters where your images are deployed, as well as the Binary Authorization policy that governs deployment. |
| **Image** | A project that contains the images to be verified. |
| **Attestor** | A project that stores attestor definitions. You can also use the note project for this purpose. |
| **Note** | A project that stores attestor notes for a particular attestor definition. You can also use the attestor project for this purpose. |
| **Attestation** | A project that stores attestations for a particular attestor. You can also use the attestor project or the image project for this purpose. |

## Activities and associated roles

In Google Cloud, separation of duties is accomplished by granting
IAM roles to principals in different projects. These principals
include service accounts, used by GKE and
Binary Authorization, and user accounts, accessed by people.

By providing different organizational roles with specific IAM
roles, you can enforce the
[principle of least privilege](https://docs.cloud.google.com/iam/docs/using-iam-securely.md.txt#least_privilege),
ensuring that the user and service accounts in your organization have only the
roles essential to performing their intended functions. Binary Authorization
provides [predefined roles](https://docs.cloud.google.com/binary-authorization/docs/access-control/roles-permissions.md.txt) for controlling access to
policies and attestors.

The following table describes typical Binary Authorization activities. Separation of
duties is achieved by having separate Google Cloud project. Each project is
only granted the minimum required IAM roles to accomplish the
activity and associated tasks.

For an end-to-end tutorial describing this scenario, see:
[Multi-project setup](https://docs.cloud.google.com/binary-authorization/docs/multi-project-setup-cli.md.txt).

| Activity | Task | Roles on Deployer project | Roles on Attestor project | Roles on Attestation project |
|---|---|---|---|---|
| Security Operations (SecOps) management | Create attestors | None | roles/containeranalysis.notesEditor roles/binaryauthorization.attestorsAdmin | None |
| Security Operations (SecOps) management | Configure Binary Authorization policy | roles/binaryauthorization.policyEditor | roles/binaryauthorization.attestorsViewer | None |
| Deployment management | Enable Binary Authorization for a cluster | roles/serviceusage.serviceUsageAdmin roles/container.clusterAdmin | None | None |
| Attestation management | Create attestations | None | roles/containeranalysis.notes.attacher | roles/containeranalysis.occurrences.editor |

## Check permissions

You can use the following methods when building permission-aware UIs and
command-line tools.

- [`binaryauthorization.attestors.testIamPermissions`](https://docs.cloud.google.com/binary-authorization/docs/reference/rest/v1/projects.attestors/testIamPermissions.md.txt)
- [`binaryauthorization.policy.testIamPermissions`](https://docs.cloud.google.com/binary-authorization/docs/reference/rest/v1/projects.policy/testIamPermissions.md.txt)

Requests return permissions that a caller has on the specified resource.
Any identity can call these methods.

These methods aren't for authorization checking and might fail open without
warning.