Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

Update GCP documentation

Tuan Dang533d49304a40
diff --git a/docs/documentation/platform/identities/aws-auth.mdx b/docs/documentation/platform/identities/aws-auth.mdx
index cf76ffce74..09fdb88659 100644
--- a/docs/documentation/platform/identities/aws-auth.mdx
+++ b/docs/documentation/platform/identities/aws-auth.mdx
@@ -37,7 +37,7 @@ At a high-level, Infisical authenticates an IAM principal by verifying its ident
then Infisical returns a short-lived access token that can be used to make authenticated requests to the Infisical API.
In AWS Auth, an IAM principal signs a `GetCallerIdentity` query using the [AWS Signature v4 algorithm](https://docs.aws.amazon.com/IAM/latest/UserGuide/create-signed-request.html); this is done using the credentials from the AWS environment where the IAM principal is running.
-The query data including the request method, request body, and request headers are sent to Infisical afterwhich Infisical forwards the signed query to AWS STS API via the [sts:GetCallerIdentity](https://docs.aws.amazon.com/STS/latest/APIReference/API_GetCallerIdentity.html) method to verify and obtain the identity of the IAM principal.
+The query data including the request method, request body, and request headers are sent to Infisical after which Infisical forwards the signed query to AWS STS API via the [sts:GetCallerIdentity](https://docs.aws.amazon.com/STS/latest/APIReference/API_GetCallerIdentity.html) method to verify and obtain the identity of the IAM principal.
Once obtained, the identity information is verified against specified requirements such as if the associated IAM principal ARN is allowed to authenticate with Infisical. If all is well, Infisical returns a short-lived access token that can be used to make authenticated requests to the Infisical API.
<Note>
diff --git a/docs/documentation/platform/identities/gcp-auth.mdx b/docs/documentation/platform/identities/gcp-auth.mdx
index 401471e4ba..012dfdaa3d 100644
--- a/docs/documentation/platform/identities/gcp-auth.mdx
+++ b/docs/documentation/platform/identities/gcp-auth.mdx
@@ -5,50 +5,50 @@ description: "Learn how to authenticate with Infisical for GCE instances and oth
**GCP Auth** is a GCP-native authentication method for GCP resources to access Infisical.
-- GCP GCE Auth: For Google Compute Engine (GCE) instances to authenticate with Infisical.
- GCP IAM Auth: For Google Cloud Platform (GCP) service accounts to authenticate with Infisical.
+- GCP GCE Auth: For Google Compute Engine (GCE) instances to authenticate with Infisical.
<Tabs>
- <Tab title="Google GCE Auth">
-
+<Tab title="GCP IAM Auth">
+
## Diagram
- The following sequence digram illustrates the GCP GCE Auth workflow for authenticating a GCE instance with Infisical.
+ The following sequence digram illustrates the GCP IAM Auth workflow for authenticating GCP IAM service accounts with Infisical.
```mermaid
sequenceDiagram
- participant GCE as GCE Instance
+ participant GCE as Client
participant Infis as Infisical
- participant Google as OAuth2 API
+ participant Google as Cloud IAM
- Note over GCE,Google: Step 1: Instance Identity Token Retrieval
- GCE->>Google: Request instance identity metadata token
- Google-->>GCE: Return JWT token with RS256 signature
+ Note over GCE,Google: Step 1: Signed JWT Token Generation
+ GCE->>Google: Request to generate signed JWT token
+ Google-->>GCE: Return signed JWT token
- Note over GCE,Infis: Step 2: Identity Token Login Operation
- GCE->>Infis: Send JWT token to /api/v1/auth/gcp-auth/login
- Infis->>Google: Request OAuth2 certificates
- Google-->>Infis: Return certificates
+ Note over GCE,Infis: Step 2: JWT Token Login Operation
+ GCE->>Infis: Send signed JWT token to /api/v1/auth/gcp-auth/login
+ Infis->>Google: Request public key
+ Google-->>Infis: Return public key
- Note over Infis: Step 3: Identity Token Verification
- Note over Infis: Step 4: Identity Property Validation
+ Note over Infis: Step 3: JWT Token Verification
+ Note over Infis: Step 4: JWT Property Validation
Infis->>GCE: Return short-lived access token
Note over GCE,Infis: Step 4: Access Infisical API with Token
GCE->>Infis: Make authenticated requests using the short-lived access token
```
- ## Concept
+## Concept
-At a high-level, Infisical authenticates a GCE instance by verifying its identity and checking that it meets specific requirements (e.g. it is an allowed GCE instance) at the `/api/v1/auth/gcp-auth/login` endpoint. If successful,
+At a high-level, Infisical authenticates an IAM service account by verifying its identity and checking that it meets specific requirements (e.g. it is an allowed service account) at the `/api/v1/auth/gcp-auth/login` endpoint. If successful,
then Infisical returns a short-lived access token that can be used to make authenticated requests to the Infisical API.
-In GCP GCE Auth, the client obtains an [instance identity metadata token](https://cloud.google.com/compute/docs/instances/verifying-instance-identity) constituting the identity for a GCE instance; this is a unique JWT token that includes details about the instance as well as Google's [RS256 signature](https://datatracker.ietf.org/doc/html/rfc7518#section-3.3).
-The token is sent to Infisical afterwhich Infisical verifies the token against Google's [public OAuth2 certificates](https://www.googleapis.com/oauth2/v3/certs) and checks if the associated instance is allowed to authenticate with Infisical. If all is well, Infisical returns a short-lived access token that can be used to make authenticated requests to the Infisical API.
+In GCP IAM Auth, the client generates a signed JWT using the `projects.serviceAccounts.signJwt` [API method](https://cloud.google.com/iam/docs/reference/credentials/rest/v1/projects.serviceAccounts/signJwt); this is done using the service account credentials from the GCP environment where the client is running.
+The signed JWT is sent to Infisical after which Infisical verifies the JWT and checks if the associated service account is allowed to authenticate with Infisical. If all is well, Infisical returns a short-lived access token that can be used to make authenticated requests to the Infisical API.
<Note>
We recommend using one of Infisical's clients like SDKs or the Infisical Agent
-to authenticate with Infisical using GCP GCE Auth as they handle the
+to authenticate with Infisical using GCP IAM Auth as they handle the
authentication process including generating the signed JWT token.
Also, note that Infisical needs network-level access to send requests to the Google Cloud API
@@ -56,10 +56,10 @@ as part of the GCP Auth workflow.
</Note>
-## Guide
+## Workflow
In the following steps, we explore how to create and use identities for your workloads and applications on GCP to
-access the Infisical API using the GCP GCE authentication method.
+access the Infisical API using the GCP IAM authentication method.
<Steps>
<Step title="Creating an identity">
@@ -76,16 +76,15 @@ access the Infisical API using the GCP GCE authentication method.
- Name (required): A friendly name for the identity.
- Role (required): A role from the **Organization Roles** tab for the identity to assume. The organization role assigned will determine what organization level resources this identity can have access to.
- Once you've created an identity, you'll be prompted to configure the authentication method for it. Here, select **GCP Auth** and set the **Type** to **GCP GCE Auth**.
+ Once you've created an identity, you'll be prompted to configure the authentication method for it. Here, select **GCP IAM Auth** and set the **Type** to **GCP IAM Auth**.
- ![identities create gcp auth method](/images/platform/identities/identities-org-create-gcp-gce-auth-method.png)
+ ![identities create gcp auth method](/images/platform/identities/identities-org-create-gcp-iam-auth-method.png)
Here's some more guidance on each field:
- - Service Account JSON: The JSON key file for the GCP service account that will be used by Infisical to look-up authenticated service account details.
- - Allowed Service Account Emails: A comma-separated list of trusted service account emails corresponding to the GCE instance(s) allowed to authenticate with Infisical; this could be something like `[email protected]`, `[email protected]`, etc.
- - Allowed Projects: A comma-separated list of trusted GCP projects that the GCE instance must belong to authenticate with Infisical.
- - Allowed Zones: A comma-separated list of trusted zones that the GCE instances must belong to authenticate with Infisical; this should be the fully-qualified zone name in the format `<region>-<zone>`like `us-central1-a`, `us-west1-b`, etc.
+ - Service Account JSON: The JSON key file for the GCP service account that will be used by Infisical to look-up other service account details; this service account should have the `iam.serviceAccounts.get` permission that can be found on the `roles/iam.serviceAccountKeyAdmin` role.
+ - Allowed Service Account Emails: A comma-separated list of trusted IAM service account emails that are allowed to authenticate with Infisical; this could be something like `[email protected]`, `[email protected]`, etc.
+ - Allowed Projects: A comma-separated list of trusted GCP projects that the IAM service accounts must belong to authenticate with Infisical.
- Access Token TTL (default is `2592000` equivalent to 30 days): The lifetime for an acccess token in seconds. This value will be referenced at renewal time.
- Access Token Max TTL (default is `2592000` equivalent to 30 days): The maximum lifetime for an acccess token in seconds. This value will be referenced at renewal time.
- Access Token Max Number of Uses (default is `0`): The maximum number of times that an access token can be used; a value of `0` implies infinite number of uses.
@@ -108,23 +107,47 @@ access the Infisical API using the GCP GCE authentication method.
![identities project create](/images/platform/identities/identities-project-create.png)
</Step>
<Step title="Accessing the Infisical API with the identity">
- To access the Infisical API as the identity, you need to generate an [instance identity metadata token](https://cloud.google.com/compute/docs/instances/verifying-instance-identity) constituting the identity of the present GCE instance and make a request to the `/api/v1/auth/gcp-auth/login` endpoint containing the token in exchange for an access token.
+ To access the Infisical API as the identity, you need to generate a signed JWT token using the `projects.serviceAccounts.signJwt` [API method](https://cloud.google.com/iam/docs/reference/credentials/rest/v1/projects.serviceAccounts/signJwt) and make a request to the `/api/v1/auth/gcp-auth/login` endpoint containing the signed JWT token in exchange for an access token.
+
+ <Info>
+ Make sure that the service account has the `iam.serviceAccounts.signJwt` permission or the `roles/iam.serviceAccountTokenCreator` role.
+ </Info>
We provide a few code examples below of how you can authenticate with Infisical to access the [Infisical API](/api-reference/overview/introduction).
<AccordionGroup>
<Accordion
- title="Sample code for generating the instance identity metadata token"
+ title="Sample code for generating a signed JWT token"
>
- Start by making a request from the GCE instance to obtain the instance identity metadata token.
+ The following code provides a generic example of how you can generate a signed JWT token against the `projects.serviceAccounts.signJwt` API method.
- #### Sample request
- ```bash Request
- curl -H "Metadata-Flavor: Google" \
- 'http://metadata/computeMetadata/v1/instance/service-accounts/default/identity?audience=${identityId}&format=full'
- ```
+ The shown example uses Node.js and the official [google-auth-library](https://github.com/googleapis/google-auth-library-nodejs#readme) package but you can use any language you wish.
- Next use send the obtained JWT token along to authenticate with Infisical and obtain an access token.
+
+ ```javascript
+ const { GoogleAuth } = require("google-auth-library");
+
+ const auth = new GoogleAuth({
+ scopes: "https://www.googleapis.com/auth/cloud-platform",
+ });
+
+ const credentials = await auth.getCredentials();
+
+ const identityId = "<your-infisical-identity-id>";
+
+ const jwtPayload = {
+ sub: credentials.client_email,
+ aud: identityId,
+ };
+
+ const { data } = await client.request({
+ url: `https://iamcredentials.googleapis.com/v1/projects/-/serviceAccounts/${credentials.client_email}:signJwt`,
+ method: "POST",
+ data: { payload: JSON.stringify(jwtPayload) },
+ });
+
+ const jwt = data.signedJwt // send this jwt to Infisical in the next step
+ ```
#### Sample request
@@ -162,48 +185,47 @@ access the Infisical API using the GCP GCE authentication method.
</Step>
</Steps>
-
</Tab>
- <Tab title="GCP IAM Auth">
-
+ <Tab title="Google GCE Auth">
+
## Diagram
- The following sequence digram illustrates the GCP IAM Auth workflow for authenticating GCP IAM service accounts with Infisical.
+ The following sequence digram illustrates the GCP GCE Auth workflow for authenticating a GCE instance with Infisical.
```mermaid
sequenceDiagram
- participant GCE as Client
+ participant GCE as GCE Instance
participant Infis as Infisical
- participant Google as Cloud IAM
+ participant Google as OAuth2 API
- Note over GCE,Google: Step 1: Signed JWT Token Generation
- GCE->>Google: Request to generate signed JWT token
- Google-->>GCE: Return signed JWT token
+ Note over GCE,Google: Step 1: Instance Identity Token Retrieval
+ GCE->>Google: Request instance identity metadata token
+ Google-->>GCE: Return JWT token with RS256 signature
- Note over GCE,Infis: Step 2: JWT Token Login Operation
- GCE->>Infis: Send signed JWT token to /api/v1/auth/gcp-auth/login
- Infis->>Google: Request public key
- Google-->>Infis: Return public key
+ Note over GCE,Infis: Step 2: Identity Token Login Operation
+ GCE->>Infis: Send JWT token to /api/v1/auth/gcp-auth/login
+ Infis->>Google: Request OAuth2 certificates
+ Google-->>Infis: Return certificates
- Note over Infis: Step 3: JWT Token Verification
- Note over Infis: Step 4: JWT Property Validation
+ Note over Infis: Step 3: Identity Token Verification
+ Note over Infis: Step 4: Identity Property Validation
Infis->>GCE: Return short-lived access token
Note over GCE,Infis: Step 4: Access Infisical API with Token
GCE->>Infis: Make authenticated requests using the short-lived access token
```
-## Concept
+ ## Concept
-At a high-level, Infisical authenticates an IAM service account by verifying its identity and checking that it meets specific requirements (e.g. it is an allowed service account) at the `/api/v1/auth/gcp-auth/login` endpoint. If successful,
+At a high-level, Infisical authenticates a GCE instance by verifying its identity and checking that it meets specific requirements (e.g. it is an allowed GCE instance) at the `/api/v1/auth/gcp-auth/login` endpoint. If successful,
then Infisical returns a short-lived access token that can be used to make authenticated requests to the Infisical API.
-In GCP IAM Auth, the client generates a signed JWT using the `projects.serviceAccounts.signJwt` [API method](https://cloud.google.com/iam/docs/reference/credentials/rest/v1/projects.serviceAccounts/signJwt); this is done using the service account credentials from the GCP environment where the client is running.
-The signed JWT is sent to Infisical afterwhich Infisical verifies the JWT and checks if the associated service account is allowed to authenticate with Infisical. If all is well, Infisical returns a short-lived access token that can be used to make authenticated requests to the Infisical API.
+In GCP GCE Auth, the client obtains an [instance identity metadata token](https://cloud.google.com/compute/docs/instances/verifying-instance-identity) constituting the identity for a GCE instance; this is a unique JWT token that includes details about the instance as well as Google's [RS256 signature](https://datatracker.ietf.org/doc/html/rfc7518#section-3.3).
+The token is sent to Infisical after which Infisical verifies the token against Google's [public OAuth2 certificates](https://www.googleapis.com/oauth2/v3/certs) and checks if the associated instance is allowed to authenticate with Infisical. If all is well, Infisical returns a short-lived access token that can be used to make authenticated requests to the Infisical API.
<Note>
We recommend using one of Infisical's clients like SDKs or the Infisical Agent
-to authenticate with Infisical using GCP IAM Auth as they handle the
+to authenticate with Infisical using GCP GCE Auth as they handle the
authentication process including generating the signed JWT token.
Also, note that Infisical needs network-level access to send requests to the Google Cloud API
@@ -211,10 +233,10 @@ as part of the GCP Auth workflow.
</Note>
-## Workflow
+## Guide
In the following steps, we explore how to create and use identities for your workloads and applications on GCP to
-access the Infisical API using the GCP IAM authentication method.
+access the Infisical API using the GCP GCE authentication method.
<Steps>
<Step title="Creating an identity">
@@ -231,15 +253,16 @@ access the Infisical API using the GCP IAM authentication method.
- Name (required): A friendly name for the identity.
- Role (required): A role from the **Organization Roles** tab for the identity to assume. The organization role assigned will determine what organization level resources this identity can have access to.
- Once you've created an identity, you'll be prompted to configure the authentication method for it. Here, select **GCP IAM Auth** and set the **Type** to **GCP IAM Auth**.
+ Once you've created an identity, you'll be prompted to configure the authentication method for it. Here, select **GCP Auth** and set the **Type** to **GCP GCE Auth**.
- ![identities create gcp auth method](/images/platform/identities/identities-org-create-gcp-iam-auth-method.png)
+ ![identities create gcp auth method](/images/platform/identities/identities-org-create-gcp-gce-auth-method.png)
Here's some more guidance on each field:
- Service Account JSON: The JSON key file for the GCP service account that will be used by Infisical to look-up authenticated service account details.
- - Allowed Service Account Emails: A comma-separated list of trusted IAM service account emails that are allowed to authenticate with Infisical; this could be something like `[email protected]`, `[email protected]`, etc.
- - Allowed Projects: A comma-separated list of trusted GCP projects that the IAM service accounts must belong to authenticate with Infisical.
+ - Allowed Service Account Emails: A comma-separated list of trusted service account emails corresponding to the GCE instance(s) allowed to authenticate with Infisical; this could be something like `[email protected]`, `[email protected]`, etc.
+ - Allowed Projects: A comma-separated list of trusted GCP projects that the GCE instance must belong to authenticate with Infisical.
+ - Allowed Zones: A comma-separated list of trusted zones that the GCE instances must belong to authenticate with Infisical; this should be the fully-qualified zone name in the format `<region>-<zone>`like `us-central1-a`, `us-west1-b`, etc.
- Access Token TTL (default is `2592000` equivalent to 30 days): The lifetime for an acccess token in seconds. This value will be referenced at renewal time.
- Access Token Max TTL (default is `2592000` equivalent to 30 days): The maximum lifetime for an acccess token in seconds. This value will be referenced at renewal time.
- Access Token Max Number of Uses (default is `0`): The maximum number of times that an access token can be used; a value of `0` implies infinite number of uses.
@@ -262,51 +285,24 @@ access the Infisical API using the GCP IAM authentication method.
![identities project create](/images/platform/identities/identities-project-create.png)
</Step>
<Step title="Accessing the Infisical API with the identity">
- To access the Infisical API as the identity, you need to generate a signed JWT token using the `projects.serviceAccounts.signJwt` [API method](https://cloud.google.com/iam/docs/reference/credentials/rest/v1/projects.serviceAccounts/signJwt) and make a request to the `/api/v1/auth/gcp-auth/login` endpoint containing the signed JWT token in exchange for an access token.
+ To access the Infisical API as the identity, you need to generate an [instance identity metadata token](https://cloud.google.com/compute/docs/instances/verifying-instance-identity) constituting the identity of the present GCE instance and make a request to the `/api/v1/auth/gcp-auth/login` endpoint containing the token in exchange for an access token.
We provide a few code examples below of how you can authenticate with Infisical to access the [Infisical API](/api-reference/overview/introduction).
<AccordionGroup>
<Accordion
- title="Sample code for generating a signed JWT token"
+ title="Sample code for generating the instance identity metadata token"
>
- The following code provides a generic example of how you can generate a signed JWT token against the `projects.serviceAccounts.signJwt` API method.
-
- The shown example uses Node.js and the official [google-auth-library](https://github.com/googleapis/google-auth-library-nodejs#readme) package but you can use any language you wish.
-
- <Info>
- The example assumes that you have created a GCP service account and have downloaded the JSON key file for it.
-
- Make sure that the service account has the `iam.serviceAccounts.signJwt` permission; this is available on the `roles/iam.serviceAccountTokenCreator` role.
- </Info>
-
- ```javascript
- const { GoogleAuth } = require("google-auth-library");
-
- const auth = new GoogleAuth({
- keyFile: serviceAccountKeyFile, // path to the service account JSON key file
- scopes: "https://www.googleapis.com/auth/cloud-platform",
- });
-
- const client = await auth.getClient();
- const projectId = await auth.getProjectId();
-
- const identityId = "<your-infisical-identity-id>";
-
- const jwtPayload = {
- sub: client.email,
- aud: identityId,
- };
-
- const { data } = await client.request({
- url: `https://iamcredentials.googleapis.com/v1/projects/-/serviceAccounts/${client.email}:signJwt`,
- method: "POST",
- data: { payload: JSON.stringify(jwtPayload) },
- });
+ Start by making a request from the GCE instance to obtain the instance identity metadata token.
- const jwt = data.signedJwt // send this jwt to Infisical in the next step
+ #### Sample request
+ ```bash Request
+ curl -H "Metadata-Flavor: Google" \
+ 'http://metadata/computeMetadata/v1/instance/service-accounts/default/identity?audience=${identityId}&format=full'
```
+ Next use send the obtained JWT token along to authenticate with Infisical and obtain an access token.
+
#### Sample request
```bash Request
@@ -343,5 +339,7 @@ access the Infisical API using the GCP IAM authentication method.
</Step>
</Steps>
+
</Tab>
+
</Tabs>
diff --git a/docs/documentation/platform/identities/universal-auth.mdx b/docs/documentation/platform/identities/universal-auth.mdx
index bad96c0e30..2517e53b97 100644
--- a/docs/documentation/platform/identities/universal-auth.mdx
+++ b/docs/documentation/platform/identities/universal-auth.mdx
@@ -148,7 +148,7 @@ using the Universal Auth authentication method.
- The client secret/access token is being used from an untrusted IP.
</Accordion>
<Accordion title="What is access token renewal and TTL/Max TTL?">
- A identity access token can have a time-to-live (TTL) or incremental lifetime afterwhich it expires.
+ A identity access token can have a time-to-live (TTL) or incremental lifetime after which it expires.
In certain cases, you may want to extend the lifespan of an access token; to do so, you must set a max TTL parameter.