# Export GET /api/v1/organization/audit-logs Get all audit logs for an organization # Attach POST /api/v1/auth/aws-auth/identities/{identityId} Attach AWS Auth configuration onto identity # Login POST /api/v1/auth/aws-auth/login Login with AWS Auth # Retrieve GET /api/v1/auth/aws-auth/identities/{identityId} Retrieve AWS Auth configuration on identity # Revoke DELETE /api/v1/auth/aws-auth/identities/{identityId} Delete AWS Auth configuration on identity # Update PATCH /api/v1/auth/aws-auth/identities/{identityId} Update AWS Auth configuration on identity # Attach POST /api/v1/auth/azure-auth/identities/{identityId} Attach Azure Auth configuration onto identity # Login POST /api/v1/auth/azure-auth/login Login with Azure Auth # Retrieve GET /api/v1/auth/azure-auth/identities/{identityId} Retrieve Azure Auth configuration on identity # Revoke DELETE /api/v1/auth/azure-auth/identities/{identityId} Delete Azure Auth configuration on identity # Update PATCH /api/v1/auth/azure-auth/identities/{identityId} Update Azure Auth configuration on identity # Retrieve certificate / chain GET /api/v1/pki/ca/{caId}/certificate Get current CA cert and cert chain of a CA # Create POST /api/v1/pki/ca Create CA # List CRLs GET /api/v1/pki/ca/{caId}/crls Get list of CRLs of the CA # Get CSR GET /api/v1/pki/ca/{caId}/csr Get CA CSR # Delete DELETE /api/v1/pki/ca/{caId} Delete CA # Import certificate POST /api/v1/pki/ca/{caId}/import-certificate Import certificate and chain to CA # Issue certificate POST /api/v1/pki/ca/{caId}/issue-certificate Issue certificate from CA # List GET /api/v2/workspace/{slug}/cas # List CA certificates GET /api/v1/pki/ca/{caId}/ca-certificates Get list of past and current CA certificates for a CA # Retrieve GET /api/v1/pki/ca/{caId} Get CA # Renew POST /api/v1/pki/ca/{caId}/renew Perform CA certificate renewal # Sign certificate POST /api/v1/pki/ca/{caId}/sign-certificate Sign certificate from CA # Sign intermediate certificate POST /api/v1/pki/ca/{caId}/sign-intermediate Create intermediate CA certificate from parent CA # Update PATCH /api/v1/pki/ca/{caId} Update CA # Create POST /api/v1/pki/certificate-templates # Delete DELETE /api/v1/pki/certificate-templates/{certificateTemplateId} # Get by ID GET /api/v1/pki/certificate-templates/{certificateTemplateId} # Update PATCH /api/v1/pki/certificate-templates/{certificateTemplateId} # Get Certificate Body / Chain GET /api/v1/pki/certificates/{serialNumber}/certificate Get certificate body of certificate # Delete DELETE /api/v1/pki/certificates/{serialNumber} Delete certificate # Issue Certificate POST /api/v1/pki/certificates/issue-certificate Issue certificate # List GET /api/v2/workspace/{slug}/certificates # Retrieve GET /api/v1/pki/certificates/{serialNumber} Get certificate # Revoke POST /api/v1/pki/certificates/{serialNumber}/revoke Revoke # Sign Certificate POST /api/v1/pki/certificates/sign-certificate Sign certificate # Create POST /api/v1/dynamic-secrets # Create Lease POST /api/v1/dynamic-secrets/leases # Delete DELETE /api/v1/dynamic-secrets/{name} # Delete Lease DELETE /api/v1/dynamic-secrets/leases/{leaseId} # Get GET /api/v1/dynamic-secrets/{name} # Get Lease GET /api/v1/dynamic-secrets/leases/{leaseId} # List GET /api/v1/dynamic-secrets # List Leases GET /api/v1/dynamic-secrets/{name}/leases # Renew Lease POST /api/v1/dynamic-secrets/leases/{leaseId}/renew # Update PATCH /api/v1/dynamic-secrets/{name} # Create POST /api/v1/workspace/{workspaceId}/environments Create environment # Delete DELETE /api/v1/workspace/{workspaceId}/environments/{id} Delete environment # Update PATCH /api/v1/workspace/{workspaceId}/environments/{id} Update environment # Create POST /api/v1/folders Create folders # Delete DELETE /api/v1/folders/{folderIdOrName} Delete a folder # Get by ID GET /api/v1/folders/{id} Get folder by id # List GET /api/v1/folders Get folders # Update PATCH /api/v1/folders/{folderId} Update folder # Attach POST /api/v1/auth/gcp-auth/identities/{identityId} Attach GCP Auth configuration onto identity # Login POST /api/v1/auth/gcp-auth/login Login with GCP Auth # Retrieve GET /api/v1/auth/gcp-auth/identities/{identityId} Retrieve GCP Auth configuration on identity # Revoke DELETE /api/v1/auth/gcp-auth/identities/{identityId} Delete GCP Auth configuration on identity # Update PATCH /api/v1/auth/gcp-auth/identities/{identityId} Update GCP Auth configuration on identity # Add Group User POST /api/v1/groups/{id}/users/{username} # Create POST /api/v1/groups # Delete DELETE /api/v1/groups/{id} # Get Groups in Organization GET /api/v1/groups # Get By ID GET /api/v1/groups/{id} # List Group Users GET /api/v1/groups/{id}/users # Remove Group User DELETE /api/v1/groups/{id}/users/{username} # Update PATCH /api/v1/groups/{id} # Create POST /api/v1/identities Create identity # Delete DELETE /api/v1/identities/{identityId} Delete identity # Get By ID GET /api/v1/identities/{identityId} Get an identity by id # List GET /api/v1/identities List identities # Update PATCH /api/v1/identities/{identityId} Update identity # Create Permanent POST /api/v1/additional-privilege/identity/permanent Create a permanent or a non expiry specific privilege for identity. # Create Temporary POST /api/v1/additional-privilege/identity/temporary Create a temporary or a expiring specific privilege for identity. # Delete DELETE /api/v1/additional-privilege/identity Delete a specific privilege of an identity. # Find By Privilege Slug GET /api/v1/additional-privilege/identity/{privilegeSlug} Retrieve details of a specific privilege by privilege slug. # List GET /api/v1/additional-privilege/identity List of a specific privilege of an identity in a project. # Update PATCH /api/v1/additional-privilege/identity Update a specific privilege of an identity. # Create POST /api/v1/integration Create an integration to sync secrets. ## Integration Parameters The integration creation endpoint is generic and can be used for all native integrations. For specific integration parameters for a given service, please review the respective documentation below. The ID of the integration auth object for authentication with AWS. Refer [Create Integration Auth](./create-auth) for more info Whether the integration should be active or inactive The secret name used when saving secret in AWS SSM. Used for naming and can be arbitrary. The AWS region of the SSM. Example: `us-east-1` The Infisical environment slug from where secrets will be synced from. Example: `dev` The Infisical folder path from where secrets will be synced from. Example: `/some/path`. The root of the environment is `/`. Coming Soon Coming Soon # Create Auth POST /api/v1/integration-auth/access-token Create the integration authentication object required for syncing secrets. ## Integration Authentication Parameters The integration authentication endpoint is generic and can be used for all native integrations. For specific integration parameters for a given service, please review the respective documentation below. This value must be **aws-secret-manager**. Infisical project id for the integration. The AWS IAM User Access ID. The AWS IAM User Access Secret Key. Coming Soon Coming Soon # Delete DELETE /api/v1/integration/{integrationId} Remove an integration using the integration object ID # Delete Auth DELETE /api/v1/integration-auth Remove all integration's auth object from the project. # Delete Auth By ID DELETE /api/v1/integration-auth/{integrationAuthId} Remove an integration auth object by object id. # Get Auth By ID GET /api/v1/integration-auth/{integrationAuthId} Get details of an integration authorization by auth object id. # List Auth GET /api/v1/workspace/{workspaceId}/authorizations List integration auth objects for a workspace. # List Project Integrations GET /api/v1/workspace/{workspaceId}/integrations List integrations for a project. # Update PATCH /api/v1/integration/{integrationId} Update an integration by integration id # Create Key POST /api/v1/kms/keys Create KMS key # Decrypt Data POST /api/v1/kms/keys/{keyId}/decrypt Decrypt data with KMS key # Delete Key DELETE /api/v1/kms/keys/{keyId} Delete KMS key # Encrypt Data POST /api/v1/kms/keys/{keyId}/encrypt Encrypt data with KMS key # List Keys Get /api/v1/kms/keys List KMS keys # Update Key PATCH /api/v1/kms/keys/{keyId} Update KMS key # Attach POST /api/v1/auth/kubernetes-auth/identities/{identityId} Attach Kubernetes Auth configuration onto identity # Login POST /api/v1/auth/kubernetes-auth/login Login with Kubernetes Auth # Retrieve GET /api/v1/auth/kubernetes-auth/identities/{identityId} Retrieve Kubernetes Auth configuration on identity # Revoke DELETE /api/v1/auth/kubernetes-auth/identities/{identityId} Delete Kubernetes Auth configuration on identity # Update PATCH /api/v1/auth/kubernetes-auth/identities/{identityId} Update Kubernetes Auth configuration on identity # Attach POST /api/v1/auth/oidc-auth/identities/{identityId} Attach OIDC Auth configuration onto identity # Login POST /api/v1/auth/oidc-auth/login Login with OIDC Auth # Retrieve GET /api/v1/auth/oidc-auth/identities/{identityId} Retrieve OIDC Auth configuration on identity # Revoke DELETE /api/v1/auth/oidc-auth/identities/{identityId} Delete OIDC Auth configuration on identity # Update PATCH /api/v1/auth/oidc-auth/identities/{identityId} Update OIDC Auth configuration on identity # Delete User Membership DELETE /api/v2/organizations/{organizationId}/memberships/{membershipId} Delete organization user memberships # List Identity Memberships GET /api/v2/organizations/{orgId}/identity-memberships Return organization identity memberships # Get User Memberships GET /api/v2/organizations/{organizationId}/memberships Return organization user memberships # Update User Membership PATCH /api/v2/organizations/{organizationId}/memberships/{membershipId} Update organization user memberships # Get Projects GET /api/v2/organizations/{organizationId}/workspaces Return projects in organization that user is apart of # Create POST /api/v1/pki/alerts Create PKI alert # Delete DELETE /api/v1/pki/alerts/{alertId} Delete PKI alert # Retrieve GET /api/v1/pki/alerts/{alertId} Get PKI alert # Update PATCH /api/v1/pki/alerts/{alertId} Update PKI alert # Add Collection Item POST /api/v1/pki/collections/{collectionId}/items Add item to PKI collection # Create POST /api/v1/pki/collections Create PKI collection # Delete DELETE /api/v1/pki/collections/{collectionId} Delete PKI collection # Delete Collection Item DELETE /api/v1/pki/collections/{collectionId}/items/{collectionItemId} Remove item from PKI collection # Retrieve GET /api/v1/pki/collections/{collectionId}/items Get items in PKI collection # Retrieve GET /api/v1/pki/collections/{collectionId} Get PKI collection # Update PATCH /api/v1/pki/collections/{collectionId} Update PKI collection # Create Project Membership POST /api/v2/workspace/{projectId}/groups/{groupId} Add group to project # Delete Project Membership DELETE /api/v2/workspace/{projectId}/groups/{groupId} Remove group from project # Get Project Membership GET /api/v2/workspace/{projectId}/groups/{groupId} Return project group # List Project Memberships GET /api/v2/workspace/{projectId}/groups Return list of groups in project # Update Project Membership PATCH /api/v2/workspace/{projectId}/groups/{groupId} Update group in project # Create Identity Membership POST /api/v2/workspace/{projectId}/identity-memberships/{identityId} Create project identity membership # Delete Identity Membership DELETE /api/v2/workspace/{projectId}/identity-memberships/{identityId} Delete project identity memberships # Get Identity by ID GET /api/v2/workspace/{projectId}/identity-memberships/{identityId} Return project identity membership # List Identity Memberships GET /api/v2/workspace/{projectId}/identity-memberships Return project identity memberships # Update Identity Membership PATCH /api/v2/workspace/{projectId}/identity-memberships/{identityId} Update project identity memberships # Create POST /api/v1/workspace/{projectSlug}/roles Create a project role You can read more about the permissions field in the [permissions documentation](/internals/permissions). # Delete DELETE /api/v1/workspace/{projectSlug}/roles/{roleId} Delete a project role # Get By Slug GET /api/v1/workspace/{projectSlug}/roles/slug/{slug} # List GET /api/v1/workspace/{projectSlug}/roles List project role # Update PATCH /api/v1/workspace/{projectSlug}/roles/{roleId} Update a project role # Create POST /api/v1/project-templates Create a project template. You can read more about the role's permissions field in the [permissions documentation](/internals/permissions). # Delete DELETE /api/v1/project-templates/{templateId} Delete a project template. # Get By ID GET /api/v1/project-templates/{templateId} Get a project template by ID. # List GET /api/v1/project-templates List project templates for the current organization. # Update PATCH /api/v1/project-templates/{templateId} Update a project template. You can read more about the role's permissions field in the [permissions documentation](/internals/permissions). # Get By Username POST /api/v1/workspace/{workspaceId}/memberships/details Return project user memberships # Invite Member POST /api/v2/workspace/{projectId}/memberships Invite members to project # Get User Memberships GET /api/v1/workspace/{workspaceId}/memberships Return project user memberships # Remove Member DELETE /api/v2/workspace/{projectId}/memberships Remove members from project # Update User Membership PATCH /api/v1/workspace/{workspaceId}/memberships/{membershipId} Update project user membership # Create POST /api/v1/secret-imports Create secret imports # Delete DELETE /api/v1/secret-imports/{secretImportId} Delete secret imports # List GET /api/v1/secret-imports Get secret imports # Update PATCH /api/v1/secret-imports/{secretImportId} Update secret imports # Create POST /api/v1/workspace/{projectId}/tags # Delete DELETE /api/v1/workspace/{projectId}/tags/{tagId} # Get By ID GET /api/v1/workspace/{projectId}/tags/{tagId} # Get By Slug GET /api/v1/workspace/{projectId}/tags/slug/{tagSlug} # List GET /api/v1/workspace/{projectId}/tags # Update PATCH /api/v1/workspace/{projectId}/tags/{tagId} # Attach tags POST /api/v3/secrets/tags/{secretName} Attach tags to a secret # Create POST /api/v3/secrets/raw/{secretName} Create secret # Bulk Create POST /api/v3/secrets/batch/raw Create many secrets # Delete DELETE /api/v3/secrets/raw/{secretName} Delete secret # Bulk Delete DELETE /api/v3/secrets/batch/raw Delete many secrets # Detach tags DELETE /api/v3/secrets/tags/{secretName} Detach tags from a secret # List GET /api/v3/secrets/raw List secrets # Retrieve GET /api/v3/secrets/raw/{secretName} Get a secret by name # Update PATCH /api/v3/secrets/raw/{secretName} Update secret # Bulk Update PATCH /api/v3/secrets/batch/raw Update many secrets # Get GET /api/v2/service-token Return Infisical Token data This endpoint is deprecated and will be removed in the future. We recommend switching to using [Machine Identities](/documentation/platform/identities/machine-identities). # Attach POST /api/v1/auth/token-auth/identities/{identityId} Attach Token Auth configuration onto identity # Create Token POST /api/v1/auth/token-auth/identities/{identityId}/tokens Create token for identity with Token Auth # Get Tokens GET /api/v1/auth/token-auth/identities/{identityId}/tokens Get tokens for identity with Token Auth # Retrieve GET /api/v1/auth/token-auth/identities/{identityId} Retrieve Token Auth configuration on identity # Revoke DELETE /api/v1/auth/token-auth/identities/{identityId} Delete Token Auth configuration on identity # Revoke Token POST /api/v1/auth/token-auth/tokens/{tokenId}/revoke Revoke token for identity with Token Auth # Update PATCH /api/v1/auth/token-auth/identities/{identityId} Update Token Auth configuration on identity # Update Token PATCH /api/v1/auth/token-auth/tokens/{tokenId} Update token for identity with Token Auth # Attach POST /api/v1/auth/universal-auth/identities/{identityId} Attach Universal Auth configuration onto identity # Create Client Secret POST /api/v1/auth/universal-auth/identities/{identityId}/client-secrets Create Universal Auth Client Secret for identity # Get Client Secret By ID GET /api/v1/auth/universal-auth/identities/{identityId}/client-secrets/{clientSecretId} Get Universal Auth Client Secret for identity # List Client Secrets GET /api/v1/auth/universal-auth/identities/{identityId}/client-secrets List Universal Auth Client Secrets for identity # Login POST /api/v1/auth/universal-auth/login Login with Universal Auth # Renew Access Token POST /api/v1/auth/token/renew Renew access token # Retrieve GET /api/v1/auth/universal-auth/identities/{identityId} Retrieve Universal Auth configuration on identity # Revoke DELETE /api/v1/auth/universal-auth/identities/{identityId} Delete Universal Auth configuration on identity # Revoke Access Token POST /api/v1/auth/token/revoke Revoke access token # Revoke Client Secret POST /api/v1/auth/universal-auth/identities/{identityId}/client-secrets/{clientSecretId}/revoke Revoke Universal Auth Client Secrets for identity # Update PATCH /api/v1/auth/universal-auth/identities/{identityId} Update Universal Auth configuration on identity # Create Project POST /api/v2/workspace Create a new project # Delete Project DELETE /api/v1/workspace/{workspaceId} Delete project This operation is irreversible. All data associated with the project will be deleted. Please use with caution. # Get Project GET /api/v1/workspace/{workspaceId} Get project # Roll Back to Snapshot POST /api/v1/secret-snapshot/{secretSnapshotId}/rollback Roll back project secrets to those captured in a secret snapshot version. # Get Snapshots GET /api/v1/workspace/{workspaceId}/secret-snapshots Return project secret snapshots ids # Update Project PATCH /api/v1/workspace/{workspaceId} Update project # Authentication Learn how to authenticate with the Infisical Public API. You can authenticate with the Infisical API using [Identities](/documentation/platform/identities/machine-identities) paired with authentication modes such as [Universal Auth](/documentation/platform/identities/universal-auth). To interact with the Infisical API, you will need to obtain an access token. Follow the step by [step guide](/documentation/platform/identities/universal-auth) to get an access token via Universal Auth. **FAQ** The Service Token and API Key authentication modes are being deprecated out in favor of [Identities](/documentation/platform/identity). We expect to make a deprecation notice in the coming months alongside a larger deprecation initiative planned for Q1/Q2 2024. With identities, we're improving significantly over the shortcomings of Service Tokens and API Keys. Amongst many differences, identities provide broader access over the Infisical API, utilizes the same role-based permission system used by users, and comes with ample more configurable security measures. There are a few reasons for why this might happen: * You have insufficient organization permissions to create, read, update, delete identities. * The identity you are trying to read, update, or delete is more privileged than yourself. * The role you are trying to create an identity for or update an identity to is more privileged than yours. There are a few reasons for why this might happen: * The client secret or access token has expired. * The identity is insufficently permissioned to interact with the resources you wish to access. * You are attempting to access a `/raw` secrets endpoint that requires your project to disable E2EE. * The client secret/access token is being used from an untrusted IP. # Configure native integrations via API How to use Infisical API to sync secrets to external secret managers The Infisical API allows you to create programmatic integrations that connect with third-party secret managers to synchronize secrets from Infisical. This guide will primarily demonstrate the process using AWS Secret Store Manager (AWS SSM), but the steps are generally applicable to other secret management integrations. For details on setting up AWS SSM synchronization and understanding its prerequisites, refer to the [AWS SSM integration setup documentation](../../../integrations/cloud/aws-secret-manager). Authentication is required for all integrations. Use the [Integration Auth API](../../endpoints/integrations/create-auth) with the following parameters to authenticate. Set this parameter to **aws-secret-manager**. The Infisical project ID for the integration. The AWS IAM User Access ID. The AWS IAM User Access Secret Key. ```bash Request curl --request POST \ --url https://app.infisical.com/api/v1/integration-auth/access-token \ --header 'Authorization: ' \ --header 'Content-Type: application/json' \ --data '{ "workspaceId": "", "integration": "aws-secret-manager", "accessId": "", "accessToken": "" }' ``` Once authentication between AWS SSM and Infisical is established, you can configure the synchronization behavior. This involves specifying the source (environment and secret path in Infisical) and the destination in SSM to which the secrets will be synchronized. Use the [integration API](../../endpoints/integrations/create) with the following parameters to configure the sync source and destination. The ID of the integration authentication object used with AWS, obtained from the previous API response. Indicates whether the integration should be active or inactive. The secret name for saving in AWS SSM, which can be arbitrarily chosen. The AWS region where the SSM is located, e.g., `us-east-1`. The Infisical environment slug from which secrets will be synchronized, e.g., `dev`. The Infisical folder path from which secrets will be synchronized, e.g., `/some/path`. The root path is `/`. ```bash Request curl --request POST \ --url https://app.infisical.com/api/v1/integration \ --header 'Authorization: ' \ --header 'Content-Type: application/json' \ --data '{ "integrationAuthId": "", "sourceEnvironment": "", "secretPath": "", "app": "", "region": "" }' ``` Congratulations! You have successfully set up an integration to synchronize secrets from Infisical with AWS SSM. For more information, [view the integration API reference](../../endpoints/integrations). # API Reference Infisical's Public (REST) API provides users an alternative way to programmatically access and manage secrets via HTTPS requests. This can be useful for automating tasks, such as rotating credentials, or for integrating secret management into a larger system. With the Public API, you can create, read, update, and delete secrets, as well as manage access control, query audit logs, and more. # Changelog The changelog below reflects new product developments and updates on a monthly basis. ## October 2024 * Significantly improved performance of audit log operations in UI. * Released [Databricks integration](https://infisical.com/docs/integrations/cloud/databricks). * Added ability to enforce 2FA organization-wide. * Added multiple resource to the [Infisical Terraform Provider](https://registry.terraform.io/providers/Infisical/infisical/latest/docs), including AWS and GCP integrations. * Released [Infisical KMS](https://infisical.com/docs/documentation/platform/kms/overview). * Added support for [LDAP dynamic secrets](https://infisical.com/docs/documentation/platform/ldap/overview). * Enabled changing auth methods for machine identities in the UI. * Launched [Infisical EU Cloud](https://eu.infisical.com). ## September 2024 * Improved paginations for identities and secrets. * Significant improvements to the [Infisical Terraform Provider](https://registry.terraform.io/providers/Infisical/infisical/latest/docs). * Created [Slack Integration](https://infisical.com/docs/documentation/platform/workflow-integrations/slack-integration#slack-integration) for Access Requests and Approval Workflows. * Added Dynamic Secrets for [Elaticsearch](https://infisical.com/docs/documentation/platform/dynamic-secrets/elastic-search) and [MongoDB](https://infisical.com/docs/documentation/platform/dynamic-secrets/mongo-db). * More authentication methods are now supported by Infisical SDKs and Agent. * Integrations now have dedicated audit logs and an overview screen. * Added support for secret referencing in the Terraform Provider. * Released support for [older versions of .NET](https://www.nuget.org/packages/Infisical.Sdk#supportedframeworks-body-tab) via SDK. * Released Infisical PKI Issuer which works alongside `cert-manager` to manage certificates in Kubernetes. ## August 2024 * Added [Azure DevOps integration](https://infisical.com/docs/integrations/cloud/azure-devops). * Released ability to hot-reload variables in CLI ([--watch flag](https://infisical.com/docs/cli/commands/run#infisical-run:watch)). * Added Dynamic Secrets for [Redis](https://infisical.com/docs/documentation/platform/dynamic-secrets/redis). * Added [Alerting](https://infisical.com/docs/documentation/platform/pki/alerting) for Certificate Management. * You can now specify roles and project memberships when adding new users. * Approval workflows now have email notifications. * Access requests are now integrated with User Groups. * Released ability to use IAM Roles for AWS Integrations. ## July 2024 * Released the official [Ruby SDK](https://infisical.com/docs/sdks/languages/ruby). * Increased the speed and efficiency of secret operations. * Released AWS KMS wrapping (bring your own key). * Users can now log in to CLI via SSO in non-browser environments. * Released [Slack Webhooks](https://infisical.com/docs/documentation/platform/webhooks). * Added [Dynamic Secrets with MS SQL](https://infisical.com/docs/documentation/platform/dynamic-secrets/mssql). * Redesigned and simplified the Machine Identities page. * Added the ability to move secrets/folders to another location. * Added [OIDC](https://infisical.com/docs/documentation/platform/identities/oidc-auth/general) support to CLI, Go SDK, and more. * Released [Linux installer for Infisical](https://infisical.com/docs/self-hosting/deployment-options/native/standalone-binary). ## June 2024 * Released [Infisical PKI](https://infisical.com/docs/documentation/platform/pki/overview). * Released the official [Go SDK](https://infisical.com/docs/sdks/languages/go). * Released [OIDC Authentication method](https://infisical.com/docs/documentation/platform/identities/oidc-auth/general). * Allowed users to configure log retention periods on self-hosted instances. * Added [tags](https://registry.terraform.io/providers/Infisical/infisical/latest/docs/resources/secret_tag) to terraform provider. * Released [public secret sharing](https://share.infisical.com). * Built a [native integration with Rundeck](https://infisical.com/docs/integrations/cicd/rundeck). * Added list view for projects in the dashboard. * Fixed offline coding mode in CLI. * Users are now able to leave a particular project themselves. ## May 2024 * Released [AWS](https://infisical.com/docs/documentation/platform/identities/aws-auth), [GCP](https://infisical.com/docs/documentation/platform/identities/gcp-auth), [Azure](https://infisical.com/docs/documentation/platform/identities/azure-auth), and [Kubernetes](https://infisical.com/docs/documentation/platform/identities/kubernetes-auth) Native Auth Methods. * Added [Secret Sharing](https://infisical.com/docs/documentation/platform/secret-sharing) functionality for sharing sensitive data through encrypted links – within and outside of an organization. * Updated [Secret Referencing](https://infisical.com/docs/documentation/platform/secret-reference) to be supported in all Infisical clients. Infisical UI is now able to provide automatic reference suggestions when typing. * Released new [Infisical Jenkins Plugin](https://infisical.com/docs/integrations/cicd/jenkins). * Added statuses and manual sync option to integrations in the Dashboard UI. * Released universal [Audit Log Streaming](https://infisical.com/docs/documentation/platform/audit-log-streams). * Added [Dynamic Secret template for AWS IAM](https://infisical.com/docs/documentation/platform/dynamic-secrets/aws-iam). * Added support for syncing tags and custom KMS keys to [AWS Secrets Manager](https://infisical.com/docs/integrations/cloud/aws-secret-manager) and [Parameter Store](https://infisical.com/docs/integrations/cloud/aws-parameter-store) Integrations. * Officially released Infisical on [AWS Marketplace](https://infisical.com/blog/infisical-launches-on-aws-marketplace). ## April 2024 * Added [Access Requests](https://infisical.com/docs/documentation/platform/access-controls/access-requests) as part of self-serve secrets management workflows. * Added [Temporary Access Provisioning](https://infisical.com/docs/documentation/platform/access-controls/temporary-access) for roles and additional privileges. ## March 2024 * Released support for [Dynamic Secrets](https://infisical.com/docs/documentation/platform/dynamic-secrets/overview). * Released the concept of [Additional Privileges](https://infisical.com/docs/documentation/platform/access-controls/additional-privileges) on top of user/machine roles. ## Feb 2024 * Added org-scoped authentication enforcement for SAML * Added support for [SCIM](https://infisical.com/docs/documentation/platform/scim/overview) along with instructions for setting it up with [Okta](https://infisical.com/docs/documentation/platform/scim/okta), [Azure](https://infisical.com/docs/documentation/platform/scim/azure), and [JumpCloud](https://infisical.com/docs/documentation/platform/scim/jumpcloud). * Pushed out project update for non-E2EE w/ new endpoints like for project creation and member invitation. * Added API Integration testing for new backend. * Added capability to create projects in Terraform. * Added slug-based capabilities to both organizations and projects to gradually make the API more developer-friendly moving forward. * Fixed + improved various analytics/telemetry-related items. * Fixed various issues associated with the Python SDK: build during installation on Mac OS, Rust dependency. * Updated self-hosting documentation to reflect [new backend](https://infisical.com/docs/self-hosting/overview). * Released [Postgres-based Infisical helm chart](https://cloudsmith.io/~infisical/repos/helm-charts/packages/detail/helm/infisical-standalone/). * Added checks to ensure that breaking API changes don't get released. * Automated API reference documentation to be inline with latest releases of Infisical. ## Jan 2024 * Completed Postgres migration initiative with restructed Fastify-based backend. * Reduced size of Infisical Node.js SDK by ≈90%. * Added secret fallback support to all SDK's. * Added Machine Identity support to [Terraform Provider](https://github.com/Infisical/terraform-provider-infisical). * Released [.NET SDK](https://infisical.com/docs/sdks/languages/csharp). * Added symmetric encryption support to all SDK's. * Fixed secret reminders bug, where reminders were not being updated correctly. ## Dec 2023 * Released [(machine) identities](https://infisical.com/docs/documentation/platform/identities/overview) and [universal auth](https://infisical.com/docs/documentation/platform/identities/universal-auth) features. * Created new cross-language SDKs for [Python](https://infisical.com/docs/sdks/languages/python), [Node](https://infisical.com/docs/sdks/languages/node), and [Java](https://infisical.com/docs/sdks/languages/java). * Released first version of the [Infisical Agent](https://infisical.com/docs/infisical-agent/overview) * Added ability to [manage folders via CLI](https://infisical.com/docs/cli/commands/secrets). ## Nov 2023 * Replaced internal [Winston](https://github.com/winstonjs/winston) with [Pino](https://github.com/pinojs/pino) logging library with external logging to AWS CloudWatch * Added admin panel to self-hosting experience. * Released [secret rotation](https://infisical.com/docs/documentation/platform/secret-rotation/overview) feature with preliminary support for rotating [SendGrid](https://infisical.com/docs/documentation/platform/secret-rotation/sendgrid), [PostgreSQL/CockroachDB](https://infisical.com/docs/documentation/platform/secret-rotation/postgres), and [MySQL/MariaDB](https://infisical.com/docs/documentation/platform/secret-rotation/mysql) credentials. * Released secret reminders feature. ## Oct 2023 * Added support for [GitLab SSO](https://infisical.com/docs/documentation/platform/sso/gitlab). * Became SOC 2 (Type II) certified. * Reduced required JWT configuration from 5-6 secrets to 1 secret for self-hosting Infisical. * Compacted Infisical into 1 Docker image. * Added native [Hasura Cloud integration](https://infisical.com/docs/integrations/cloud/hasura-cloud). * Updated resource deletion logic for user, organization, and project deletion. ## Sep 2023 * Released [secret approvals](https://infisical.com/docs/documentation/platform/pr-workflows) feature. * Released an update to access controls; every user role now clearly defines and enforces a certain set of conditions across Infisical. * Updated UI/UX for integrations. * Added a native integration with [Qovery](https://infisical.com/docs/integrations/cloud/qovery). * Added service token generation capability for the CLI. ## Aug 2023 * Release Audit Logs V2. * Add support for [GitHub SSO](https://infisical.com/docs/documentation/platform/sso/github). * Enable users to opt in for multiple authentication methods. * Improved password requirements including check against [Have I Been Pwnd Password API](https://haveibeenpwned.com/Passwords). * Added native [GCP Secret Manager integration](https://infisical.com/docs/integrations/cloud/gcp-secret-manager) ## July 2023 * Released [secret referencing and importing](https://infisical.com/docs/documentation/platform/secret-reference) across folders and environments. * Redesigned the project/organization experience. * Updated the secrets overview page; users are now able to edit secrets directly from it. * Added native [Laravel Forge integration](https://infisical.com/docs/integrations/cloud/laravel-forge). * Added native [Codefresh integration](https://infisical.com/docs/integrations/cicd/codefresh). * Added native [Bitbucket integration](https://infisical.com/docs/integrations/cicd/bitbucket). * Added native [DigitalOcean App Platform integration](https://infisical.com/docs/integrations/cloud/digital-ocean-app-platform). * Added native [Cloud66 integration](https://infisical.com/docs/integrations/cloud/cloud-66). * Added native [Terraform Cloud integration](https://infisical.com/docs/integrations/cloud/terraform-cloud). * Added native [Northflank integration](https://infisical.com/docs/integrations/cloud/northflank). * Added native [Windmill integration](https://infisical.com/docs/integrations/cloud/windmill). * Added support for [Google SSO](https://infisical.com/docs/documentation/platform/sso/google) * Added support for [Okta](https://infisical.com/docs/documentation/platform/sso/okta), [Azure AD](https://infisical.com/docs/documentation/platform/sso/azure), and [JumpCloud](https://infisical.com/docs/documentation/platform/sso/jumpcloud) [SAML](https://infisical.com/docs/documentation/platform/saml) authentication. * Released [folders / path-based secret storage](https://infisical.com/docs/documentation/platform/folder). * Released [webhooks](https://infisical.com/docs/documentation/platform/webhooks). ## June 2023 * Released the [Terraform Provider](https://infisical.com/docs/integrations/frameworks/terraform#5-run-terraform). * Updated the usage and billing page. Added the free trial for the professional tier. * Added native integrations with [Checkly](https://infisical.com/docs/integrations/cloud/checkly), [Hashicorp Vault](https://infisical.com/docs/integrations/cloud/hashicorp-vault), and [Cloudflare Pages](https://infisical.com/docs/integrations/cloud/cloudflare-pages). * Completed a penetration test with a `very good` result. * Added support for multi-line secrets. ## May 2023 * Released secret scanning capability for the CLI. * Released customer / license service to manage customer billing information, cloud plans, and self-hosted enterprise licenses; all instances of Infisicals now fetch/relay information from this service. * Completed penetration test. * Released new landing page. * Started SOC 2 (Type II) compliance certification preparation. * Released new deployment options for Fly.io, Digital Ocean and Render. ## April 2023 * Upgraded secret-handling to include blind-indexing (can be thought of as a fingerprint). * Added Node SDK support for working with individual secrets. * Released preliminary Python SDK. * Released service accounts, a client type capable of accessing multiple projects. * Added native Supabase integration. * Added native Railway integration. * Improved dashboard speed / performance. * Released the Secrets Overview page for users to view and identify missing environment secrets within one dashboard. * Updated documentation to include quickstarts and guides; also updated `README.md`. ## March 2023 * Added support for global configs to the Kubernetes operator. * Added support for self-hosted deployments to operate without any attached email service / SMTP configuration. * Added native Azure Key Vault integration. * Released one-click AWS EC2 deployment method. * Released preliminary Node SDK. ## Feb 2023 * Upgraded private key encryption/decryption mechanism to use Argon2id and 256-bit protected keys. * Added preliminary email-based 2FA capability. * Added suspicious login alerting if user logs in via new device or IP address. * Added documentation for PM2 integration. * Added secret backups support for the CLI; it now fetches and caches secrets locally to be used in the event of future failed fetch. * Added support for comparing secret values across environments on each secret. * Added native AWS Parameter Store integration. * Added native AWS Secrets Manager integration. * Added native GitLab integration. * Added native CircleCI integration. * Added native Travis CI integration. * Added secret tagging capability for enhanced organizational structure/grouping. * Released new dashboard design allowing more actions to be performed within the dashboard itself. * Added capability to generate `.env.example` file. ## Jan 2023 * Added preliminary audit logging capability covering CRUD secret operations. * Added secret overriding capability for team members to have their own branch of a secret. * Added secret versioning capability. * Added secret snapshot and point-in-time recovery capabilities to track and roll back the full state of a project. * Added native Vercel integration. * Added native Netlify integration. * Added native GitHub Actions integration. * Added custom environment names. * Added auto-redeployment capability to the Kubernetes operator. * (Service Token 2.0) Shortened the length of service tokens. * Added a public-facing API. * Added preliminary access control capability for users to be provisioned read/write access to environments. * Performed various web UI optimizations. ## Nov 2022 * Infisical is open sourced. * Added Infisical CLI support for Docker and Docker Compose. * Rewrote the Infisical CLI in Golang to be platform-agnostic. * Rewrote the documentation. ## Oct 2022 * Added support for organizations; projects now belong to organizations. * Improved speed / performance of dashboard by 25x. * Added capability to change account password in settings. * Added persistence for logging into the organization and project that users left from in their previous session. * Added password recovery emergency kit with automatic download enforcement upon account creation. * Added capability to copy-to-clipboard capabilities. * Released first native integration between Infisical and Heroku; environment variables can now be sent and kept in sync with Heroku. ## Sep 2022 * Added capability to change user roles in projects. * Added capability to delete projects. * Added Stripe. * Added default environments (development, staging, production) for new users with example key-pairs. * Added loading indicators. * Moved from push/pull mode of secret operation to automatically pulling and injecting secrets into processes upon startup. * Added drag-and-drop capability for adding new .env files. * Improved security measures against common attacks (e.g. XSS, clickjacking, etc.). * Added support for personal secrets (later modified to be secret overrides in Jan 2023). * Improved account password validation and enforce minimum requirements. * Added sorting capability to sort keys by name alphabetically in dashboard. * Added downloading secrets back as `.env` file capability. ## Aug 2022 * Released first version of the Infisical platform with push/pull capability and end-to-end encryption. * Improved security handling of authentication tokens by storing refresh tokens in HttpOnly cookies. * Added hiding key values on client-side. * Added search bar to dashboard to query for keys on client-side. * Added capability to rename a project. * Added user roles for projects. * Added incident contacts. # infisical export Export Infisical secrets from CLI into different file formats ```bash infisical export [options] ``` ## Description Export environment variables from the platform into a file format. ## Subcommands & flags Use this command to export environment variables from the platform into a raw file formats ```bash $ infisical export # Export variables to a .env file infisical export > .env # Export variables to a .env file (with export keyword) infisical export --format=dotenv-export > .env # Export variables to a CSV file infisical export --format=csv > secrets.csv # Export variables to a JSON file infisical export --format=json > secrets.json # Export variables to a YAML file infisical export --format=yaml > secrets.yaml # Render secrets using a custom template file infisical export --template= ``` ### Environment variables Used to fetch secrets via a [machine identities](/documentation/platform/identities/machine-identities) apposed to logged in credentials. Simply, export this variable in the terminal before running this command. ```bash # Example export INFISICAL_TOKEN=$(infisical login --method=universal-auth --client-id= --client-secret= --silent --plain) # --plain flag will output only the token, so it can be fed to an environment variable. --silent will disable any update messages. ``` Alternatively, you may use service tokens. ```bash # Example export INFISICAL_TOKEN= ``` Used to disable the check for new CLI versions. This can improve the time it takes to run this command. Recommended for production environments. To use, simply export this variable in the terminal before running this command. ```bash # Example export INFISICAL_DISABLE_UPDATE_CHECK=true ``` ### flags The `--template` flag specifies the path to the template file used for rendering secrets. When using templates, you can omit the other format flags. ```text my-template-file {{$secrets := secret "" "" ""}} {{$length := len $secrets}} {{- "{"}} {{- with $secrets }} {{- range $index, $secret := . }} "{{ $secret.Key }}": "{{ $secret.Value }}"{{if lt $index (minus $length 1)}},{{end}} {{- end }} {{- end }} {{ "}" -}} ``` ```bash # Example infisical export --template="/path/to/template/file" ``` Used to set the environment that secrets are pulled from. ```bash # Example infisical export --env=prod ``` Note: this flag only accepts environment slug names not the fully qualified name. To view the slug name of an environment, visit the project settings page. default value: `dev` By default the project id is retrieved from the `.infisical.json` located at the root of your local project. This flag allows you to override this behavior by explicitly defining the project to fetch your secrets from. ```bash # Example infisical export --projectId=XXXXXXXXXXXXXX ``` Parse shell parameter expansions in your secrets (e.g., `${DOMAIN}`) Default value: `true` By default imported secrets are available, you can disable it by setting this option to false. Default value: `true` Format of the output file. Accepted values: `dotenv`, `dotenv-export`, `csv`, `json` and `yaml` Default value: `dotenv` Prioritizes personal secrets with the same name over shared secrets Default value: `true` The `--path` flag indicates which project folder secrets will be injected from. ```bash # Example infisical export --path="/path/to/folder" --env=dev ``` When working with tags, you can use this flag to filter and retrieve only secrets that are associated with a specific tag(s). ```bash # Example infisical run --tags=tag1,tag2,tag3 -- npm run dev ``` Note: you must reference the tag by its slug name not its fully qualified name. Go to project settings to view all tag slugs. By default, all secrets are fetched # infisical init Switch between Infisical projects within CLI ```bash infisical init ``` ## Description Link a local project to your Infisical project. Once connected, you can then access the secrets locally from the connected Infisical project. This command creates a `infisical.json` file containing your Project ID. # infisical login Login into Infisical from the CLI ```bash infisical login ``` ### Description The CLI uses authentication to verify your identity. When you enter the correct email and password for your account, a token is generated and saved in your system Keyring to allow you to make future interactions with the CLI. To change where the login credentials are stored, visit the [vaults command](./vault). If you have added multiple users, you can switch between the users by using the [user command](./user). When you authenticate with **any other method than `user`**, an access token will be printed to the console upon successful login. This token can be used to authenticate with the Infisical API and the CLI by passing it in the `--token` flag when applicable. Use flag `--plain` along with `--silent` to print only the token in plain text when using a machine identity auth method. ### Authentication Methods The Infisical CLI supports multiple authentication methods. Below are the available authentication methods, with their respective flags. The Universal Auth method is a simple and secure way to authenticate with Infisical. It requires a client ID and a client secret to authenticate with Infisical. Your machine identity client ID. Your machine identity client secret. To create a universal auth machine identity, follow the step by step guide outlined [here](/documentation/platform/identities/universal-auth). Run the `login` command with the following flags to obtain an access token: ```bash infisical login --method=universal-auth --client-id= --client-secret= ``` The Native Kubernetes method is used to authenticate with Infisical when running in a Kubernetes environment. It requires a service account token to authenticate with Infisical. Your machine identity ID. Path to the Kubernetes service account token to use. Default: `/var/run/secrets/kubernetes.io/serviceaccount/token`. To create a Kubernetes machine identity, follow the step by step guide outlined [here](/documentation/platform/identities/kubernetes-auth). Run the `login` command with the following flags to obtain an access token: ```bash # --service-account-token-path is optional, and will default to '/var/run/secrets/kubernetes.io/serviceaccount/token' if not provided. infisical login --method=kubernetes --machine-identity-id= --service-account-token-path= ``` The Native Azure method is used to authenticate with Infisical when running in an Azure environment. Your machine identity ID. To create an Azure machine identity, follow the step by step guide outlined [here](/documentation/platform/identities/azure-auth). Run the `login` command with the following flags to obtain an access token: ```bash infisical login --method=azure --machine-identity-id= ``` The Native GCP ID Token method is used to authenticate with Infisical when running in a GCP environment. Your machine identity ID. To create a GCP machine identity, follow the step by step guide outlined [here](/documentation/platform/identities/gcp-auth). Run the `login` command with the following flags to obtain an access token: ```bash infisical login --method=gcp-id-token --machine-identity-id= ``` The GCP IAM method is used to authenticate with Infisical with a GCP service account key. Your machine identity ID. Path to your GCP service account key file *(Must be in JSON format!)* To create a GCP machine identity, follow the step by step guide outlined [here](/documentation/platform/identities/gcp-auth). Run the `login` command with the following flags to obtain an access token: ```bash infisical login --method=gcp-iam --machine-identity-id= --service-account-key-file-path= ``` The AWS IAM method is used to authenticate with Infisical with an AWS IAM role while running in an AWS environment like EC2, Lambda, etc. Your machine identity ID. To create an AWS machine identity, follow the step by step guide outlined [here](/documentation/platform/identities/aws-auth). Run the `login` command with the following flags to obtain an access token: ```bash infisical login --method=aws-iam --machine-identity-id= ``` The OIDC Auth method is used to authenticate with Infisical via identity tokens with OIDC. Your machine identity ID. The OIDC JWT from the identity provider. To create an OIDC machine identity, follow the step by step guide outlined [here](/documentation/platform/identities/oidc-auth/general). Run the `login` command with the following flags to obtain an access token: ```bash infisical login --method=oidc-auth --machine-identity-id= --oidc-jwt= ``` ### Flags The login command supports a number of flags that you can use for different authentication methods. Below is a list of all the flags that can be used with the login command. ```bash infisical login --method= # Optional, will default to 'user'. ``` #### Valid values for the `method` flag are: * `user`: Login using email and password. (default) * `universal-auth`: Login using a universal auth client ID and client secret. * `kubernetes`: Login using a Kubernetes native auth. * `azure`: Login using an Azure native auth. * `gcp-id-token`: Login using a GCP ID token native auth. * `gcp-iam`: Login using a GCP IAM. * `aws-iam`: Login using an AWS IAM native auth. * `oidc-auth`: Login using oidc auth. ```bash infisical login --client-id= # Optional, required if --method=universal-auth. ``` #### Description The client ID of the universal auth machine identity. This is required if the `--method` flag is set to `universal-auth`. The `client-id` flag can be substituted with the `INFISICAL_UNIVERSAL_AUTH_CLIENT_ID` environment variable. ```bash infisical login --client-secret= # Optional, required if --method=universal-auth. ``` #### Description The client secret of the universal auth machine identity. This is required if the `--method` flag is set to `universal-auth`. The `client-secret` flag can be substituted with the `INFISICAL_UNIVERSAL_AUTH_CLIENT_SECRET` environment variable. ```bash infisical login --machine-identity-id= # Optional, required if --method=kubernetes, azure, gcp-id-token, gcp-iam, or aws-iam. ``` #### Description The ID of the machine identity. This is required if the `--method` flag is set to `kubernetes`, `azure`, `gcp-id-token`, `gcp-iam`, or `aws-iam`. The `machine-identity-id` flag can be substituted with the `INFISICAL_MACHINE_IDENTITY_ID` environment variable. ```bash infisical login --service-account-token-path= # Optional Will default to '/var/run/secrets/kubernetes.io/serviceaccount/token'. ``` #### Description The path to the Kubernetes service account token to use for authentication. This is optional and will default to `/var/run/secrets/kubernetes.io/serviceaccount/token`. The `service-account-token-path` flag can be substituted with the `INFISICAL_KUBERNETES_SERVICE_ACCOUNT_TOKEN_PATH` environment variable. ```bash infisical login --service-account-key-file-path= # Optional, but required if --method=gcp-iam. ``` #### Description The path to your GCP service account key file. This is required if the `--method` flag is set to `gcp-iam`. The `service-account-key-path` flag can be substituted with the `INFISICAL_GCP_IAM_SERVICE_ACCOUNT_KEY_FILE_PATH` environment variable. ```bash infisical login --oidc-jwt= ``` #### Description The JWT provided by an identity provider for OIDC authentication. The `oidc-jwt` flag can be substituted with the `INFISICAL_OIDC_AUTH_JWT` environment variable. ### Machine Identity Authentication Quick Start In this example we'll be using the `universal-auth` method to login to obtain an Infisical access token, which we will then use to fetch secrets with. ```bash export INFISICAL_TOKEN=$(infisical login --method=universal-auth --client-id= --client-secret= --silent --plain) # silent and plain is important to ensure only the token itself is printed, so we can easily set it as an environment variable. ``` Now that we've set the `INFISICAL_TOKEN` environment variable, we can use the CLI to interact with Infisical. The CLI will automatically check for the presence of the `INFISICAL_TOKEN` environment variable and use it for authentication. Alternatively, if you would rather use the `--token` flag to pass the token directly, you can do so by running the following command: ```bash infisical [command] --token= # The token output from the login command. ``` ```bash infisical secrets --projectId= The `--recursive`, and `--env` flag is optional and will fetch all secrets in subfolders. The default environment is `dev` if no `--env` flag is provided. # infisical reset Reset Infisical ```bash infisical reset ``` ## Description This command provides a way to clear all Infisical-generated configuration data, effectively resetting the software to its default settings. This can be an effective way to address any persistent issues that arise while using the CLI. # infisical run The command that injects your secrets into local environment ```bash infisical run [options] -- [your application start command] # Example infisical run [options] -- npm run dev ``` ```bash infisical run [options] --command [string command] # Example infisical run [options] --command "npm run bootstrap && npm run dev start; other-bash-command" ``` ## Description Inject secrets from Infisical into your application process. ## Subcommands & flags Use this command to inject secrets into your applications process ```bash $ infisical run -- # Example $ infisical run -- npm run dev ``` ### Environment variables Used to fetch secrets via a [machine identity](/documentation/platform/identities/machine-identities) apposed to logged in credentials. Simply, export this variable in the terminal before running this command. ```bash # Example export INFISICAL_TOKEN=$(infisical login --method=universal-auth --client-id= --client-secret= --silent --plain) # --plain flag will output only the token, so it can be fed to an environment variable. --silent will disable any update messages. ``` Alternatively, you may use service tokens. ```bash # Example export INFISICAL_TOKEN= ``` Used to disable the check for new CLI versions. This can improve the time it takes to run this command. Recommended for production environments. To use, simply export this variable in the terminal before running this command. ```bash # Example export INFISICAL_DISABLE_UPDATE_CHECK=true ``` ### Flags By passing the `watch` flag, you are telling the CLI to watch for changes that happen in your Infisical project. If secret changes happen, the command you provided will automatically be restarted with the new environment variables attached. ```bash # Example infisical run --watch -- printenv ``` Explicitly set the directory where the .infisical.json resides. This is useful for some monorepo setups. ```bash # Example infisical run --project-config-dir=/some-dir -- printenv ``` Pass secrets into multiple commands at once ```bash # Example infisical run --command="npm run build && npm run dev; more-commands..." ``` The project ID to fetch secrets from. This is required when using a machine identity to authenticate. ```bash # Example infisical run --projectId= -- npm run dev ``` If you are using a [machine identity](/documentation/platform/identities/machine-identities) to authenticate, you can pass the token as a flag ```bash # Example infisical run --token="" --projectId= -- npm run start ``` You may also expose the token to the CLI by setting the environment variable `INFISICAL_TOKEN` before executing the run command. This will have the same effect as setting the token with `--token` flag Turn on or off the shell parameter expansion in your secrets. If you have used shell parameters in your secret(s), activating this feature will populate them before injecting them into your application process. Default value: `true` By default imported secrets are available, you can disable it by setting this option to false. Default value: `true` {" "} This is used to specify the environment from which secrets should be retrieved. The accepted values are the environment slugs defined for your project, such as `dev`, `staging`, `test`, and `prod`. Default value: `dev` Prioritizes personal secrets with the same name over shared secrets Default value: `true` When working with tags, you can use this flag to filter and retrieve only secrets that are associated with a specific tag(s). ```bash # Example infisical run --tags=tag1,tag2,tag3 -- npm run dev ``` Note: you must reference the tag by its slug name not its fully qualified name. Go to project settings to view all tag slugs. By default, all secrets are fetched The `--path` flag indicates which project folder secrets will be injected from. ```bash # Example infisical run --path="/nextjs" -- npm run dev ``` ## Automatically reload command when secrets change To automatically reload your command when secrets change, use the `--watch` flag. ```bash infisical run --watch -- npm run dev ``` This will watch for changes in your secrets and automatically restart your command with the new secrets. When your command restarts, it will have the new environment variables injeceted into it. Please note that this feature is intended for development purposes. It is not recommended to use this in production environments. Generally it's not recommended to automatically reload your application in production when remote changes are made. # scan Scan git history, directories, and files for secrets ```bash infisical scan # Display the full secret findings infisical scan --verbose ``` ## Description The `infisical scan` command serves to scan repositories, directories, and files. It's compatible with both individual developer machines and Continuous Integration (CI) environments. When you run `infisical scan` on a Git repository, Infisical will parses the output of a `git log -p` command. This command generates [patches](https://stackoverflow.com/questions/8279602/what-is-a-patch-in-git-version-control) that Infisical uses to identify secrets in your code. You can configure the range of commits that `git log` will cover using the `--log-opts` flag. Any options you can use with `git log -p` are valid for `--log-opts`. For instance, to instruct Infisical to scan a specific range of commits, use the following command: `infisical scan --log-opts="--all commitA..commitB"`. For more details, refer to the [Git log documentation](https://git-scm.com/docs/git-log). To scan individual files and directories, use the `--no-git` flag. ### Flags **Description** git log options **Description** treat git repo as a regular directory and scan those files, --log-opts has no effect on the scan when --no-git is set Default value: `false` Short hand: `-b` **Description** scan input from stdin, ex: `cat some_file | infisical scan --pipe` Default value: `false` Short hand: `-b` **Description** scan files that are symlinks to other files Default value: `false` Short hand: `-b` **Description** path to baseline with issues that can be ignored Short hand: `-c` **Description** config file path order of precedence: 1. \--config flag 2. env var INFISICAL\_SCAN\_CONFIG 3. (--source/-s)/.infisical-scan.toml If none of the three options are used, then Infisical will use the default config **Description** exit code when leaks have been encountered (default 1) **Description** files larger than this will be skipped **Description** turn off color for verbose output **Description** redact secrets from logs and stdout **Description** output format (json, csv, sarif) (default "json") **Description** report file **Description** path to source (default ".") **Description** show verbose output from scan # scan git-changes Scan for secrets in your uncommitted code ```bash infisical scan git-changes # Display the full secret findings infisical scan git-changes --verbose ``` ## Description Scanning for secrets before you commit your changes is great way to prevent leaks. Infisical makes this easy with the sub command `git-changes`. The `git-changes` scans for uncommitted changes in a Git repository, and is especially designed for use on developer machines, aligning with the ['shift left'](https://cloud.google.com/architecture/devops/devops-tech-shifting-left-on-security) security approach. When `git-changes` is run on a Git repository, Infisical parses the output from a `git diff` command. To scan changes in commits that have been staged via `git add`, you can add the `--staged` flag to the sub command. This flag is particularly useful when using Infisical CLI as a pre-commit tool. ### Flags **Description** detect secrets in a --staged state Default value: `false` **Description** git log options Short hand: `-b` **Description** path to baseline with issues that can be ignored Short hand: `-c` **Description** config file path order of precedence: 1. \--config flag 2. env var INFISICAL\_SCAN\_CONFIG 3. (--source/-s)/.infisical-scan.toml If none of the three options are used, then Infisical will use the default config **Description** exit code when leaks have been encountered (default 1) **Description** files larger than this will be skipped **Description** turn off color for verbose output **Description** redact secrets from logs and stdout **Description** output format (json, csv, sarif) (default "json") **Description** report file **Description** path to source (default ".") **Description** show verbose output from scan # scan install Add various scanning tools seamlessly into your development lifecycle ```bash infisical scan install --pre-commit-hook ``` ## Description The command `infisical scan install` is designed to incorporate various scanning tools seamlessly into your development lifecycle. Initially, we are offering users the ability to install a pre-commit hook. This hook conducts an automatic scan for any exposed secrets in your commits before they are pushed. ### Flags ```bash infisical scan install --pre-commit-hook ``` **Description** Installs a git pre-commit hook that triggers Infisical to scan your staged changes for any exposed secrets prior to pushing. # infisical secrets Perform CRUD operations with Infisical secrets ``` infisical secrets ``` ## Description This command enables you to perform CRUD (create, read, update, delete) operations on secrets within your Infisical project. With it, you can view, create, update, and delete secrets in your environment. ### Sub-commands Use this command to print out all of the secrets in your project ```bash $ infisical secrets ``` ### Environment variables Used to fetch secrets via a [machine identity](/documentation/platform/identities/machine-identities) apposed to logged in credentials. Simply, export this variable in the terminal before running this command. ```bash # Example export INFISICAL_TOKEN=$(infisical login --method=universal-auth --client-id= --client-secret= --silent --plain) # --plain flag will output only the token, so it can be fed to an environment variable. --silent will disable any update messages. ``` Alternatively, you may use service tokens. ```bash # Example export INFISICAL_TOKEN= ``` Used to disable the check for new CLI versions. This can improve the time it takes to run this command. Recommended for production environments. To use, simply export this variable in the terminal before running this command. ```bash # Example export INFISICAL_DISABLE_UPDATE_CHECK=true ``` ### Flags Parse shell parameter expansions in your secrets Default value: `true` The project ID to fetch secrets from. This is required when using a machine identity to authenticate. ```bash # Example infisical secrets --projectId= ``` Used to select the environment name on which actions should be taken on Default value: `dev` The `--path` flag indicates which project folder secrets will be injected from. ```bash # Example infisical secrets --path="/" --env=dev ``` The `--plain` flag will output all your secret values without formatting, one per line. ```bash # Example infisical secrets --plain --silent ``` The `--silent` flag disables output of tip/info messages. Useful when running in scripts or CI/CD pipelines. ```bash # Example infisical secrets --silent ``` Can be used inline to replace `INFISICAL_DISABLE_UPDATE_CHECK` This command allows you selectively print the requested secrets by name ```bash $ infisical secrets get ... # Example $ infisical secrets get DOMAIN $ infisical secrets get DOMAIN PORT ``` ### Flags Used to select the environment name on which actions should be taken on Default value: `dev` The `--plain` flag will output all your requested secret values without formatting, one per line. Default value: `false` ```bash # Example infisical secrets get FOO --plain infisical secrets get FOO BAR --plain # Fetch a single value and assign it to a variable API_KEY=$(infisical secrets get FOO --plain --silent) ``` When running in CI/CD environments or in a script, set `INFISICAL_DISABLE_UPDATE_CHECK=true` or add the `--silent` flag. This will help hide any CLI info/debug output and only show the secret value. The `--silent` flag disables output of tip/info messages. Useful when running in scripts or CI/CD pipelines. ```bash # Example infisical secrets get FOO --plain --silent ``` Can be used inline to replace `INFISICAL_DISABLE_UPDATE_CHECK` Use `--plain` instead, as it supports single and multiple secrets. Used to print the plain value of a single requested secret without any table style. Default value: `false` Example: `infisical secrets get DOMAIN --raw-value` When running in CI/CD environments or in a script, set `INFISICAL_DISABLE_UPDATE_CHECK=true` or add the `--silent` flag. This will help hide any CLI info/debug output and only show the secret value. This command allows you to set or update secrets in your environment. If the secret key provided already exists, its value will be updated with the new value. If the secret key does not exist, a new secret will be created using both the key and value provided. ```bash $ infisical secrets set ... ## Example $ infisical secrets set STRIPE_API_KEY=sjdgwkeudyjwe DOMAIN=example.com HASH=jebhfbwe ``` ### Flags Used to select the environment name on which actions should be taken on Default value: `dev` Used to select the project folder in which the secrets will be set. This is useful when creating new secrets under a particular path. ```bash # Example infisical secrets set DOMAIN=example.com --path="common/backend" ``` Used to select the type of secret to create. This could be either personal or shared (defaults to shared) ```bash # Example infisical secrets set DOMAIN=example.com --type=personal ``` This command allows you to delete secrets by their name(s). ```bash $ infisical secrets delete ... ## Example $ infisical secrets delete STRIPE_API_KEY DOMAIN HASH ``` ### Flags Used to select the environment name on which actions should be taken on Default value: `dev` The `--path` flag indicates which project folder secrets will be injected from. ```bash # Example infisical secrets delete ... --path="/" ``` This command allows you to fetch, create and delete folders from within a path from a given project. ```bash $ infisical secrets folders ``` ### sub commands Used to fetch all folders within a path in a given project ``` infisical secrets folders get --path=/some/path/to/folder ``` #### Flags The path from where folders should be fetched from Default value: `/` Fetch folders using a [machine identity](/documentation/platform/identities/machine-identities) access token. Default value: \`\` Used to create a folder by name within a path. ``` infisical secrets folders create --path=/some/path/to/folder --name=folder-name ``` ### Flags Path to where the folder should be created Default value: `/` Name of the folder to be created in selected `--path` Default value: \`\` Used to delete a folder by name within a path. ``` infisical secrets folders delete --path=/some/path/to/folder --name=folder-name ``` ### Flags Path to where the folder should be created Default value: `/` Name of the folder to be deleted within selected `--path` Default value: \`\` This command allows you to generate an example .env file from your secrets and with their associated comments and tags. This is useful when you would like to let others who work on the project but do not use Infisical become aware of the required environment variables and their intended values. To place default values in your example .env file, you can simply include the syntax `DEFAULT:` within your secret's comment in Infisical. This will result in the specified value being extracted and utilized as the default. ```bash $ infisical secrets generate-example-env ## Example $ infisical secrets generate-example-env > .example-env ``` ### Flags Used to select the environment name on which actions should be taken on Default value: `dev` # infisical service-token Manage Infisical service tokens This command is deprecated and will be removed in the near future. Please switch to using [Machine Identities](/documentation/platform/identities/machine-identities) for authenticating with Infisical. ```bash infisical service-token create --scope=dev:/global --scope=dev:/backend --access-level=read --access-level=write ``` ## Description The Infisical `service-token` command allows you to manage service tokens for a given Infisical project. With this command, you can create, view, and delete service tokens. Use this command to create a service token ```bash $ infisical service-token create --scope=dev:/backend/** --access-level=read --access-level=write ``` ### Flags ```bash infisical service-token create --scope=dev:/global --scope=dev:/backend/** --access-level=read ``` Use the scope flag to define which environments and paths your service token should be authorized to access. The value of your scope flag should be in the following `:`. Here, `environment slug` refers to the slug name of the environment, and `path` indicates the folder path where your secrets are stored. For specifying multiple scopes, you can use multiple --scope flags. The `path` can be a Glob pattern ```bash infisical service-token create --scope=dev:/global --access-level=read --projectId=63cefb15c8d3175601cfa989 ``` The project ID you'd like to create the service token for. By default, the CLI will attempt to use the linked Infisical project in `.infisical.json` generated by `infisical init` command. ```bash infisical service-token create --scope=dev:/global --access-level=read --name service-token-name ``` Service token name Default: `Service token generated via CLI` ```bash infisical service-token create --scope=dev:/global --access-level=read --expiry-seconds 120 ``` Set the service token's expiration time in seconds from now. To never expire set to zero. Default: `1 day` ```bash infisical service-token create --scope=dev:/global --access-level=read --access-level=write ``` The type of access the service token should have. Can be `read` and or `write` ```bash infisical service-token create --scope=dev:/global --access-level=read --access-level=write --token-only ``` When true, only the service token will be printed Default: `false` # infisical token Manage your Infisical identity access tokens ```bash infisical token renew ``` ## Description The Infisical `token` command allows you to manage your universal auth access tokens. With this command, you can renew your access tokens. In the future more subcommands will be added to better help you manage your tokens through the CLI. Use this command to renew your access token. This command will renew your access token and output a renewed access token to the console. ```bash $ infisical token renew ``` # infisical user Manage logged in users ```bash infisical user ``` ## Description This command allows you to manage the current logged in users on the CLI ### Sub-commands Use this command to switch between profiles that are currently logged into the CLI ```bash infisical user switch ``` With this command, you can modify the backend API that is utilized for all requests associated with a specific profile. For instance, you have the option to point the profile to use either the Infisical Cloud or your own self-hosted Infisical instance. ```bash infisical user update domain ``` # infisical vault Change the vault type in Infisical ```bash infisical vault # Example output Vaults are used to securely store your login details locally. Available vaults: - auto (automatically select native vault on system) - file (encrypted file vault) You are currently using [file] vault to store your login credentials ``` ```bash infisical vault set # Example infisical vault set keychain ``` ## Description To safeguard your login details when using the CLI, Infisical attempts to store them in a system keyring. If a system keyring cannot be found on your machine, the data is stored in a config file. # FAQ Frequently Asked Questions about Infisical CLI Frequently asked questions about the CLI can be found on this page. If you can't find the answer you are looking for, please create an issue on our GitHub repository or join our Slack channel for additional support. By default, the CLI will choose the most suitable store available on your system. If you experience issues with the default store, you can switch to a different one. If none of the available stores work for you, you can try using the `file` store type by running `infisical vault set file`, which should work in most cases. If you are still experiencing trouble, please seek support. [Learn more about vault command](./commands/vault) Yes. If you have previously retrieved secrets for a specific project and environment (such as dev, staging, or prod), the `run`/`secret` command will utilize the saved secrets, even when offline, on subsequent fetch attempts. Yes. This is simply a configuration file and contains no sensitive data. Visit the Infisical website and navigate to a project of your choice. Once on the project page, access the **Project Settings** from the sidebar. Within the Project name section, click the "Copy Project ID" button for copying the current Project ID to clipboard, or simply obtain it from the URL of the current page. ``` https://app.infisical.com/project//settings ``` # Install Infisical's CLI is one of the best way to manage environments and secrets. Install it here The Infisical CLI is powerful command line tool that can be used to retrieve, modify, export and inject secrets into any process or application as environment variables. You can use it across various environments, whether it's local development, CI/CD, staging, or production. ## Installation Use [brew](https://brew.sh/) package manager ```bash brew install infisical/get-cli/infisical ``` ### Updates ```bash brew update && brew upgrade infisical ``` Use [Scoop](https://scoop.sh/) package manager ```bash scoop bucket add org https://github.com/Infisical/scoop-infisical.git ``` ```bash scoop install infisical ``` ### Updates ```bash scoop update infisical ``` Use [NPM](https://www.npmjs.com/) package manager ```bash npm install -g @infisical/cli ``` ### Updates ```bash npm update -g @infisical/cli ``` Install prerequisite ```bash apk add --no-cache bash sudo ``` Add Infisical repository ```bash curl -1sLf \ 'https://dl.cloudsmith.io/public/infisical/infisical-cli/setup.alpine.sh' \ | bash ``` Then install CLI ```bash apk update && sudo apk add infisical ``` ### If you are installing the CLI in production environments, we highly recommend to set the version of the CLI to a specific version. This will help keep your CLI version consistent across reinstalls. [View versions](https://cloudsmith.io/~infisical/repos/infisical-cli/packages/) Add Infisical repository ```bash curl -1sLf \ 'https://dl.cloudsmith.io/public/infisical/infisical-cli/setup.rpm.sh' \ | sudo -E bash ``` Then install CLI ```bash sudo yum install infisical ``` ### If you are installing the CLI in production environments, we highly recommend to set the version of the CLI to a specific version. This will help keep your CLI version consistent across reinstalls. [View versions](https://cloudsmith.io/~infisical/repos/infisical-cli/packages/) Add Infisical repository ```bash curl -1sLf \ 'https://dl.cloudsmith.io/public/infisical/infisical-cli/setup.deb.sh' \ | sudo -E bash ``` Then install CLI ```bash sudo apt-get update && sudo apt-get install -y infisical ``` ### If you are installing the CLI in production environments, we highly recommend to set the version of the CLI to a specific version. This will help keep your CLI version consistent across reinstalls. [View versions](https://cloudsmith.io/~infisical/repos/infisical-cli/packages/) Use the `yay` package manager to install from the [Arch User Repository](https://aur.archlinux.org/packages/infisical-bin) ```bash yay -S infisical-bin ``` ### If you are installing the CLI in production environments, we highly recommend to set the version of the CLI to a specific version. This will help keep your CLI version consistent across reinstalls. [View versions](https://cloudsmith.io/~infisical/repos/infisical-cli/packages/) ## Quick Usage Guide Now that you have the CLI installed on your system, follow this guide to make the best use of it # Project config file Project config file & customization options To link your local project on your machine with an Infisical project, we suggest using the infisical init CLI command. This will generate a `.infisical.json` file in the root directory of your project. The `.infisical.json` file specifies various parameters, such as the Infisical project to retrieve secrets from, along with other configuration options. Furthermore, you can define additional properties in the file to further tailor your local development experience. ## Set default environment If you need to change environments while using the CLI, you can do so by including the `--env` flag in your command. However, this can be inconvenient if you typically work in just one environment. To simplify the process, you can establish a default environment, which will be used for every command unless you specify otherwise. ```json .infisical.json { "workspaceId": "63ee5410a45f7a1ed39ba118", "defaultEnvironment": "test", "gitBranchToEnvironmentMapping": null } ``` ### How it works If both `defaultEnvironment` and `gitBranchToEnvironmentMapping` are configured, `gitBranchToEnvironmentMapping` will take precedence over `defaultEnvironment`. However, if `gitBranchToEnvironmentMapping` is not set and `defaultEnvironment` is, then the `defaultEnvironment` will be used to execute your Infisical CLI commands. If you wish to override the `defaultEnvironment`, you can do so by using the `--env` flag explicitly. ## Set Infisical environment based on GitHub branch When fetching your secrets from Infisical, you can switch between environments by using the `--env` flag. However, in certain cases, you may prefer the environment to be automatically mapped based on the current GitHub branch you are working on. To achieve this, simply add the `gitBranchToEnvironmentMapping` property to your configuration file, as shown below. ```json .infisical.json { "workspaceId": "63ee5410a45f7a1ed39ba118", "gitBranchToEnvironmentMapping": { "branchName": "dev", "anotherBranchName": "staging" } } ``` ### How it works After configuring this property, every time you use the CLI with the specified configuration file, it will automatically verify if there is a corresponding environment mapping for the current Github branch you are on. If it exists, the CLI will use that environment to retrieve secrets. You can override this behavior by explicitly using the `--env` flag while interacting with the CLI. # Secret scanning Scan and prevent secret leaks in your code base Building upon its core functionality of fetching and injecting secrets into your applications, Infisical now takes a significant step forward in bolstering your code security. We've enhanced our CLI tool to include a powerful scanning feature, capable of identifying more than 140 different types of secret leaks in your codebase. In addition to scanning for past leaks, this new addition also actively aids in preventing future leaks. # Scanning ```bash infisical scan # Display the full secret findings infisical scan --verbose ``` The `infisical scan` command serves to scan repositories, directories, and files. It's compatible with both individual developer machines and Continuous Integration (CI) environments. When you run `infisical scan` on a Git repository, Infisical will parses the output of a `git log -p` command. This command generates [patches](https://stackoverflow.com/questions/8279602/what-is-a-patch-in-git-version-control) that Infisical uses to identify secrets in your code. You can configure the range of commits that `git log` will cover using the `--log-opts` flag. Any options you can use with `git log -p` are valid for `--log-opts`. For instance, to instruct Infisical to scan a specific range of commits, use the following command: `infisical scan --log-opts="--all commitA..commitB"`. For more details, refer to the [Git log documentation](https://git-scm.com/docs/git-log). To scan individual files and directories, use the `--no-git` flag. **View [full details for this command](./commands/scan)** ```bash infisical scan git-changes # Display the full secret findings infisical scan git-changes --verbose ``` Scanning for secrets before you commit your changes is great way to prevent leaks. Infisical makes this easy with the sub command `git-changes`. The `git-changes` scans for uncommitted changes in a Git repository, and is especially designed for use on developer machines, aligning with the ['shift left'](https://cloud.google.com/architecture/devops/devops-tech-shifting-left-on-security) security approach. When `git-changes` is run on a Git repository, Infisical parses the output from a `git diff` command. To scan changes in commits that have been staged via `git add`, you can add the `--staged` flag to the sub command. This flag is particularly useful when using Infisical CLI as a pre-commit tool. **View [full details for this command](./commands/scan-git-changes)** ​ `git-changes` command is only for Git repositories; using it on files or directories will result in an error. # # # Automatically scan changes before you commit To lower the risk of committing hardcoded secrets to your code repository, we have designed a custom git pre-commit hook. This hook scans the changes you're about to commit for any exposed secrets. If any hardcoded secrets are detected, it will block your commit. ### Install pre-commit hook To install this git hook, go into your local git repository and run the following command. ```bash infisical scan install --pre-commit-hook ``` To disable this hook after installing it, run the command `git config --bool hooks.infisical-scan false` ### Third party hooks management If you would rather handle your pre-commit hook outside of the standard `.git/hooks` directory, you can quickly achieve this by adding the following command into your pre-commit script. For instance, if you utilize [Husky](https://typicode.github.io/husky/) for managing your Git hooks, you can insert the command provided below into your `.husky/pre-commit` file. ```bash infisical scan git-changes --staged --verbose ``` # # # Creating a baseline When scanning large repositories or repositories with a long history, it can be helpful to use a baseline. A baseline allows Infisical to ignore any old findings that are already present in the baseline findings. You can create a infisical scan report by running `infisical scan` with the `--report-path` flag. To create a Infisical scan report and save it in a file called leaks-report.json, use the following command: ``` infisical scan --report-path leaks-report.json ``` Once a baseline is created, you can apply it when running the `infisical scan` command again. Use the following command: ``` infisical scan --baseline-path leaks-report.json --report-path findings.json ``` After running the `scan` command with the `--baseline-path` flag, the report output in findings.json will only contain new issues. # # # Configuration file To customize the scan, such as specifying your own rules or establishing exceptions for certain files or paths that should not be flagged as risks, you can define these specifications in the configuration file. ```toml infisical-scan.toml # Title for the configuration file title = "Some title" # This configuration is the foundation that can be expanded. If there are any overlapping rules # between this base and the expanded configuration, the rules in this base will take priority. # Another aspect of extending configurations is the ability to link multiple files, up to a depth of 2. # "Allowlist" arrays get appended and may have repeated elements. # "useDefault" and "path" cannot be used simultaneously. Please choose one. [extend] # useDefault will extend the base configuration with the default config: # https://raw.githubusercontent.com/Infisical/infisical/main/cli/config/infisical-scan.toml useDefault = true # or you can supply a path to a configuration. Path is relative to where infisical cli # was invoked, not the location of the base config. path = "common_config.toml" # An array of tables that contain information that define instructions # on how to detect secrets [[rules]] # Unique identifier for this rule id = "some-identifier-for-rule" # Short human readable description of the rule. description = "awesome rule 1" # Golang regular expression used to detect secrets. Note Golang's regex engine # does not support lookaheads. regex = '''one-go-style-regex-for-this-rule''' # Golang regular expression used to match paths. This can be used as a standalone rule or it can be used # in conjunction with a valid `regex` entry. path = '''a-file-path-regex''' # Array of strings used for metadata and reporting purposes. tags = ["tag","another tag"] # A regex match may have many groups, this allows you to specify the group that should be used as (which group the secret is contained in) # its entropy checked if `entropy` is set. secretGroup = 3 # Float representing the minimum shannon entropy a regex group must have to be considered a secret. # Shannon entropy measures how random a data is. Since secrets are usually composed of many random characters, they typically have high entropy entropy = 3.5 # Keywords are used for pre-regex check filtering. # If rule has keywords but the text fragment being scanned doesn't have at least one of it's keywords, it will be skipped for processing further. # Ideally these values should either be part of the identifier or unique strings specific to the rule's regex # (introduced in v8.6.0) keywords = [ "auth", "password", "token", ] # You can include an allowlist table for a single rule to reduce false positives or ignore commits # with known/rotated secrets [rules.allowlist] description = "ignore commit A" commits = [ "commit-A", "commit-B"] paths = [ '''go\.mod''', '''go\.sum''' ] # note: (rule) regexTarget defaults to check the _Secret_ in the finding. # if regexTarget is not specified then _Secret_ will be used. # Acceptable values for regexTarget are "match" and "line" regexTarget = "match" regexes = [ '''process''', '''getenv''', ] # note: stopwords targets the extracted secret, not the entire regex match # if the extracted secret is found in the stopwords list, the finding will be skipped (i.e not included in report) stopwords = [ '''client''', '''endpoint''', ] # This is a global allowlist which has a higher order of precedence than rule-specific allowlists. # If a commit listed in the `commits` field below is encountered then that commit will be skipped and no # secrets will be detected for said commit. The same logic applies for regexes and paths. [allowlist] description = "global allow list" commits = [ "commit-A", "commit-B", "commit-C"] paths = [ '''gitleaks\.toml''', '''(.*?)(jpg|gif|doc)''' ] # note: (global) regexTarget defaults to check the _Secret_ in the finding. # if regexTarget is not specified then _Secret_ will be used. # Acceptable values for regexTarget are "match" and "line" regexTarget = "match" regexes = [ '''219-09-9999''', '''078-05-1120''', '''(9[0-9]{2}|666)-\d{2}-\d{4}''', ] # note: stopwords targets the extracted secret, not the entire regex match # if the extracted secret is found in the stopwords list, the finding will be skipped (i.e not included in report) stopwords = [ '''client''', '''endpoint''', ] ``` # # # Ignoring Known Secrets If you're intentionally committing a test secret that `infisical scan` might flag, you can instruct Infisical to overlook that secret with the methods listed below. ### infisical-scan:ignore To ignore a secret contained in line of code, simply add `infisical-scan:ignore ` at the end of the line as comment in the given programming. ```js example.js function helloWorld() { console.log("8dyfuiRyq=vVc3RRr_edRk-fK__JItpZ"); // infisical-scan:ignore } ``` ### .infisicalignore An alternative method to exclude specific findings involves creating a .infisicalignore file at your repository's root. You can then add the fingerprints of the findings you wish to exclude. The Infisical scan report provides a unique Fingerprint for each secret found. By incorporating these Fingerprints into the .infisicalignore file, Infisical will skip the corresponding secret findings in subsequent scans. ```.ignore .infisicalignore bea0ff6e05a4de73a5db625d4ae181a015b50855:frontend/components/utilities/attemptLogin.js:stripe-access-token:147 bea0ff6e05a4de73a5db625d4ae181a015b50855:backend/src/json/integrations.json:generic-api-key:5 1961b92340e5d2613acae528b886c842427ce5d0:frontend/components/utilities/attemptLogin.js:stripe-access-token:148 ``` # Quickstart Manage secrets with Infisical CLI The CLI is designed for a variety of secret management applications ranging from local development to CI/CD and production scenarios. In the following steps, we explore how to use the Infisical CLI to fetch back environment variables from Infisical and inject them into your local development process. Start by running the `infisical login` command to authenticate with Infisical. ```bash infisical login ``` If you are in a containerized environment such as WSL 2 or Codespaces, run `infisical login -i` to avoid browser based login Next, navigate to your project and initialize Infisical. ```bash # navigate to your project cd /path/to/project # initialize infisical infisical init ``` The `infisical init` command creates a `.infisical.json` file, containing [local project settings](./project-config), at the location where the command is executed. The `.infisical.json` file does not contain any sensitive data, so you may commit it to your git repository. Finally, pass environment variables from Infisical into your application. ```bash infisical run --env=dev --path=/apps/firefly -- [your application start command] # e.g. npm run dev # example with node (nodemon) infisical run --env=staging --path=/apps/spotify -- nodemon index.js # example with flask infisical run --env=prod --path=/apps/backend -- flask run # example with spring boot - maven infisical run --env=dev --path=/apps/ -- ./mvnw spring-boot:run --quiet ``` Custom aliases can utilize secrets from Infisical. Suppose there is a custom alias `yd` in `custom.sh` that runs `yarn dev` and needs the secrets provided by Infisical. ```bash #!/bin/sh yd() { yarn dev } ``` To make the secrets available from Infisical to `yd`, you can run the following command: ```bash infisical run --env=prod --path=/apps/reddit --command="source custom.sh && yd" ``` View all available options for `run` command [here](./commands/run) In the following steps, we explore how to use the Infisical CLI in a non-local development scenario to fetch back environment variables and export them to a file. Follow the steps listed [here](/documentation/platform/identities/universal-auth) to create a machine identity and obtain a **client ID** and **client secret** for it. Run the following command to authenticate with Infisical using the **client ID** and **client secret** credentials from step 1 and set the `INFISICAL_TOKEN` environment variable to the retrieved access token. ```bash export INFISICAL_TOKEN=$(infisical login --method=universal-auth --client-id= --client-secret= --silent --plain) # --plain flag will output only the token, so it can be fed to an environment variable. --silent will disable any update messages. ``` The CLI is configured to look out for the `INFISICAL_TOKEN` environment variable, so going forward any command used will be authenticated. Alternatively, assuming you have an access token on hand, you can also pass it directly to the CLI using the `--token` flag in conjunction with other CLI commands. Keep in mind that the machine identity access token has a limited lifetime. It is recommended to use it only for the duration of the task at hand. You can [refresh the token](./commands/token) if needed. Finally, export the environment variables from Infisical to a file of choice. ```bash # export variables to a .env file (with export keyword) infisical export --format=dotenv-export > .env # export variables to a YAML file infisical export --format=yaml > secrets.yaml ``` ## History Your terminal keeps a history with the commands you run. When you create Infisical secrets directly from your terminal, they'll stay there for a while. For security and privacy concerns, we recommend you to configure your terminal to ignore those specific Infisical commands. `$HOME/.profile` is pretty common but, you could place it under `$HOME/.profile.d/infisical.sh` or any profile file run at login ```bash cat <> $HOME/.profile && source $HOME/.profile # Ignoring specific Infisical CLI commands DEFAULT_HISTIGNORE=$HISTIGNORE export HISTIGNORE="*infisical secrets set*:$DEFAULT_HISTIGNORE" EOF ``` If you're on WSL, then you can use the Unix/Linux method. Here's some [documentation](https://superuser.com/a/1658331) about how to clear the terminal history, in PowerShell and CMD ## FAQ Yes. The CLI is set to connect to Infisical Cloud by default, but if you're running your own instance of Infisical, you can direct the CLI to it using one of the methods provided below. #### Method 1: Use the updated CLI Beginning with CLI version V0.4.0, it is now possible to choose between logging in through the Infisical cloud or your own self-hosted instance. Simply execute the `infisical login` command and follow the on-screen instructions. #### Method 2: Export environment variable You can point the CLI to the self-hosted Infisical instance by exporting the environment variable `INFISICAL_API_URL` in your terminal. ```bash # set backend host export INFISICAL_API_URL="https://your-self-hosted-infisical.com/api" # remove backend host unset INFISICAL_API_URL ``` ```bash # set backend host setx INFISICAL_API_URL "https://your-self-hosted-infisical.com/api" # remove backend host setx INFISICAL_API_URL "" # NOTE: Once set or removed, please restart powershell for the change to take effect ``` #### Method 3: Set manually on every command Another option to point the CLI to your self-hosted Infisical instance is to set it via a flag on every command you run. ```bash # Example infisical --domain="https://your-self-hosted-infisical.com/api" ``` To use Infisical for non local development scenarios, please create a service token. The service token will allow you to authenticate and interact with Infisical. Once you have created a service token with the required permissions, you’ll need to feed the token to the CLI. ```bash infisical export --token= infisical secrets --token= infisical run --token= -- npm run dev ``` #### Pass via shell environment variable The CLI is configured to look for an environment variable named `INFISICAL_TOKEN`. If set, it’ll attempt to use it for authentication. ```bash export INFISICAL_TOKEN= ``` # Code of Conduct What you should know before contributing to Infisical? ## Our Pledge We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, caste, color, religion, or sexual identity and orientation. We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community. ## Our Standards Examples of behavior that contributes to a positive environment for our community include: * Demonstrating empathy and kindness toward other people * Being respectful of differing opinions, viewpoints, and experiences * Giving and gracefully accepting constructive feedback * Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience * Focusing on what is best not just for us as individuals, but for the overall community Examples of unacceptable behavior include: * The use of sexualized language or imagery, and sexual attention or advances of any kind * Trolling, insulting or derogatory comments, and personal or political attacks * Public or private harassment * Publishing others' private information, such as a physical or email address, without their explicit permission * Other conduct which could reasonably be considered inappropriate in a professional setting ## Enforcement Responsibilities Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful. Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate. ## Scope This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. ## Enforcement Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at [team@infisical.com](mailto:team@infisical.com). All complaints will be reviewed and investigated promptly and fairly. All community leaders are obligated to respect the privacy and security of the reporter of any incident. ## Enforcement Guidelines Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct: ### 1. Correction **Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community. **Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested. ### 2. Warning **Community Impact**: A violation through a single incident or series of actions. **Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban. ### 3. Temporary Ban **Community Impact**: A serious violation of community standards, including sustained inappropriate behavior. **Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban. ### 4. Permanent Ban **Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals. **Consequence**: A permanent ban from any sort of public interaction within the community. ## Attribution This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.1, available at [https://www.contributor-covenant.org/version/2/1/code\_of\_conduct.html][v2.1]. Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder][mozilla coc]. For answers to common questions about this code of conduct, see the FAQ at [https://www.contributor-covenant.org/faq][faq]. Translations are available at [https://www.contributor-covenant.org/translations][translations]. [homepage]: https://www.contributor-covenant.org [v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html [mozilla coc]: https://github.com/mozilla/diversity [faq]: https://www.contributor-covenant.org/faq [translations]: https://www.contributor-covenant.org/translations # FAQ Frequently Asked Questions about contributing to Infisical Frequently asked questions about contributing to Infisical can be found on this page. If you can't find the answer you are looking for, please create an issue on our GitHub repository or join our Slack channel for additional support. The Alpine Linux CDN may be unavailable/down in your region infrequently (eg. there is an unplanned outage). One possible fix is to add a retry mechanism and a fallback mirrors array to the Dockerfile. You can also use this as an opportunity to pin the Alpine Linux version for Docker to use in case there are issues with the latest version. Ensure to use https for the mirrors. #### Make the following changes to the backend Dockerfile ```bash # Pin Alpine version from list: https://dl-cdn.alpinelinux.org/alpine/ ARG ALPINE_VERSION=3.17 ARG ALPINE_APPEND=v3.17/main # Specify number of retries for each mirror ARG MAX_RETRIES=3 # Define base Alpine mirror URLs in attempt order from list: https://dl-cdn.alpinelinux.org/alpine/MIRRORS.txt ARG BASE_ALPINE_MIRRORS="https://dl-cdn.alpinelinux.org/alpine https://ftp.halifax.rwth-aachen.de/alpine https://uk.alpinelinux.org/alpine" # Build stage # Add the Alpine version arg FROM node:16-alpine$ALPINE_VERSION AS build WORKDIR /app COPY package*.json ./ RUN npm ci --only-production COPY . . RUN npm run build # Production stage # Add the Alpine version arg FROM node:16-alpine$ALPINE_VERSION WORKDIR /app ENV npm_config_cache /home/node/.npm COPY package*.json ./ RUN npm ci --only-production COPY --from=build /app . # Add retry mechanism and loop through the specified mirrors RUN retries_left=$MAX_RETRIES; \ for mirror in $ALPINE_MIRRORS; do \ full_mirror="$mirror/$ALPINE_APPEND"; \ echo "Trying mirror: $full_mirror"; \ echo >>/etc/apk/repositories "$full_mirror"; \ for i in $(seq $retries_left); do \ echo "Retrying... Attempt $i (Retries Left: $((retries_left - i)))"; \ if apk add --no-cache bash curl git && \ curl -1sLf 'https://dl.cloudsmith.io/public/infisical/infisical-cli/setup.alpine.sh' | bash && \ apk add --no-cache infisical=0.8.1; then \ break; \ fi; \ sleep 10; \ done; \ if [ $? -eq 0 ]; then \ break; \ fi; \ done HEALTHCHECK --interval=10s --timeout=3s --start-period=10s \ CMD node healthcheck.js EXPOSE 4000 CMD ["npm", "run", "start"] ``` [Alpine Linux (mirrors) - official site](https://dl-cdn.alpinelinux.org/alpine/MIRRORS.txt) [Alpine Linux (mirrors) - archived site](https://web.archive.org/web/20230914123159/https://dl-cdn.alpinelinux.org/alpine/MIRRORS.txt) [Alpine Linux (versions) - official site](https://dl-cdn.alpinelinux.org/alpine/) [Alpine Linux (versions) - archived site](https://web.archive.org/web/20230914123455/https://dl-cdn.alpinelinux.org/alpine/) # Overview Contributing to the Infisical ecosystem. To set a strong foundation, this section outlines how we, the community and members of Infisical, should approach the development and contribution process. ## Code-bases Infisical has two major code-bases. One for the platform code, and one for SDKs. The contribution process has some key differences between the two, so we've split the documentation into two sections: * The [Infisical Platform](https://github.com/Infisical/infisical), the Infisical platform itself. * The [Infisical SDK](https://github.com/Infisical/sdk), the official Infisical client SDKs. The Infisical platform is the core of the Infisical ecosystem. The SDKs are the official Infisical client libraries, used by developers to easily interact with the Infisical platform. ## Community We are building an inclusive community, and this means adhering to the [Code of Conduct](/contributing/getting-started/code-of-conduct). ## Bugs and issues Bug reports help make Infisical a better experience for everyone. When you report a bug, a template will be created automatically containing information we'd like to know. Before raising a new issue, please search existing ones to make sure you're not creating a duplicate. If the issue is related to security, please email us directly at [team@infisical.com](mailto:team@infisical.com). ## Deciding what to work on You can start by browsing through our list of issues or adding your own that improves on the platform experience. Once you've decided on an issue, leave a comment and wait to get approved; this helps avoid multiple people working on the same issue. If you're ever in doubt about whether or not a proposed feature aligns with Infisical as a whole, feel free to raise an issue about it and we'll get back to you promptly. ## Writing and submitting code Anyone can contribute code to Infisical. To get started, check out the local development guides for each language. * Local development guide for Platform is [here](/contributing/platform/developing). * Local development guide for SDK is [here](/contributing/sdk/developing). ## Licensing Most of Infisical's code is under the MIT license, though some paid feature restrictions are covered by a proprietary license. Any third party components incorporated into our code are licensed under the original license provided by the applicable component owner. # Pull requests This guide walks through the code submission process for Infisical. ## Making a pull request Once you are done making changes in local development, you can submit a pull request (PR) to the main repository branch. We require a few considerations on your part to ensure that PRs are easy to review and up to standard with the code. ### Title and content Start by providing a concise title addressing what your PR achieves such as "add pagination to retrieve environment variables for GitLab integration." You should follow the automatically-generated PR template to fill in the PR description. This includes a more detailed description of the changes in the PR, the type of PR, and an acknowledgement that you've read and agreed to the contributing guidelines. ### Feature PRs Give a functional overview of how your feature works, including how the user can use the feature. Then share any technical details in an overview of how the PR works. As of `06-01-2023`, all PRs created after this date are required to attach a video of you performing the described functionality. ### Bug Fix PRs Give an overview of the bug at hand and how your PR fixes the it at both a high and low level. Feel free to add a short video or screenshots of what your PR achieves. ## Getting your PR reviewed Once your PR is reviewed, one or two relevant members of the Infisical team should review and approve the PR before it is merged. You should coordinate and ping the team member closest to the submitted functionality via our [Slack](https://infisical.com/slack) to review your PR. * Vlad: Frontend, Web UI * Tony: Backend, SDKs, Security * Maidul: Backend, CI/CD, CLI, Kubernetes Operator * Daniel: Frontend, UI/UX, Backend, SDKs The team member(s) will start by enabling baseline checks to ensure that there are no leaked secrets, new dependencies are clear, and the frontend/backend services start up. Afterward, they will review your PR thoroughly by testing the code and leave any feedback or work in with you to revise the PR up to standard. Once everything is good, the team member(s) will approve the PR to be merged into the `main` branch; all changes will be tested in CI/CD and our staging environment first before being deployed to production. Due to the high volume of issues, PRs, etc. from the community, and limited bandwidth on our end to address everything instantly, we prefer reviewing PRs once they are fully complete and well-tested. In the past, we've often had to review low-quality PRs up to 10 times which severely restricts our capacity to address other issues, PRs, and initiatives in the pipeline. As such, we ask of the community to submit higher-quality PRs that, for example, don't break existing code; in return we'll prioritize the first 3 reviews for PRs. # Backend folder structure ``` ├── scripts ├── e2e-test └── src/ ├── @types/ │ ├── knex.d.ts │ └── fastify.d.ts ├── db/ │ ├── migrations │ ├── schemas │ └── seed ├── lib/ │ ├── fn │ ├── date │ └── config ├── queue ├── server/ │ ├── routes/ │ │ ├── v1 │ │ └── v2 │ ├── plugins │ └── config ├── services/ │ ├── auth │ ├── org │ └── project/ │ ├── project-service.ts │ ├── project-types.ts │ └── project-dal.ts └── ee/ ├── routes └── services ``` ### `backend/scripts` Contains reusable scripts for backend automation, like running migrations and generating SQL schemas. ### `backend/e2e-test` Integration tests for the APIs. ### `backend/src` The source code of the backend. * `@types`: Type definitions for libraries like Fastify and Knex. * `db`: Knex.js configuration for the database, including migration, seed files, and SQL type schemas. * `lib`: Stateless, reusable functions used across the codebase. * `queue`: Infisical's queue system based on BullMQ. ### `src/server` * Scope anything related to Fastify/service here. * Includes routes, Fastify plugins, and server configurations. * The routes folder contains various versions of routes separated into v1, v2, etc. ### `src/services` * Handles the core business logic for all operations. * Follows the co-location principle: related components should be kept together. * Each service component typically contains: 1. **dal**: Database Access Layer functions for database operations 2. **service**: The service layer containing business logic. 3. **type**: Type definitions used within the service component. 4. **fns**: An optional component for sharing reusable functions related to the service. 5. **queue**: An optional component for queue-specific logic, like `secret-queue.ts`. ### `src/ee` Follows the same pattern as above, with the exception of a license change from MIT to Infisical Proprietary License. ### Guidelines and Best Practices * All services are interconnected at `/src/server/routes/index.ts`, following the principle of simple dependency injection. * Files should be named in dash-case. * Avoid using classes in the codebase; opt for simple functions instead. * All committed code must be properly linted using `npm run lint:fix` and type-checked with `npm run type:check`. * Minimize shared logic between services as much as possible. * Controllers within a router component should ideally call only one service layer, with exceptions for services like `audit-log` that require access to request object data. # Backend development guide Suppose you're interested in implementing a new feature in Infisical's backend, let's call it "feature-x." Here are the general steps you should follow. ## Database schema migration In order to run [schema migrations](https://en.wikipedia.org/wiki/Schema_migration#:~:text=A%20schema%20migration%20is%20performed,some%20newer%20or%20older%20version) you need to expose your database connection string. Create a `.env.migration` file to set the database connection URI for migration scripts, or alternatively, export the `DB_CONNECTION_URI` environment variable. ## Creating new database model If your feature involves a change in the database, you need to first address this by generating the necessary database schemas. 1. If you're adding a new table, update the `TableName` enum in `/src/db/schemas/models.ts` to include the new table name. 2. Create a new migration file by running `npm run migration:new` and give it a relevant name, such as `feature-x`. 3. Navigate to `/src/db/migrations/_.ts`. 4. Modify both the `up` and `down` functions to create or alter Postgres fields on migration up and to revert these changes on migration down, ensuring idempotency as outlined [here](https://github.com/graphile/migrate/blob/main/docs/idempotent-examples.md). ### Generating TS Schemas While typically you would need to manually write TS types for Knex type-sense, we have automated this process: 1. Start the server. 2. Run `npm run migration:latest` to apply all database changes. 3. Execute `npm run generate:schema` to automatically generate types and schemas using [zod](https://github.com/colinhacks/zod) in the `/src/db/schemas` folder. 4. Update the barrel export in `schema/index` and include the new tables in `/src/@types/knex.d.ts` to enable type-sensing in Knex.js. ## Business Logic Once the database changes are in place, it's time to create the APIs for `feature-x`: 1. Execute `npm run generate:component`. 2. Choose option 1 for the service component. 3. Name the service in dash-case, like `feature-x`. This will create a `feature-x` folder in `/src/services` containing three files. 1. `feature-x-dal`: The Database Access Layer functions. 2. `feature-x-service`: The service layer where all the business logic is handled. 3. `feature-x-type`: The types used by `feature-x`. For reusable shared functions, set up a file named `feature-x-fns`. Use the custom Infisical function `ormify` in `src/lib/knex` for simple database operations within the DAL. ## Connecting the Service Layer to the Server Layer Server-related logic is handled in `/src/server`. To connect the service layer to the server layer, we use Fastify plugins for dependency injection: 1. Add the service type in the `fastify.d.ts` file under the `service` namespace of a FastifyServerInstance type. 2. In `/src/server/routes/index.ts`, instantiate the required dependencies for `feature-x`, such as the DAL and service layers, and then pass them to `fastify.register("service,{...dependencies})`. 3. This makes the service layer accessible within all routes under the Fastify service instance, accessed via `server.services..`. ## Writing API Routes 1. To create a route component, run `npm run generate:component`. 2. Select option 3, type the router name in dash-case, and provide the version number. This will generate a router file in `src/server/routes/v/` 1. Implement your logic to connect with the service layer as needed. 2. Import the router component in the version folder's index.ts. For instance, if it's in v1, import it in `v1/index.ts`. 3. Finally, register it under the appropriate prefix for access. # Local development This guide will help you set up and run the Infisical platform in local development. ## Fork and clone the repo [Fork](https://docs.github.com/en/get-started/quickstart/fork-a-repo) the [repository](https://github.com/Infisical/infisical) to your own GitHub account and then [clone](https://docs.github.com/en/repositories/creating-and-managing-repositories/cloning-a-repository) it to your local device. Once, you've done that, create a new branch: ```console git checkout -b MY_BRANCH_NAME ``` ## Set up environment variables Start by creating a .env file at the root of the Infisical directory then copy the contents of the file linked [here](https://github.com/Infisical/infisical/blob/main/.env.example). View all available [environment variables](https://infisical.com/docs/self-hosting/configuration/envars) and guidance for each. ## Starting Infisical for development We use Docker to spin up all required services for Infisical in local development. If you are unfamiliar with Docker, don’t worry, all you have to do is install Docker for your machine and run the command below to start up the development server. #### Start local server ```bash docker compose -f docker-compose.dev.yml up --build --force-recreate ``` #### Access local server Once all the services have spun up, browse to [http://localhost:8080](http://localhost:8080). #### Shutdown local server ```bash # To stop environment use Control+C (on Mac) CTRL+C (on Win) or docker compose -f docker-compose.dev.yml down ``` ## Starting Infisical docs locally We use [Mintlify](https://mintlify.com/) for our docs. #### Install Mintlify CLI. ```bash npm i -g mintlify ``` or ```bash yarn global add mintlify ``` #### Running the docs Go to `docs` directory and run `mintlify dev`. This will start up the docs on `localhost:3000` ```bash # From the root directory cd docs; mintlify dev; ``` # Local development This guide will help you contribute to the Infisical SDK. ## Fork and clone the repo [Fork](https://docs.github.com/en/get-started/quickstart/fork-a-repo) the [repository](https://github.com/Infisical/sdk) to your own GitHub account and then [clone](https://docs.github.com/en/repositories/creating-and-managing-repositories/cloning-a-repository) it to your local device. Once, you've done that, create a new branch: ```console git checkout -b MY_BRANCH_NAME ``` ## Set up environment variables Start by creating a .env file at the root of the Infisical directory then copy the contents of the file below into the .env file. ```env # This is required for running tests locally. # Rename this file to ".env" and fill in the values below. # Please make sure that the machine identity has access to the project you are testing in. # https://infisical.com/docs/documentation/platform/identities/universal-auth INFISICAL_UNIVERSAL_CLIENT_ID=MACHINE_IDENTITY_CLIENT_ID INFISICAL_UNIVERSAL_CLIENT_SECRET=MACHINE_IDENTITY_CLIENT_SECRET # The ID of the Infisical project where we will create the test secrets. # NOTE: The project must have a dev environment. (This is created by default when you create a project.) INFISICAL_PROJECT_ID=INFISICAL_TEST_PROJECT_ID # The Infisical site URL. If you are testing with a local Infisical instance, then this should be set to "http://localhost:8080". INFISICAL_SITE_URL=https://app.infisical.com ``` The above values are required for running tests locally. Before opening a pull request, make sure to run `cargo test` to ensure that all tests pass. ## Guidelines ### Predictable and consistent When adding new functionality (such as new functions), it's very important that the functionality is added to *all* the SDK's. This is to ensure that the SDK's are predictable and consistent across all languages. If you are adding new functionality, please make sure to add it to all the SDK's. ### Handling errors Error handling is very important when writing SDK's. We want to make sure that the SDK's are easy to use, and that the user gets a good understanding of what went wrong when something fails. When adding new functionality, please make sure to add proper error handling. [Read more about error handling here](#error-handling). ### Tests If you add new functionality or modify existing functionality, please write tests thats properly cover the new functionality. You can run tests locally by running `cargo test` from the root directory. You must always run tests before opening a pull request. ### Code style Please follow the default rust styling guide when writing code for the base SDK. [Read more about rust code style here](https://doc.rust-lang.org/nightly/style-guide/#the-default-rust-style). ## Prerequisites for contributing ### Understanding the terms In the guide we use some terms that might be unfamiliar to you. Here's a quick explanation of the terms we use: * **Base SDK**: The base SDK is the SDK that all other SDK's are built on top of. The base SDK is written in Rust, and is responsible for executing commands and parsing the input and output to and from JSON. * **Commands**: Commands are what's being sent from the target language to the command handler. The command handler uses the command to execute the corresponding function in the base SDK. Commands are in reality just a JSON string that tells the command handler what function to execute, and what input to use. * **Command handler**: The command handler is the part of the base SDK that takes care of executing commands. It also takes care of parsing the input and output to and from JSON. * **Target language**: The target language refers to the actual SDK code. For example, the [Node.js SDK](https://www.npmjs.com/package/@infisical/sdk) is a "target language", and so is the [Python SDK](https://pypi.org/project/infisical-python/). ### Understanding the execution flow After the target language SDK is initiated, it uses language-specific bindings to interact with the base SDK. These bindings are instantiated, setting up the interface for command execution. A client within the command handler is created, which issues commands to the base SDK. When a command is executed, it is first validated. If valid, the command handler locates the corresponding command to perform. If the command executes successfully, the command handler returns the output to the target language SDK, where it is parsed and returned to the user. If the command handler fails to validate the input, an error will be returned to the target language SDK. ### Rust knowledge Contributing to the SDK requires intermediate to advanced knowledge of Rust concepts such as lifetimes, traits, generics, and async/await *(futures)*, and more. ### Rust setup The base SDK is written in rust. Therefore you must have rustc and cargo installed. You can install rustc and cargo by following the instructions [here](https://www.rust-lang.org/tools/install). You shouldn't have to use the rust cross compilation toolchain, as all compilation is done through a collection of Github Actions. However. If you need to test cross compilation, please do so with Github Actions. ### Tests If you add new functionality or modify existing functionality, please write tests thats properly cover the new functionality. You can run tests locally by running `cargo test` from the root directory. ### Language-specific crates The language-specific crates should ideally never have to be modified, as they are simply a wrapper for the `infisical-json` crate, which executes "commands" from the base SDK. If you need to create a new target-language specific crate, please try to create native bindings for the target language. Some languages don't have direct support for native bindings (Java as an example). In those cases we can use the C bindings (`crates/infisical-c`) in the target language. ## Generate types Having almost seemless type safety from the base SDK to the target language is critical, as writing types for each language has a lot of drawbacks such as duplicated code, and lots of overhead trying to keep the types up-to-date and in sync across a large collection of languages. Therefore we decided to use [QuickType](https://quicktype.io/) and [Serde](https://serde.rs/) to help us generate types for each language. In our Rust base SDK (`crates/infisical`), we define all the inputs/outputs. If you are interested in reading about QuickType works under the hood, you can [read more here](http://blog.quicktype.io/under-the-hood/). This is an example of a type defined in Rust (both input and output). For this to become a generated type, you'll need to add it to our schema generator. More on that further down. ```rust use schemars::JsonSchema; use serde::{Deserialize, Serialize}; #[derive(Serialize, Deserialize, Debug, JsonSchema)] #[serde(rename_all = "camelCase")] // Input: pub struct CreateSecretOptions { pub environment: String, // environment pub secret_comment: Option, // secretComment pub path: Option, // secretPath pub secret_value: String, // secretValue pub skip_multiline_encoding: Option, // skipMultilineEncoding pub r#type: Option, // shared / personal pub project_id: String, // workspaceId pub secret_name: String, // secretName (PASSED AS PARAMETER IN REQUEST) } // Output: #[derive(Serialize, Deserialize, Debug, JsonSchema)] #[serde(rename_all = "camelCase")] pub struct CreateSecretResponse { pub secret: Secret, // "Secret" is defined elsewhere. } ``` ### Adding input types to the schema generator You will *only* have to define outputs in our schema generator, then QuickType will take care of the rest behind the scenes. You can find the Rust crate that takes care of type generation here: `crates/sdk-schemas/src/main.rs`. Simply add the output *(also called response)*, to the `write_schema_for_response!` macro. This will let QuickType know that it should generate types for the given structs. The main function will look something like this: ```rust fn main() -> Result<()> { // Input types for new Client write_schema_for!(infisical_json::client::ClientSettings); // Input types for Client::run_command write_schema_for!(infisical_json::command::Command); // Output types for Client::run_command // Only add structs which are direct results of SDK commands. write_schema_for_response! { infisical::manager::secrets::GetSecretResponse, infisical::manager::secrets::ListSecretsResponse, infisical::manager::secrets::UpdateSecretResponse, infisical::manager::secrets::DeleteSecretResponse, infisical::manager::secrets::CreateSecretResponse, // <-- This is the output from the above example! infisical::auth::AccessTokenSuccessResponse }; Ok(()) } ``` ### Generating the types for the target language Once you've added the output to the schema generator, you can generate the types for the target language by running the following command from the root directory: ```console $ npm install $ npm run schemas ``` If you change any of the structs defined in the base SDK, you will need to run this script to re-generate the types. This command will run the `schemas.ts` file found in the `support/scripts` folder. If you are adding a new language, it's important that you add the language to the code. This is an example of how how we generate types for Node.js: ```ts const ts = await quicktype({ inputData, lang: "typescript", rendererOptions: {} }); await ensureDir("./languages/node/src/infisical_client"); writeToFile("./languages/node/src/infisical_client/schemas.ts", ts.lines); ``` ## Building bindings We've tried to streamline the building process as much as possible. So you shouldn't have to worry much about building bindings, as it should just be a few commands. ### Node.js Building bindings for Node.js is very straight foward. The command below will generate NAPI bindings for Node.js, and move the bindings to the correct folder. We use [NAPI-RS](https://napi.rs/) to generate the bindings. ```console $ cd languages/node $ npm run build ``` ### Python To generate and use python bindings you will need to run the following commands. The Python SDK is located inside the crates folder. This is a limitation of the maturin tool, forcing us to structure the project in this way. ```console $ pip install -U pip maturin $ cd crates/infisical-py $ python3 -m venv .venv $ source .venv/bin/activate $ maturin develop ``` After running the commands above, it's very important that you rename the generated .so file to `infisical_py.so`. After renaming it you also need to move it into the root of the `crates/infisical-py` folder. ### Java Java uses the C bindings to interact with the base SDK. To build and use the C bindings in Java, please follow the instructions below. ```console $ cd crates/infisical-c $ cargo build --release $ cd ../../languages/java ``` After generating the C bindings, the generated .so or .dll has been created in the `/target` directory at the root of the project. You have to manually move the generated file into the `languages/java/src/main/resources` directory. ## Error handling ### Error handling in the base SDK The base SDK should never panic. If an error occurs, we should return a `Result` with an error message. We have a custom Result type defined in the `error.rs` file in the base SDK. All our errors are defined in an enum called `Error`. The `Error` enum is defined in the `error.rs` file in the base SDK. The `Error` enum is used in the `Result` type, which is used as the return type for all functions in the base SDK. ```rust #[derive(Debug, Error)] pub enum Error { // Secret not found #[error("Secret with name '{}' not found.", .secret_name)] SecretNotFound { secret_name: String }, // .. other errors // Errors that are not specific to the base SDK. #[error(transparent)] Reqwest(#[from] reqwest::Error), #[error(transparent)] Serde(#[from] serde_json::Error), #[error(transparent)] Io(#[from] std::io::Error), } ``` ### Returning an error You can find many examples of how we return errors in the SDK code. A relevant example is for creating secrets, which can be found in `crates/infisical/src/api/secrets/create_secret.rs`. When the error happened due to a request error to our API, we have an API error handler. This prevents duplicate code and keeps error handling consistent across the SDK. You can find the api error handler in the `error.rs` file. ### Error handling in the target language SDK's. All data sent to the target language SDK has the same format. The format is an object with 3 fields: `success (boolean)`, `data (could be anything or nothing)`, and `errorMessage (string or null)`. The `success` field is used to determine if the request was successful or not. The `data` field is used to return data from the SDK. The `errorMessage` field is used to return an error message if the request was not successful. This means that if the success if false or if the error message is not null, something went wrong and we should throw an error on the target-language level, with the error message. ## Command handler ### What is the command handler The command handler (the `infisical-json` crate), takes care of executing commands sent from the target language. It also takes care of parsing the input and output to and from JSON. The command handler is the only part of the base SDK that should be aware of JSON. The rest of the base SDK should be completely unaware of JSON, and only work with the Rust structs defined in the base SDK. The command handler exposes a function called `run_command`, which is what we use in the target language to execute commands. The function takes a json string as input, and returns a json string as output. We use helper functions generated by QuickType to convert the input and output to and from JSON. ### Creating new SDK methods Creating new commands is necessary when adding new methods to the SDK's. Defining a new command is a 3-step process in most cases. #### 1. Define the input and output structs Earlier in this guide, we defined the input and output structs for the `CreateSecret` command. We will use that as an example here as well. #### 2. Creating the method in the base SDK The first step is to create the method in the base SDK. This step will be different depending on what method you are adding. In this example we're going to assume you're adding a function for creating a new secret. After you created the function for creating the secret, you'll need need to add it to the ClientSecrets implementation. We do it this way to keep the code organized and easy to read. The ClientSecrets struct is located in the `crates/infisical/src/manager/secrets.rs` file. ```rust pub struct ClientSecrets<'a> { pub(crate) client: &'a mut crate::Client, } impl<'a> ClientSecrets<'a> { pub async fn create(&mut self, input: &CreateSecretOptions) -> Result { create_secret(self.client, input).await // <-- This is the function you created! } } impl<'a> Client { pub fn secrets(&'a mut self) -> ClientSecrets<'a> { ClientSecrets { client: self } } } ``` #### 3. Define a new command We define new commands in the `crates/infisical-json/src/command.rs` file. The `Command` enum is what we use to define new commands. In the codesnippet below we define a new command called `CreateSecret`. The `CreateSecret` command takes a `CreateSecretOptions` struct as input. We don't have to define the output, because QuickType's converter helps us with figuring out the return type for each command. ````rust ```rust use schemars::JsonSchema; use serde::{Deserialize, Serialize}; #[derive(Serialize, Deserialize, JsonSchema, Debug)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub enum Command { GetSecret(GetSecretOptions), ListSecrets(ListSecretsOptions), CreateSecret(CreateSecretOptions), // <-- The new command! UpdateSecret(UpdateSecretOptions), DeleteSecret(DeleteSecretOptions), } ```` #### 4. Add the command to the command handler After defining the command, we need to add it to the command handler itself. This takes place in the `crates/infisical-json/src/client.rs` file. The `run_command` function is what we use to execute commands. In the Client implementation we try to parse the JSON string into a `Command` enum. If the parsing is successful, we match the command and execute the corresponding function. ```rust match cmd { Command::GetSecret(req) => self.0.secrets().get(&req).await.into_string(), Command::ListSecrets(req) => self.0.secrets().list(&req).await.into_string(), Command::UpdateSecret(req) => self.0.secrets().update(&req).await.into_string(), Command::DeleteSecret(req) => self.0.secrets().delete(&req).await.into_string(), // This is the new command: Command::CreateSecret(req) => self.0.secrets().create(&req).await.into_string(), } ``` #### 5. Implementing the new command in the target language SDK's We did it! We've now added a new command to the base SDK. The last step is to implement the new command in the target language SDK's. The process is a little different from language to language, but in this example we're going to assume that we're adding a new command to the Node.js SDK. First you'll need to generate the new type schemas, we added a new command, input struct, and output struct. [Read more about generating types here](#generating-the-types-for-the-target-language). Secondly you need to build the new node bindings so we can use the new functionality in the Node.js SDK. You can do this by running the following command from the `languages/node` directory: ```console $ npm install $ npm run build ``` The build command will execute a build script in the `infisical-napi` crate, and move the generated bindings to the appropriate folder. After building the new bindings, you can access the new functionality in the Node.js SDK source. ```ts // 'binding' is a js file that makes it easier to access the methods in the bindings. (it's auto generated when running npm run build) import * as rust from "../../binding"; // We can import the newly generated types from the schemas.ts file. (Generated with QuickType!) import type { CreateSecretOptions, CreateSecretResponse } from "./schemas"; // This is the QuickType converter that we use to create commands with! It takes care of all JSON parsing and serialization. import { Convert, ClientSettings } from "./schemas"; export class InfisicalClient { #client: rust.Client; constructor(settings: ClientSettings) { const settingsJson = settings == null ? null : Convert.clientSettingsToJson(settings); this.#client = new rust.InfisicalClient(settingsJson); } // ... getSecret // ... listSecrets // ... updateSecret // ... deleteSecret async createSecret(options: CreateSecretOptions): Promise { // The runCommand will return a JSON string, which we can parse into a CreateSecretResponse. const command = await this.#client.runCommand( Convert.commandToJson({ createSecret: options }) ); const response = Convert.toResponseForCreateSecretResponse(command); // <-- This is the QuickType converter in action! // If the response is not successful or the data is null, we throw an error. if (!response.success || response.data == null) { throw new Error(response.errorMessage ?? "Something went wrong"); } // To make it easier to work with the response, we return the secret directly. return response.data.secret; } } ``` And that's it! We've now added a new command to the base SDK, and implemented it in the Node.js SDK. The process is very similar for all other languages, but the code will look a little different. ## Conclusion The SDK has a lot of moving parts, and it can be a little overwhelming at first. But once you get the hang of it, it's actually quite simple. If you have any questions, feel free to reach out to us on [Slack](https://infisical.com/slack), or [open an issue](https://github.com/Infisical/sdk/issues) on GitHub. # What is Infisical? An Introduction to the Infisical secret management platform. **[Infisical](https://infisical.com)** is the open source secret management platform that developers use to centralize their application configuration and secrets like API keys and database credentials as well as manage their internal PKI. Additionally, developers use Infisical to prevent secrets leaks to git and securely share secrets amongst engineers. Start managing secrets securely with [Infisical Cloud](https://app.infisical.com) or learn how to [host Infisical](/self-hosting/overview) yourself. Get started with Infisical Cloud in just a few minutes. Self-host Infisical on your own infrastructure. ## Why Infisical? Infisical helps developers achieve secure centralized secret management and provides all the tools to easily manage secrets in various environments and infrastructure components. In particular, here are some of the most common points that developers mention after adopting Infisical: * Streamlined **local development** processes (switching .env files to [Infisical CLI](/cli/commands/run) and removing secrets from developer machines). * **Best-in-class developer experience** with an easy-to-use [Web Dashboard](/documentation/platform/project). * Simple secret management inside **[CI/CD pipelines](/integrations/cicd/githubactions)** and staging environments. * Secure and compliant secret management practices in **[production environments](/sdks/overview)**. * **Facilitated workflows** around [secret change management](/documentation/platform/pr-workflows), [access requests](/documentation/platform/access-controls/access-requests), [temporary access provisioning](/documentation/platform/access-controls/temporary-access), and more. * **Improved security posture** thanks to [secret scanning](/cli/scanning-overview), [granular access control policies](/documentation/platform/access-controls/overview), [automated secret rotation](https://infisical.com/docs/documentation/platform/secret-rotation/overview), and [dynamic secrets](/documentation/platform/dynamic-secrets/overview) capabilities. ## How does Infisical work? To make secret management effortless and secure, Infisical follows a certain structure for enabling secret management workflows as defined below. **Identities** in Infisical are users or machine which have a certain set of roles and permissions assigned to them. Such identities are able to manage secrets in various **Clients** throughout the entire infrastructure. To do that, identities have to verify themselves through one of the available **Authentication Methods**. As a result, the 3 main concepts that are important to understand are: * **[Identities](/documentation/platform/identities/overview)**: users or machines with a set permissions assigned to them. * **[Clients](/integrations/platforms/kubernetes)**: Infisical-developed tools for managing secrets in various infrastructure components (e.g., [Kubernetes Operator](/integrations/platforms/kubernetes), [Infisical Agent](/integrations/platforms/infisical-agent), [CLI](/cli/usage), [SDKs](/sdks/overview), [API](/api-reference/overview/introduction), [Web Dashboard](/documentation/platform/organization)). * **[Authentication Methods](/documentation/platform/identities/universal-auth)**: ways for Identities to authenticate inside different clients (e.g., SAML SSO for Web Dashboard, Universal Auth for Infisical Agent, AWS Auth etc.). ## How to get started with Infisical? Depending on your use case, it might be helpful to look into some of the resources and guides provided below. Inject secrets into any application process/environment. Fetch secrets with any programming language on demand. Inject secrets into Docker containers. Fetch and save secrets as native Kubernetes secrets. Fetch secrets via HTTP request. Explore integrations for GitHub, Vercel, AWS, and more. # Introduction Whether you're running a Node application on Heroku, Next.js application with Vercel, or Kubernetes on AWS, Infisical has a secret management strategy from local development to production ready for you. ## Guides by Language Manage secrets across your Node stack Manage secrets across your Python stack ## Guides by Stack Manage secrets for your Next.js + Vercel stack Want a guide? [Throw in a request](https://github.com/Infisical/infisical/issues). # Secret Management in Development Environments Learn how to manage secrets in local development environments. ## Problem at hand There is a number of issues that arise with secret management in local development environment: 1. **Getting secrets onto local machines**. When new developers join or a new project is created, the process of getting the development set of secrets onto local machines is often unclear. As a result, developers end up spending a lot of time onboarding and risk potentially following insecure practices when sharing secrets from one developer to another. 2. **Syncing secrets with teammates**. One of the problems with .env files is that they become unsynced when one of the developers updates a secret or configuration. Even if the rest of the team is notified, developers don't make all the right changes immediately, and later on end up spending a lot of time debugging an issue due to missing environment variables. This leads to a lot of inefficiencies and lost time. 3. **Accidentally leaking secrets**. When developing locally, it's common for developers to accidentally leak a hardcoded secret as part of a commit. As soon as the secret is part of the git history, it becomes hard to get it removed and create a security vulnerability. ## Solution One of the main benefits of Infisical is the facilitation of secret management workflows in local development use cases. In particular, Infisical heavily follows the "Security Shift Left" principle to enable developers to effortlessly follow secure practices when coding. ### CLI [Infisical CLI](/cli/overview) is the most frequently used Infisical tool for secret management in local development environments. It makes it easy to inject secrets right into the local application environments based on the permissions given to corresponding developers. ### Dashboard On top of that, Infisical provides a great [Web Dashboard](https://app.infisical.com/signup) that can be used to making quick secret updates. ![project dashboard](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/dashboard.png) ### Personal Overrides By default, all the secrets in the Infisical environments are shared among project members who have the permission to access those environment. At the same time, when doing local development, it is often desirable to change the value of a certain secret only for a particular self. For such use cases, Infisical supports the functionality of **Personal Overrides** – which allow developers to override values of any secrets without affecting the workflows of the rest of the team. Personal Overrides can be created both in the dashboard or via [Infisical CLI](/cli/overview). ### Secret Scanning In addition, Infisical also provides a set of tools to automatically prevent secret leaks to git history. This functionality can be set up on the level of [Infisical CLI using pre-commit hooks](/cli/scanning-overview#automatically-scan-changes-before-you-commit) or through a direct integration with platforms like GitHub. # Microsoft Power Apps Learn how to manage secrets in Microsoft Power Apps with Infisical. In recent years, there has been a shift towards so-called low-code and no-code platforms. These platforms are particularly appealing to businesses without internal development capabilities, yet teams often discover that some coding is necessary to fully satisfy their business needs. Low-code platforms have become increasingly sophisticated and useful, leading to a rise in their adoption by businesses. A prime example is Microsoft Power Apps, which offers a range of data sources and service integrations right out of the box. However, even with advanced tools, you might not always find a ready-made solution for every challenge. This means that low-code doesn't equate to no-code, as some coding and customization are still required to cater to specific needs. Consider the need for data integrations where an HTTP-based call to a web service might be necessary, typically requiring authentication through an API key or another type of secret. Importantly, it's crucial to avoid hardcoding these secrets, as they would then be accessible to anyone with collaboration rights to the code. This underscores the importance of using a secret management solution like Infisical. In this article, we'll demonstrate how to retrieve app secrets from Infisical for use in a Power Apps application. We'll create a simple application with a dedicated data connector to illustrate the ease of integrating Infisical with Power Apps. This tutorial assumes some prior programming experience in C#. Prerequisites: * Created Microsoft Power App. First, let’s create a new Azure Function using the Azure Management Portal. Get the [Function App](https://azuremarketplace.microsoft.com/en-us/marketplace/apps/Microsoft.FunctionApp?tab=Overview) from the [Azure Marketplace](https://azuremarketplace.microsoft.com/en-us/). ![function app](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/guides/microsoft-power-apps/function-app.png) Place it in a subscription using any resource group. The name of the function is arbitrary. We'll use .NET as a runtime stack, but you can use whatever you're most comfortable with. The OS choice is also up to you. While Linux may look like a lightweight solution, Windows actually has more Azure Functions support. For instance, you cannot edit a Linux-based Azure Function within the Azure management portal. By using a consumption plan, we'll only pay for the resources we use when they are requested. This is the classic “serverless” approach, where you do not pay for running servers, only for interactivity. Once the new Azure Functions instance is ready, we add a function. In this case, we can do that already from the Azure Management Portal. Use the “HTTP trigger” template and choose the “function” authorization level. The code for the first function can be as simple as: ``` using System.Net; public static async Task Run(HttpRequestMessage req, TraceWriter log) { log.Info("C# HTTP trigger function processed a request."); return req.CreateResponse(HttpStatusCode.OK, "Hello World"); } ``` The code above is written for the older runtime. As a result, you may need to change the runtime version to 1 for the Azure Power Apps integration to work. If we start at a newer version (for example, 3) this triggers a warning before the migration. Finally, we also need to publish the Swagger (or API) definitions and enable cross-origin resource sharing (CORS). While the API definitions are rather easy to set up, the correct CORS value may be tricky. For now, we can use the wildcard option to allow all hosts. Once we set all this up, it’s time to create the custom connector. You can create the custom connector via the data pane. When we use “Create from Azure Service (Preview)”, this yields a dialog similar to the following: ![custom-connector](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/guides/microsoft-power-apps/custom-connector.png) We can now fill out the fields using the information for our created function. The combination boxes are automatically filled in order. Once we select one of the reachable subscriptions (tied to the same account we’ve used to log in to create a Power App), the available services are displayed. Once we select our Azure Functions service, we select the function for retrieving the secret. You can add Infisical in an Azure Function quite easily using the [Infisical SDK for .NET](https://infisical.com/docs/sdks/languages/csharp) (or other languages). This enables the function to communicate with Infisical to obtain secrets, among other things. In short, we can simply bring all the necessary classes over and start using the Client class. Essentially, this enables us to write code like this: ``` var settings = new ClientSettings { ClientId = "CLIENT_ID", ClientSecret = "CLIENT_SECRET", // SiteUrl = "http://localhost:8080", <-- This line can be omitted if you're using Infisical Cloud. }; var infisical = new InfisicalClient(settings); var options = new GetSecretOptions { SecretName = "TEST", ProjectId = "PROJECT_ID", Environment = "dev", }; var secret = infisical.GetSecret(options); ``` Knowing the URL of Infisical as well as the Client Id and Client Secret, we can now access the desired values. Now it’s time to actually use the secret within a Power App. There are two ways to request a desired target service with a secret retrieved from the function: 1. Call the function first, retrieve the secret, then call the target service, for example, via another custom connector with the secret as input. 2. Perform the final API request within the function call — not returning a secret at all, just the response from invoking the target service. While the first option is more flexible (and presumably cheaper!), the second option is definitely easier. In the end, you should mostly decide based on whether the function should be reused for other purposes. If the single Power App is the only consumer of the function, it may make more sense to go with the second option. Otherwise, you should use the first option. For our simple example, we don’t need to reuse the function. We also don’t want the additional complexity of maintaining two different custom connectors, where we only use one to pass data to the other one. Based on the previous snippet, we create the following code (for proxying a GET request from an API accessible via the URL specified in the apiEndpoint variable). ``` using (var client = new HttpClient()) { client.DefaultRequestHeaders .Accept .Add(new MediaTypeWithQualityHeaderValue("application/json")); client.DefaultRequestHeaders.Add("X-API-KEY", secret); var result = await client.GetAsync(apiEndpoint); var resultContent = await result.Content.ReadAsStringAsync(); req.CreateResponse(HttpStatusCode.OK, resultContent); } ``` This creates a request to the resource protected by an API key that is retrieved from Infisical. # Next.js + Vercel This guide demonstrates how to use Infisical to manage secrets for your Next.js + Vercel stack from local development to production. It uses: * Infisical (you can use [Infisical Cloud](https://app.infisical.com) or a [self-hosted instance of Infisical](https://infisical.com/docs/self-hosting/overview)) to store your secrets. ## Project Setup To begin, we need to set up a project in Infisical and add secrets to an environment in it. ### Create a project 1. Create a new project in [Infisical](https://app.infisical.com/). 2. Add a secret to the development environment of this project so we can pull it back for local development. In the **Secrets Overview** page, press **Explore Development** and add a secret with the key `NEXT_PUBLIC_NAME` and value `YOUR_NAME`. 3. Add a secret to the production environment of this project so we can sync it to Vercel. Switch to the **Production** environment and add a secret with the key `NEXT_PUBLIC_NAME` and value `ANOTHER_NAME`. ## Create a Next.js app Initialize a new Node.js app. We can use `create-next-app` to initialize an app called `infisical-nextjs`. ```console npx create-next-app@latest --use-npm infisical-nextjs cd infisical-nextjs ``` ```console npx create-next-app@latest --ts --use-npm infisical-nextjs cd infisical-nextjs ``` Next, inside `pages/_app.js`, lets add a `console.log()` to print out the environment variable in the browser console. ```js import '@/styles/globals.css' export default function App({ Component, pageProps }) { console.log('Hello, ', process.env.NEXT_PUBLIC_NAME); return } ``` ```tsx import '@/styles/globals.css' import type { AppProps } from 'next/app' export default function App({ Component, pageProps }: AppProps) { console.log('Hello, ', process.env.NEXT_PUBLIC_NAME); return } ``` ## Infisical CLI for local development environment variables We'll now use the Infisical CLI to fetch secrets from Infisical into your Next.js app for local development. ### CLI Installation Follow the instructions for your operating system to install the Infisical CLI. Use [brew](https://brew.sh/) package manager ```console $ brew install infisical/get-cli/infisical ``` Use [Scoop](https://scoop.sh/) package manager ```console $ scoop bucket add org https://github.com/Infisical/scoop-infisical.git ``` ```console $ scoop install infisical ``` Install prerequisite ```console $ apk add --no-cache bash sudo ``` Add Infisical repository ```console $ curl -1sLf \ 'https://dl.cloudsmith.io/public/infisical/infisical-cli/setup.alpine.sh' \ | bash ``` Then install CLI ```console $ apk update && sudo apk add infisical ``` Add Infisical repository ```console $ curl -1sLf \ 'https://dl.cloudsmith.io/public/infisical/infisical-cli/setup.rpm.sh' \ | sudo -E bash ``` Then install CLI ```console $ sudo yum install infisical ``` Add Infisical repository ```console $ curl -1sLf \ 'https://dl.cloudsmith.io/public/infisical/infisical-cli/setup.deb.sh' \ | sudo -E bash ``` Then install CLI ```console $ sudo apt-get update && sudo apt-get install -y infisical ``` Use the `yay` package manager to install from the [Arch User Repository](https://aur.archlinux.org/packages/infisical-bin) ```console $ yay -S infisical-bin ``` ### Login Authenticate the CLI with the Infisical platform using your email and password. ```console $ infisical login ``` ### Initialization Run the `init` command at the root of the Next.js app. This step connects your local project to the project on the Infisical platform and creates a `infisical.json` file containing a reference to that latter project. ```console $ infisical init ``` ### Start the Next.js app with secrets injected as environment variables ```console $ infisical run -- npm run dev ``` If you open your browser console, **Hello, YOUR\_NAME** should be printed out. Here, the CLI fetched the secret from Infisical and injected it into the Next.js app upon starting up. By default, the CLI fetches secrets from the development environment which has the slug `dev`; you can inject secrets from different environments by modifying the `env` flag as per the [CLI documentation](/cli/usage). At this stage, you know how to use the Infisical CLI to inject secrets into your Next.js app for local development. ## Infisical-Vercel integration for production environment variables We'll now use the Infisical-Vercel integration send secrets from Infisical to Vercel as production environment variables. ### Infisical-Vercel integration To begin we have to import the Next.js app into Vercel as a project. [Follow these instructions](https://nextjs.org/learn/basics/deploying-nextjs-app/deploy) to deploy the Next.js app to Vercel. Next, navigate to your project's integrations tab in Infisical and press on the Vercel tile to grant Infisical access to your Vercel account. ![integrations](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/integrations.png) ![integrations vercel authorization](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/integrations/vercel/integrations-vercel-auth.png) Opting in for the Infisical-Vercel integration will break end-to-end encryption since Infisical will be able to read your secrets. This is, however, necessary for Infisical to sync the secrets to Vercel. Your secrets remain encrypted at rest following our [security guide mechanics](/security/mechanics). Now select **Production** for (the source) **Environment** and sync it to the **Production Environment** of the (target) application in Vercel. Lastly, press create integration to start syncing secrets to Vercel. ![integrations vercel](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/integrations/vercel/integrations-vercel-create.png) ![integrations vercel](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/integrations/vercel/integrations-vercel.png) You should now see your secret from Infisical appear as production environment variables in your Vercel project. At this stage, you know how to use the Infisical-Vercel integration to sync production secrets from Infisical to Vercel. The following environment variable names are reserved by Vercel and cannot be synced: `AWS_SECRET_KEY`, `AWS_EXECUTION_ENV`, `AWS_LAMBDA_LOG_GROUP_NAME`, `AWS_LAMBDA_LOG_STREAM_NAME`, `AWS_LAMBDA_FUNCTION_NAME`, `AWS_LAMBDA_FUNCTION_MEMORY_SIZE`, `AWS_LAMBDA_FUNCTION_VERSION`, `NOW_REGION`, `TZ`, `LAMBDA_TASK_ROOT`, `LAMBDA_RUNTIME_DIR`, `AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY`, `AWS_SESSION_TOKEN`, `AWS_REGION`, and `AWS_DEFAULT_REGION`. ## FAQ Vercel does not specialize in secret management which means it lacks many useful features for effectively managing environment variables. Here are some features that teams benefit from by using Infisical together with Vercel: * Audit logs: See which team members are creating, reading, updating, and deleting environment variables across all environments. * Versioning and point in time recovery: Rolling back secrets and an entire project state. * Overriding secrets that should be unique amongst team members. And much more. Yes. Your secrets are still encrypted at rest. To note, most secret managers actually don't support end-to-end encryption. Check out the [security guide](/security/overview). See also: * [Documentation for the Infisical CLI](/cli/overview) * [Documentation for the Vercel integration](/integrations/cloud/vercel) # Node This guide demonstrates how to use Infisical to manage secrets for your Node stack from local development to production. It uses: * Infisical (you can use [Infisical Cloud](https://app.infisical.com) or a [self-hosted instance of Infisical](https://infisical.com/docs/self-hosting/overview)) to store your secrets. * The [@infisical/sdk](https://github.com/Infisical/sdk/tree/main/languages/node) Node.js client SDK to fetch secrets back to your Node application on demand. ## Project Setup To begin, we need to set up a project in Infisical and add secrets to an environment in it. ### Create a project 1. Create a new project in [Infisical](https://app.infisical.com/). 2. Add a secret to the development environment of this project so we can pull it back for local development. In the **Secrets Overview** page, press **Explore Development** and add a secret with the key `NAME` and value `YOUR_NAME`. ### Create a Machine Identity Now that we've created a project and added a secret to its development environment, we need to configure an Infisical Machine Identity that our Node application can use to access the secret. * [How to setup machine identities](/documentation/platform/identities/overview) ## Create a Node app For this demonstration, we use a minimal Express application. However, the same principles will apply to any Node application such as those built on Koa or Fastify. ### Create an Express app Initialize a new Node.js project with a default `package.json` file. ```console npm init -y ``` Install `express` and [@infisical/sdk](https://www.npmjs.com/package/@infisical/sdk), the client Node SDK for Infisical. ```console npm install express @infisical/sdk ``` Finally, create an index.js file containing the application code. ```js const express = require('express'); const { InfisicalClient } = require("@infisical/sdk"); const app = express(); const PORT = 3000; const client = new InfisicalClient({ auth: { universalAuth: { clientId: "YOUR_CLIENT_ID", clientSecret: "YOUR_CLIENT_SECRET", } } }); app.get("/", async (req, res) => { // access value const name = await client.getSecret({ environment: "dev", projectId: "PROJECT_ID", path: "/", type: "shared", secretName: "NAME" }); res.send(`Hello! My name is: ${name.secretValue}`); }); app.listen(PORT, async () => { // initialize client console.log(`App listening on port ${PORT}`); }); ``` Here, we initialized a `client` instance of the Infisical Node SDK with the Infisical Token that we created earlier, giving access to the secrets in the development environment of the project in Infisical that we created earlier. Finally, start the app and head to `http://localhost:3000` to see the message **Hello, Your Name**. ```console node index.js ``` The client fetched the secret with the key `NAME` from Infisical that we returned in the response of the endpoint. At this stage, you know how to fetch secrets from Infisical back to your Node application. By using Infisical Tokens scoped to different environments, you can easily manage secrets across various stages of your project in Infisical, from local development to production. ## FAQ The client SDK caches every secret and implements a 5-minute waiting period before re-requesting it. The waiting period can be controlled by setting the `cacheTTL` parameter at the time of initializing the client. The SDK caches every secret and falls back to the cached value if a request fails. If no cached value ever-existed, the SDK falls back to whatever value is on `process.env`. The token enables the SDK to authenticate with Infisical to fetch back your secrets. Although the SDK requires you to pass in a token, it enables greater efficiency and security than if you managed dozens of secrets yourself without it. Here're some benefits: * You always pull in the right secrets because they're fetched on demand from a centralized source that is Infisical. * You can use the Infisical which comes with tons of benefits like secret versioning, access controls, audit logs, etc. * You now risk leaking one token that can be revoked instead of dozens of raw secrets. And much more. See also: * Explore the [Node SDK](https://github.com/Infisical/sdk/tree/main/languages/node) # Infisical Organizational Structure Blueprint Learn how to structure your projects, secrets, and other resources within Infisical. Infisical is designed to provide comprehensive, centralized, and efficient management of secrets, certificates, and encryption keys within organizations. Below is an overview of Infisical's structured components, which developers and administrators can leverage for optimal project management and security posture. ### 1. Projects * **Definition and Role**: [Projects](/documentation/platform/project) are the highest-level construct within an [organization](/documentation/platform/organization) in Infisical. They serve as the primary container for all functionalities. * **Correspondence to Code Repositories**: Projects typically align with specific code repositories. * **Functional Capabilities**: Each project encompasses features for managing secrets, certificates, and encryption keys, serving as the central hub for these resources. ### 2. Environments * **Purpose**: Environments are designed for organizing and compartmentalizing secrets within projects. * **Customization Options**: Environments can be tailored to align with existing infrastructure setups of any project. Default options include **Development**, **Staging**, and **Production**. * **Structure**: Each environment inherently has a root level for storing secrets, but additional sub-organizations can be created through [folders](/documentation/platform/folder) for better secret management. ### 3. Folders * **Use Case**: Folders are available for more advanced organizational needs, allowing logical separation of secrets. * **Typical Structure**: Folders can correspond to specific logical units, such as microservices or different layers of an application, providing refined control over secrets. ### 4. Imports * **Purpose and Benefits**: To promote reusability and avoid redundancy, Infisical supports the use of imports. This allows secrets, folders, or entire environments to be referenced across multiple projects as needed. * **Best Practice**: Utilizing [secret imports](/documentation/platform/secret-reference#secret-imports) or [references](/documentation/platform/secret-reference#secret-referencing) ensures consistency and minimizes manual overhead. ### 5. Approval Workflows * **Importance**: Implementing approval workflows is recommended for organizations aiming to enhance efficiency and strengthen their security posture. * **Types of Workflows**: * **[Access Requests](/documentation/platform/pr-workflows)**: This workflow allows developers to request access to sensitive resources. Such access can be configured for temporary use, a practice known as "just-in-time" access. * **[Change Requests](/documentation/platform/access-controls/access-requests)**: Facilitates reviews and approvals when changes are proposed for sensitive environments or specific folders, ensuring proper oversight. ### 6. Access Controls Infisical’s access control framework is unified for both human users and machine identities, ensuring consistent management across the board. ### 6.1 Roles * **2 Role Types**: * **Organization-Level Roles**: Provide broad access across the organization (e.g., ability to manage billing, configure settings, etc.). * **Project-Level Roles**: Essential for configuring access to specific secrets and other sensitive assets within a project. * **Granular Permissions**: While default roles are available, [custom roles](/documentation/platform/access-controls/role-based-access-controls#creating-custom-roles) can be created for more tailored access controls. * **Admin Considerations**: Note that admin users are able to access all projects. This role should be assigned judiciously to prevent unintended overreach. Project access is defined not via an organization-level role, but rather through specific project memberships of both human and machine identities. Admin roles bypass this by default. ### 6.2 Additional Privileges [Additional privileges](/documentation/platform/access-controls/additional-privileges) can be assigned to users and machines on an ad-hoc basis for specific scenarios where roles alone are insufficient. If you find yourself using additional privileges too much, it is recommended to create custom roles. Additional privileges can be temporary or permanent. ### 6.3 Attribute-Based Access Control (ABAC) [Attribute-based Access Controls](/documentation/platform/access-controls/attribute-based-access-controls) allow restrictions based on tags or attributes linked to secrets. These can be integrated with SAML assertions and other security frameworks for dynamic access management. ### 6.4 User Groups * **Application**: Organizations should use users groups in situations when they have a lot of developers with the same level of access (e.g., separated by team, department, seniority, etc.). * **Synchronization**: [User groups](/documentation/platform/groups) can be synced with an identity provider to maintain consistency and reduce manual management. ### **Implementation Note** For larger-scale organizations, automating configurations through **Terraform** or other infrastructure-as-code (IaC) tools is advisable. Manual configurations may lead to errors, so leveraging IaC enhances reliability and consistency in managing Infisical's robust capabilities. This structured approach ensures that Infisical's functionalities are fully leveraged, providing both flexibility and rigorous control over an organization's sensitive information and access needs. # Python This guide demonstrates how to use Infisical to manage secrets for your Python stack from local development to production. It uses: * Infisical (you can use [Infisical Cloud](https://app.infisical.com) or a [self-hosted instance of Infisical](https://infisical.com/docs/self-hosting/overview)) to store your secrets. * The [infisical-python](https://pypi.org/project/infisical-python/) Python client SDK to fetch secrets back to your Python application on demand. ## Project Setup To begin, we need to set up a project in Infisical and add secrets to an environment in it. ### Create a project 1. Create a new project in [Infisical](https://app.infisical.com/). 2. Add a secret to the development environment of this project so we can pull it back for local development. In the **Secrets Overview** page, press **Explore Development** and add a secret with the key `NAME` and value `YOUR_NAME`. ### Create a Machine Identity Now that we've created a project and added a secret to its development environment, we need to configure an Infisical Machine Identity that our Python application can use to access the secret. * [How to setup machine identities](/documentation/platform/identities/overview) ## Create a Python app For this demonstration, we use a minimal Flask application. However, the same principles will apply to any Python application such as those built with Django. ### Create a Flask app First, create a virtual environment and activate it. ```console python3 -m venv env source env/bin/activate ``` Install Flask and [infisical-python](https://pypi.org/project/infisical-python/), the client Python SDK for Infisical. ```console pip install flask infisical-python ``` Finally, create an `app.py` file containing the application code. ```py from flask import Flask from infisical_client import ClientSettings, InfisicalClient, GetSecretOptions, AuthenticationOptions, UniversalAuthMethod app = Flask(__name__) client = InfisicalClient(ClientSettings( auth=AuthenticationOptions( universal_auth=UniversalAuthMethod( client_id="CLIENT_ID", client_secret="CLIENT_SECRET", ) ) )) @app.route("/") def hello_world(): # access value name = client.getSecret(options=GetSecretOptions( environment="dev", project_id="PROJECT_ID", secret_name="NAME" )) return f"Hello! My name is: {name.secret_value}" ``` Here, we initialized a `client` instance of the Infisical Python SDK with the Infisical Token that we created earlier, giving access to the secrets in the development environment of the project in Infisical that we created earlier. Finally, start the app and head to `http://localhost:5000` to see the message **Hello, Your Name**. ```console flask run ``` The client fetched the secret with the key `NAME` from Infisical that we returned in the response of the endpoint. At this stage, you know how to fetch secrets from Infisical back to your Python application. By using Infisical Tokens scoped to different environments, you can easily manage secrets across various stages of your project in Infisical, from local development to production. ## FAQ The client SDK caches every secret and implements a 5-minute waiting period before re-requesting it. The waiting period can be controlled by setting the `cacheTTL` parameter at the time of initializing the client. The SDK caches every secret and falls back to the cached value if a request fails. If no cached value ever-existed, the SDK falls back to whatever value is on `process.env`. The token enables the SDK to authenticate with Infisical to fetch back your secrets. Although the SDK requires you to pass in a token, it enables greater efficiency and security than if you managed dozens of secrets yourself without it. Here're some benefits: * You always pull in the right secrets because they're fetched on demand from a centralized source that is Infisical. * You can use the Infisical which comes with tons of benefits like secret versioning, access controls, audit logs, etc. * You now risk leaking one token that can be revoked instead of dozens of raw secrets. And much more. See also: * Explore the [Python SDK](https://github.com/Infisical/sdk/tree/main/crates/infisical-py) # Access Requests Learn how to request access to sensitive resources in Infisical. In certain situations, developers need to expand their access to a certain new project or a sensitive environment. For those use cases, it is helpful to utilize Infisical's **Access Requests** functionality. This functionality works in the following way: 1. A project administrator sets up an access policy that assigns access managers (also known as eligible approvers) to a certain sensitive folder or environment. ![Create Access Request Policy Modal](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/access-controls/create-access-request-policy.png) ![Access Request Policies](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/access-controls/access-request-policies.png) 2. When a developer requests access to one of such sensitive resources, the request is visible in the dashboard, and the corresponding eligible approvers get an email notification about it. ![Access Request Create](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/access-controls/request-access.png) ![Access Request Dashboard](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/access-controls/access-requests-pending.png) 3. An eligible approver can approve or reject the access request. {/* ![Access Request Review](/images/platform/access-controls/review-access-request.png) */} ![Access Request Bypass](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/access-controls/access-request-bypass.png) If the access request matches with a policy that has a **Soft** enforcement level, the requester may bypass the policy and get access to the resource without full approval. 5. As soon as the request is approved, developer is able to access the sought resources. ![Access Request Dashboard](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/access-controls/access-requests-completed.png) # Additional Privileges Learn how to add specific privileges on top of predefined roles. Even though Infisical supports full-fledged [role-base access controls](./role-based-access-controls) with ability to set predefined permissions for user and machine identities, it is sometimes desired to set additional privileges for specific user or machine identities on top of their roles. Infisical **Additional Privileges** functionality enables specific permissions with access to sensitive secrets/folders by identities within certain projects. It is possible to set up additional privileges through Web UI or API. To provision specific privileges through Web UI: 1. Click on the `Edit` button next to the set of roles for user or identities. ![Edit User Role](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/access-controls/edit-role.png) 2. Click `Add Additional Privileges` in the corresponding section of the permission management modal. ![Add Specific Privilege](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/access-controls/add-additional-privileges.png) 3. Fill out the necessary parameters in the privilege entry that appears. It is possible to specify the `Environment` and `Secret Path` to which you want to enable access. It is also possible to define the range of permissions (`View`, `Create`, `Modify`, `Delete`) as well as how long the access should last (e.g., permanent or timed). ![Additional privileges](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/access-controls/additional-privileges.png) 4. Click the `Save` button to enable the additional privilege. ![Confirm Specific Privilege](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/access-controls/confirm-additional-privileges.png) # Attribute-based Access Controls Learn how to use ABAC to manage permissions based on identity attributes. Infisical's Attribute-based Access Controls (ABAC) allow for dynamic, attribute-driven permissions for both user and machine identities. ABAC policies use metadata attributes—stored as key-value pairs on identities—to enforce fine-grained permissions that are context aware. In ABAC, access controls are defined using metadata attributes, such as location or department, which can be set directly on user or machine identities. During policy execution, these attributes are evaluated, and determine whether said actor can access the requested resource or perform the requested operation. ## Project-level Permissions Attribute-based access controls are currently available for polices defined on projects. You can set ABAC permissions to control access to environments, folders, secrets, and secret tags. ### Setting Metadata on Identities For organizations using SAML for login, Infisical automatically maps metadata attributes from SAML assertions to user identities. This makes it easy to create policies that dynamically adapt based on the SAML user’s attributes. ## Defining ABAC Policies ABAC policies make use of identity metadata to define dynamic permissions. Each attribute must start and end with double curly-brackets `{{ }}`. The following attributes are available within project permissions: * **User ID**: `{{ identity.id }}` * **Username**: `{{ identity.username }}` * **Metadata Attributes**: `{{ identity.metadata. }}` During policy execution, these placeholders are replaced by their actual values prior to evaluation. ### Example Use Case #### Location-based Access Control Suppose you want to restrict access to secrets within a specific folder based on a user's geographic region. You could assign a `location` attribute to each user (e.g., `identity.metadata.location`). You could then structure your folders to align with this attribute and define permissions accordingly. For example, a policy might restrict access to folders matching the user's location attribute in the following pattern: ``` /appA/{{ identity.metadata.location }} ``` Using this structure, users can only access folders that correspond to their configured `location` attribute. Consequently, if a users attribute changes due to relocation, no policies need to be changed to gain access to the folders associated with their new location. # Access Controls Learn about Infisical's access control toolset. To make sure that users and machine identities are only accessing the resources and performing actions they are authorized to, Infisical supports a wide range of access control tools. Manage user and machine identitity permissions through predefined roles. Manage user and machine identitity permissions based on their attributes. Add specific privileges to users and machines on top of their roles. Grant timed access to roles and specific privileges. Enable users to request (temporary) access to sensitive resources. Set up review policies for secret changes in sensitive environments. Track every action performed by user and machine identities in Infisical. # Role-based Access Controls Learn how to use RBAC to manage user permissions. Infisical's Role-based Access Controls (RBAC) enable the usage of predefined and custom roles that imply a set of permissions for user and machine identities. Such roles male it possible to restrict access to resources and the range of actions that can be performed. In general, access controls can be split up across [projects](/documentation/platform/project) and [organizations](/documentation/platform/organization). ## Organization-level access controls By default, every user and machine identity in a organization is either an **admin** or a **member**. **Admins** are able to perform every action with the organization, including adding and removing organization members, managing access controls, setting up security settings, and creating new projects. **Members**, on the other hand, are restricted from removing organization members, modifying billing information, updating access controls, and performing a number of other actions. Overall, organization-level access controls are significantly of administrative nature. Access to projects, secrets and other sensitive data is specified on the project level. ![Org member role](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/rbac/org-member-role.png) ## Project-level access controls By default, every user in a project is either a **viewer**, **developer**, or an **admin**. Each of these roles comes with a varying access to different features and resources inside projects. As such: * **Admin**: This role enables identities to have access to all environments, folders, secrets, and actions within the project. * **Developers**: This role restricts identities from performing project control actions, updating Approval Workflow policies, managing roles/members, and more. * **Viewer**: The most limiting bulit-in role on the project level – it forbids user and machine identities to perform any action and rather shows them in the read-only mode. ![Project member role](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/access-controls/rbac.png) ## Creating custom roles By creating custom roles, you are able to adjust permissions to the needs of your organization. This can be useful for: * Creating superadmin roles, roles specific to SRE engineers, etc. * Restricting access of users to specific secrets, folders, and environments. * Embedding these specific roles into [Approval Workflow policies](/documentation/platform/pr-workflows). It is worth noting that users are able to assume multiple built-in and custom roles. A user will gain access to all actions within the roles assigned to them, not just the actions those roles share in common. ![project member custom role](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/rbac/project-member-custom-role.png) # Temporary Access Learn how to set up timed access to sensitive resources for user and machine identities. Certain environments and secrets are so sensitive that it is recommended to not give any user permanent access to those. For such use cases, Infisical supports the functionality of **Temporary Access** provisioning. To provision temporary access through Web UI: 1. Click on the `Edit` button next to the set of roles for user or identities. ![Edit User Role](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/access-controls/edit-role.png) 2. Click `Permanent` next to the role or specific privilege that you want to make temporary. 3. Specify the duration of remporary access (e.g., `1m`, `2h`, `3d`). ![Configure temp access](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/access-controls/configure-temporary-access.png) 4. Click `Grant`. 5. Click the corresponding `Save` button to enable remporary access. ![Temporary Access](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/access-controls/temporary-access.png) Every user and machine identity should always have at least one permanent role attached to it. # Organization Admin Console View and manage resources across your organization The Organization Admin Console can only be accessed by organization members with admin status. ## Accessing the Organization Admin Console On the sidebar, tap on your initials to access the settings dropdown and press the **Organization Admin Console** option. ![Access Organization Admin Console](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/admin-panels/access-org-admin-console.png) ## Projects Tab The Projects tab lists all the projects within your organization, including those which you are not a member of. You can easily filter projects by name or slug using the search bar. ![Projects Section](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/admin-panels/org-admin-console-projects.png) ### Accessing a Project in Your Organization You can access a project that you are not a member of by tapping on the options menu of the project row and pressing the **Access** button. Doing so will grant you admin permissions for the selected project and add you as a member. ![Access project](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/admin-panels/org-admin-console-access.png) # null Learn about Infisical's Admin Consoles Infisical offers a server and organization level console for admins to customize their settings and manage various resources across the platform. Configure and manage server related features. View and access resources across your organization. # Server Admin Console Configure and manage server related features The Server Admin Console provides **server administrators** with the ability to customize settings and manage users for their entire Infisical instance. The first user to setup an account on your Infisical instance is designated as the server administrator by default. ## Accessing the Server Admin Console On the sidebar, tap on your initials to access the settings dropdown and press the **Server Admin Console** option. ![Access Server Admin Console](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/admin-panels/access-server-admin-panel.png) ## General Tab Configure general settings for your instance. ![General Settings](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/admin-panels/admin-panel-general.png) ### Allow User Signups User signups are enabled by default, allowing **Anyone** with access to your instance to sign up. This can alternatively be **Disabled** to prevent any users from signing up. ### Restrict Signup Domain Signup can be restricted to users matching one or more email domains, such as your organization's domain, to control who has access to your instance. ### Default Organization If you're using SAML/LDAP/OIDC for only one organization on your instance, you can specify a default organization to use at login to skip requiring users to manually enter the organization slug. ### Trust Emails By default, users signing up through SAML/LDAP/OIDC will still need to verify their email address to prevent email spoofing. This requirement can be skipped by enabling the switch to trust logins through the respective method. ## Authentication Tab From this tab, you can configure which login methods are enabled for your instance. ![Authentication Settings](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/admin-panels/admin-panel-auths.png) ## Rate Limit Tab This tab allows you to set various rate limits for your Infisical instance. You do not need to redeploy when making changes to rate limits as these will be propagated automatically. ![Rate Limit Settings](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/admin-panels/admin-panel-rate-limits.png) Note that rate limit configuration is a paid feature. Please contact [sales@infisical.com](mailto:sales@infisical.com) to purchase a license for its use. ## User Management Tab From this tab, you can view all the users who have signed up for your instance. You can search for users using the search bar and remove them from your instance by pressing the **X** button on their respective row. ![User Management](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/admin-panels/admin-panel-users.png) Note that rate limit configuration is a paid feature. Please contact [sales@infisical.com](mailto:sales@infisical.com) to purchase a license for its use. # Audit Log Streams Learn how to stream Infisical Audit Logs to external logging providers. Audit log streams is a paid feature. If you're using Infisical Cloud, then it is available under the **Enterprise Tier**. If you're self-hosting Infisical, then you should contact [team@infisical.com](mailto:team@infisical.com) to purchase an enterprise license to use it. Infisical Audit Log Streaming enables you to transmit your organization's Audit Logs to external logging providers for monitoring and analysis. The logs are formatted in JSON, requiring your logging provider to support JSON-based log parsing. ## Overview ![stream create](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/audit-log-streams/stream-create.png) ![stream create](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/audit-log-streams/stream-inputs.png) Provide the following values The HTTPS endpoint URL of the logging provider that collects the JSON stream. The HTTP headers for the logging provider for identification and authentication. ![stream listt](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/audit-log-streams/stream-list.png) Your Audit Logs are now ready to be streamed. ## Example Providers ### Better Stack ![better stack connect source](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/audit-log-streams/betterstack-create-source.png) ![better stack connect](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/audit-log-streams/betterstack-source-details.png) 1. Copy the **endpoint** from Better Stack to the **Endpoint URL** field. 2. Create a new header with key **Authorization** and set the value as **Bearer \**. ### Datadog ![api key create](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/audit-log-streams/datadog-api-sidebar.png) ![api key form](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/audit-log-streams/data-create-api-key.png) ![api key form](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/audit-log-streams/data-dog-api-key.png) ![datadog url](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/audit-log-streams/datadog-logging-endpoint.png) 1. Navigate to the [Datadog Send Logs API documentation](https://docs.datadoghq.com/api/latest/logs/?code-lang=curl\&site=us5#send-logs). 2. Pick your Datadog account region. 3. Obtain your Datadog logging endpoint URL. ![datadog api key details](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/audit-log-streams/datadog-source-details.png) 1. Copy the **logging endpoint** from Datadog to the **Endpoint URL** field. 2. Copy the **API Key** from previous step 3. Create a new header with key **DD-API-KEY** and set the value as **API Key**. # Stream to Non-HTTP providers How to stream Infisical Audit Logs to Non-HTTP log providers Audit log streams is a paid feature. If you're using Infisical Cloud, then it is available under the **Enterprise Tier**. If you're self-hosting Infisical, then you should contact [team@infisical.com](mailto:team@infisical.com) to purchase an enterprise license to use it. This guide will demonstrate how you can send Infisical Audit log streams to storage solutions that do not support direct HTTP-based ingestion, such as AWS S3. To achieve this, you will learn how you can use a log collector like Fluent Bit to capture and forward logs from Infisical to non-HTTP storage options. In this pattern, Fluent Bit acts as an intermediary, accepting HTTP log streams from Infisical and transforming them into a format that can be sent to your desired storage provider. ## Overview Log collectors are tools used to collect, analyze, transform, and send logs to storage. For the purposes of this guide, we will use [Fluent Bit](https://fluentbit.io) as our log collector and send logs from Infisical to AWS S3. However, this is just a example and you can use any log collector of your choice. ## Deploy Fluent Bit You can deploy Fluent Bit in one of two ways: 1. As a sidecar to your self-hosted Infisical instance 2. As a standalone service in any deployment/compute service (e.g., AWS EC2, ECS, or GCP Compute Engine) To view all deployment methods, visit the [Fluent Bit Getting Started guide](https://docs.fluentbit.io/manual/installation/getting-started-with-fluent-bit). ## Configure Fluent Bit To set up Fluent Bit, you'll need to provide a configuration file that establishes an HTTP listener and configures an output to send JSON data to your chosen storage solution. The following Fluent Bit configuration sets up an HTTP listener on port `8888` and sends logs to AWS S3: ```ini [SERVICE] Flush 1 Log_Level info Daemon off [INPUT] Name http Listen 0.0.0.0 Port 8888 [OUTPUT] Name s3 Match * bucket my-bucket region us-west-2 total_file_size 50M use_put_object Off compression gzip s3_key_format /$TAG/%Y/%m/%d/%H_%M_%S.gz ``` ### Connecting Infisical Audit Log Stream Once Fluent Bit is set up and configured, you can point the Infisical [audit log stream](/documentation/platform/audit-log-streams/audit-log-streams) to Fluent Bit's HTTP listener, which will then forward the logs to your chosen provider. Using this pattern, you are able to send Infisical Audit logs to various providers that do not support HTTP based log ingestion by default. # Overview Track evert event action performed within Infisical projects. Note that Audit Logs is a paid feature. If you're using Infisical Cloud, then it is available under the **Pro**, and **Enterprise Tier** with varying retention periods. If you're self-hosting Infisical, then you should contact [sales@infisical.com](mailto:sales@infisical.com) to purchase an enterprise license to use it. Infisical provides audit logs for security and compliance teams to monitor information access. With the Audit Log functionality, teams can: * **Track** 40+ different events; * **Filter** audit logs by event, actor, source, date or any combination of these filters; * **Inspect** extensive metadata in the event of any suspicious activity or incident review. ![Audit logs](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/audit-logs/audit-logs-table.png) Each log contains the following data: * **Event**: The underlying action such as create, list, read, update, or delete secret(s). * **Actor**: The entity responsible for performing or causing the event; this can be a user or service. * **Timestamp**: The date and time at which point the event occurred. * **Source** (User agent + IP): The software (user agent) and network address (IP) from which the event was initiated. * **Metadata**: Additional data to provide context for each event. For example, this could be the path at which a secret was fetched from etc. # Email and Password Learn how to authenticate into Infisical with email and password. **Email and Password** is the most common authentication method that can be used by user identities for authentication into Web Dashboard and Infisical CLI. It is recommended to utilize [Multi-factor Authentication](/documentation/platform/mfa) in addition to it. It is currently possible to use the **Email and Password** auth method to authenticate into the Web Dashboard and Infisical CLI. Every **Email and Password** is accompanied by an emergency kit given to users during signup. If the password is lost or forgotten, emergency kit is only way to retrieve the access to your account. It is possible to generate a new emergency kit with the following steps: 1. Open the `Personal Settings` menu. ![open personal settings](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/auth-methods/access-personal-settings.png) 2. Scroll down to the `Emergency Kit` section. 3. Enter your current password and click `Save`. # AWS ElastiCache Learn how to dynamically generate AWS ElastiCache user credentials. The Infisical AWS ElastiCache dynamic secret allows you to generate AWS ElastiCache credentials on demand based on configured role. ## Prerequisites 2. Create an AWS IAM user with the following permissions: ```json { "Version": "2012-10-17", "Statement": [ { "Sid": "", "Effect": "Allow", "Action": [ "elasticache:DescribeUsers", "elasticache:ModifyUser", "elasticache:CreateUser", "elasticache:CreateUserGroup", "elasticache:DeleteUser", "elasticache:DescribeReplicationGroups", "elasticache:DescribeUserGroups", "elasticache:ModifyReplicationGroup", "elasticache:ModifyUserGroup" ], "Resource": "arn:aws:elasticache:::user:*" } ] } ``` 3. Create an access key ID and secret access key for the user you created in the previous step. You will need these to configure the Infisical dynamic secret. New leases may take up-to a couple of minutes before ElastiCache has the chance to complete their configuration. It is recommended to use a retry strategy when establishing new ElastiCache connections. This may prevent errors when trying to use a password that isn't yet live on the targeted ElastiCache cluster. While a leasing is being created, you will be unable to create new leases for the same dynamic secret. Please ensure that your ElastiCache cluster has transit encryption enabled and set to required. This is required for the dynamic secret to work. ## Set up Dynamic Secrets with AWS ElastiCache Open the Secret Overview dashboard and select the environment in which you would like to add a dynamic secret. ![Add Dynamic Secret Button](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/add-dynamic-secret-button.png) ![Dynamic Secret Modal](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/dynamic-secret-modal-aws-elasti-cache.png) Name by which you want the secret to be referenced Default time-to-live for a generated secret (it is possible to modify this value when a secret is generate) Maximum time-to-live for a generated secret. The region that the ElastiCache cluster is located in. *(e.g. us-east-1)* This is the access key ID of the AWS IAM user you created in the prerequisites. This will be used to provision and manage the dynamic secret leases. This is the secret access key of the AWS IAM user you created in the prerequisites. This will be used to provision and manage the dynamic secret leases. A CA may be required if your DB requires it for incoming connections. This is often the case when connecting to a managed service. If you want to provide specific privileges for the generated dynamic credentials, you can modify the ElastiCache statement to your needs. This is useful if you want to only give access to a specific table(s). ![Modify ElastiCache Statements Modal](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/modify-elasticache-statement.png) After submitting the form, you will see a dynamic secret created in the dashboard. If this step fails, you may have to add the CA certificate. Once you've successfully configured the dynamic secret, you're ready to generate on-demand credentials. To do this, simply click on the 'Generate' button which appears when hovering over the dynamic secret item. Alternatively, you can initiate the creation of a new lease by selecting 'New Lease' from the dynamic secret lease list section. ![Dynamic Secret](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/dynamic-secret-generate-redis.png) ![Dynamic Secret](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/dynamic-secret-lease-empty-redis.png) When generating these secrets, it's important to specify a Time-to-Live (TTL) duration. This will dictate how long the credentials are valid for. ![Provision Lease](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/provision-lease.png) Ensure that the TTL for the lease fall within the maximum TTL defined when configuring the dynamic secret. Once you click the `Submit` button, a new secret lease will be generated and the credentials from it will be shown to you. ![Provision Lease](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/lease-values.png) ## Audit or Revoke Leases Once you have created one or more leases, you will be able to access them by clicking on the respective dynamic secret item on the dashboard. This will allow you see the expiration time of the lease or delete a lease before it's set time to live. ![Provision Lease](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/lease-data.png) ## Renew Leases To extend the life of the generated dynamic secret leases past its initial time to live, simply click on the **Renew** as illustrated below. ![Provision Lease](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/dynamic-secret-lease-renew.png) Lease renewals cannot exceed the maximum TTL set when configuring the dynamic secret # AWS IAM Learn how to dynamically generate AWS IAM Users. The Infisical AWS IAM dynamic secret allows you to generate AWS IAM Users on demand based on configured AWS policy. ## Prerequisite Infisical needs an initial AWS IAM user with the required permissions to create sub IAM users. This IAM user will be responsible for managing the lifecycle of new IAM users. ```json { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "iam:AttachUserPolicy", "iam:CreateAccessKey", "iam:CreateUser", "iam:DeleteAccessKey", "iam:DeleteUser", "iam:DeleteUserPolicy", "iam:DetachUserPolicy", "iam:GetUser", "iam:ListAccessKeys", "iam:ListAttachedUserPolicies", "iam:ListGroupsForUser", "iam:ListUserPolicies", "iam:PutUserPolicy", "iam:AddUserToGroup", "iam:RemoveUserFromGroup" ], "Resource": ["*"] } ] } ``` To minimize managing user access you can attach a resource in format > arn:aws:iam::\:user/\ Replace **\** with your AWS account id and **\** with a path to minimize managing user access. ## Set up Dynamic Secrets with AWS IAM Navigate to the Secret Overview dashboard and select the environment in which you would like to add a dynamic secret to. ![Add Dynamic Secret Button](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/add-dynamic-secret-button.png) ![Dynamic Secret Modal](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/dynamic-secret-modal-aws-iam.png) Name by which you want the secret to be referenced Default time-to-live for a generated secret (it is possible to modify this value when a secret is generate) Maximum time-to-live for a generated secret The managing AWS IAM User Access Key The managing AWS IAM User Secret Key [IAM AWS Path](https://aws.amazon.com/blogs/security/optimize-aws-administration-with-iam-paths/) to scope created IAM User resource access. The AWS data center region. The IAM Policy ARN of the [AWS Permissions Boundary](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_boundaries.html) to attach to IAM users created in the role. The AWS IAM groups that should be assigned to the created users. Multiple values can be provided by separating them with commas The AWS IAM managed policies that should be attached to the created users. Multiple values can be provided by separating them with commas The AWS IAM inline policy that should be attached to the created users. Multiple values can be provided by separating them with commas ![Dynamic Secret Setup Modal](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/dynamic-secret-setup-modal-aws-iam.png) After submitting the form, you will see a dynamic secret created in the dashboard. ![Dynamic Secret](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/dynamic-secret.png) Once you've successfully configured the dynamic secret, you're ready to generate on-demand credentials. To do this, simply click on the 'Generate' button which appears when hovering over the dynamic secret item. Alternatively, you can initiate the creation of a new lease by selecting 'New Lease' from the dynamic secret lease list section. ![Dynamic Secret](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/dynamic-secret-generate.png) ![Dynamic Secret](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/dynamic-secret-lease-empty.png) When generating these secrets, it's important to specify a Time-to-Live (TTL) duration. This will dictate how long the credentials are valid for. ![Provision Lease](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/provision-lease.png) Ensure that the TTL for the lease fall within the maximum TTL defined when configuring the dynamic secret in step 4. Once you click the `Submit` button, a new secret lease will be generated and the credentials for it will be shown to you. ![Provision Lease](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/lease-values-aws-iam.png) ## Audit or Revoke Leases Once you have created one or more leases, you will be able to access them by clicking on the respective dynamic secret item on the dashboard. This will allow you see the lease details and delete the lease ahead of its expiration time. ![Provision Lease](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/lease-data.png) ## Renew Leases To extend the life of the generated dynamic secret lease past its initial time to live, simply click on the **Renew** as illustrated below. ![Provision Lease](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/dynamic-secret-lease-renew.png) Lease renewals cannot exceed the maximum TTL set when configuring the dynamic secret # Azure Entra Id Learn how to dynamically generate Azure Entra Id user credentials. The Infisical Azure Entra Id dynamic secret allows you to generate Azure Entra Id credentials on demand based on configured role. ## Prerequisites Login to [Microsoft Entra ID](https://entra.microsoft.com/) Go to Overview, Copy and store `Tenant Id` ![Copy Tenant Id](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/dynamic-secret-ad-tenant-id.png) Go to Applications > App registrations. Click on New Registration. ![Copy Tenant Id](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/dynamic-secret-ad-new-registration.png) Enter an application name. Click Register. Copy and store `Application Id`. ![Copy Application Id](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/dynamic-secret-ad-copy-app-id.png) Go to Clients and Secrets. Click on New Client Secret. Enter a description, select expiry and click Add. Copy and store `Client Secret` value. ![Copy client Secret](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/dynamic-secret-ad-add-client-secret.png) Go to API Permissions. Click on Add a permission. ![Click add a permission](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/dynamic-secret-ad-add-permission.png) Click on Microsoft Graph. ![Click Microsoft Graph](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/dynamic-secret-ad-select-graph.png) Click on Application Permissions. Search and select `User.ReadWrite.All` and click Add permissions. ![Add User.Read.All](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/dynamic-secret-ad-select-perms.png) Click on Grant admin consent for app. Click yes to confirm. ![Grant admin consent](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/dynamic-secret-ad-admin-consent.png) Go to Dashboard. Click on show more. ![Show more](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/dynamic-secret-ad-show-more.png) Click on Roles & admins. Search for User Administrator and click on it. ![User Administrator](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/dynamic-secret-ad-user-admin.png) Click on Add assignments. Search for the application name you created and select it. Click on Add. ![Add assignments](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/dynamic-secret-ad-add-assignments.png) ## Set up Dynamic Secrets with Azure Entra ID Open the Secret Overview dashboard and select the environment in which you would like to add a dynamic secret. ![Add Dynamic Secret Button](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/add-dynamic-secret-button.png) ![Dynamic Secret Modal](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/dynamic-secret-ad-modal.png) Prefix for the secrets to be created Default time-to-live for a generated secret (it is possible to modify this value when a secret is generate) Maximum time-to-live for a generated secret. The Tenant ID of your Azure Entra ID account. The Application ID of the application you created in Azure Entra ID. The Client Secret of the application you created in Azure Entra ID. Multi select list of users to generate secrets for. After submitting the form, you will see a dynamic secrets for each user created in the dashboard. Once you've successfully configured the dynamic secret, you're ready to generate on-demand credentials. To do this, simply click on the 'Generate' button which appears when hovering over the dynamic secret item. Alternatively, you can initiate the creation of a new lease by selecting 'New Lease' from the dynamic secret lease list section. ![Dynamic Secret](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/dynamic-secret-generate-redis.png) ![Dynamic Secret](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/dynamic-secret-lease-empty-redis.png) When generating these secrets, it's important to specify a Time-to-Live (TTL) duration. This will dictate how long the credentials are valid for. ![Provision Lease](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/provision-lease.png) Ensure that the TTL for the lease fall within the maximum TTL defined when configuring the dynamic secret. Once you click the `Submit` button, a new secret lease will be generated and the credentials from it will be shown to you. ![Provision Lease](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/dynamic-secret-ad-lease.png) ## Audit or Revoke Leases Once you have created one or more leases, you will be able to access them by clicking on the respective dynamic secret item on the dashboard. This will allow you see the expiration time of the lease or delete a lease before it's set time to live. ![Provision Lease](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/lease-data.png) ## Renew Leases To extend the life of the generated dynamic secret leases past its initial time to live, simply click on the **Renew** as illustrated below. ![Provision Lease](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/dynamic-secret-lease-renew.png) Lease renewals cannot exceed the maximum TTL set when configuring the dynamic secret # Cassandra Learn how to dynamically generate Cassandra database user credentials The Infisical Cassandra dynamic secret allows you to generate Cassandra database credentials on demand based on configured role. ## Prerequisite Infisical requires a Cassandra user in your instance with the necessary permissions. This user will facilitate the creation of new accounts as needed. Ensure the user possesses privileges for creating, dropping, and granting permissions to roles for it to be able to create dynamic secrets. In your Cassandra configuration file `cassandra.yaml`, make sure you have the following settings: ```yaml authenticator: PasswordAuthenticator authorizer: CassandraAuthorizer ``` The above configuration allows user creation and granting permissions. ## Set up Dynamic Secrets with Cassandra Open the Secret Overview dashboard and select the environment in which you would like to add a dynamic secret. ![Add Dynamic Secret Button](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/add-dynamic-secret-button.png) ![Dynamic Secret Modal](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/dynamic-secret-modal-cassandra.png) Name by which you want the secret to be referenced Default time-to-live for a generated secret (it is possible to modify this value when a secret is generate) Maximum time-to-live for a generated secret Cassandra Host. You can specify multiple Cassandra hosts by separating them with commas. Cassandra port Username that will be used to create dynamic secrets Password that will be used to create dynamic secrets Specify the local data center in Cassandra that you want to use. This choice should align with your Cassandra cluster setup. Keyspace name where you want to create dynamic secrets. This ensures that the user is limited to that keyspace. A CA may be required if your cassandra requires it for incoming connections. ![Dynamic Secret Setup Modal](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/dynamic-secret-setup-modal-cassandra.png) If you want to provide specific privileges for the generated dynamic credentials, you can modify the CQL statement to your needs. This is useful if you want to only give access to a specific key-space(s). ![Modify CQL Statements Modal](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/modify-cql-statements.png) After submitting the form, you will see a dynamic secret created in the dashboard. If this step fails, you may have to add the CA certficate. ![Dynamic Secret](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/dynamic-secret.png) Once you've successfully configured the dynamic secret, you're ready to generate on-demand credentials. To do this, simply click on the 'Generate' button which appears when hovering over the dynamic secret item. Alternatively, you can initiate the creation of a new lease by selecting 'New Lease' from the dynamic secret lease list section. ![Dynamic Secret](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/dynamic-secret-generate.png) ![Dynamic Secret](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/dynamic-secret-lease-empty.png) When generating these secrets, it's important to specify a Time-to-Live (TTL) duration. This will dictate how long the credentials are valid for. ![Provision Lease](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/provision-lease.png) Ensure that the TTL for the lease fall within the maximum TTL defined when configuring the dynamic secret in step 4. Once you click the `Submit` button, a new secret lease will be generated and the credentials for it will be shown to you. ![Provision Lease](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/lease-values.png) ## Audit or Revoke Leases Once you have created one or more leases, you will be able to access them by clicking on the respective dynamic secret item on the dashboard. This will allow you see the lease details and delete the lease ahead of its expiration time. ![Provision Lease](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/lease-data.png) ## Renew Leases To extend the life of the generated dynamic secret lease past its initial time to live, simply click on the **Renew** as illustrated below. ![Provision Lease](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/dynamic-secret-lease-renew.png) Lease renewals cannot exceed the maximum TTL set when configuring the dynamic secret # Elasticsearch Learn how to dynamically generate Elasticsearch user credentials. The Infisical Elasticsearch dynamic secret allows you to generate Elasticsearch credentials on demand based on configured role. ## Prerequisites 1. Create a role with at least `manage_security` and `monitor` permissions. 2. Assign the newly created role to your API key or user that you'll use later in the dynamic secret configuration. For testing purposes, you can also use a highly privileged role like `superuser`, that will have full control over the cluster. This is not recommended in production environments following the principle of least privilege. ## Set up Dynamic Secrets with Elasticsearch Open the Secret Overview dashboard and select the environment in which you would like to add a dynamic secret. ![Add Dynamic Secret Button](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/add-dynamic-secret-button.png) ![Dynamic Secret Modal](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/dynamic-secret-modal-elastic-search.png) Name by which you want the secret to be referenced Default time-to-live for a generated secret (it is possible to modify this value when a secret is generate) Maximum time-to-live for a generated secret. Your Elasticsearch host. This is the endpoint that your instance runs on. *(Example: [https://your-cluster-ip](https://your-cluster-ip))* The port that your Elasticsearch instance is running on. *(Example: 9200)* The roles that the new user that is created when a lease is provisioned will be assigned to. This is a required field. This defaults to `superuser`, which is highly privileged. It is recommended to create a new role with the least privileges required for the lease. Select the authentication method you want to use to connect to your Elasticsearch instance. The username of the user that will be used to provision new dynamic secret leases. Only required if you selected the `Username/Password` authentication method. The password of the user that will be used to provision new dynamic secret leases. Only required if you selected the `Username/Password` authentication method. The ID of the API key that will be used to provision new dynamic secret leases. Only required if you selected the `API Key` authentication method. The API key that will be used to provision new dynamic secret leases. Only required if you selected the `API Key` authentication method. A CA may be required if your DB requires it for incoming connections. This is often the case when connecting to a managed service. ![Dynamic Secret Setup Modal](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/dynamic-secret-input-modal-elastic-search.png) After submitting the form, you will see a dynamic secret created in the dashboard. If this step fails, you may have to add the CA certificate. Once you've successfully configured the dynamic secret, you're ready to generate on-demand credentials. To do this, simply click on the 'Generate' button which appears when hovering over the dynamic secret item. Alternatively, you can initiate the creation of a new lease by selecting 'New Lease' from the dynamic secret lease list section. ![Dynamic Secret](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/dynamic-secret-generate-redis.png) ![Dynamic Secret](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/dynamic-secret-lease-empty-redis.png) When generating these secrets, it's important to specify a Time-to-Live (TTL) duration. This will dictate how long the credentials are valid for. ![Provision Lease](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/provision-lease.png) Ensure that the TTL for the lease fall within the maximum TTL defined when configuring the dynamic secret. Once you click the `Submit` button, a new secret lease will be generated and the credentials from it will be shown to you. ![Provision Lease](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/lease-values.png) ## Audit or Revoke Leases Once you have created one or more leases, you will be able to access them by clicking on the respective dynamic secret item on the dashboard. This will allow you see the expiration time of the lease or delete a lease before it's set time to live. ![Provision Lease](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/lease-data.png) ## Renew Leases To extend the life of the generated dynamic secret leases past its initial time to live, simply click on the **Renew** as illustrated below. ![Provision Lease](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/dynamic-secret-lease-renew.png) Lease renewals cannot exceed the maximum TTL set when configuring the dynamic secret # LDAP Learn how to dynamically generate user credentials via LDAP. The Infisical LDAP dynamic secret allows you to generate user credentials on demand via LDAP. The integration is general to any LDAP implementation but has been tested with OpenLDAP and Active directory as of now. ## Prerequisites 1. Create a user with the necessary permissions to create users in your LDAP server. 2. Ensure your LDAP server is reachable via Infisical instance. ## Create LDAP Credentials Open the Secret Overview dashboard and select the environment in which you would like to add a dynamic secret. ![Add Dynamic Secret Button](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/add-dynamic-secret-button.png) ![Dynamic Secret Modal](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/dynamic-secret-ldap-select.png) Name by which you want the secret to be referenced Default time-to-live for a generated secret (it is possible to modify this value when a secret is generate) Maximum time-to-live for a generated secret. LDAP url to connect to. *(Example: ldap\://your-ldap-ip:389 or ldaps\://domain:636)* DN to bind to. This should have permissions to create a new users. Password for the given DN. CA certificate to use for TLS in case of a secure connection. The type of LDAP credential - select Dynamic. LDIF to run while creating a user in LDAP. This can include extra steps to assign the user to groups or set permissions. Here `{{Username}}`, `{{Password}}` and `{{EncodedPassword}}` are templatized variables for the username and password generated by the dynamic secret. `{{EncodedPassword}}` is the encoded password required for the `unicodePwd` field in Active Directory as described [here](https://learn.microsoft.com/en-us/troubleshoot/windows-server/active-directory/change-windows-active-directory-user-password). **OpenLDAP** Example: ``` dn: uid={{Username}},dc=infisical,dc=com changetype: add objectClass: top objectClass: person objectClass: organizationalPerson objectClass: inetOrgPerson cn: John Doe sn: Doe uid: jdoe mail: jdoe@infisical.com userPassword: {{Password}} ``` **Active Directory** Example: ``` dn: CN={{Username}},OU=Test Create,DC=infisical,DC=com changetype: add objectClass: top objectClass: person objectClass: organizationalPerson objectClass: user userPrincipalName: {{Username}}@infisical.com sAMAccountName: {{Username}} unicodePwd::{{EncodedPassword}} userAccountControl: 66048 dn: CN=test-group,OU=Test Create,DC=infisical,DC=com changetype: modify add: member member: CN={{Username}},OU=Test Create,DC=infisical,DC=com - ``` LDIF to run while revoking a user in LDAP. This can include extra steps to remove the user from groups or set permissions. Here `{{Username}}` is a templatized variable for the username generated by the dynamic secret. **OpenLDAP / Active Directory** Example: ``` dn: CN={{Username}},OU=Test Create,DC=infisical,DC=com changetype: delete ``` LDIF to run incase Creation LDIF fails midway. For the creation example shown above, if the user is created successfully but not added to a group, this LDIF can be used to remove the user. Here `{{Username}}`, `{{Password}}` and `{{EncodedPassword}}` are templatized variables for the username generated by the dynamic secret. **OpenLDAP / Active Directory** Example: ``` dn: CN={{Username}},OU=Test Create,DC=infisical,DC=com changetype: delete ``` After submitting the form, you will see a dynamic secret created in the dashboard. Once you've successfully configured the dynamic secret, you're ready to generate on-demand credentials. To do this, simply click on the 'Generate' button which appears when hovering over the dynamic secret item. Alternatively, you can initiate the creation of a new lease by selecting 'New Lease' from the dynamic secret lease list section. ![Dynamic Secret](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/dynamic-secret-generate-redis.png) ![Dynamic Secret](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/dynamic-secret-lease-empty-redis.png) When generating these secrets, it's important to specify a Time-to-Live (TTL) duration. This will dictate how long the credentials are valid for. ![Provision Lease](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/provision-lease.png) Ensure that the TTL for the lease fall within the maximum TTL defined when configuring the dynamic secret. Once you click the `Submit` button, a new secret lease will be generated and the credentials from it will be shown to you with an array of DN's altered depending on the Creation LDIF. ![Provision Lease](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/dynamic-secret-ldap-lease.png) Open the Secret Overview dashboard and select the environment in which you would like to add a dynamic secret. ![Add Dynamic Secret Button](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/add-dynamic-secret-button.png) ![Dynamic Secret Modal](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/dynamic-secret-ldap-select.png) Name by which you want the secret to be referenced Default time-to-live for a generated secret (it is possible to modify this value when a secret is generate) Maximum time-to-live for a generated secret. LDAP url to connect to. *(Example: ldap\://your-ldap-ip:389 or ldaps\://domain:636)* DN to bind to. This should have permissions to create a new users. Password for the given DN. CA certificate to use for TLS in case of a secure connection. The type of LDAP credential - select Static. LDIF to run for rotating the credentals of an LDAP user. This can include extra LDAP steps based on your needs. Here `{{Password}}` and `{{EncodedPassword}}` are templatized variables for the password generated by the dynamic secret. Note that the `-` characters and the empty lines found at the end of the examples are necessary based on the LDIF format. **OpenLDAP** Example: ``` dn: cn=sheencaps capadngan,ou=people,dc=acme,dc=com changetype: modify replace: userPassword password: {{Password}} - ``` **Active Directory** Example: ``` dn: cn=sheencaps capadngan,ou=people,dc=acme,dc=com changetype: modify replace: unicodePwd unicodePwd::{{EncodedPassword}} - ``` `{{EncodedPassword}}` is the encoded password required for the `unicodePwd` field in Active Directory as described [here](https://learn.microsoft.com/en-us/troubleshoot/windows-server/active-directory/change-windows-active-directory-user-password). After submitting the form, you will see a dynamic secret created in the dashboard. Once you've successfully configured the dynamic secret, you're ready to generate on-demand credentials. To do this, simply click on the 'Generate' button which appears when hovering over the dynamic secret item. Alternatively, you can initiate the creation of a new lease by selecting 'New Lease' from the dynamic secret lease list section. ![Dynamic Secret](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/dynamic-secret-generate-redis.png) ![Dynamic Secret](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/dynamic-secret-lease-empty-redis.png) When generating these secrets, it's important to specify a Time-to-Live (TTL) duration. This will dictate how long the credentials are valid for. ![Provision Lease](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/provision-lease.png) Ensure that the TTL for the lease fall within the maximum TTL defined when configuring the dynamic secret. Once you click the `Submit` button, a new secret lease will be generated and the credentials from it will be shown to you with an array of DN's altered depending on the Creation LDIF. ![Provision Lease](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/dynamic-secret-ldap-lease.png) ## Active Directory Integration * Passwords in Active Directory are set using the `unicodePwd` field. This must be proceeded by two colons `::` as shown in the example. [Source](https://learn.microsoft.com/en-us/troubleshoot/windows-server/active-directory/change-windows-active-directory-user-password) * Active directory uses the `userAccountControl` field to enable account. [Read More](https://learn.microsoft.com/en-us/troubleshoot/windows-server/active-directory/useraccountcontrol-manipulate-account-properties) * `userAccountControl` set to `512` enables a user. * To disable AD's password expiration for this dynamic user account. The `userAccountControl` value for this is: `65536`. * Since `userAccountControl` flag is cumulative set it to `512 + 65536` = `66048` to do both. * Active Directory does not permit direct modification of a user's `memberOf` attribute. The member attribute of a group and the `memberOf` attribute of a user are [linked attributes](https://learn.microsoft.com/en-us/windows/win32/ad/linked-attributes), where the member attribute represents the forward link, which can be modified. In the context of AD group membership, the group's `member` attribute serves as the forward link. Therefore, to add a newly created dynamic user to a group, a modification request must be issued to the desired group, updating its membership to include the new user. ## LDIF Entries User account management is handled through **LDIF entries**. #### Things to Remember * **No trailing spaces:** Ensure there are no trailing spaces on any line, including blank lines. * **Empty lines before modify blocks:** Every modify block must be preceded by an empty line. * **Multiple modifications:** You can define multiple modifications for a DN within a single modify block. Each modification should end with a single dash (`-`). # Mongo Atlas Learn how to dynamically generate Mongo Atlas Database user credentials. The Infisical Mongo Atlas dynamic secret allows you to generate Mongo Atlas Database credentials on demand based on configured role. ## Prerequisite Create a project scopped API Key with the required permission in your Mongo Atlas following the [official doc](https://www.mongodb.com/docs/atlas/configure-api-access/#grant-programmatic-access-to-a-project). The API Key must have permission to manage users in the project. ## Set up Dynamic Secrets with Mongo Atlas Open the Secret Overview dashboard and select the environment in which you would like to add a dynamic secret. ![Add Dynamic Secret Button](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/add-dynamic-secret-button.png) ![Dynamic Secret Modal](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/dynamic-secret-atlas-modal.png) Name by which you want the secret to be referenced Default time-to-live for a generated secret (it is possible to modify this value when a secret is generate) Maximum time-to-live for a generated secret The public key of your generated Atlas API Key. This acts as a username. The private key of your generated Atlas API Key. This acts as a password. Unique 24-hexadecimal digit string that identifies your project. This is same as project id List that provides the pairings of one role with one applicable database. * **Database Name**: Database to which the user is granted access privileges. * **Collection**: Collection on which this role applies. * **Role Name**: Human-readable label that identifies a group of privileges assigned to a database user. This value can either be a built-in role or a custom role. * Enum: `atlasAdmin` `backup` `clusterMonitor` `dbAdmin` `dbAdminAnyDatabase` `enableSharding` `read` `readAnyDatabase` `readWrite` `readWriteAnyDatabase` ``. ![Dynamic Secret Setup Modal](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/dynamic-secret-modal-atlas.png) List that contains clusters, MongoDB Atlas Data Lakes, and MongoDB Atlas Streams Instances that this database user can access. If omitted, MongoDB Cloud grants the database user access to all the clusters, MongoDB Atlas Data Lakes, and MongoDB Atlas Streams Instances in the project. ![Modify Scope Modal](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/advanced-option-atlas.png) * **Label**: Human-readable label that identifies the cluster or MongoDB Atlas Data Lake that this database user can access. * **Type**: Category of resource that this database user can access. After submitting the form, you will see a dynamic secret created in the dashboard. If this step fails, you may have to add the CA certficate. ![Dynamic Secret](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/dynamic-secret.png) Once you've successfully configured the dynamic secret, you're ready to generate on-demand credentials. To do this, simply click on the 'Generate' button which appears when hovering over the dynamic secret item. Alternatively, you can initiate the creation of a new lease by selecting 'New Lease' from the dynamic secret lease list section. ![Dynamic Secret](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/dynamic-secret-generate.png) ![Dynamic Secret](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/dynamic-secret-lease-empty.png) When generating these secrets, it's important to specify a Time-to-Live (TTL) duration. This will dictate how long the credentials are valid for. ![Provision Lease](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/provision-lease.png) Ensure that the TTL for the lease fall within the maximum TTL defined when configuring the dynamic secret. Once you click the `Submit` button, a new secret lease will be generated and the credentials for it will be shown to you. ![Provision Lease](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/lease-values.png) ## Audit or Revoke Leases Once you have created one or more leases, you will be able to access them by clicking on the respective dynamic secret item on the dashboard. This will allow you see the expiration time of the lease or delete a lease before it's set time to live. ![Provision Lease](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/lease-data.png) ## Renew Leases To extend the life of the generated dynamic secret leases past its initial time to live, simply click on the **Renew** as illustrated below. ![Provision Lease](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/dynamic-secret-lease-renew.png) Lease renewals cannot exceed the maximum TTL set when configuring the dynamic secret # Mongo DB Learn how to dynamically generate Mongo DB Database user credentials. The Infisical Mongo DB dynamic secret allows you to generate Mongo DB Database credentials on demand based on configured role. If your using Mongo Atlas, please use [Atlas Dynamic Secret](./mongo-atlas) as MongoDB commands are not supported by atlas. ## Prerequisite Create a user with the required permission in your MongoDB instance. This user will be used to create new accounts on-demand. ## Set up Dynamic Secrets with Mongo DB Open the Secret Overview dashboard and select the environment in which you would like to add a dynamic secret. ![Add Dynamic Secret Button](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/add-dynamic-secret-button.png) ![Dynamic Secret Modal](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/dynamic-secret-modal-mongodb.png) Name by which you want the secret to be referenced Default time-to-live for a generated secret (it is possible to modify this value when a secret is generate) Maximum time-to-live for a generated secret Database host URL. Database port number. If your Mongo DB is cluster you can omit this. Username of the admin user that will be used to create dynamic secrets Password of the admin user that will be used to create dynamic secrets Name of the database for which you want to create dynamic secrets Human-readable label that identifies a group of privileges assigned to a database user. This value can either be a built-in role or a custom role. * Enum: `atlasAdmin` `backup` `clusterMonitor` `dbAdmin` `dbAdminAnyDatabase` `enableSharding` `read` `readAnyDatabase` `readWrite` `readWriteAnyDatabase` ``. A CA may be required if your DB requires it for incoming connections. ![Dynamic Secret Setup Modal](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/dynamic-secret-mongodb.png) After submitting the form, you will see a dynamic secret created in the dashboard. If this step fails, you may have to add the CA certificate. Once you've successfully configured the dynamic secret, you're ready to generate on-demand credentials. To do this, simply click on the 'Generate' button which appears when hovering over the dynamic secret item. Alternatively, you can initiate the creation of a new lease by selecting 'New Lease' from the dynamic secret lease list section. ![Dynamic Secret](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/dynamic-secret-generate.png) ![Dynamic Secret](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/dynamic-secret-lease-empty.png) When generating these secrets, it's important to specify a Time-to-Live (TTL) duration. This will dictate how long the credentials are valid for. ![Provision Lease](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/provision-lease.png) Ensure that the TTL for the lease fall within the maximum TTL defined when configuring the dynamic secret. Once you click the `Submit` button, a new secret lease will be generated and the credentials from it will be shown to you. ![Provision Lease](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/lease-values.png) ## Audit or Revoke Leases Once you have created one or more leases, you will be able to access them by clicking on the respective dynamic secret item on the dashboard. This will allow you see the expiration time of the lease or delete a lease before it's set time to live. ![Provision Lease](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/lease-data.png) ## Renew Leases To extend the life of the generated dynamic secret leases past its initial time to live, simply click on the **Renew** as illustrated below. ![Provision Lease](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/dynamic-secret-lease-renew.png) Lease renewals cannot exceed the maximum TTL set when configuring the dynamic secret # MS SQL Learn how to dynamically generate MS SQL database user credentials. The Infisical MS SQL dynamic secret allows you to generate Microsoft SQL server database credentials on demand based on configured role. ## Prerequisite Create a user with the required permission in your SQL instance. This user will be used to create new accounts on-demand. ## Set up Dynamic Secrets with MS SQL Open the Secret Overview dashboard and select the environment in which you would like to add a dynamic secret. ![Add Dynamic Secret Button](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/add-dynamic-secret-button.png) ![Dynamic Secret Modal](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/dynamic-secret-modal.png) Name by which you want the secret to be referenced Default time-to-live for a generated secret (it is possible to modify this value when a secret is generate) Maximum time-to-live for a generated secret Choose the service you want to generate dynamic secrets for. This must be selected as **MS SQL**. Database host Database port Username that will be used to create dynamic secrets Password that will be used to create dynamic secrets Name of the database for which you want to create dynamic secrets A CA may be required if your DB requires it for incoming connections. AWS RDS instances with default settings will requires a CA which can be downloaded [here](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/UsingWithRDS.SSL.html#UsingWithRDS.SSL.CertificatesAllRegions). ![Dynamic Secret Setup Modal](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/dynamic-secret-setup-modal-mssql.png) If you want to provide specific privileges for the generated dynamic credentials, you can modify the SQL statement to your needs. This is useful if you want to only give access to a specific table(s). ![Modify SQL Statements Modal](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/modify-sql-statements-mssql.png) After submitting the form, you will see a dynamic secret created in the dashboard. If this step fails, you may have to add the CA certficate. ![Dynamic Secret](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/dynamic-secret.png) Once you've successfully configured the dynamic secret, you're ready to generate on-demand credentials. To do this, simply click on the 'Generate' button which appears when hovering over the dynamic secret item. Alternatively, you can initiate the creation of a new lease by selecting 'New Lease' from the dynamic secret lease list section. ![Dynamic Secret](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/dynamic-secret-generate.png) ![Dynamic Secret](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/dynamic-secret-lease-empty.png) When generating these secrets, it's important to specify a Time-to-Live (TTL) duration. This will dictate how long the credentials are valid for. ![Provision Lease](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/provision-lease.png) Ensure that the TTL for the lease fall within the maximum TTL defined when configuring the dynamic secret. Once you click the `Submit` button, a new secret lease will be generated and the credentials for it will be shown to you. ![Provision Lease](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/lease-values.png) ## Audit or Revoke Leases Once you have created one or more leases, you will be able to access them by clicking on the respective dynamic secret item on the dashboard. This will allow you see the expiration time of the lease or delete the lease before it's set time to live. ![Provision Lease](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/lease-data.png) ## Renew Leases To extend the life of the generated dynamic secret leases past its initial time to live, simply click on the **Renew** as illustrated below. ![Provision Lease](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/dynamic-secret-lease-renew.png) Lease renewals cannot exceed the maximum TTL set when configuring the dynamic secret # MySQL Learn how to dynamically generate MySQL Database user credentials. The Infisical MySQL dynamic secret allows you to generate MySQL Database credentials on demand based on configured role. ## Prerequisite Create a user with the required permission in your SQL instance. This user will be used to create new accounts on-demand. ## Set up Dynamic Secrets with MySQL Open the Secret Overview dashboard and select the environment in which you would like to add a dynamic secret. ![Add Dynamic Secret Button](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/add-dynamic-secret-button.png) ![Dynamic Secret Modal](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/dynamic-secret-modal.png) Name by which you want the secret to be referenced Default time-to-live for a generated secret (it is possible to modify this value when a secret is generate) Maximum time-to-live for a generated secret Choose the service you want to generate dynamic secrets for. This must be selected as **MySQL**. Database host Database port Username that will be used to create dynamic secrets Password that will be used to create dynamic secrets Name of the database for which you want to create dynamic secrets A CA may be required if your DB requires it for incoming connections. AWS RDS instances with default settings will requires a CA which can be downloaded [here](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/UsingWithRDS.SSL.html#UsingWithRDS.SSL.CertificatesAllRegions). If you want to provide specific privileges for the generated dynamic credentials, you can modify the SQL statement to your needs. This is useful if you want to only give access to a specific table(s). ![Modify SQL Statements Modal](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/modify-sql-statement-mysql.png) After submitting the form, you will see a dynamic secret created in the dashboard. If this step fails, you may have to add the CA certificate. ![Dynamic Secret](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/dynamic-secret.png) Once you've successfully configured the dynamic secret, you're ready to generate on-demand credentials. To do this, simply click on the 'Generate' button which appears when hovering over the dynamic secret item. Alternatively, you can initiate the creation of a new lease by selecting 'New Lease' from the dynamic secret lease list section. ![Dynamic Secret](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/dynamic-secret-generate.png) ![Dynamic Secret](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/dynamic-secret-lease-empty.png) When generating these secrets, it's important to specify a Time-to-Live (TTL) duration. This will dictate how long the credentials are valid for. ![Provision Lease](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/provision-lease.png) Ensure that the TTL for the lease fall within the maximum TTL defined when configuring the dynamic secret. Once you click the `Submit` button, a new secret lease will be generated and the credentials from it will be shown to you. ![Provision Lease](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/lease-values.png) ## Audit or Revoke Leases Once you have created one or more leases, you will be able to access them by clicking on the respective dynamic secret item on the dashboard. This will allow you see the expiration time of the lease or delete a lease before it's set time to live. ![Provision Lease](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/lease-data.png) ## Renew Leases To extend the life of the generated dynamic secret leases past its initial time to live, simply click on the **Renew** as illustrated below. ![Provision Lease](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/dynamic-secret-lease-renew.png) Lease renewals cannot exceed the maximum TTL set when configuring the dynamic secret # Oracle Learn how to dynamically generate Oracle Database user credentials. The Infisical Oracle dynamic secret allows you to generate Oracle Database credentials on demand based on configured role. ## Prerequisite Create a user with the required permission in your SQL instance. This user will be used to create new accounts on-demand. ## Set up Dynamic Secrets with Oracle Open the Secret Overview dashboard and select the environment in which you would like to add a dynamic secret. ![Add Dynamic Secret Button](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/add-dynamic-secret-button.png) ![Dynamic Secret Modal](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/dynamic-secret-modal.png) Name by which you want the secret to be referenced Default time-to-live for a generated secret (it is possible to modify this value when a secret is generate) Maximum time-to-live for a generated secret Choose the service you want to generate dynamic secrets for. This must be selected as **Oracle**. Database host Database port Username that will be used to create dynamic secrets Password that will be used to create dynamic secrets Name of the database for which you want to create dynamic secrets A CA may be required if your DB requires it for incoming connections. AWS RDS instances with default settings will requires a CA which can be downloaded [here](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/UsingWithRDS.SSL.html#UsingWithRDS.SSL.CertificatesAllRegions). ![Dynamic Secret Setup Modal](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/dynamic-secret-modal-oracle.png) If you want to provide specific privileges for the generated dynamic credentials, you can modify the SQL statement to your needs. This is useful if you want to only give access to a specific table(s). After submitting the form, you will see a dynamic secret created in the dashboard. If this step fails, you may have to add the CA certficate. ![Dynamic Secret](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/dynamic-secret.png) Once you've successfully configured the dynamic secret, you're ready to generate on-demand credentials. To do this, simply click on the 'Generate' button which appears when hovering over the dynamic secret item. Alternatively, you can initiate the creation of a new lease by selecting 'New Lease' from the dynamic secret lease list section. ![Dynamic Secret](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/dynamic-secret-generate.png) ![Dynamic Secret](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/dynamic-secret-lease-empty.png) When generating these secrets, it's important to specify a Time-to-Live (TTL) duration. This will dictate how long the credentials are valid for. ![Provision Lease](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/provision-lease.png) Ensure that the TTL for the lease fall within the maximum TTL defined when configuring the dynamic secret. Once you click the `Submit` button, a new secret lease will be generated and the credentials for it will be shown to you. ![Provision Lease](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/lease-values.png) ## Audit or Revoke Leases Once you have created one or more leases, you will be able to access them by clicking on the respective dynamic secret item on the dashboard. This will allow you see the expiration time of the lease or delete a lease before it's set time to live. ![Provision Lease](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/lease-data.png) ## Renew Leases To extend the life of the generated dynamic secret leases past its initial time to live, simply click on the **Renew** as illustrated below. ![Provision Lease](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/dynamic-secret-lease-renew.png) Lease renewals cannot exceed the maximum TTL set when configuring the dynamic secret # Dynamic Secrets Learn how to generate secrets dynamically on-demand. ## Introduction Contrary to static key-value secrets, which require manual input of data into the secure Infisical storage, **dynamic secrets are generated on-demand upon access**. **Dynamic secrets are unique to every identity using them**. Such secrets come are generated only at the moment they are retrieved, eliminating the possibility of theft or reuse by another identity. Thanks to Infisical's integrated revocation capabilities, dynamic secrets can be promptly invalidated post-use, significantly reducing their lifespan. ## Benefits of Dynamic Secrets This approach offers several advantages in terms of security and management: * **Enhanced Security**: By frequently changing secrets, dynamic secrets minimize the risk associated with secret compromise. Even if an attacker manages to obtain a secret, it would likely be invalid by the time they attempt to use it. * **Reduced Secret Lifetime**: The limited validity period of dynamic secrets means that they are less valuable targets for attackers. This inherently reduces the time window during which a secret can be exploited. * **Automated Management**: Dynamic secrets enable automated systems to handle the generation, distribution, revocation, and rotation of secrets without human intervention, thus reducing the risk of human error. * **Auditing and Traceability**: The generation of dynamic secrets can be tightly controlled and monitored. This allows for detailed auditing of who accessed what secret and when, improving overall security posture and compliance with regulatory standards. * **Scalability**: Dynamic secret management systems can scale more effectively to handle a large number of services and applications, as they automate much of the overhead associated with manual secret management. Dynamic secrets are particularly useful in environments with stringent security requirements, such as cloud environments, distributed systems, and microservices architectures, where they help to manage database credentials, API keys, tokens, and other types of secrets. ## Infisical Dynamic Secret Templates 1. [PostgreSQL](./postgresql) 2. [MySQL](./mysql) 3. [Cassandra](./cassandra) 4. [Oracle](./oracle) 5. [Redis](./redis) 6. [AWS IAM](./aws-iam) # PostgreSQL Learn how to dynamically generate PostgreSQL database users. The Infisical PostgreSQL dynamic secret allows you to generate PostgreSQL database credentials on demand based on configured role. ## Prerequisite Create a user with the required permission in your SQL instance. This user will be used to create new accounts on-demand. ## Set up Dynamic Secrets with PostgreSQL Open the Secret Overview dashboard and select the environment in which you would like to add a dynamic secret. ![Add Dynamic Secret Button](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/add-dynamic-secret-button.png) ![Dynamic Secret Modal](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/dynamic-secret-modal.png) Name by which you want the secret to be referenced Default time-to-live for a generated secret (it is possible to modify this value when a secret is generate) Maximum time-to-live for a generated secret Choose the service you want to generate dynamic secrets for. This must be selected as **PostgreSQL**. Database host Database port Username that will be used to create dynamic secrets Password that will be used to create dynamic secrets Name of the database for which you want to create dynamic secrets A CA may be required if your DB requires it for incoming connections. AWS RDS instances with default settings will requires a CA which can be downloaded [here](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/UsingWithRDS.SSL.html#UsingWithRDS.SSL.CertificatesAllRegions). ![Dynamic Secret Setup Modal](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/dynamic-secret-setup-modal.png) If you want to provide specific privileges for the generated dynamic credentials, you can modify the SQL statement to your needs. This is useful if you want to only give access to a specific table(s). ![Modify SQL Statements Modal](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/modify-sql-statements.png) After submitting the form, you will see a dynamic secret created in the dashboard. If this step fails, you may have to add the CA certficate. ![Dynamic Secret](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/dynamic-secret.png) Once you've successfully configured the dynamic secret, you're ready to generate on-demand credentials. To do this, simply click on the 'Generate' button which appears when hovering over the dynamic secret item. Alternatively, you can initiate the creation of a new lease by selecting 'New Lease' from the dynamic secret lease list section. ![Dynamic Secret](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/dynamic-secret-generate.png) ![Dynamic Secret](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/dynamic-secret-lease-empty.png) When generating these secrets, it's important to specify a Time-to-Live (TTL) duration. This will dictate how long the credentials are valid for. ![Provision Lease](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/provision-lease.png) Ensure that the TTL for the lease fall within the maximum TTL defined when configuring the dynamic secret. Once you click the `Submit` button, a new secret lease will be generated and the credentials for it will be shown to you. ![Provision Lease](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/lease-values.png) ## Audit or Revoke Leases Once you have created one or more leases, you will be able to access them by clicking on the respective dynamic secret item on the dashboard. This will allow you see the expiration time of the lease or delete the lease before it's set time to live. ![Provision Lease](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/lease-data.png) ## Renew Leases To extend the life of the generated dynamic secret leases past its initial time to live, simply click on the **Renew** as illustrated below. ![Provision Lease](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/dynamic-secret-lease-renew.png) Lease renewals cannot exceed the maximum TTL set when configuring the dynamic secret # RabbitMQ Learn how to dynamically generate RabbitMQ user credentials. The Infisical RabbitMQ dynamic secret allows you to generate RabbitMQ credentials on demand based on configured role. ## Prerequisites 1. Ensure that the `management` plugin is enabled on your RabbitMQ instance. This is required for the dynamic secret to work. ## Set up Dynamic Secrets with RabbitMQ Open the Secret Overview dashboard and select the environment in which you would like to add a dynamic secret. ![Add Dynamic Secret Button](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/add-dynamic-secret-button.png) ![Dynamic Secret Modal](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/dynamic-secret-modal-rabbit-mq.png) Name by which you want the secret to be referenced Default time-to-live for a generated secret (it is possible to modify this value when a secret is generate) Maximum time-to-live for a generated secret. Your RabbitMQ host. This must be in HTTP format. *(Example: [http://your-cluster-ip](http://your-cluster-ip))* The port that the RabbitMQ management plugin is listening on. This is `15672` by default. The name of the virtual host that the user will be assigned to. This defaults to `/`. The permissions that the user will have on the virtual host. This defaults to `.*`. The three permission fields all take a regular expression *(regex)*, that should match resource names for which the user is granted read / write / configuration permissions The username of the user that will be used to provision new dynamic secret leases. The password of the user that will be used to provision new dynamic secret leases. A CA may be required if your DB requires it for incoming connections. This is often the case when connecting to a managed service. ![Dynamic Secret Setup Modal](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/dynamic-secret-input-modal-rabbit-mq.png) After submitting the form, you will see a dynamic secret created in the dashboard. If this step fails, you may have to add the CA certificate. Once you've successfully configured the dynamic secret, you're ready to generate on-demand credentials. To do this, simply click on the 'Generate' button which appears when hovering over the dynamic secret item. Alternatively, you can initiate the creation of a new lease by selecting 'New Lease' from the dynamic secret lease list section. ![Dynamic Secret](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/dynamic-secret-generate-redis.png) ![Dynamic Secret](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/dynamic-secret-lease-empty-redis.png) When generating these secrets, it's important to specify a Time-to-Live (TTL) duration. This will dictate how long the credentials are valid for. ![Provision Lease](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/provision-lease.png) Ensure that the TTL for the lease fall within the maximum TTL defined when configuring the dynamic secret. Once you click the `Submit` button, a new secret lease will be generated and the credentials from it will be shown to you. ![Provision Lease](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/lease-values.png) ## Audit or Revoke Leases Once you have created one or more leases, you will be able to access them by clicking on the respective dynamic secret item on the dashboard. This will allow you see the expiration time of the lease or delete a lease before it's set time to live. ![Provision Lease](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/lease-data.png) ## Renew Leases To extend the life of the generated dynamic secret leases past its initial time to live, simply click on the **Renew** as illustrated below. ![Provision Lease](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/dynamic-secret-lease-renew.png) Lease renewals cannot exceed the maximum TTL set when configuring the dynamic secret # Redis Learn how to dynamically generate Redis Database user credentials. The Infisical Redis dynamic secret allows you to generate Redis Database credentials on demand based on configured role. ## Prerequisite Create a user with the required permission in your Redis instance. This user will be used to create new accounts on-demand. ## Set up Dynamic Secrets with Redis Open the Secret Overview dashboard and select the environment in which you would like to add a dynamic secret. ![Add Dynamic Secret Button](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/add-dynamic-secret-button.png) ![Dynamic Secret Modal](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/dynamic-secret-modal-redis.png) Name by which you want the secret to be referenced Default time-to-live for a generated secret (it is possible to modify this value when a secret is generate) Maximum time-to-live for a generated secret. The database host, this can be an IP address or a domain name as long as Infisical can reach it. The database port, this is the port that the Redis instance is listening on. Redis username that will be used to create new users on-demand. This is often 'default' or 'admin'. Password that will be used to create dynamic secrets. This is required if your Redis instance is password protected. A CA may be required if your DB requires it for incoming connections. This is often the case when connecting to a managed service. If you want to provide specific privileges for the generated dynamic credentials, you can modify the Redis statement to your needs. This is useful if you want to only give access to a specific table(s). ![Modify Redis Statements Modal](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/modify-redis-statement.png) After submitting the form, you will see a dynamic secret created in the dashboard. If this step fails, you may have to add the CA certificate. Once you've successfully configured the dynamic secret, you're ready to generate on-demand credentials. To do this, simply click on the 'Generate' button which appears when hovering over the dynamic secret item. Alternatively, you can initiate the creation of a new lease by selecting 'New Lease' from the dynamic secret lease list section. ![Dynamic Secret](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/dynamic-secret-generate-redis.png) ![Dynamic Secret](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/dynamic-secret-lease-empty-redis.png) When generating these secrets, it's important to specify a Time-to-Live (TTL) duration. This will dictate how long the credentials are valid for. ![Provision Lease](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/provision-lease.png) Ensure that the TTL for the lease fall within the maximum TTL defined when configuring the dynamic secret. Once you click the `Submit` button, a new secret lease will be generated and the credentials from it will be shown to you. ![Provision Lease](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/lease-values.png) ## Audit or Revoke Leases Once you have created one or more leases, you will be able to access them by clicking on the respective dynamic secret item on the dashboard. This will allow you see the expiration time of the lease or delete a lease before it's set time to live. ![Provision Lease](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/lease-data.png) ## Renew Leases To extend the life of the generated dynamic secret leases past its initial time to live, simply click on the **Renew** as illustrated below. ![Provision Lease](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/dynamic-secret-lease-renew.png) Lease renewals cannot exceed the maximum TTL set when configuring the dynamic secret # SAP HANA Learn how to dynamically generate SAP HANA database account credentials. The Infisical SAP HANA dynamic secret allows you to generate SAP HANA database credentials on demand. ## Prerequisite * Infisical requires a SAP HANA database user in your instance with the necessary permissions. This user will facilitate the creation of new accounts as needed. Ensure the user possesses privileges for creating, dropping, and granting permissions to roles for it to be able to create dynamic secrets. * The SAP HANA instance should be reachable by Infisical. ## Set up Dynamic Secrets with SAP HANA Open the Secret Overview dashboard and select the environment in which you would like to add a dynamic secret. ![Add Dynamic Secret Button](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/add-dynamic-secret-button.png) ![Dynamic Secret Modal](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/dynamic-secret-modal-sap-hana.png) Name by which you want the secret to be referenced Default time-to-live for a generated secret (it is possible to modify this value when a secret is generate) Maximum time-to-live for a generated secret SAP HANA Host SAP HANA Port Username that will be used to create dynamic secrets Password that will be used to create dynamic secrets A CA may be required for SSL if you are self-hosting SAP HANA ![Dynamic Secret Setup Modal](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/dynamic-secret-setup-modal-sap-hana.png) If you want to provide specific privileges for the generated dynamic credentials, you can modify the SQL statement to your needs. ![Modify SQL Statements Modal](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/modify-sap-hana-sql-statements.png) Due to SAP HANA limitations, the attached SQL statements are not executed as a transaction. After submitting the form, you will see a dynamic secret created in the dashboard. If this step fails, you may have to add the CA certficate. Once you've successfully configured the dynamic secret, you're ready to generate on-demand credentials. To do this, simply click on the 'Generate' button which appears when hovering over the dynamic secret item. Alternatively, you can initiate the creation of a new lease by selecting 'New Lease' from the dynamic secret lease list section. ![Dynamic Secret](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/dynamic-secret-generate.png) ![Dynamic Secret](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/dynamic-secret-lease-empty.png) When generating these secrets, it's important to specify a Time-to-Live (TTL) duration. This will dictate how long the credentials are valid for. ![Provision Lease](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/provision-lease.png) Ensure that the TTL for the lease fall within the maximum TTL defined when configuring the dynamic secret in step 4. Once you click the `Submit` button, a new secret lease will be generated and the credentials for it will be shown to you. ![Provision Lease](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/lease-values.png) ## Audit or Revoke Leases Once you have created one or more leases, you will be able to access them by clicking on the respective dynamic secret item on the dashboard. This will allow you see the lease details and delete the lease ahead of its expiration time. ![Provision Lease](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/lease-data.png) ## Renew Leases To extend the life of the generated dynamic secret lease past its initial time to live, simply click on the **Renew** as illustrated below. ![Provision Lease](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/dynamic-secret-lease-renew.png) Lease renewals cannot exceed the maximum TTL set when configuring the dynamic secret. # Snowflake Learn how to dynamically generate Snowflake user credentials. Infisical's Snowflake dynamic secrets allow you to generate Snowflake user credentials on demand. ## Snowflake Prerequisites Infisical requires a Snowflake user in your account with the USERADMIN role. This user will act as a service account for Infisical and facilitate the creation of new users as needed. ![Snowflake User Dashboard](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/snowflake/dynamic-secret-snowflake-users-page.png) Be sure to uncheck "Force user to change password on first time login" ![Snowflake Create Service User](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/snowflake/dynamic-secret-snowflake-create-service-user.png) ![Snowflake Account And Organization Identifiers](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/snowflake/dynamic-secret-snowflake-identifiers.png) ## Set up Dynamic Secrets with Snowflake Open the Secret Overview dashboard and select the environment in which you would like to add a dynamic secret. ![Add Dynamic Secret Button](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/add-dynamic-secret-button.png) ![Dynamic Secret Modal](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/snowflake/dynamic-secret-snowflake-modal.png) The name you want to reference this secret by Default time-to-live for a generated secret (it is possible to modify this value when generating a secret) Maximum time-to-live for a generated secret Snowflake account identifier Snowflake organization identifier Username of the Infisical Service User Password of the Infisical Service User ![Dynamic Secret Setup Modal](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/snowflake/dynamic-secret-snowflake-setup-modal.png) If you want to provide specific privileges for the generated dynamic credentials, you can modify the SQL statement to your needs. ![Modify SQL Statements Modal](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/snowflake/dynamic-secret-snowflake-sql-statements.png) After submitting the form, you will see a dynamic secret created in the dashboard. Once you've successfully configured the dynamic secret, you're ready to generate on-demand credentials. To do this, simply click on the 'Generate' button which appears when hovering over the dynamic secret item. Alternatively, you can initiate the creation of a new lease by selecting 'New Lease' from the dynamic secret lease list section. ![Dynamic Secret](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/dynamic-secret-generate.png) ![Dynamic Secret](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/dynamic-secret-lease-empty.png) When generating these secrets, it's important to specify a Time-to-Live (TTL) duration. This will dictate how long the credentials are valid for. ![Provision Lease](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/provision-lease.png) Ensure that the TTL for the lease fall within the maximum TTL defined when configuring the dynamic secret in step 4. Once you click the `Submit` button, a new secret lease will be generated and the credentials for it will be shown to you. ![Provision Lease](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/lease-values.png) ## Audit or Revoke Leases Once you have created one or more leases, you will be able to access them by clicking on the respective dynamic secret item on the dashboard. This will allow you see the lease details and delete the lease ahead of its expiration time. ![Provision Lease](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/lease-data.png) ## Renew Leases To extend the life of the generated dynamic secret lease past its initial time to live, simply click on the **Renew** button as illustrated below. ![Provision Lease](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/dynamic-secrets/dynamic-secret-lease-renew.png) Lease renewals cannot exceed the maximum TTL set when configuring the dynamic secret. # Folders Learn how to organize secrets with folders. Infisical Folders enable users to organize secrets using custom structures dependent on the intended use case (also known as **path-based secret storage**). It is great for organizing secrets around hierarchies with multiple services or types of secrets involved at large quantities. Infisical Folders can be infinitely nested to mirror your application architecture – whether it's microservices, monorepos, or any logical grouping that best suits your needs. Consider the following structure for a microservice architecture: ``` | service1 |---- envars |---- users |-------- tokens1 |-------- tokens2 | service2 |---- envars ... ``` In this example, we store environment variables for each microservice under each respective `/envars` folder. We also store user-specific secrets for micro-service 1 under `/service1/users`. With this folder structure in place, your applications only need to specify a path like `/microservice1/envars` to fetch secrets from there. By extending this example, you can see how path-based secret storage provides a versatile approach to manage secrets for any architecture. ## Managing folders To add a folder, press the downward chevron to the right of the **Add Secret** button; then press on the **Add Folder** button. Folder names can only contain alphabets, numbers, and dashes ![add folder](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/folder/folders-add.png) To delete a folder, hover over it and press the **X** button that appears on the right side. ![delete folder](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/folder/folders-delete.png) ### Comparing folders It's possible to compare the contents of folders across environments in the **Secrets Overview** page. When you click on a folder, the table will display the items within it across environments. In the image below, you can see that the **Development** environment is the only one that contains items in the `/users` folder, being other folders `/user-a`, `/user-b`, ... `/user-f`. ![comparing folders](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/folder/folders-secrets-overview.png) # User Groups Manage user groups in Infisical. User Groups is a paid feature. If you're using Infisical Cloud, then it is available under the **Enterprise Tier**. If you're self-hosting Infisical, then you should contact [team@infisical.com](mailto:team@infisical.com) to purchase an enterprise license to use it. ## Concept A (user) group is a collection of users that you can create in an Infisical organization to more efficiently manage permissions and access control for multiple users together. For example, you can have a group called `Developers` with the `Developer` role containing all the developers in your organization. User groups have the following properties: * If a group is added to a project under specific role(s), all users in the group will be provisioned access to the project with the role(s). Conversely, if a group is removed from a project, all users in the group will lose access to the project. * If a user is added to a group, they will inherit the access control properties of the group including access to project(s) under the role(s) assigned to the group. Conversely, if a user is removed from a group, they will lose access to project(s) that the group has access to. * If a user was previously added to a project under a role and is later added to a group that has access to the same project under a different role, then the user will now have access to the project under the composite permissions of the two roles. If the group is subsequently removed from the project, the user will not lose access to the project as they were previously added to the project separately. * A user can be part of multiple groups. If a user is part of multiple groups, they will inherit the composite permissions of all the groups that they are part of. ## Workflow In the following steps, we explore how to create and use user groups to provision user access to projects in Infisical. To create a group, head to your Organization Settings > Access Control > Groups and press **Create group**. ![groups org](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/groups/groups-org.png) When creating a group, you specify an organization level [role](/documentation/platform/role-based-access-controls) for it to assume; you can configure roles in Organization Settings > Access Control > Organization Roles. ![groups org create](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/groups/groups-org-create.png) Now input a few details for your new group. Here’s some guidance for each field: * Name (required): A friendly name for the group like `Engineering`. * Slug (required): A unique identifier for the group like `engineering`. * Role (required): A role from the Organization Roles tab for the group to assume. The organization role assigned will determine what organization level resources this group can have access to. Next, you'll want to assign users to the group. To do this, press on the users icon on the group and start assigning users to the group. ![groups org users](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/groups/groups-org-users.png) In this example, we're assigning **Alan Turing** and **Ada Lovelace** to the group **Engineering**. ![groups org assign users](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/groups/groups-org-users-assign.png) To enable the group to access project-level resources such as secrets within a specific project, you should add it to that project. To do this, head over to the project you want to add the group to and go to Project Settings > Access Control > Groups and press **Add group**. ![groups project](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/groups/groups-project.png) Next, select the group you want to add to the project and the project level role you want to allow it to assume. The project role assigned will determine what project level resources this group can have access to. ![groups project add](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/groups/groups-project-create.png) That's it! The users of the group now have access to the project under the role you assigned to the group. # AWS Auth Learn how to authenticate with Infisical for EC2 instances, Lambda functions, and other IAM principals. **AWS Auth** is an AWS-native authentication method for IAM principals like EC2 instances or Lambda functions to access Infisical. ## Diagram The following sequence diagram illustrates the AWS Auth workflow for authenticating AWS IAM principals with Infisical. ```mermaid sequenceDiagram participant Client as Client participant Infis as Infisical participant AWS as AWS STS Note over Client,Client: Step 1: Sign GetCallerIdentityQuery Note over Client,Infis: Step 2: Login Operation Client->>Infis: Send signed query details /api/v1/auth/aws-auth/login Note over Infis,AWS: Step 3: Query verification Infis->>AWS: Forward signed GetCallerIdentity query AWS-->>Infis: Return IAM user/role details Note over Infis: Step 4: Identity Property Validation Infis->>Client: Return short-lived access token Note over Client,Infis: Step 5: Access Infisical API with Token Client->>Infis: Make authenticated requests using the short-lived access token ``` ## Concept At a high-level, Infisical authenticates an IAM principal by verifying its identity and checking that it meets specific requirements (e.g. it is an allowed IAM principal ARN) at the `/api/v1/auth/aws-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. To be more specific: 1. The client 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. 2. The client sends the signed query data to Infisical including the request method, request body, and request headers at the `/api/v1/auth/aws-auth/login` endpoint. 3. Infisical reconstructs the query and sends it to AWS STS API via the [sts:GetCallerIdentity](https://docs.aws.amazon.com/STS/latest/APIReference/API_GetCallerIdentity.html) method for verification and obtains the identity associated with the IAM principal. 4. Infisical checks the identity's properties against set criteria such **Allowed Principal ARNs**. 5. If all is well, Infisical returns a short-lived access token that the IAM principal can use to make authenticated requests to the Infisical API. We recommend using one of Infisical's clients like SDKs or the Infisical Agent to authenticate with Infisical using AWS Auth as they handle the authentication process including the signed `GetCallerIdentity` query construction for you. Also, note that Infisical needs network-level access to send requests to the AWS STS API as part of the AWS Auth workflow. ## Guide In the following steps, we explore how to create and use identities for your workloads and applications on AWS to access the Infisical API using the AWS Auth authentication method. To create an identity, head to your Organization Settings > Access Control > Machine Identities and press **Create identity**. ![identities organization](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/identities/identities-org.png) When creating an identity, you specify an organization level [role](/documentation/platform/role-based-access-controls) for it to assume; you can configure roles in Organization Settings > Access Control > Organization Roles. ![identities organization create](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/identities/identities-org-create.png) Now input a few details for your new identity. Here's some guidance for each field: * 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 redirected to a page where you can manage the identity. ![identities page](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/identities/identities-page.png) Since the identity has been configured with Universal Auth by default, you should re-configure it to use AWS Auth instead. To do this, press to edit the **Authentication** section, remove the existing Universal Auth configuration, and add a new AWS Auth configuration onto the identity. ![identities page remove default auth](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/identities/identities-page-remove-default-auth.png) ![identities create aws auth method](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/identities/identities-org-create-aws-auth-method.png) Here's some more guidance on each field: * Allowed Principal ARNs: A comma-separated list of trusted IAM principal ARNs that are allowed to authenticate with Infisical. The values should take one of three forms: `arn:aws:iam::123456789012:user/MyUserName`, `arn:aws:iam::123456789012:role/MyRoleName`, or `arn:aws:iam::123456789012:*`. Using a wildcard in this case allows any IAM principal in the account `123456789012` to authenticate with Infisical under the identity. * Allowed Account IDs: A comma-separated list of trusted AWS account IDs that are allowed to authenticate with Infisical. * STS Endpoint (default is `https://sts.amazonaws.com/`): The endpoint URL for the AWS STS API. This value should be adjusted based on the AWS region you are operating in (e.g. `https://sts.us-east-1.amazonaws.com/`); refer to the list of regional STS endpoints [here](https://docs.aws.amazon.com/general/latest/gr/sts.html). * 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. * Access Token Trusted IPs: The IPs or CIDR ranges that access tokens can be used from. By default, each token is given the `0.0.0.0/0`, allowing usage from any network address. To enable the identity to access project-level resources such as secrets within a specific project, you should add it to that project. To do this, head over to the project you want to add the identity to and go to Project Settings > Access Control > Machine Identities and press **Add identity**. Next, select the identity you want to add to the project and the project level role you want to allow it to assume. The project role assigned will determine what project level resources this identity can have access to. ![identities project](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/identities/identities-project.png) ![identities project create](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/identities/identities-project-create.png) To access the Infisical API as the identity, you need to construct a signed `GetCallerIdentity` query using the [AWS Signature v4 algorithm](https://docs.aws.amazon.com/IAM/latest/UserGuide/create-signed-request.html) and make a request to the `/api/v1/auth/aws-auth/login` endpoint containing the query data in exchange for an access token. We provide a few code examples below of how you can authenticate with Infisical from inside a Lambda function, EC2 instance, etc. and obtain an access token to access the [Infisical API](/api-reference/overview/introduction). The following query construction is an example of how you can authenticate with Infisical from inside a Lambda function. The shown example uses Node.js but you can use other languages supported by AWS Lambda. ```javascript import AWS from "aws-sdk"; import axios from "axios"; export const handler = async (event, context) => { try { const region = process.env.AWS_REGION; AWS.config.update({ region }); const iamRequestURL = `https://sts.${region}.amazonaws.com/`; const iamRequestBody = "Action=GetCallerIdentity&Version=2011-06-15"; const iamRequestHeaders = { "Content-Type": "application/x-www-form-urlencoded; charset=utf-8", Host: `sts.${region}.amazonaws.com`, }; // Create the request const request = new AWS.HttpRequest(iamRequestURL, region); request.method = "POST"; request.headers = iamRequestHeaders; request.headers["X-Amz-Date"] = AWS.util.date .iso8601(new Date()) .replace(/[:-]|\.\d{3}/g, ""); request.body = iamRequestBody; request.headers["Content-Length"] = Buffer.byteLength(iamRequestBody).toString(); // Sign the request const signer = new AWS.Signers.V4(request, "sts"); signer.addAuthorization(AWS.config.credentials, new Date()); const infisicalUrl = "https://app.infisical.com"; // or your self-hosted Infisical URL const identityId = ""; const { data } = await axios.post( `${infisicalUrl}/api/v1/auth/aws-auth/login`, { identityId, iamHttpRequestMethod: "POST", iamRequestUrl: Buffer.from(iamRequestURL).toString("base64"), iamRequestBody: Buffer.from(iamRequestBody).toString("base64"), iamRequestHeaders: Buffer.from( JSON.stringify(iamRequestHeaders) ).toString("base64"), } ); console.log("result data: ", data); // access token here } catch (err) { console.error(err); } }; ``` The following query construction is an example of how you can authenticate with Infisical from inside a EC2 instance. The shown example uses Node.js but you can use other language you wish. ```javascript import AWS from "aws-sdk"; import axios from "axios"; const main = async () => { try { // obtain region from EC2 instance metadata const tokenResponse = await axios.put("http://169.254.169.254/latest/api/token", null, { headers: { "X-aws-ec2-metadata-token-ttl-seconds": "21600" } }); const url = "http://169.254.169.254/latest/dynamic/instance-identity/document"; const response = await axios.get(url, { headers: { "X-aws-ec2-metadata-token": tokenResponse.data } }); const region = response.data.region; AWS.config.update({ region }); const iamRequestURL = `https://sts.${region}.amazonaws.com/`; const iamRequestBody = "Action=GetCallerIdentity&Version=2011-06-15"; const iamRequestHeaders = { "Content-Type": "application/x-www-form-urlencoded; charset=utf-8", Host: `sts.${region}.amazonaws.com` }; const request = new AWS.HttpRequest(new AWS.Endpoint(iamRequestURL), AWS.config.region); request.method = "POST"; request.headers = iamRequestHeaders; request.headers["X-Amz-Date"] = AWS.util.date.iso8601(new Date()).replace(/[:-]|\.\d{3}/g, ""); request.body = iamRequestBody; request.headers["Content-Length"] = Buffer.byteLength(iamRequestBody); const signer = new AWS.Signers.V4(request, "sts"); signer.addAuthorization(AWS.config.credentials, new Date()); const infisicalUrl = "https://app.infisical.com"; // or your self-hosted Infisical URL const identityId = ""; const { data } = await axios.post(`${infisicalUrl}/api/v1/auth/aws-auth/login`, { identityId, iamHttpRequestMethod: "POST", iamRequestUrl: Buffer.from(iamRequestURL).toString("base64"), iamRequestBody: Buffer.from(iamRequestBody).toString("base64"), iamRequestHeaders: Buffer.from(JSON.stringify(iamRequestHeaders)).toString("base64") }); console.log("result data: ", data); // access token here } catch (err) { console.error(err); } } main(); ``` The following query construction provides a generic example of how you can construct a signed `GetCallerIdentity` query and obtain the required payload components. The shown example uses Node.js but you can use any language you wish. ```javascript const AWS = require("aws-sdk"); const region = ""; const infisicalUrl = "https://app.infisical.com"; // or your self-hosted Infisical URL const iamRequestURL = `https://sts.${region}.amazonaws.com/`; const iamRequestBody = "Action=GetCallerIdentity&Version=2011-06-15"; const iamRequestHeaders = { "Content-Type": "application/x-www-form-urlencoded; charset=utf-8", Host: `sts.${region}.amazonaws.com` }; const request = new AWS.HttpRequest(new AWS.Endpoint(iamRequestURL), region); request.method = "POST"; request.headers = iamRequestHeaders; request.headers["X-Amz-Date"] = AWS.util.date.iso8601(new Date()).replace(/[:-]|\.\d{3}/g, ""); request.body = iamRequestBody; request.headers["Content-Length"] = Buffer.byteLength(iamRequestBody); const signer = new AWS.Signers.V4(request, "sts"); signer.addAuthorization(AWS.config.credentials, new Date()); ``` #### Sample request ```bash Request curl --location --request POST 'https://app.infisical.com/api/v1/auth/aws-auth/login' \ --header 'Content-Type: application/x-www-form-urlencoded' \ --data-urlencode 'identityId=...' \ --data-urlencode 'iamHttpRequestMethod=...' \ --data-urlencode 'iamRequestBody=...' \ --data-urlencode 'iamRequestHeaders=...' ``` Note that you should replace `` with the ID of the identity you created in step 1. #### Sample response ```bash Response { "accessToken": "...", "expiresIn": 7200, "accessTokenMaxTTL": 43244 "tokenType": "Bearer" } ``` Next, you can use the access token to access the [Infisical API](/api-reference/overview/introduction) We recommend using one of Infisical's clients like SDKs or the Infisical Agent to authenticate with Infisical using AWS Auth as they handle the authentication process including the signed `GetCallerIdentity` query construction for you. Each identity access token has a time-to-live (TLL) which you can infer from the response of the login operation; the default TTL is `7200` seconds which can be adjusted. If an identity access token expires, it can no longer authenticate with the Infisical API. In this case, a new access token should be obtained by performing another login operation. # Azure Auth Learn how to authenticate with Infisical for services on Azure **Azure Auth** is an Azure-native authentication method for Azure resources like Azure VMs, Azure App Services, Azure Functions, Azure Kubernetes Service, etc. to access Infisical. ## Diagram The following sequence diagram illustrates the Azure Auth workflow for authenticating Azure [service principals](https://learn.microsoft.com/en-us/entra/identity-platform/app-objects-and-service-principals?tabs=browser) with Infisical. ```mermaid sequenceDiagram participant Client as Client participant Infis as Infisical participant Azure as Azure AD OpenID Note over Client,Azure: Step 1: Instance Identity Token Retrieval Client->>Azure: Request managed identity access token Azure-->>Client: Return managed identity access token Note over Client,Infis: Step 2: Identity Token Login Operation Client->>Infis: Send managed identity access token to /api/v1/auth/azure-auth/login Infis->>Azure: Request public key Azure-->>Infis: Return public key Note over Infis: Step 3: Identity Token Verification Note over Infis: Step 4: Identity Property Validation Infis->>Client: Return short-lived access token Note over Client,Infis: Step 4: Access Infisical API with Token Client->>Infis: Make authenticated requests using the short-lived access token ``` ## Concept At a high-level, Infisical authenticates an Azure service by verifying its identity and checking that it meets specific requirements (e.g. it is bound to an allowed service principal) at the `/api/v1/auth/azure-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. To be more specific: 1. The client running on an Azure service obtains an [access token](https://learn.microsoft.com/en-us/entra/identity/managed-identities-azure-resources/how-to-use-vm-token#get-a-token-using-http) that is a JWT token representing the managed identity for the Azure resource such as a Virtual Machine; the managed identity is associated with a service principal in Azure AD. 2. The client sends the access token to Infisical. 3. Infisical verifies the token against the corresponding public key at the [public Azure AD OpenID configuration endpoint](https://learn.microsoft.com/en-us/answers/questions/793793/azure-ad-validate-access-token). 4. Infisical checks if the entity behind the access token is allowed to authenticate with Infisical based on set criteria such as **Allowed Service Principal IDs**. 5. If all is well, Infisical returns a short-lived access token that the client can use to make authenticated requests to the Infisical API. We recommend using one of Infisical's clients like SDKs or the Infisical Agent to authenticate with Infisical using Azure Auth as they handle the authentication process including generating the client access token for you. Also, note that Infisical needs network-level access to send requests to the Google Cloud API as part of the Azure Auth workflow. ## Guide In the following steps, we explore how to create and use identities for your applications in Azure to access the Infisical API using the Azure Auth authentication method. To create an identity, head to your Organization Settings > Access Control > Machine Identities and press **Create identity**. ![identities organization](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/identities/identities-org.png) When creating an identity, you specify an organization level [role](/documentation/platform/role-based-access-controls) for it to assume; you can configure roles in Organization Settings > Access Control > Organization Roles. ![identities organization create](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/identities/identities-org-create.png) Now input a few details for your new identity. Here's some guidance for each field: * 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 redirected to a page where you can manage the identity. ![identities page](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/identities/identities-page.png) Since the identity has been configured with Universal Auth by default, you should re-configure it to use Azure Auth instead. To do this, press to edit the **Authentication** section, remove the existing Universal Auth configuration, and add a new Azure Auth configuration onto the identity. ![identities page remove default auth](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/identities/identities-page-remove-default-auth.png) ![identities create azure auth method](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/identities/identities-org-create-azure-auth-method.png) Here's some more guidance on each field: * Tenant ID: The [tenant ID](https://learn.microsoft.com/en-us/entra/fundamentals/how-to-find-tenant) for the Azure AD organization. * Resource / Audience: The resource URL for the application registered in Azure AD. The value is expected to match the `aud` claim of the access token JWT later used in the login operation against Infisical. See the [resource](https://learn.microsoft.com/en-us/entra/identity/managed-identities-azure-resources/how-to-use-vm-token#get-a-token-using-http) parameter for how the audience is set when requesting a JWT access token from the Azure Instance Metadata Service (IMDS) endpoint. In most cases, this value should be `https://management.azure.com/` which is the default. * Allowed Service Principal IDs: A comma-separated list of Azure AD service principal IDs that are allowed 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. * Access Token Trusted IPs: The IPs or CIDR ranges that access tokens can be used from. By default, each token is given the `0.0.0.0/0`, allowing usage from any network address. To enable the identity to access project-level resources such as secrets within a specific project, you should add it to that project. To do this, head over to the project you want to add the identity to and go to Project Settings > Access Control > Machine Identities and press **Add identity**. Next, select the identity you want to add to the project and the project level role you want to allow it to assume. The project role assigned will determine what project level resources this identity can have access to. ![identities project](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/identities/identities-project.png) ![identities project create](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/identities/identities-project-create.png) To access the Infisical API as the identity, you need to generate a managed identity [access token](https://learn.microsoft.com/en-us/entra/identity/managed-identities-azure-resources/how-to-use-vm-token#get-a-token-using-http) that is a JWT token representing the managed identity for the Azure resource such as a Virtual Machine. The client token must be sent to the `/api/v1/auth/azure-auth/login` endpoint in exchange for a separate access token to access the Infisical API. We provide a few code examples below of how you can authenticate with Infisical to access the [Infisical API](/api-reference/overview/introduction). Start by making a request from your Azure client such as Virtual Machine to obtain a managed identity access token. For more examples of how to obtain the managed identity access token, refer to the [official documentation](https://learn.microsoft.com/en-us/entra/identity/managed-identities-azure-resources/how-to-use-vm-token#get-a-token-using-http). #### Sample request ```bash curl curl 'http://169.254.169.254/metadata/identity/oauth2/token?api-version=2018-02-01&resource=https%3A%2F%2Fmanagement.azure.com%2F' -H Metadata:true -s ``` #### Sample response ```bash { "access_token": "eyJ0eXAi...", "refresh_token": "", "expires_in": "3599", "expires_on": "1506484173", "not_before": "1506480273", "resource": "https://management.azure.com/", "token_type": "Bearer" } ``` Next use send the obtained managed identity access token (i.e. the token from the `access_token` field above) to authenticate with Infisical and obtain a separate access token. #### Sample request ```bash Request curl --location --request POST 'https://app.infisical.com/api/v1/auth/gcp-auth/login' \ --header 'Content-Type: application/x-www-form-urlencoded' \ --data-urlencode 'identityId=...' \ --data-urlencode 'jwt=...' ``` Note that you should replace `` with the ID of the identity you created in step 1. #### Sample response ```bash Response { "accessToken": "...", "expiresIn": 7200, "accessTokenMaxTTL": 43244 "tokenType": "Bearer" } ``` Next, you can use this access token to access the [Infisical API](/api-reference/overview/introduction) We recommend using one of Infisical's clients like SDKs or the Infisical Agent to authenticate with Infisical using Azure Auth as they handle the authentication process including retrieving the client access token. Each identity access token has a time-to-live (TLL) which you can infer from the response of the login operation; the default TTL is `7200` seconds which can be adjusted. If an identity access token expires, it can no longer authenticate with the Infisical API. In this case, a new access token should be obtained by performing another login operation. # GCP Auth Learn how to authenticate with Infisical for services on Google Cloud Platform **GCP Auth** is a GCP-native authentication method for GCP resources to access Infisical. It consists of two sub-methods/approaches: * GCP ID Token Auth: For GCP services including [Compute Engine](https://cloud.google.com/compute/docs/instances/verifying-instance-identity#request_signature), [App Engine standard environment](https://cloud.google.com/appengine/docs/standard/python3/runtime#metadata_server), [App Engine flexible environment](https://cloud.google.com/appengine/docs/flexible/python/runtime#metadata_server), [Cloud Functions](https://cloud.google.com/functions/docs/securing/function-identity#using_the_metadata_server_to_acquire_tokens), [Cloud Run](https://cloud.google.com/run/docs/container-contract#metadata-server), [Google Kubernetes Engine](https://cloud.google.com/kubernetes-engine/docs/concepts/workload-identity#instance_metadata), and [Cloud Build](https://cloud.google.com/kubernetes-engine/docs/concepts/workload-identity#instance_metadata) to authenticate with Infisical. * GCP IAM Auth: For Google Cloud Platform (GCP) service accounts to authenticate with Infisical. ## Diagram The following sequence diagram illustrates the GCP ID Token Auth workflow for authenticating GCP resources with Infisical. ```mermaid sequenceDiagram participant GCE as GCP Service participant Infis as Infisical participant Google as OAuth2 API 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: 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: 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 At a high-level, Infisical authenticates a GCP resource 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. To be more specific: 1. The client running on a GCP service obtains an [ID token](https://cloud.google.com/docs/authentication/get-id-token) constituting the identity for a GCP resource such as a GCE instance or Cloud Function; 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). 2. The client sends the ID token to Infisical at the `/api/v1/auth/gcp-auth/login` endpoint. 3. Infisical verifies the token against Google's [public OAuth2 certificates](https://www.googleapis.com/oauth2/v3/certs). 4. Infisical checks if the entity behind the ID token is allowed to authenticate with Infisical based on set criteria such as **Allowed Service Account Emails**. 5. If all is well, Infisical returns a short-lived access token that the client can use to make authenticated requests to the Infisical API. We recommend using one of Infisical's clients like SDKs or the Infisical Agent to authenticate with Infisical using GCP ID Token Auth as they handle the authentication process including generating the instance ID token for you. Also, note that Infisical needs network-level access to send requests to the Google Cloud API as part of the GCP Auth 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 ID Token authentication method. To create an identity, head to your Organization Settings > Access Control > Machine Identities and press **Create identity**. ![identities organization](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/identities/identities-org.png) When creating an identity, you specify an organization level [role](/documentation/platform/role-based-access-controls) for it to assume; you can configure roles in Organization Settings > Access Control > Organization Roles. ![identities organization create](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/identities/identities-org-create.png) Now input a few details for your new identity. Here's some guidance for each field: * 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 redirected to a page where you can manage the identity. ![identities page](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/identities/identities-page.png) Since the identity has been configured with Universal Auth by default, you should re-configure it to use GCP Auth instead. To do this, press to edit the **Authentication** section, remove the existing Universal Auth configuration, and add a new GCP Auth configuration onto the identity; set the **Type** field to **GCP ID Token Auth**. ![identities page remove default auth](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/identities/identities-page-remove-default-auth.png) ![identities create gcp auth method](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/identities/identities-org-create-gcp-gce-auth-method.png) Here's some more guidance on each field: * Allowed Service Account Emails: A comma-separated list of trusted service account emails corresponding to the GCE resource(s) allowed to authenticate with Infisical; this could be something like `test@project.iam.gserviceaccount.com`, `12345-compute@developer.gserviceaccount.com`, etc. * Allowed Projects: A comma-separated list of trusted GCP projects that the GCE instance must belong to authenticate with Infisical. Note that this validation property will only work for GCE instances. * 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 `-`like `us-central1-a`, `us-west1-b`, etc. Note that this validation property will only work for GCE instances. * 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. * Access Token Trusted IPs: The IPs or CIDR ranges that access tokens can be used from. By default, each token is given the `0.0.0.0/0`, allowing usage from any network address. To enable the identity to access project-level resources such as secrets within a specific project, you should add it to that project. To do this, head over to the project you want to add the identity to and go to Project Settings > Access Control > Machine Identities and press **Add identity**. Next, select the identity you want to add to the project and the project level role you want to allow it to assume. The project role assigned will determine what project level resources this identity can have access to. ![identities project](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/identities/identities-project.png) ![identities project create](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/identities/identities-project-create.png) To access the Infisical API as the identity, you need to generate an [ID token](https://cloud.google.com/docs/authentication/get-id-token) 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). Start by making a request from the GCE instance to obtain the ID token. For more examples of how to obtain the token in Java, Go, Node.js, etc. refer to the [official documentation](https://cloud.google.com/docs/authentication/get-id-token#curl). #### Sample request ```bash curl curl -H "Metadata-Flavor: Google" \ 'http://metadata/computeMetadata/v1/instance/service-accounts/default/identity?audience=&format=full' ``` Note that you should replace `` with the ID of the identity you created in step 1. Next use send the obtained JWT token along to authenticate with Infisical and obtain an access token. #### Sample request ```bash Request curl --location --request POST 'https://app.infisical.com/api/v1/auth/gcp-auth/login' \ --header 'Content-Type: application/x-www-form-urlencoded' \ --data-urlencode 'identityId=...' \ --data-urlencode 'jwt=...' ``` #### Sample response ```bash Response { "accessToken": "...", "expiresIn": 7200, "accessTokenMaxTTL": 43244 "tokenType": "Bearer" } ``` Next, you can use the access token to access the [Infisical API](/api-reference/overview/introduction) 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 authentication process including generating the signed JWT token. Each identity access token has a time-to-live (TLL) which you can infer from the response of the login operation; the default TTL is `7200` seconds which can be adjusted. If an identity access token expires, it can no longer authenticate with the Infisical API. In this case, a new access token should be obtained by performing another login operation. ## Diagram The following sequence diagram illustrates the GCP IAM Auth workflow for authenticating GCP IAM service accounts with Infisical. ```mermaid sequenceDiagram participant GCE as Client participant Infis as Infisical participant Google as Cloud IAM 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: 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: JWT Token Verification Note over Infis: Step 4: JWT Property Validation Infis->>GCE: Return short-lived access token Note over GCE,Infis: Step 5: Access Infisical API with Token GCE->>Infis: Make authenticated requests using the short-lived access token ``` ## 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, then Infisical returns a short-lived access token that can be used to make authenticated requests to the Infisical API. To be more specific: 1. The client generates a signed JWT token 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 associated with the client. 2. The client sends the signed JWT token to Infisical at the `/api/v1/auth/gcp-auth/login` endpoint. 3. Infisical verifies the signed JWT token. 4. Infisical checks if the service account behind the JWT token is allowed to authenticate with Infisical based **Allowed Service Account Emails**. 5. If all is well, Infisical returns a short-lived access token that the client can use to make authenticated requests to the Infisical API. 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 authentication process including generating the signed JWT token. Also, note that Infisical needs network-level access to send requests to the Google Cloud API as part of the GCP Auth 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. To create an identity, head to your Organization Settings > Access Control > Machine Identities and press **Create identity**. ![identities organization](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/identities/identities-org.png) When creating an identity, you specify an organization level [role](/documentation/platform/role-based-access-controls) for it to assume; you can configure roles in Organization Settings > Access Control > Organization Roles. ![identities organization create](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/identities/identities-org-create.png) Now input a few details for your new identity. Here's some guidance for each field: * 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 redirected to a page where you can manage the identity. ![identities page](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/identities/identities-page.png) Since the identity has been configured with Universal Auth by default, you should re-configure it to use GCP Auth instead. To do this, press to edit the **Authentication** section, remove the existing Universal Auth configuration, and add a new GCP Auth configuration onto the identity; set the **Type** field to **GCP IAM Auth**. ![identities page remove default auth](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/identities/identities-page-remove-default-auth.png) ![identities organization create token auth method](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/identities/identities-org-create-gcp-iam-auth-method.png) Here's some more guidance on each field: * 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 `test@project.iam.gserviceaccount.com`, `12345-compute@developer.gserviceaccount.com`, 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. * Access Token Trusted IPs: The IPs or CIDR ranges that access tokens can be used from. By default, each token is given the `0.0.0.0/0`, allowing usage from any network address. To enable the identity to access project-level resources such as secrets within a specific project, you should add it to that project. To do this, head over to the project you want to add the identity to and go to Project Settings > Access Control > Machine Identities and press **Add identity**. Next, select the identity you want to add to the project and the project level role you want to allow it to assume. The project role assigned will determine what project level resources this identity can have access to. ![identities project](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/identities/identities-project.png) ![identities project create](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/identities/identities-project-create.png) 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. Make sure that the service account has the `iam.serviceAccounts.signJwt` permission or the `roles/iam.serviceAccountTokenCreator` role. We provide a few code examples below of how you can authenticate with Infisical to access the [Infisical API](/api-reference/overview/introduction). 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. ```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 = ""; 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 ```bash Request curl --location --request POST 'https://app.infisical.com/api/v1/auth/gcp-auth/login' \ --header 'Content-Type: application/x-www-form-urlencoded' \ --data-urlencode 'identityId=...' \ --data-urlencode 'jwt=...' ``` #### Sample response ```bash Response { "accessToken": "...", "expiresIn": 7200, "accessTokenMaxTTL": 43244 "tokenType": "Bearer" } ``` Next, you can use the access token to access the [Infisical API](/api-reference/overview/introduction) 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 authentication process including generating the signed JWT token. Each identity access token has a time-to-live (TLL) which you can infer from the response of the login operation; the default TTL is `7200` seconds which can be adjusted. If an identity access token expires, it can no longer authenticate with the Infisical API. In this case, a new access token should be obtained by performing another login operation. # Kubernetes Auth Learn how to authenticate with Infisical in Kubernetes **Kubernetes Auth** is a Kubernetes-native authentication method for applications (e.g. pods) to access Infisical. ## Diagram The following sequence diagram illustrates the Kubernetes Auth workflow for authenticating applications running in pods with Infisical. ```mermaid sequenceDiagram participant Pod as Pod participant Infis as Infisical participant KubernetesServer as K8s API Server Note over Pod: Step 1: Service Account JWT Token Retrieval Note over Pod,Infis: Step 2: JWT Token Login Operation Pod->>Infis: Send JWT token to /api/v1/auth/kubernetes-auth/login Infis->>KubernetesServer: Forward JWT token for validation KubernetesServer-->>Infis: Return identity info for JWT Note over Infis: Step 3: Identity Property Verification Infis->>Pod: Return short-lived access token Note over Pod,Infis: Step 4: Access Infisical API with Token Pod->>Infis: Make authenticated requests using the short-lived access token ``` ## Concept At a high-level, Infisical authenticates an application in Kubernetes by verifying its identity and checking that it meets specific requirements (e.g. it is bound to an allowed service account) at the `/api/v1/auth/kubernetes-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. To be more specific: 1. The application deployed on Kubernetes retrieves its [service account credential](https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/#opt-out-of-api-credential-automounting) that is a JWT token at the `/var/run/secrets/kubernetes.io/serviceaccount/token` pod path. 2. The application sends the JWT token to Infisical at the `/api/v1/auth/kubernetes-auth/login` endpoint after which Infisical forwards the JWT token to the Kubernetes API Server at the [TokenReview API](https://kubernetes.io/docs/reference/kubernetes-api/authentication-resources/token-review-v1/) for verification and to obtain the service account information associated with the JWT token. Infisical is able to authenticate and interact with the TokenReview API by using a long-lived service account JWT token itself (referred to onward as the token reviewer JWT token). 3. Infisical checks the service account properties against set criteria such **Allowed Service Account Names** and **Allowed Namespaces**. 4. If all is well, Infisical returns a short-lived access token that the application can use to make authenticated requests to the Infisical API. We recommend using one of Infisical's clients like SDKs or the Infisical Agent to authenticate with Infisical using Kubernetes Auth as they handle the authentication process including service account credential retrieval for you. ## Guide In the following steps, we explore how to create and use identities for your applications in Kubernetes to access the Infisical API using the Kubernetes Auth authentication method. 1.1. Start by creating a service account in your Kubernetes cluster that will be used by Infisical to authenticate with the Kubernetes API Server. ```yaml infisical-service-account.yaml apiVersion: v1 kind: ServiceAccount metadata: name: infisical-auth namespace: default ``` ``` kubectl apply -f infisical-service-account.yaml ``` 1.2. Bind the service account to the `system:auth-delegator` cluster role. As described [here](https://kubernetes.io/docs/reference/access-authn-authz/rbac/#other-component-roles), this role allows delegated authentication and authorization checks, specifically for Infisical to access the [TokenReview API](https://kubernetes.io/docs/reference/kubernetes-api/authentication-resources/token-review-v1/). You can apply the following configuration file: ```yaml cluster-role-binding.yaml apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRoleBinding metadata: name: role-tokenreview-binding namespace: default roleRef: apiGroup: rbac.authorization.k8s.io kind: ClusterRole name: system:auth-delegator subjects: - kind: ServiceAccount name: infisical-auth namespace: default ``` ``` kubectl apply -f cluster-role-binding.yaml ``` 1.3. Next, create a long-lived service account JWT token (i.e. the token reviewer JWT token) for the service account using this configuration file for a new `Secret` resource: ```yaml service-account-token.yaml apiVersion: v1 kind: Secret type: kubernetes.io/service-account-token metadata: name: infisical-auth-token annotations: kubernetes.io/service-account.name: "infisical-auth" ``` ``` kubectl apply -f service-account-token.yaml ``` 1.4. Link the secret in step 1.3 to the service account in step 1.1: ```bash kubectl patch serviceaccount infisical-auth -p '{"secrets": [{"name": "infisical-auth-token"}]}' -n default ``` 1.5. Finally, retrieve the token reviewer JWT token from the secret. ```bash kubectl get secret infisical-auth-token -n default -o=jsonpath='{.data.token}' | base64 --decode ``` Keep this JWT token handy as you will need it for the **Token Reviewer JWT** field when configuring the Kubernetes Auth authentication method for the identity in step 2. To create an identity, head to your Organization Settings > Access Control > Machine Identities and press **Create identity**. ![identities organization](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/identities/identities-org.png) When creating an identity, you specify an organization level [role](/documentation/platform/role-based-access-controls) for it to assume; you can configure roles in Organization Settings > Access Control > Organization Roles. ![identities organization create](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/identities/identities-org-create.png) Now input a few details for your new identity. Here's some guidance for each field: * 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 redirected to a page where you can manage the identity. ![identities page](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/identities/identities-page.png) Since the identity has been configured with Universal Auth by default, you should re-configure it to use Kubernetes Auth instead. To do this, press to edit the **Authentication** section, remove the existing Universal Auth configuration, and add a new Kubernetes Auth configuration onto the identity. ![identities page remove default auth](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/identities/identities-page-remove-default-auth.png) ![identities organization create kubernetes auth method](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/identities/identities-org-create-kubernetes-auth-method.png) Here's some more guidance on each field: * Kubernetes Host / Base Kubernetes API URL: The host string, host:port pair, or URL to the base of the Kubernetes API server. This can usually be obtained by running `kubectl cluster-info`. * Token Reviewer JWT: A long-lived service account JWT token for Infisical to access the [TokenReview API](https://kubernetes.io/docs/reference/kubernetes-api/authentication-resources/token-review-v1/) to validate other service account JWT tokens submitted by applications/pods. This is the JWT token obtained from step 1.5. * Allowed Service Account Names: A comma-separated list of trusted service account names that are allowed to authenticate with Infisical. * Allowed Namespaces: A comma-separated list of trusted namespaces that service accounts must belong to authenticate with Infisical. * Allowed Audience: An optional audience claim that the service account JWT token must have to authenticate with Infisical. * CA Certificate: The PEM-encoded CA cert for the Kubernetes API server. This is used by the TLS client for secure communication with the Kubernetes API server. * 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. * Access Token Trusted IPs: The IPs or CIDR ranges that access tokens can be used from. By default, each token is given the `0.0.0.0/0`, allowing usage from any network address. To enable the identity to access project-level resources such as secrets within a specific project, you should add it to that project. To do this, head over to the project you want to add the identity to and go to Project Settings > Access Control > Machine Identities and press **Add identity**. Next, select the identity you want to add to the project and the project level role you want to allow it to assume. The project role assigned will determine what project level resources this identity can have access to. ![identities project](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/identities/identities-project.png) ![identities project create](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/identities/identities-project-create.png) To access the Infisical API as the identity, you should first make sure that the pod running your application is bound to a service account specified in the **Allowed Service Account Names** field of the identity's Kubernetes Auth authentication method configuration in step 2. Once bound, the pod will receive automatically mounted service account credentials that is a JWT token at the `/var/run/secrets/kubernetes.io/serviceaccount/token` path. This token should be used to authenticate with Infisical at the `/api/v1/auth/kubernetes-auth/login` endpoint. For information on how to configure sevice accounts for pods, refer to the guide [here](https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/). We provide a code example below of how you might retrieve the JWT token and use it to authenticate with Infisical to gain access to the [Infisical API](/api-reference/overview/introduction). The shown example uses Node.js but you can use any other language to retrieve the service account JWT token and use it to authenticate with Infisical. ```javascript const fs = require("fs"); try { const tokenPath = "/var/run/secrets/kubernetes.io/serviceaccount/token"; const jwtToken = fs.readFileSync(tokenPath, "utf8"); const infisicalUrl = "https://app.infisical.com"; // or your self-hosted Infisical URL const identityId = ""; const { data } = await axios.post( `{infisicalUrl}/api/v1/auth/kubernetes-auth/login`, { identityId, jwt, } ); console.log("result data: ", data); // access token here } catch(err) { console.error(err); } ``` We recommend using one of Infisical's clients like SDKs or the Infisical Agent to authenticate with Infisical using Kubernetes Auth as they handle the authentication process including service account credential retrieval for you. Each identity access token has a time-to-live (TLL) which you can infer from the response of the login operation; the default TTL is `7200` seconds which can be adjusted. If an identity access token exceeds its max ttl, it can no longer authenticate with the Infisical API. In this case, a new access token should be obtained by performing another login operation. **FAQ** There are a few reasons for why this might happen: * The Kubernetes Auth authentication method configuration is invalid. * The service account JWT token has expired is malformed or invalid. * The service account associated with the JWT token does not meet the criteria set forth in the Kubernetes Auth authentication method configuration such as **Allowed Service Account Names** and **Allowed Namespaces**. There are a few reasons for why this might happen: * The access token has expired. * The identity is insufficently permissioned to interact with the resources you wish to access. * The client access token is being used from an untrusted IP. 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. A token can be renewed any number of times where each call to renew it can extend the token's lifetime by increments of the access token's TTL. Regardless of how frequently an access token is renewed, its lifespan remains bound to the maximum TTL determined at its creation. # Machine Identities Learn how to use Machine Identities to programmatically interact with Infisical. ## Concept An Infisical machine identity is an entity that represents a workload or application that require access to various resources in Infisical. This is conceptually similar to an IAM user in AWS or service account in Google Cloud Platform (GCP). Each identity must authenticate with the Infisical API using a supported authentication method like [Token Auth](/documentation/platform/identities/token-auth), [Universal Auth](/documentation/platform/identities/universal-auth), [Kubernetes Auth](/documentation/platform/identities/kubernetes-auth), [AWS Auth](/documentation/platform/identities/aws-auth), [Azure Auth](/documentation/platform/identities/azure-auth), or [GCP Auth](/documentation/platform/identities/gcp-auth) to get back a short-lived access token to be used in subsequent requests. ![Organization Identities](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/organization/organization-machine-identities.png) Key Features: * Role Assignment: Identities must be assigned [roles](/documentation/platform/role-based-access-controls). These roles determine the scope of access to resources, either at the organization level or project level. * Auth/Token Configuration: Identities must be configured with corresponding authentication methods and access token properties to securely interact with the Infisical API. ## Workflow A typical workflow for using identities consists of four steps: 1. Creating the identity with a name and [role](/documentation/platform/access-controls/role-based-access-controls) in Organization Access Control > Machine Identities. This step also involves configuring an authentication method for it. 2. Adding the identity to the project(s) you want it to have access to. 3. Authenticating the identity with the Infisical API based on the configured authentication method on it and receiving a short-lived access token back. 4. Authenticating subsequent requests with the Infisical API using the short-lived access token. ## Authentication Methods To interact with various resources in Infisical, Machine Identities can authenticate with the Infisical API using: * [Token Auth](/documentation/platform/identities/token-auth): A platform-agnostic, simple authentication method suitable to authenticate with Infisical using a token. * [Universal Auth](/documentation/platform/identities/universal-auth): A platform-agnostic authentication method suitable to authenticate with Infisical using a Client ID and Client Secret. * [Kubernetes Auth](/documentation/platform/identities/kubernetes-auth): A Kubernetes-native authentication method for applications (e.g. pods). * [AWS Auth](/documentation/platform/identities/aws-auth): An AWS-native authentication method for AWS services (e.g. EC2, Lambda functions, etc.). * [Azure Auth](/documentation/platform/identities/azure-auth): An Azure-native authentication method for Azure resources (e.g. Azure VMs, Azure App Services, Azure Functions, Azure Kubernetes Service, etc.). * [GCP Auth](/documentation/platform/identities/gcp-auth): A GCP-native authentication method for GCP resources (e.g. Compute Engine, App Engine, Cloud Run, Google Kubernetes Engine, IAM service accounts, etc.). * [OIDC Auth](/documentation/platform/identities/oidc-auth): A platform-agnostic, JWT-based authentication method for workloads using an OpenID Connect identity provider. ## FAQ Yes - Identities can be used with the CLI. You can learn more about how to do this in the CLI quickstart [here](/cli/usage). A service token is a project-level authentication method that is being deprecated in favor of identities. The service token method will be removed in the future in accordance with the deprecation notice and timeline stated [here](https://infisical.com/blog/deprecating-api-keys). Amongst many differences, identities provide broader access over the Infisical API, utilizes the same permission system as user identities, and come with a significantly larger number of configurable authentication and security features. If you're looking for a simple authentication method, similar to service tokens, that can be bound onto an identity, we recommend checking out [Token Auth](/documentation/platform/identities/token-auth). There are a few reasons for why this might happen: * You have insufficient organization permissions to create, read, update, delete identities. * The identity you are trying to read, update, or delete is more privileged than yourself. * The role you are trying to create an identity for or update an identity to is more privileged than yours. # CircleCI Learn how to authenticate CircleCI jobs with Infisical using OpenID Connect (OIDC). **OIDC Auth** is a platform-agnostic JWT-based authentication method that can be used to authenticate from any platform or environment using an identity provider with OpenID Connect. ## Diagram The following sequence diagram illustrates the OIDC Auth workflow for authenticating CircleCI jobs with Infisical. ```mermaid sequenceDiagram participant Client as CircleCI Job participant Idp as CircleCI Identity Provider participant Infis as Infisical Idp->>Client: Step 1: Inject JWT with verifiable claims Note over Client,Infis: Step 2: Login Operation Client->>Infis: Send signed JWT to /api/v1/auth/oidc-auth/login Note over Infis,Idp: Step 3: Query verification Infis->>Idp: Request JWT public key using OIDC Discovery Idp-->>Infis: Return public key Note over Infis: Step 4: JWT validation Infis->>Client: Return short-lived access token Note over Client,Infis: Step 5: Access Infisical API with Token Client->>Infis: Make authenticated requests using the short-lived access token ``` ## Concept At a high-level, Infisical authenticates a client by verifying the JWT and checking that it meets specific requirements (e.g. it is issued by a trusted identity provider) at the `/api/v1/auth/oidc-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. To be more specific: 1. CircleCI provides the running job with a valid OIDC token specific to the execution. 2. The CircleCI OIDC token is sent to Infisical at the `/api/v1/auth/oidc-auth/login` endpoint. 3. Infisical fetches the public key that was used to sign the identity token provided by CircleCI. 4. Infisical validates the JWT using the public key provided by the identity provider and checks that the subject, audience, and claims of the token matches with the set criteria. 5. If all is well, Infisical returns a short-lived access token that CircleCI jobs can use to make authenticated requests to the Infisical API. Infisical needs network-level access to the CircleCI servers. ## Guide In the following steps, we explore how to create and use identities to access the Infisical API using the OIDC Auth authentication method. To create an identity, head to your Organization Settings > Access Control > Machine Identities and press **Create identity**. ![identities organization](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/identities/identities-org.png) When creating an identity, you specify an organization level [role](/documentation/platform/role-based-access-controls) for it to assume; you can configure roles in Organization Settings > Access Control > Organization Roles. ![identities organization create](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/identities/identities-org-create.png) Now input a few details for your new identity. Here's some guidance for each field: * 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 redirected to a page where you can manage the identity. ![identities page](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/identities/identities-page.png) Since the identity has been configured with Universal Auth by default, you should re-configure it to use OIDC Auth instead. To do this, press to edit the **Authentication** section, remove the existing Universal Auth configuration, and add a new OIDC Auth configuration onto the identity. ![identities page remove default auth](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/identities/identities-page-remove-default-auth.png) ![identities create oidc auth method](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/identities/identities-org-create-oidc-auth-method.png) Restrict access by configuring the Subject, Audiences, and Claims fields Here's some more guidance on each field: * OIDC Discovery URL: The URL used to retrieve the OpenID Connect configuration from the identity provider. This will be used to fetch the public key needed for verifying the provided JWT. This should be set to `https://oidc.circleci.com/org/` where `organization_id` refers to the CircleCI organization where the job is being run. * Issuer: The unique identifier of the identity provider issuing the JWT. This value is used to verify the iss (issuer) claim in the JWT to ensure the token is issued by a trusted provider. This should be set to `https://oidc.circleci.com/org/` as well. * CA Certificate: The PEM-encoded CA cert for establishing secure communication with the Identity Provider endpoints. This can be left as blank. * Subject: The expected principal that is the subject of the JWT. The format of the sub field for CircleCI OIDC tokens is `org//project//user/` where organization\_id, project\_id, and user\_id are UUIDs that identify the CircleCI organization, project, and user, respectively. The user is the CircleCI user that caused this job to run. * Audiences: A list of intended recipients. This value is checked against the aud (audience) claim in the token. Set this to the CircleCI `organization_id` corresponding to where the job is running. * Claims: Additional information or attributes that should be present in the JWT for it to be valid. Refer to CircleCI's [documentation](https://circleci.com/docs/openid-connect-tokens) for the complete list of supported claims. * 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. * Access Token Trusted IPs: The IPs or CIDR ranges that access tokens can be used from. By default, each token is given the `0.0.0.0/0`, allowing usage from any network address. For more details on the appropriate values for the OIDC fields, refer to CircleCI's [documentation](https://circleci.com/docs/openid-connect-tokens). The `subject`, `audiences`, and `claims` fields support glob pattern matching; however, we highly recommend using hardcoded values whenever possible. To enable the identity to access project-level resources such as secrets within a specific project, you should add it to that project. To do this, head over to the project you want to add the identity to and go to Project Settings > Access Control > Machine Identities and press **Add identity**. Next, select the identity you want to add to the project and the project level role you want to allow it to assume. The project role assigned will determine what project level resources this identity can have access to. ![identities project](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/identities/identities-project.png) ![identities project create](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/identities/identities-project-create.png) The following is an example of how to use the `$CIRCLE_OIDC_TOKEN` with the Infisical [terraform provider](https://registry.terraform.io/providers/Infisical/infisical/latest/docs) to manage resources in a CircleCI pipeline. ```yml config.yml version: 2.1 jobs: terraform-apply: docker: - image: hashicorp/terraform:latest steps: - checkout - run: command: | export INFISICAL_AUTH_JWT="$CIRCLE_OIDC_TOKEN" terraform init terraform apply -auto-approve workflows: version: 2 build-and-test: jobs: - terraform-apply ``` The Infisical terraform provider expects the `INFISICAL_AUTH_JWT` environment variable to be set to the CircleCI OIDC token. ```hcl main.tf terraform { required_providers { infisical = { source = "infisical/infisical" } } } provider "infisical" { host = "https://app.infisical.com" auth = { oidc = { identity_id = "f2f5ee4c-6223-461a-87c3-406a6b481462" } } } resource "infisical_access_approval_policy" "prod-access-approval" { project_id = "09eda1f8-85a3-47a9-8a6f-e27f133b2a36" name = "my-approval-policy" environment_slug = "prod" secret_path = "/" approvers = [ { type = "user" username = "sheen+200@infisical.com" }, ] required_approvals = 1 enforcement_level = "soft" } ``` Each identity access token has a time-to-live (TLL) which you can infer from the response of the login operation; the default TTL is `7200` seconds which can be adjusted. If an identity access token expires, it can no longer authenticate with the Infisical API. In this case, a new access token should be obtained by performing another login operation. # General Learn how to authenticate with Infisical from any platform or environment using OpenID Connect (OIDC). **OIDC Auth** is a platform-agnostic JWT-based authentication method that can be used to authenticate from any platform or environment using an identity provider with OpenID Connect. ## Diagram The following sequence diagram illustrates the OIDC Auth workflow for authenticating clients with Infisical. ```mermaid sequenceDiagram participant Client as Client participant Idp as Identity Provider participant Infis as Infisical Client->>Idp: Step 1: Request identity token Idp-->>Client: Return JWT with verifiable claims Note over Client,Infis: Step 2: Login Operation Client->>Infis: Send signed JWT to /api/v1/auth/oidc-auth/login Note over Infis,Idp: Step 3: Query verification Infis->>Idp: Request JWT public key using OIDC Discovery Idp-->>Infis: Return public key Note over Infis: Step 4: JWT validation Infis->>Client: Return short-lived access token Note over Client,Infis: Step 5: Access Infisical API with Token Client->>Infis: Make authenticated requests using the short-lived access token ``` ## Concept At a high-level, Infisical authenticates a client by verifying the JWT and checking that it meets specific requirements (e.g. it is issued by a trusted identity provider) at the `/api/v1/auth/oidc-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. To be more specific: 1. The client requests an identity token from its identity provider. 2. The client sends the identity token to Infisical at the `/api/v1/auth/oidc-auth/login` endpoint. 3. Infisical fetches the public key that was used to sign the identity token from the identity provider using OIDC Discovery. 4. Infisical validates the JWT using the public key provided by the identity provider and checks that the subject, audience, and claims of the token matches with the set criteria. 5. If all is well, Infisical returns a short-lived access token that the client can use to make authenticated requests to the Infisical API. Infisical needs network-level access to the identity provider configuration endpoints. ## Guide In the following steps, we explore how to create and use identities to access the Infisical API using the OIDC Auth authentication method. To create an identity, head to your Organization Settings > Access Control > Machine Identities and press **Create identity**. ![identities organization](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/identities/identities-org.png) When creating an identity, you specify an organization level [role](/documentation/platform/role-based-access-controls) for it to assume; you can configure roles in Organization Settings > Access Control > Organization Roles. ![identities organization create](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/identities/identities-org-create.png) Now input a few details for your new identity. Here's some guidance for each field: * 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 redirected to a page where you can manage the identity. ![identities page](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/identities/identities-page.png) Since the identity has been configured with Universal Auth by default, you should re-configure it to use OIDC Auth instead. To do this, press to edit the **Authentication** section, remove the existing Universal Auth configuration, and add a new OIDC Auth configuration onto the identity. ![identities page remove default auth](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/identities/identities-page-remove-default-auth.png) ![identities create oidc auth method](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/identities/identities-org-create-oidc-auth-method.png) Restrict access by configuring the Subject, Audiences, and Claims fields Here's some more guidance on each field: * OIDC Discovery URL: The URL used to retrieve the OpenID Connect configuration from the identity provider. This will be used to fetch the public key needed for verifying the provided JWT. * Issuer: The unique identifier of the identity provider issuing the JWT. This value is used to verify the iss (issuer) claim in the JWT to ensure the token is issued by a trusted provider. * CA Certificate: The PEM-encoded CA cert for establishing secure communication with the Identity Provider endpoints. * Subject: The expected principal that is the subject of the JWT. The `sub` (subject) claim in the JWT should match this value. * Audiences: A list of intended recipients. This value is checked against the aud (audience) claim in the token. The token's aud claim should match at least one of the audiences for it to be valid. * Claims: Additional information or attributes that should be present in the JWT for it to be valid. * 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. * Access Token Trusted IPs: The IPs or CIDR ranges that access tokens can be used from. By default, each token is given the `0.0.0.0/0`, allowing usage from any network address. The `subject`, `audiences`, and `claims` fields support glob pattern matching; however, we highly recommend using hardcoded values whenever possible. To enable the identity to access project-level resources such as secrets within a specific project, you should add it to that project. To do this, head over to the project you want to add the identity to and go to Project Settings > Access Control > Machine Identities and press **Add identity**. Next, select the identity you want to add to the project and the project level role you want to allow it to assume. The project role assigned will determine what project level resources this identity can have access to. ![identities project](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/identities/identities-project.png) ![identities project create](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/identities/identities-project-create.png) To access the Infisical API as the identity, you need to fetch an identity token from an identity provider and make a request to the `/api/v1/auth/oidc-auth/login` endpoint in exchange for an access token. We provide an example below of how authentication is done with Infisical using OIDC. It is a snippet from the [official Github secrets action](https://github.com/Infisical/secrets-action). #### Sample usage ```javascript export const oidcLogin = async ({ identityId, domain, oidcAudience }) => { const idToken = await core.getIDToken(oidcAudience); const loginData = querystring.stringify({ identityId, jwt: idToken, }); try { const response = await axios({ method: "post", url: `${domain}/api/v1/auth/oidc-auth/login`, headers: { "Content-Type": "application/x-www-form-urlencoded", }, data: loginData, }); return response.data.accessToken; } catch (err) { core.error("Error:", err.message); throw err; } }; ``` #### Sample OIDC login response ```bash Response { "accessToken": "...", "expiresIn": 7200, "accessTokenMaxTTL": 43244 "tokenType": "Bearer" } ``` We recommend using one of Infisical's clients like SDKs or the Infisical Agent to authenticate with Infisical using OIDC Auth as they handle the authentication process including the fetching of identity tokens for you. Each identity access token has a time-to-live (TLL) which you can infer from the response of the login operation; the default TTL is `7200` seconds which can be adjusted. If an identity access token expires, it can no longer authenticate with the Infisical API. In this case, a new access token should be obtained by performing another login operation. # Github Learn how to authenticate Github workflows with Infisical using OpenID Connect (OIDC). **OIDC Auth** is a platform-agnostic JWT-based authentication method that can be used to authenticate from any platform or environment using an identity provider with OpenID Connect. ## Diagram The following sequence diagram illustrates the OIDC Auth workflow for authenticating Github workflows with Infisical. ```mermaid sequenceDiagram participant Client as Github Workflow participant Idp as Identity Provider participant Infis as Infisical Client->>Idp: Step 1: Request identity token Idp-->>Client: Return JWT with verifiable claims Note over Client,Infis: Step 2: Login Operation Client->>Infis: Send signed JWT to /api/v1/auth/oidc-auth/login Note over Infis,Idp: Step 3: Query verification Infis->>Idp: Request JWT public key using OIDC Discovery Idp-->>Infis: Return public key Note over Infis: Step 4: JWT validation Infis->>Client: Return short-lived access token Note over Client,Infis: Step 5: Access Infisical API with Token Client->>Infis: Make authenticated requests using the short-lived access token ``` ## Concept At a high-level, Infisical authenticates a client by verifying the JWT and checking that it meets specific requirements (e.g. it is issued by a trusted identity provider) at the `/api/v1/auth/oidc-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. To be more specific: 1. The Github workflow requests an identity token from Github's identity provider. 2. The fetched identity token is sent to Infisical at the `/api/v1/auth/oidc-auth/login` endpoint. 3. Infisical fetches the public key that was used to sign the identity token from Github's identity provider using OIDC Discovery. 4. Infisical validates the JWT using the public key provided by the identity provider and checks that the subject, audience, and claims of the token matches with the set criteria. 5. If all is well, Infisical returns a short-lived access token that the Github workflow can use to make authenticated requests to the Infisical API. Infisical needs network-level access to Github's identity provider endpoints. ## Guide In the following steps, we explore how to create and use identities to access the Infisical API using the OIDC Auth authentication method. To create an identity, head to your Organization Settings > Access Control > Machine Identities and press **Create identity**. ![identities organization](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/identities/identities-org.png) When creating an identity, you specify an organization level [role](/documentation/platform/role-based-access-controls) for it to assume; you can configure roles in Organization Settings > Access Control > Organization Roles. ![identities organization create](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/identities/identities-org-create.png) Now input a few details for your new identity. Here's some guidance for each field: * 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 redirected to a page where you can manage the identity. ![identities page](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/identities/identities-page.png) Since the identity has been configured with Universal Auth by default, you should re-configure it to use OIDC Auth instead. To do this, press to edit the **Authentication** section, remove the existing Universal Auth configuration, and add a new OIDC Auth configuration onto the identity. ![identities page remove default auth](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/identities/identities-page-remove-default-auth.png) ![identities create oidc auth method](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/identities/identities-org-create-oidc-auth-method.png) Restrict access by configuring the Subject, Audiences, and Claims fields Here's some more guidance on each field: * OIDC Discovery URL: The URL used to retrieve the OpenID Connect configuration from the identity provider. This will be used to fetch the public key needed for verifying the provided JWT. This should be set to `https://token.actions.githubusercontent.com` * Issuer: The unique identifier of the identity provider issuing the JWT. This value is used to verify the iss (issuer) claim in the JWT to ensure the token is issued by a trusted provider. This should be set to `https://token.actions.githubusercontent.com` * CA Certificate: The PEM-encoded CA cert for establishing secure communication with the Identity Provider endpoints. For Github workflows, this can be left as blank. * Subject: The expected principal that is the subject of the JWT. The format of the sub field for GitHub workflow OIDC tokens is as follows: `"repo:/:"`. The environment can be where the GitHub workflow is running, such as `environment`, `ref`, or `job_workflow_ref`. For example, if you have a repository owned by octocat named example-repo, and the GitHub workflow is running on the main branch, the subject field might look like this: `repo:octocat/example-repo:ref:refs/heads/main` * Audiences: A list of intended recipients. This value is checked against the aud (audience) claim in the token. By default, set this to the URL of the repository owner, such as the organization that owns the repository (e.g. `https://github.com/octo-org`). * Claims: Additional information or attributes that should be present in the JWT for it to be valid. You can refer to Github's [documentation](https://docs.github.com/en/actions/deployment/security-hardening-your-deployments/about-security-hardening-with-openid-connect#understanding-the-oidc-token) for the complete list of supported claims. * 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. * Access Token Trusted IPs: The IPs or CIDR ranges that access tokens can be used from. By default, each token is given the `0.0.0.0/0`, allowing usage from any network address. If you are unsure about what to configure for the subject, audience, and claims fields you can use [github/actions-oidc-debugger](https://github.com/github/actions-oidc-debugger) to get the appropriate values. Alternatively, you can fetch the JWT from the workflow and inspect the fields manually. The `subject`, `audiences`, and `claims` fields support glob pattern matching; however, we highly recommend using hardcoded values whenever possible. To enable the identity to access project-level resources such as secrets within a specific project, you should add it to that project. To do this, head over to the project you want to add the identity to and go to Project Settings > Access Control > Machine Identities and press **Add identity**. Next, select the identity you want to add to the project and the project level role you want to allow it to assume. The project role assigned will determine what project level resources this identity can have access to. ![identities project](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/identities/identities-project.png) ![identities project create](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/identities/identities-project-create.png) As a prerequisite, you will need to set `id-token:write` permissions for the Github workflow. This setting allows the JWT to be requested from Github's OIDC provider. ```yaml permissions: id-token: write # This is required for requesting the JWT ... ``` To access the Infisical API as the identity, you need to fetch an identity token from Github's identity provider and make a request to the `/api/v1/auth/oidc-auth/login` endpoint in exchange for an access token. The identity token can be fetched using either of the following approaches: * Using environment variables on the runner (`ACTIONS_ID_TOKEN_REQUEST_URL` and `ACTIONS_ID_TOKEN_REQUEST_TOKEN`). ```yaml steps: - name: Request OIDC Token run: | echo "Requesting OIDC token..." TOKEN=$(curl -s -H "Authorization: Bearer $ACTIONS_ID_TOKEN_REQUEST_TOKEN" "$ACTIONS_ID_TOKEN_REQUEST_URL" | jq -r '.value') echo "TOKEN=$TOKEN" >> $GITHUB_ENV ``` * Using `getIDToken()` from the Github Actions toolkit. Below is an example of how a Github workflow can be configured to fetch secrets from Infisical using the [Infisical Secrets Action](https://github.com/Infisical/secrets-action) with OIDC Auth. ```yaml name: Manual workflow on: workflow_dispatch: permissions: id-token: write # This is required for requesting the JWT jobs: build: runs-on: ubuntu-latest steps: - uses: Infisical/secrets-action@v1.0.7 with: method: "oidc" env-slug: "dev" project-slug: "ggggg-9-des" identity-id: "6b579c00-5c85-4b44-aabe-f8a ... ``` Preceding steps can then use the secret values injected onto the workflow's environment. We recommend using [Infisical Secrets Action](https://github.com/Infisical/secrets-action) to authenticate with Infisical using OIDC Auth as it handles the authentication process including the fetching of identity tokens for you. Each identity access token has a time-to-live (TLL) which you can infer from the response of the login operation; the default TTL is `7200` seconds which can be adjusted. If an identity access token expires, it can no longer authenticate with the Infisical API. In this case, a new access token should be obtained by performing another login operation. # GitLab Learn how to authenticate GitLab pipelines with Infisical using OpenID Connect (OIDC). **OIDC Auth** is a platform-agnostic JWT-based authentication method that can be used to authenticate from any platform or environment using an identity provider with OpenID Connect. ## Diagram The following sequence diagram illustrates the OIDC Auth workflow for authenticating GitLab pipelines with Infisical. ```mermaid sequenceDiagram participant Client as GitLab Pipeline participant Idp as GitLab Identity Provider participant Infis as Infisical Client->>Idp: Step 1: Request identity token Idp-->>Client: Return JWT with verifiable claims Note over Client,Infis: Step 2: Login Operation Client->>Infis: Send signed JWT to /api/v1/auth/oidc-auth/login Note over Infis,Idp: Step 3: Query verification Infis->>Idp: Request JWT public key using OIDC Discovery Idp-->>Infis: Return public key Note over Infis: Step 4: JWT validation Infis->>Client: Return short-lived access token Note over Client,Infis: Step 5: Access Infisical API with Token Client->>Infis: Make authenticated requests using the short-lived access token ``` ## Concept At a high-level, Infisical authenticates a client by verifying the JWT and checking that it meets specific requirements (e.g. it is issued by a trusted identity provider) at the `/api/v1/auth/oidc-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. To be more specific: 1. The GitLab pipeline requests an identity token from GitLab's identity provider. 2. The fetched identity token is sent to Infisical at the `/api/v1/auth/oidc-auth/login` endpoint. 3. Infisical fetches the public key that was used to sign the identity token from GitLab's identity provider using OIDC Discovery. 4. Infisical validates the JWT using the public key provided by the identity provider and checks that the subject, audience, and claims of the token matches with the set criteria. 5. If all is well, Infisical returns a short-lived access token that the GitLab pipeline can use to make authenticated requests to the Infisical API. Infisical needs network-level access to GitLab's identity provider endpoints. ## Guide In the following steps, we explore how to create and use identities to access the Infisical API using the OIDC Auth authentication method. To create an identity, head to your Organization Settings > Access Control > Machine Identities and press **Create identity**. ![identities organization](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/identities/identities-org.png) When creating an identity, you specify an organization level [role](/documentation/platform/role-based-access-controls) for it to assume; you can configure roles in Organization Settings > Access Control > Organization Roles. ![identities organization create](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/identities/identities-org-create.png) Now input a few details for your new identity. Here's some guidance for each field: * 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 redirected to a page where you can manage the identity. ![identities page](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/identities/identities-page.png) Since the identity has been configured with Universal Auth by default, you should re-configure it to use OIDC Auth instead. To do this, press to edit the **Authentication** section, remove the existing Universal Auth configuration, and add a new OIDC Auth configuration onto the identity. ![identities page remove default auth](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/identities/identities-page-remove-default-auth.png) ![identities create oidc auth method](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/identities/identities-org-create-oidc-auth-method.png) Restrict access by configuring the Subject, Audiences, and Claims fields Here's some more guidance on each field: * OIDC Discovery URL: The URL used to retrieve the OpenID Connect configuration from the identity provider. This will be used to fetch the public key needed for verifying the provided JWT. For GitLab SaaS (GitLab.com), this should be set to `https://gitlab.com`. For self-hosted GitLab instances, use the domain of your GitLab instance. * Issuer: The unique identifier of the identity provider issuing the JWT. This value is used to verify the iss (issuer) claim in the JWT to ensure the token is issued by a trusted provider. This should also be set to the domain of the Gitlab instance. * CA Certificate: The PEM-encoded CA cert for establishing secure communication with the Identity Provider endpoints. For GitLab.com, this can be left blank. * Subject: The expected principal that is the subject of the JWT. For GitLab pipelines, this should be set to a string that uniquely identifies the pipeline and its context, in the format `project_path:{group}/{project}:ref_type:{type}:ref:{branch_name}` (e.g., `project_path:example-group/example-project:ref_type:branch:ref:main`). * Claims: Additional information or attributes that should be present in the JWT for it to be valid. You can refer to GitLab's [documentation](https://docs.gitlab.com/ee/ci/secrets/id_token_authentication.html#token-payload) for the list of supported claims. * 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. * Access Token Trusted IPs: The IPs or CIDR ranges that access tokens can be used from. By default, each token is given the `0.0.0.0/0`, allowing usage from any network address. For more details on the appropriate values for the OIDC fields, refer to GitLab's [documentation](https://docs.gitlab.com/ee/ci/secrets/id_token_authentication.html#token-payload). The `subject`, `audiences`, and `claims` fields support glob pattern matching; however, we highly recommend using hardcoded values whenever possible. To enable the identity to access project-level resources such as secrets within a specific project, you should add it to that project. To do this, head over to the project you want to add the identity to and go to Project Settings > Access Control > Machine Identities and press **Add identity**. Next, select the identity you want to add to the project and the project level role you want to allow it to assume. The project role assigned will determine what project level resources this identity can have access to. ![identities project](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/identities/identities-project.png) ![identities project create](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/identities/identities-project-create.png) As demonstration, we will be using the Infisical CLI to fetch Infisical secrets and utilize them within a GitLab pipeline. To access Infisical secrets as the identity, you need to use an identity token from GitLab which matches the OIDC configuration defined for the machine identity. This can be done by defining the `id_tokens` property. The resulting token would then be used to login with OIDC like the following: `infisical login --method=oidc-auth --oidc-jwt=$GITLAB_TOKEN` Below is a complete example of how a GitLab pipeline can be configured to work with secrets from Infisical using the Infisical CLI with OIDC Auth: ```yaml image: ubuntu stages: - build build-job: stage: build id_tokens: INFISICAL_ID_TOKEN: aud: infisical-aud-test script: - apt update && apt install -y curl - curl -1sLf 'https://dl.cloudsmith.io/public/infisical/infisical-cli/setup.deb.sh' | bash - apt-get update && apt-get install -y infisical - export INFISICAL_TOKEN=$(infisical login --method=oidc-auth --machine-identity-id=4e807a78-1b1c-4bd6-9609-ef2b0cf4fd54 --oidc-jwt=$INFISICAL_ID_TOKEN --silent --plain) - infisical run --projectId=1d0443c1-cd43-4b3a-91a3-9d5f81254a89 --env=dev -- npm run build ``` The `id_tokens` keyword is used to request an ID token for the job. In this example, an ID token named `INFISICAL_ID_TOKEN` is requested with the audience (`aud`) claim set to "infisical-aud-test". This ID token will be used to authenticate with Infisical. Each identity access token has a time-to-live (TTL) which you can infer from the response of the login operation; the default TTL is `7200` seconds, which can be adjusted. If an identity access token expires, it can no longer authenticate with the Infisical API. In this case, a new access token should be obtained by performing another login operation. # User and Machine Identities Learn more about identities to interact with resources in Infisical. To interact with secrets and resource with Infisical, it is important to understand the concept of identities. Identities can be of two types: * **People** (e.g., developers, platform engineers, administrators) * **Machines** (e.g., machine entities for managing secrets in CI/CD pipelines, production applications, and more) Both people and machines are able to utilize corresponding clients (e.g., Dashboard UI, CLI, SDKs, API, Kubernetes Operator) together with allowed authentication methods (e.g., email & password, SAML SSO, LDAP, OIDC, Universal Auth). Learn more about the concept on user identities in Infisical. Understand the concept of machine identities in Infisical. # Token Auth Learn how to authenticate to Infisical from any platform or environment using an access token. **Token Auth** is a platform-agnostic, simple authentication method that can be configured for a [machine identity](/documentation/platform/identities/machine-identities) to authenticate from any platform/environment using a token. ## Diagram The following sequence diagram illustrates the Token Auth workflow for authenticating clients with Infisical. ```mermaid sequenceDiagram participant Client as Client participant Infis as Infisical Note over Client,Infis: Access Infisical API with Token Client->>Infis: Make authenticated requests using the token ``` ## Concept Token Auth is the simplest authentication method that a client can use to authenticate with Infisical. Unlike other authentication methods where a client must exchange credential(s) for a short-lived access token to access the Infisical API, Token Auth allows a client to make authenticated requests to the Infisical API directly using a token. Conceptually, this is similar to using an API Key. To be more specific: 1. An operator creates an access token in the Infisical UI. 2. The operator shares the access token with the client which it can then use to make authenticated requests to the Infisical API. ## Guide In the following steps, we explore how to create and use identities for your workloads and applications to access the Infisical API using the Token Auth authentication method. To create an identity, head to your Organization Settings > Access Control > Machine Identities and press **Create identity**. ![identities organization](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/identities/identities-org.png) When creating an identity, you specify an organization level [role](/documentation/platform/role-based-access-controls) for it to assume; you can configure roles in Organization Settings > Access Control > Organization Roles. ![identities organization create](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/identities/identities-org-create.png) Now input a few details for your new identity. Here's some guidance for each field: * 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 redirected to a page where you can manage the identity. ![identities page](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/identities/identities-page.png) Since the identity has been configured with Universal Auth by default, you should re-configure it to use Token Auth instead. To do this, press to edit the **Authentication** section, remove the existing Universal Auth configuration, and add a new Token Auth configuration onto the identity. ![identities page remove default auth](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/identities/identities-page-remove-default-auth.png) ![identities organization create token auth method](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/identities/identities-org-create-token-auth-method.png) Here's some more guidance on each field: * 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. * Access Token Trusted IPs: The IPs or CIDR ranges that access tokens can be used from. By default, each token is given the `0.0.0.0/0`, allowing usage from any network address. Restricting access token usage to specific trusted IPs is a paid feature. If you’re using Infisical Cloud, then it is available under the Pro Tier. If you’re self-hosting Infisical, then you should contact [sales@infisical.com](mailto:sales@infisical.com) to purchase an enterprise license to use it. In order to use the identity with Token Auth, you'll need to create an (access) token; you can think of this token akin to an API Key used to authenticate with the Infisical API. With that, press **Create Token**. ![identities client secret create](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/identities/identities-token-auth-create-1.png) ![identities client secret create](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/identities/identities-token-auth-create-2.png) ![identities client secret create](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/identities/identities-token-auth-create-3.png) Copy the token and keep it handy as you'll need it to authenticate with the Infisical API. To enable the identity to access project-level resources such as secrets within a specific project, you should add it to that project. To do this, head over to the project you want to add the identity to and go to Project Settings > Access Control > Machine Identities and press **Add identity**. Next, select the identity you want to add to the project and the project level role you want to allow it to assume. The project role assigned will determine what project level resources this identity can have access to. ![identities project](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/identities/identities-project.png) ![identities project create](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/identities/identities-project-create.png) To access the Infisical API as the identity, you can use the generated access token from step 2 to authenticate with the [Infisical API](/api-reference/overview/introduction). Each identity access token has a time-to-live (TLL) which you can infer from the response of the login operation; the default TTL is `7200` seconds which can be adjusted in the Token Auth configuration. If an identity access token expires, it can no longer authenticate with the Infisical API. In this case, a new access token should be obtained. **FAQ** There are a few reasons for why this might happen: * The access token has expired. If this is the case, you should obtain a new access token or consider extending the token's TTL. * The identity is insufficently permissioned to interact with the resources you wish to access. * The access token is being used from an untrusted IP. 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. A token can be renewed any number of times where each call to renew it can extend the token's lifetime by increments of the access token's TTL. Regardless of how frequently an access token is renewed, its lifespan remains bound to the maximum TTL determined at its creation. # Universal Auth Learn how to authenticate to Infisical from any platform or environment. **Universal Auth** is a platform-agnostic authentication method that can be configured for a [machine identity](/documentation/platform/identities/machine-identities) to authenticate from any platform/environment using a Client ID and Client Secret. ## Diagram The following sequence diagram illustrates the Universal Auth workflow for authenticating clients with Infisical. ```mermaid sequenceDiagram participant Client as Client participant Infis as Infisical Note over Client,Infis: Step 1: Login Operation Client->>Infis: Send Client ID and Client Secret Note over Infis: Step 2: Client ID and Client Secret validation Infis->>Client: Return short-lived access token Note over Client,Infis: Step 3: Access Infisical API with Token Client->>Infis: Make authenticated requests using the short-lived access token ``` ## Concept In this method, Infisical authenticates a client by verifying the credentials issued for it at the `/api/v1/auth/universal-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. To be more specific: 1. The client submits a **Client ID** and **Client Secret** to Infisical at the `/api/v1/auth/universal-auth/login` endpoint. 2. Infisical verifies the credential pair. 3. If all is well, Infisical returns a short-lived access token that the client can use to make authenticated requests to the Infisical API. ## Guide In the following steps, we explore how to create and use identities for your workloads and applications to access the Infisical API using the Universal Auth authentication method. To create an identity, head to your Organization Settings > Access Control > Machine Identities and press **Create identity**. ![identities organization](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/identities/identities-org.png) When creating an identity, you specify an organization level [role](/documentation/platform/role-based-access-controls) for it to assume; you can configure roles in Organization Settings > Access Control > Organization Roles. ![identities organization create](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/identities/identities-org-create.png) Now input a few details for your new identity. Here's some guidance for each field: * 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 redirected to a page where you can manage the identity. ![identities page](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/identities/identities-page.png) Once you've created an identity, you'll be prompted to configure the **Universal Auth** authentication method for it. By default, the identity has been configured with Universal Auth. If you wish, you can edit the Universal Auth configuration details by pressing to edit the **Authentication** section. ![identities organization create universal auth method](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/identities/identities-org-create-universal-auth-method.png) Here's some more guidance on each field: * 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. * Client Secret Trusted IPs: The IPs or CIDR ranges that the **Client Secret** can be used from together with the **Client ID** to get back an access token. By default, **Client Secrets** are given the `0.0.0.0/0`, allowing usage from any network address. * Access Token Trusted IPs: The IPs or CIDR ranges that access tokens can be used from. By default, each token is given the `0.0.0.0/0`, allowing usage from any network address. Restricting **Client Secret** and access token usage to specific trusted IPs is a paid feature. If you’re using Infisical Cloud, then it is available under the Pro Tier. If you’re self-hosting Infisical, then you should contact [sales@infisical.com](mailto:sales@infisical.com) to purchase an enterprise license to use it. In order to use the identity, you'll need the non-sensitive **Client ID** of the identity and a **Client Secret** for it; you can think of these credentials akin to a username and password used to authenticate with the Infisical API. With that, press **Create Client Secret**. ![identities client secret create](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/identities/identities-universal-auth-create-1.png) ![identities client secret create](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/identities/identities-universal-auth-create-2.png) ![identities client secret create](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/identities/identities-universal-auth-create-3.png) Feel free to input any (optional) details for the **Client Secret** configuration: * Description: A description for the **Client Secret**. * TTL (default is `0`): The time-to-live for the **Client Secret**. By default, the TTL will be set to 0 which implies that the **Client Secret** will never expire; a value of `0` implies an infinite lifetime. * Max Number of Uses (default is `0`): The maximum number of times that the **Client Secret** can be used together with the **Client ID** to get back an access token; a value of `0` implies infinite number of uses. To enable the identity to access project-level resources such as secrets within a specific project, you should add it to that project. To do this, head over to the project you want to add the identity to and go to Project Settings > Access Control > Machine Identities and press **Add identity**. Next, select the identity you want to add to the project and the project level role you want to allow it to assume. The project role assigned will determine what project level resources this identity can have access to. ![identities project](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/identities/identities-project.png) ![identities project create](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/identities/identities-project-create.png) To access the Infisical API as the identity, you should first perform a login operation that is to exchange the **Client ID** and **Client Secret** of the identity for an access token by making a request to the `/api/v1/auth/universal-auth/login` endpoint. #### Sample request ```bash Request curl --location --request POST 'https://app.infisical.com/api/v1/auth/universal-auth/login' \ --header 'Content-Type: application/x-www-form-urlencoded' \ --data-urlencode 'clientId=...' \ --data-urlencode 'clientSecret=...' ``` #### Sample response ```bash Response { "accessToken": "...", "expiresIn": 7200, "accessTokenMaxTTL": 43244 "tokenType": "Bearer" } ``` Next, you can use the access token to authenticate with the [Infisical API](/api-reference/overview/introduction) Each identity access token has a time-to-live (TLL) which you can infer from the response of the login operation; the default TTL is `7200` seconds which can be adjusted in the Universal Auth configuration. If an identity access token expires, it can no longer authenticate with the Infisical API. In this case, a new access token should be obtained by performing another login operation. **FAQ** There are a few reasons for why this might happen: * The client secret or access token has expired. * The identity is insufficently permissioned to interact with the resources you wish to access. * The client secret/access token is being used from an untrusted IP. 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. A token can be renewed any number of times where each call to renew it can extend the token's lifetime by increments of the access token's TTL. Regardless of how frequently an access token is renewed, its lifespan remains bound to the maximum TTL determined at its creation. # User Identities Read more about the concept of user identities in Infisical. ## Concept A **user identity** (also known as **user**) represents a developer, admin, or any other human entity interacting with resources in Infisical. Users can be added manually (through Web UI) or programmatically (e.g., API) to [organizations](../organization) and [projects](../projects). Upon being added to an organization and projects, users assume a certain set of roles and permissions that represents their identity. ![organization members](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/organization/organization-members.png) ## Authentication methods To interact with various resources in Infisical, users are able to utilize a number of authentication methods: * **Email & Password**: the most common authentication method that is used for authentication into Web Dashboard and Infisical CLI. It is recommended to utilize [Multi-factor Authentication](/documentation/platform/mfa) in addition to it. * **SSO**: Infisical natively integrates with a number of SSO identity providers like [Google](/documentation/platform/sso/google), [GitHub](/documentation/platform/sso/github), and [GitLab](/documentation/platform/sso/gitlab). * **SAML SSO**: It is also possible to set up SAML SSO integration with identity providers like [Okta](/documentation/platform/sso/okta), [Microsoft Entra ID](/documentation/platform/sso/azure) (formerly known as Azure AD), [JumpCloud](/documentation/platform/sso/jumpcloud), [Google](/documentation/platform/sso/google-saml), and more. * **LDAP**: For organizations with more advanced needs, Infisical also provides user authentication with [LDAP](/documentation/platform/ldap/overview) that includes a number of LDAP providers. # AWS CloudHSM Learn how to manage encryption using AWS CloudHSM This guide provides instructions on securing Infisical project secrets using AWS CloudHSM. Integration with AWS CloudHSM is achieved by configuring it as a custom key store for AWS KMS. Follow the steps below to set up AWS KMS with AWS CloudHSM as the custom key store. ## Prepare AWS CloudHSM Cluster Before you get started, you'll need to configure a AWS CloudHSM cluster which meets the following criteria: * The cluster must be active. * The cluster must not be associated with any other AWS KMS custom key store. * The cluster must be configured with private subnets in at least two Availability Zones in the Region. * The security group for the cluster must include inbound and outbound rules that allow TCP traffic on ports 2223-2225. * The cluster must contain at least two active HSMs in different Availability Zones. For more details on setting up your cluster, refer to the following [AWS documentation](https://docs.aws.amazon.com/kms/latest/developerguide/create-keystore.html#before-keystore). ## Set Up AWS KMS Custom Key Store To set up an AWS KMS custom key store with AWS CloudHSM, you will need the following: * The trust anchor certificate of your AWS CloudHSM cluster. * A `kmsuser` user in the AWS CloudHSM cluster with the crypto-user role. In the AWS console, head over to `AWS KMS` > `AWS CloudHSM key stores` and click **Create key store**. Input the custom key store name. ![Set key store name](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/kms/aws-hsm/create-key-store-name.png) Select the AWS CloudHSM cluster. You should be able to select the cluster if it meets the required criteria mentioned above. ![Set key store cluster](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/kms/aws-hsm/create-key-store-cluster.png) Upload your CloudHSM's cluster trust anchor certificate file. ![Set key store cert](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/kms/aws-hsm/create-key-store-cert.png) Input the password of the `kmsuser` crypto-user in your cluster. ![Set key store password](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/kms/aws-hsm/create-key-store-password.png) Proceed with creating the AWS CloudHSM key store. For more details, refer to the following [AWS documentation](https://docs.aws.amazon.com/kms/latest/developerguide/create-keystore.html#create-keystore-console). ## Create AWS KMS Key Next, you'll need to create a AWS KMS key where you will set the key store you created previously. In your AWS console, proceed to `AWS KMS` > `Customer managed keys` and click **Create**. Set Key type to `Symmetric` and Key usage to `Encrypt and decrypt`. ![Set key options 1](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/kms/aws-hsm/create-kms-key-1.png) In the advanced options, for the Key material origin field, select `AWS CloudHSM key store`. Then, click next. ![Set key options 2](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/kms/aws-hsm/create-kms-key-2.png) Select the AWS CloudHSM key store you created earlier. ![Select HSM 1](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/kms/aws-hsm/create-kms-select-hsm.png) Proceed with creating the AWS KMS Key. ## Connect Infisical to AWS KMS Key You should now have an AWS KMS that has a custom key store set to AWS CloudHSM. To secure project resources, you will need to add this AWS KMS to your Infisical organization. To learn how, refer to the documentation [here](./aws-kms). # AWS Key Management Service Learn how to manage encryption using AWS KMS To enhance the security of your Infisical projects, you can now encrypt your secrets using an external Key Management Service (KMS). When external KMS is configured for your project, all encryption and decryption operations will be handled by the chosen KMS. This guide will walk you through the steps needed to configure external KMS support with AWS KMS. ## Prerequisites Before you begin, you'll first need to choose a method of authentication with AWS from below. 1. Navigate to the [Create IAM Role](https://console.aws.amazon.com/iamv2/home#/roles/create?step=selectEntities) page in your AWS Console. ![IAM Role Creation](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/integrations/aws/integration-aws-iam-assume-role.png) 2. Select **AWS Account** as the **Trusted Entity Type**. 3. Choose **Another AWS Account** and enter **381492033652** (Infisical AWS Account ID). This restricts the role to be assumed only by Infisical. If you are self-hosting, provide the AWS account number where Infisical is hosted. 4. Optionally, enable **Require external ID** and enter your Infisical **project ID** to further enhance security. Use the following custom policy to grant the minimum permissions required by Infisical to integrate with AWS KMS ```json { "Version": "2012-10-17", "Statement": [ { "Sid": "AllowKMSAccess", "Effect": "Allow", "Action": [ "kms:Decrypt", "kms:Encrypt", "kms:DescribeKey" ], "Resource": "*" } ] } ``` Navigate to your IAM user and add a policy to grant the following permissions: ```json { "Version": "2012-10-17", "Statement": [ { "Sid": "AllowKMSAccess", "Effect": "Allow", "Action": [ "kms:Decrypt", "kms:Encrypt", "kms:DescribeKey" ], "Resource": "*" } ] } ``` ## Setup AWS KMS in the Organization Settings Next, you will need to follow the steps listed below to add AWS KMS for your organization. ![Open encryption org settings](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/kms/aws/encryption-org-settings.png) ![Add encryption org settings](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/kms/aws/encryption-org-settings-add.png) Click the 'Add' button to begin adding a new external KMS. ![Select Encryption Provider](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/kms/aws/encryption-modal-provider-select.png) Choose 'AWS KMS' from the list of encryption providers. Selecting AWS as the provider will require you input the following fields. Name for referencing the AWS KMS key within the organization. Short description of the AWS KMS key. Authentication mode for AWS, either "AWS Assume Role" or "Access Key". ARN of the AWS role to assume for providing Infisical access to the AWS KMS Key (required if Authentication Mode is "AWS Assume Role") Custom identifier for additional validation during role assumption. AWS IAM Access Key ID for authentication (required if Authentication Mode is "Access Key"). AWS IAM Secret Access Key for authentication (required if Authentication Mode is "Access Key"). AWS region where the AWS KMS Key is located. Key ID of the AWS KMS Key. If left blank, Infisical will generate and use a new AWS KMS Key in the specified region. ![AWS KMS key ID](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/kms/aws/aws-kms-key-id.png) Save your configuration to apply the settings. You now have an AWS KMS Key configured at the organization level. You can assign these AWS KMS keys to existing Infisical projects by visiting the 'Project Settings' page. ## Assign AWS KMS Key to an Existing Project To assign the AWS KMS key you added to your organization, follow the steps below. ![Open encryption project settings](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/kms/aws/encryption-project-settings.png) ![Select encryption project settings](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/kms/aws/encryption-project-settings-select.png) Choose the AWS KMS key you configured earlier. Once you have selected the KMS of choice, click save. # Key Management Service (KMS) Configuration Learn how to configure your project's encryption ## Introduction Infisical leverages a Key Management Service (KMS) to securely encrypt and decrypt secrets in your projects. ## Overview Infisical's KMS ensures the security of your project's secrets through the following mechanisms: * Each project is assigned a unique workspace key, which is responsible for encrypting and decrypting secret values. * The workspace key itself is encrypted using the project's configured KMS. * When secrets are requested, the workspace key is derived from the configured KMS. This key is then used to decrypt the secret values on-demand before sending them to the requesting client. ## Configuration You can set the KMS for new projects during project creation. ![Configure KMS new](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/kms/configure-kms-new.png) For existing projects, you can configure the KMS from the Project Settings page. ![Configure KMS existing](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/kms/configure-kms-existing.png) ## External KMS Infisical supports the use of external KMS solutions to enhance security and compliance. You can configure your project to use services like [AWS Key Management Service](./aws-kms) for managing encryption. # HSM Integration Learn more about integrating an HSM with Infisical KMS. Changing the encryption strategy for your instance is an Enterprise-only feature. This section is intended for users who have obtained an Enterprise license and are on-premise. Please reach out to [sales@infisical.com](mailto:sales@infisical.com) if you have any questions. ## Overview Infisical KMS currently supports two encryption strategies: 1. **Standard Encryption**: This is the default encryption strategy used by Infisical KMS. It uses a software-protected encryption key to encrypt KMS keys within your Infisical instance. The root encryption key is defined by setting the `ENCRYPTION_KEY` environment variable. 2. **Hardware Security Module (HSM)**: This encryption strategy uses a Hardware Security Module (HSM) to create a root encryption key that is stored on a physical device to encrypt the KMS keys within your instance. ## Hardware Security Module (HSM) ![HSM Illustration](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/kms/hsm/hsm-illustration.png) Using a hardware security module comes with the added benefit of having a secure and tamper-proof device to store your encryption keys. This ensures that your data is protected from unauthorized access. All encryption keys used for cryptographic operations are stored within the HSM. This means that if the HSM is lost or destroyed, you will no longer be able to decrypt your data stored within Infisical. Most providers offer recovery options for HSM devices, which you should consider when setting up an HSM device. Enabling HSM encryption has a set of key benefits: 1. **Root Key Wrapping**: The root KMS encryption key that is used to secure your Infisical instance will be encrypted using the HSM device rather than the standard software-protected key. 2. **FIPS 140-2/3 Compliance**: Using an HSM device ensures that your Infisical instance is FIPS 140-2 or FIPS 140-3 compliant. For FIPS 140-3, ensure that your HSM is FIPS 140-3 validated. #### Caveats * **Performance**: Using an HSM device can have a performance impact on your Infisical instance. This is due to the additional latency introduced by the HSM device. This is however only noticeable when your instance(s) start up or when the encryption strategy is changed. * **Key Recovery**: If the HSM device is lost or destroyed, you will no longer be able to decrypt your data stored within Infisical. Most HSM providers offer recovery options, which you should consider when setting up an HSM device. ### Requirements * An Infisical instance with a version number that is equal to or greater than `v0.91.0`. * If you are using Docker, your instance must be using the `infisical/infisical-fips` image. * An HSM device from a provider such as [Thales Luna HSM](https://cpl.thalesgroup.com/encryption/data-protection-on-demand/services/luna-cloud-hsm), [AWS CloudHSM](https://aws.amazon.com/cloudhsm/), or others. ### FIPS Compliance FIPS, also known as the Federal Information Processing Standard, is a set of standards that are used to accredit cryptographic modules. FIPS 140-2 and FIPS 140-3 are the two most common standards used for cryptographic modules. If your HSM uses FIPS 140-3 validated hardware, Infisical will automatically be FIPS 140-3 compliant. If your HSM uses FIPS 140-2 validated hardware, Infisical will be FIPS 140-2 compliant. HSM devices are especially useful for organizations that operate in regulated industries such as healthcare, finance, and government, where data security and compliance are of the utmost importance. For organizations that work with US government agencies, FIPS compliance is almost always a requirement when dealing with sensitive information. FIPS compliance ensures that the cryptographic modules used by the organization meet the security requirements set by the US government. ## Setup Instructions To set up HSM encryption, you need to configure an HSM provider and HSM key. The HSM provider is used to connect to the HSM device, and the HSM key is used to encrypt Infisical's KMS keys. We recommend using a Cloud HSM provider such as [Thales Luna HSM](https://cpl.thalesgroup.com/encryption/data-protection-on-demand/services/luna-cloud-hsm) or [AWS CloudHSM](https://aws.amazon.com/cloudhsm/). You need to follow the instructions provided by the HSM provider to set up the HSM device. Once the HSM device is set up, the HSM device can be used within Infisical. After setting up the HSM from your provider, you will have a set of files that you can use to access the HSM. These files need to be present on the machine where Infisical is running. If you are using containers, you will need to mount the folder where these files are stored as a volume in the container. The setup process for an HSM device varies depending on the provider. We have created a guide for Thales Luna Cloud HSM, which you can find below. Are you using Docker? If you are using Docker, please follow the instructions in the [Using HSM's with Docker](#using-hsms-with-docker) section. Configuring the HSM on Infisical requires setting a set of environment variables: * `HSM_LIB_PATH`: The path to the PKCS#11 library provided by the HSM provider. This usually comes in the form of a `.so` for Linux and MacOS, or a `.dll` file for Windows. For Docker, you need to mount the library path as a volume. Further instructions can be found below. If you are using Docker, make sure to set the HSM\_LIB\_PATH environment variable to the path where the library is mounted in the container. * `HSM_PIN`: The PKCS#11 PIN to use for authentication with the HSM device. * `HSM_SLOT`: The slot number to use for the HSM device. This is typically between `0` and `5` for most HSM devices. * `HSM_KEY_LABEL`: The label of the key to use for encryption. **Please note that if no key is found with the provided label, the HSM will create a new key with the provided label.** You can read more about the [default instance configurations](/self-hosting/configuration/envars) here. After setting up the HSM, you need to restart the Infisical instance for the changes to take effect. ![Server Admin Console](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/kms/hsm/server-admin-console.png) ![Set Encryption Strategy](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/kms/hsm/encryption-strategy.png) Once you press the 'Save' button, your Infisical instance will immediately switch to the HSM encryption strategy. This will re-encrypt your KMS key with keys from the HSM device. To verify that the HSM was correctly configured, you can try creating a new secret in one of your projects. If the secret is created successfully, the HSM is now being used for encryption. ## Using HSMs with Docker When using Docker, you need to mount the path containing the HSM client files. This section covers how to configure your Infisical instance to use an HSM with Docker. When using Docker, you are able to set your HSM library path to any location on your machine. In this example, we are going to be using `/etc/luna-docker`. ```bash mkdir /etc/luna-docker ``` After [setting up your Luna Cloud HSM client](https://thalesdocs.com/gphsm/luna/7/docs/network/Content/install/client_install/add_dpod.htm), you should have a set of files, referred to as the HSM client. You don't need all the files, but for simplicity we recommend copying all the files from the client. A folder structure of a client folder will often look like this: ``` partition-ca-certificate.pem partition-certificate.pem server-certificate.pem Chrystoki.conf /plugins libcloud.plugin /lock /libs /64 libCryptoki2.so /jsp LunaProvider.jar /64 libLunaAPI.so /etc openssl.cnf /bin /64 ckdemo lunacm multitoken vtl ``` The most important parts of the client folder is the `Chrystoki.conf` file, and the `libs`, `plugins`, and `jsp` folders. You need to copy these files to the folder you created in the first step. ```bash cp -r / /etc/luna-docker ``` The `Chrystoki.conf` file is used to configure the HSM client. You need to update the `Chrystoki.conf` file to point to the correct file paths. In this example, we will be mounting the `/etc/luna-docker` folder to the Docker container under a different path. The path we will use in this example is `/usr/safenet/lunaclient`. This means `/etc/luna-docker` will be mounted to `/usr/safenet/lunaclient` in the Docker container. An example config file will look like this: ```Chrystoki.conf Chrystoki2 = { # This path points to the mounted path, /usr/safenet/lunaclient LibUNIX64 = /usr/safenet/lunaclient/libs/64/libCryptoki2.so; } Luna = { DefaultTimeOut = 500000; PEDTimeout1 = 100000; PEDTimeout2 = 200000; PEDTimeout3 = 20000; KeypairGenTimeOut = 2700000; CloningCommandTimeOut = 300000; CommandTimeOutPedSet = 720000; } CardReader = { LunaG5Slots = 0; RemoteCommand = 1; } Misc = { # Update the paths to point to the mounted path if your folder structure is different from the one mentioned in the previous step. PluginModuleDir = /usr/safenet/lunaclient/plugins; MutexFolder = /usr/safenet/lunaclient/lock; PE1746Enabled = 1; ToolsDir = /usr/bin; } Presentation = { ShowEmptySlots = no; } LunaSA Client = { ReceiveTimeout = 20000; # Update the paths to point to the mounted path if your folder structure is different from the one mentioned in the previous step. SSLConfigFile = /usr/safenet/lunaclient/etc/openssl.cnf; ClientPrivKeyFile = ./etc/ClientNameKey.pem; ClientCertFile = ./etc/ClientNameCert.pem; ServerCAFile = ./etc/CAFile.pem; NetClient = 1; TCPKeepAlive = 1; } REST = { AppLogLevel = error ServerName = ; ServerPort = 443; AuthTokenConfigURI = ; AuthTokenClientId = ; AuthTokenClientSecret = ; RestClient = 1; ClientTimeoutSec = 120; ClientPoolSize = 32; ClientEofRetryCount = 15; ClientConnectRetryCount = 900; ClientConnectIntervalMs = 1000; } XTC = { Enabled = 1; TimeoutSec = 600; } ``` Save the file after updating the paths. Running Docker with HSM encryption requires setting the HSM-related environment variables as mentioned previously in the [HSM setup instructions](#setup-instructions). You can set these environment variables in your Docker run command. We are setting the environment variables for Docker via the command line in this example, but you can also pass in a `.env` file to set these environment variables. If no key is found with the provided key label, the HSM will create a new key with the provided label. Infisical depends on an AES and HMAC key to be present in the HSM. If these keys are not present, Infisical will create them. The AES key label will be the value of the `HSM_KEY_LABEL` environment variable, and the HMAC key label will be the value of the `HSM_KEY_LABEL` environment variable with the suffix `_HMAC`. ```bash docker run -p 80:8080 \ -v /etc/luna-docker:/usr/safenet/lunaclient \ -e HSM_LIB_PATH="/usr/safenet/lunaclient/libs/64/libCryptoki2.so" \ -e HSM_PIN="" \ -e HSM_SLOT= \ -e HSM_KEY_LABEL="" \ # The rest are unrelated to HSM setup... -e ENCRYPTION_KEY="<>" \ -e AUTH_SECRET="<>" \ -e DB_CONNECTION_URI="<>" \ -e REDIS_URL="<>" \ -e SITE_URL="<>" \ infisical/infisical-fips: # Replace with the version you want to use ``` We recommend reading further about [using Infisical with Docker](/self-hosting/deployment-options/standalone-infisical). After following these steps, your Docker setup will be ready to use HSM encryption. ## Disabling HSM Encryption To disable HSM encryption, navigate to Infisical's Server Admin Console and set the KMS encryption strategy to `Software-based Encryption`. This will revert the encryption strategy back to the default software-based encryption. In order to disable HSM encryption, the Infisical instance must be able to access the HSM device. If the HSM device is no longer accessible, you will not be able to disable HSM encryption. # Kubernetes Encryption with KMS # Key Management Service (KMS) Learn how to manage and use cryptographic keys with Infisical. ## Concept Infisical can be used as a Key Management System (KMS), referred to as Infisical KMS, to centralize management of keys to be used for cryptographic operations like encryption/decryption. By default your Infisical data such as projects and the data within them are encrypted at rest using Infisical's own KMS. This ensures that your data is secure and protected from unauthorized access. If you are on-premise, your KMS root key will be created at random with the `ROOT_ENCRYPTION_KEY` environment variable. You can also use a Hardware Security Module (HSM), to create the root key. Read more about [HSM](/docs/documentation/platform/kms/encryption-strategies). Keys managed in KMS are not extractable from the platform. Additionally, data is never stored when performing cryptographic operations. ## Workflow The typical workflow for using Infisical KMS consists of the following steps: 1. Creating a KMS key. As part of this step, you specify a name for the key and the encryption algorithm meant to be used for it (e.g. `AES-GCM-128`, `AES-GCM-256`). 2. Encryption: To encrypt data, you would make a request to the Infisical KMS API endpoint, specifying the base64-encoded plaintext and the intended key to use for encryption; the API would return the base64-encoded ciphertext. 3. Decryption: To decrypt data, you would make a request to the Infisical KMS API endpoint, specifying the base64-encoded ciphertext and the intended key to use for decryption; the API would return the base64-encoded plaintext. Note that this workflow can be executed via the Infisical UI or manually such as via API. ## Guide to Encrypting Data In the following steps, we explore how to generate a key and use it to encrypt data. Navigate to Project > Key Management and tap on the **Add Key** button. ![kms add key button](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/kms/infisical-kms/kms-add-key.png) Specify your key details. Here's some guidance on each field: * Name: A slug-friendly name for the key. * Type: The encryption algorithm associated with the key (e.g. `AES-GCM-256`). * Description: An optional description of what the intended usage is for the key. ![kms add key modal](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/kms/infisical-kms/kms-add-key-modal.png) Once your key is generated, open the options menu for the newly created key and select encrypt data. ![kms key options](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/kms/infisical-kms/kms-key-options.png) Populate the text area with your data and tap on the Encrypt button. ![kms encrypt data](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/kms/infisical-kms/kms-encrypt-data.png) If your data is already Base64 encoded make sure to toggle the respective switch on to avoid redundant encoding. Copy and store the encrypted data. ![kms encrypted data](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/kms/infisical-kms/kms-encrypted-data.png) To create a cryptographic key, make an API request to the [Create KMS Key](/api-reference/endpoints/kms/keys/create) API endpoint. ### Sample request ```bash Request curl --request POST \ --url https://app.infisical.com/api/v1/kms/keys \ --header 'Content-Type: application/json' \ --data '{ "projectId": "", "name": "my-secret-key", "description": "...", "encryptionAlgorithm": "aes-256-gcm" }' ``` ### Sample response ```bash Response { "key": { "id": "", "description": "...", "isDisabled": false, "isReserved": false, "orgId": "", "name": "my-secret-key", "createdAt": "2023-11-07T05:31:56Z", "updatedAt": "2023-11-07T05:31:56Z", "projectId": "" } } ``` To encrypt data, make an API request to the [Encrypt Data](/api-reference/endpoints/kms/keys/encrypt) API endpoint, specifying the key to use. Make sure your data is Base64 encoded ### Sample request ```bash Request curl --request POST \ --url https://app.infisical.com/api/v1/kms/keys//encrypt \ --header 'Content-Type: application/json' \ --data '{ "plaintext": "lUFHM5Ggwo6TOfpuN1S==" // base64 encoded plaintext }' ``` ### Sample response ```bash Response { "ciphertext": "HwFHwSFHwlMF6TOfp==" // base64 encoded ciphertext } ``` ## Guide to Decrypting Data In the following steps, we explore how to use decrypt data using an existing key in Infisical KMS. Navigate to Project > Key Management and open the options menu for the key used to encrypt the data you want to decrypt. ![kms key options](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/kms/infisical-kms/kms-decrypt-options.png) Paste your encrypted data into the text area and tap on the Decrypt button. Optionally, if your data was originally plain text, enable the decode Base64 switch. ![kms decrypt data](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/kms/infisical-kms/kms-decrypt-data.png) Your decrypted data will be displayed and can be copied for use. ![kms decrypted data](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/kms/infisical-kms/kms-decrypted-data.png) To decrypt data, make an API request to the [Decrypt Data](/api-reference/endpoints/kms/keys/decrypt) API endpoint, specifying the key to use. ### Sample request ```bash Request curl --request POST \ --url https://app.infisical.com/api/v1/kms/keys//decrypt \ --header 'Content-Type: application/json' \ --data '{ "ciphertext": "HwFHwSFHwlMF6TOfp==" // base64 encoded ciphertext }' ``` ### Sample response ```bash Response { "plaintext": "lUFHM5Ggwo6TOfpuN1S==" // base64 encoded plaintext } ``` ## FAQ No. Infisical's KMS only provides cryptographic services and does not store any encrypted or decrypted data. No. Infisical's KMS will never expose your keys, encrypted or decrypted, to external sources. Currently, Infisical only supports `AES-128-GCM` and `AES-256-GCM` for encryption operations. We anticipate supporting more algorithms and cryptographic operations in the coming months. # General LDAP Learn how to log in to Infisical with LDAP. LDAP is a paid feature. If you're using Infisical Cloud, then it is available under the **Enterprise Tier**. If you're self-hosting Infisical, then you should contact [sales@infisical.com](mailto:sales@infisical.com) to purchase an enterprise license to use it. You can configure your organization in Infisical to have members authenticate with the platform via [LDAP](https://en.wikipedia.org/wiki/Lightweight_Directory_Access_Protocol) Prerequisites: * You must have an email address to use LDAP, regardless of whether or not you use that email address to sign in. In Infisical, head to your Organization Settings > Security > LDAP and select **Manage**. Next, input your LDAP server settings. ![LDAP configuration](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/ldap/ldap-config.png) Here's some guidance for each field: * URL: The LDAP server to connect to such as `ldap://ldap.your-org.com`, `ldaps://ldap.myorg.com:636` (for connection over SSL/TLS), etc. * Bind DN: The distinguished name of object to bind when performing the user search such as `cn=infisical,ou=Users,dc=acme,dc=com`. * Bind Pass: The password to use along with `Bind DN` when performing the user search. * User Search Base / User DN: Base DN under which to perform user search such as `ou=Users,dc=acme,dc=com`. * Unique User Attribute: The attribute to use as the unique identifier of LDAP users such as `sAMAccountName`, `cn`, `uid`, `objectGUID` ... If left blank, defaults to `uidNumber` * User Search Filter (optional): Template used to construct the LDAP user search filter such as `(uid={{username}})`; use literal `{{username}}` to have the given username used in the search. The default is `(uid={{username}})` which is compatible with several common directory schemas. * Group Search Base / Group DN (optional): LDAP search base to use for group membership search such as `ou=Groups,dc=acme,dc=com`. * Group Filter (optional): Template used when constructing the group membership query such as `(&(objectClass=posixGroup)(memberUid={{.Username}}))`. The template can access the following context variables: \[`UserDN`, `UserName`]. The default is `(|(memberUid={{.Username}})(member={{.UserDN}})(uniqueMember={{.UserDN}}))` which is compatible with several common directory schemas. * CA Certificate: The CA certificate to use when verifying the LDAP server certificate. The **Group Search Base / Group DN** and **Group Filter** fields are both required if you wish to sync LDAP groups to Infisical. Once you've filled out the LDAP configuration, you can test that part of the configuration is correct by pressing the **Test Connection** button. Infisical will attempt to bind to the LDAP server using the provided **URL**, **Bind DN**, and **Bind Pass**. If the operation is successful, then Infisical will display a success message; if not, then Infisical will display an error message and provide a fuller error in the server logs. ![LDAP test connection](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/ldap/ldap-test-connection.png) In order to sync LDAP groups to Infisical, head to the **LDAP Group Mappings** section to define mappings from LDAP groups to groups in Infisical. ![LDAP group mappings section](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/ldap/ldap-group-mappings-section.png) Group mappings ensure that users who log into Infisical via LDAP are added to or removed from the Infisical group(s) that corresponds to the LDAP group(s) they are a member of. ![LDAP group mappings table](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/ldap/ldap-group-mappings-table.png) Each group mapping consists of two parts: * LDAP Group CN: The common name of the LDAP group to map. * Infisical Group: The Infisical group to map the LDAP group to. For example, suppose you want to automatically add a user who is part of the LDAP group with CN `Engineers` to the Infisical group `Engineers` when the user sets up their account with Infisical. In this case, you would specify a mapping from the LDAP group with CN `Engineers` to the Infisical group `Engineers`. Now when the user logs into Infisical via LDAP, Infisical will check the LDAP groups that the user is a part of whilst referencing the group mappings you created earlier. Since the user is a member of the LDAP group with CN `Engineers`, they will be added to the Infisical group `Engineers`. In the future, if the user is no longer part of the LDAP group with CN `Engineers`, they will be removed from the Infisical group `Engineers` upon their next login. Prior to defining any group mappings, ensure that you've created the Infisical groups that you want to map the LDAP groups to. You can read more about creating (user) groups in Infisical [here](/documentation/platform/groups). Enabling LDAP allows members in your organization to log into Infisical via LDAP. ![LDAP toggle](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/ldap/ldap-toggle.png) # JumpCloud LDAP Learn how to configure JumpCloud LDAP for authenticating into Infisical. LDAP is a paid feature. If you're using Infisical Cloud, then it is available under the **Enterprise Tier**. If you're self-hosting Infisical, then you should contact [sales@infisical.com](mailto:sales@infisical.com) to purchase an enterprise license to use it. Prerequisites: * You must have an email address to use LDAP, regardless of whether or not you use that email address to sign in. In JumpCloud, head to USER MANAGEMENT > Users and create a new user via the **Manual user entry** option. This user will be used as a privileged service account to facilitate Infisical's ability to bind/search the LDAP directory. When creating the user, input their **First Name**, **Last Name**, **Username** (required), **Company Email** (required), and **Description**. Also, create a password for the user. Next, under User Security Settings and Permissions > Permission Settings, check the box next to **Enable as LDAP Bind DN**. ![LDAP JumpCloud](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/ldap/jumpcloud/ldap-jumpcloud-enable-bind-dn.png) In Infisical, head to your Organization Settings > Security > LDAP and select **Manage**. Next, input your JumpCloud LDAP server settings. ![LDAP configuration](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/ldap/ldap-config.png) Here's some guidance for each field: * URL: The LDAP server to connect to (`ldaps://ldap.jumpcloud.com:636`). * Bind DN: The distinguished name of object to bind when performing the user search (`uid=,ou=Users,o=,dc=jumpcloud,dc=com`). * Bind Pass: The password to use along with `Bind DN` when performing the user search. * User Search Base / User DN: Base DN under which to perform user search (`ou=Users,o=,dc=jumpcloud,dc=com`). * Unique User Attribute: The attribute to use as the unique identifier of LDAP users such as `sAMAccountName`, `cn`, `uid`, `objectGUID` ... If left blank, defaults to `uidNumber` * User Search Filter (optional): Template used to construct the LDAP user search filter (`(uid={{username}})`). * Group Search Base / Group DN (optional): LDAP search base to use for group membership search (`ou=Users,o=,dc=jumpcloud,dc=com`). * Group Filter (optional): Template used when constructing the group membership query (`(&(objectClass=groupOfNames)(member=uid={{.Username}},ou=Users,o=,dc=jumpcloud,dc=com))`) * CA Certificate: The CA certificate to use when verifying the LDAP server certificate (instructions to obtain the certificate for JumpCloud [here](https://jumpcloud.com/support/connect-to-ldap-with-tls-ssl)). When filling out the **Bind DN** and **Bind Pass** fields, refer to the username and password of the user created in Step 1. Also, for the **Bind DN** and **Search Base / User DN** fields, you'll want to use the organization ID that appears in your LDAP instance **ORG DN**. Once you've filled out the LDAP configuration, you can test that part of the configuration is correct by pressing the **Test Connection** button. Infisical will attempt to bind to the LDAP server using the provided **URL**, **Bind DN**, and **Bind Pass**. If the operation is successful, then Infisical will display a success message; if not, then Infisical will display an error message and provide a fuller error in the server logs. ![LDAP test connection](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/ldap/ldap-test-connection.png) In order to sync LDAP groups to Infisical, head to the **LDAP Group Mappings** section to define mappings from LDAP groups to groups in Infisical. ![LDAP group mappings section](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/ldap/ldap-group-mappings-section.png) Group mappings ensure that users who log into Infisical via LDAP are added to or removed from the Infisical group(s) that corresponds to the LDAP group(s) they are a member of. ![LDAP group mappings table](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/ldap/ldap-group-mappings-table.png) Each group mapping consists of two parts: * LDAP Group CN: The common name of the LDAP group to map. * Infisical Group: The Infisical group to map the LDAP group to. For example, suppose you want to automatically add a user who is part of the LDAP group with CN `Engineers` to the Infisical group `Engineers` when the user sets up their account with Infisical. In this case, you would specify a mapping from the LDAP group with CN `Engineers` to the Infisical group `Engineers`. Now when the user logs into Infisical via LDAP, Infisical will check the LDAP groups that the user is a part of whilst referencing the group mappings you created earlier. Since the user is a member of the LDAP group with CN `Engineers`, they will be added to the Infisical group `Engineers`. In the future, if the user is no longer part of the LDAP group with CN `Engineers`, they will be removed from the Infisical group `Engineers` upon their next login. Prior to defining any group mappings, ensure that you've created the Infisical groups that you want to map the LDAP groups to. You can read more about creating (user) groups in Infisical [here](/documentation/platform/groups). Enabling LDAP allows members in your organization to log into Infisical via LDAP. ![LDAP toggle](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/ldap/ldap-toggle.png) Resources: * [JumpCloud Cloud LDAP Guide](https://jumpcloud.com/support/use-cloud-ldap) # LDAP Overview Learn how to authenticate into Infisical with LDAP. LDAP is a paid feature. If you're using Infisical Cloud, then it is available under the **Enterprise Tier**. If you're self-hosting Infisical, then you should contact [sales@infisical.com](mailto:sales@infisical.com) to purchase an enterprise license to use it. You can configure your organization in Infisical to have members authenticate with the platform via [LDAP](https://en.wikipedia.org/wiki/Lightweight_Directory_Access_Protocol). LDAP providers: * Active Directory * [JumpCloud LDAP](/documentation/platform/ldap/jumpcloud) * AWS Directory Service * Foxpass Read the general instructions for configuring LDAP [here](/documentation/platform/ldap/general). If the documentation for your required identity provider is not shown in the list above, please reach out to [team@infisical.com](mailto:team@infisical.com) for assistance. ## FAQ By default, Infisical Cloud is configured to not trust emails from external identity providers to prevent any malicious account takeover attempts via email spoofing. Accordingly, Infisical creates a new user for anyone provisioned through an external identity provider and requires an additional email verification step upon their first login. If you're running a self-hosted instance of Infisical and would like it to trust emails from external identity providers, you can configure this behavior in the Server Admin Console. # Multi-factor Authentication Learn how to secure your Infisical account with MFA. MFA requires users to provide multiple forms of identification to access their account. ## Email 2FA If 2-factor authentication is enabled in the Personal settings page, email will be used for MFA by default. ![Email-based MFA](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/mfa-email.png) ## Mobile Authenticator 2FA You can use any mobile authenticator app (Authy, Google Authenticator, Duo, etc.) to secure your account. After registration with an authenticator, select **Mobile Authenticator** as your 2FA method. ![Authenticator-based MFA](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/mfa-authenticator.png) ## Entra ID / Azure AD MFA Before proceeding make sure you've enabled [SAML SSO for Entra ID / Azure AD](./sso/azure). We also encourage you to have your team download and setup the [Microsoft Authenticator App](https://www.microsoft.com/en-us/security/mobile-authenticator-app) prior to enabling MFA. ![Entra Infisical app](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/mfa/entra/mfa_entra_infisical_app.png) ![conditional access](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/mfa/entra/mfa_entra_conditional_access.png) ![create policy](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/mfa/entra/mfa_entra_create_policy.png) ![require MFA and review policy](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/mfa/entra/mfa_entra_review_policy.png) By default all users except the configuring admin will be setup to require MFA. Microsoft encourages keeping at least one admin excluded from MFA to prevent accidental lockout. ![enable policy and confirm](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/mfa/entra/mfa_entra_confirm_policy.png) ![mfa login](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/mfa/entra/mfa_entra_login.png) If users have not setup MFA for Entra / Azure they will be prompted to do so at this time. # Organizations Learn more and understand the concept of Infisical organizations. An Infisical organization is a set of [projects](./project) that use the same billing. Organizations allow one or more users to control billing and project permissions for all of the projects belonging to the organization. Each project belongs to an organization. ## Projects The **Projects** page is where you can view the projects that you have access to within your organization as well as create a new project. ![organization](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/organization/organization-projects.png) ## Settings The **Settings** page lets you manage information about your organization including: * **Name**: The name of your organization. * **Slug**: The slug of your organization. * **Default Organization Member Role**: The role assigned to users when joining your organization unless otherwise specified. * **Incident Contacts**: Emails that should be alerted if anything abnormal is detected within the organization. ![organization settings general](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/organization/organization-settings-general.png) * Security and Authentication: A set of setting to enforce or manage [SAML](/documentation/platform/sso/overview), [OIDC](/documentation/platform/sso/overview), [SCIM](/documentation/platform/scim/overview), [LDAP](/documentation/platform/ldap/overview), and other authentication configurations. ![organization settings auth](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/organization/organization-settings-auth.png) ## Access Control The **Access Control** page is where you can manage identities (both people and machines) that are part of your organization. You can add or remove additional members as well as modify their permissions. ![organization members](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/organization/organization-members.png) ![organization identities](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/organization/organization-machine-identities.png) In the **Organization Roles** tab, you can edit current or create new custom roles for members within the organization. Note that Role-Based Access Management (RBAC) is partly a paid feature. Infisical provides immutable roles like `admin`, `member`, etc. at the organization and project level for free. If you're using Infisical Cloud, the ability to create custom roles is available under the **Pro Tier**. If you're self-hosting Infisical, then you should contact [sales@infisical.com](mailto:sales@infisical.com) to purchase an enterprise license to use it. ![organization roles](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/organization/organization-members-roles.png) As you can see next, Infisical supports granular permissions that you can tailor to each role. If you need certain members to only be able to access billing details, for example, then you can assign them that permission only. ![organization role permissions](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/organization/organization-members-roles-add-perm.png) ## Usage & Billing The **Usage & Billing** page applies only to [Infisical Cloud](https://app.infisical.com) and is where you can manage your plan and billing information. This includes the following items: * Current plan: The current plan information such as what tier your organization is on and what features/limits apply to this tier. * Licenses: The license keys for self-hosted instances of Infisical (if applicable). * Receipts: The receipts of monthly/annual invoices. * Billing: The billing details of your organization including payment methods on file, tax IDs (if applicable), etc. ![organization usage and billing](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/organization/organization-usage-billing.png) # Point-in-Time Recovery Learn how to rollback secrets and configurations to any snapshot with Infisical. Point-in-Time Recovery is a paid feature. If you're using Infisical Cloud, then it is available under the **Pro Tier**. If you're self-hosting Infisical, then you should contact [sales@infisical.com](mailto:sales@infisical.com) to purchase an enterprise license to use it. Infisical's point-in-time recovery functionality allows secrets to be rolled back to any point in time for any given [folder](./folder) or [environment](/documentation/platform/project#project-environments). Every time a secret is updated, a new snapshot is taken – capturing the state of the folder and environment at that point of time. ## Snapshots Similar to Git, a commit (also known as snapshot) in Infisical is the state of your project's secrets at a specific point in time scoped to an environment and [folder](./folder) within it. To view a list of snapshots for the current folder, press the **Commits** button. ![PIT commits](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/pit-recovery/pit-recovery-commits.png) This opens up a sidebar from which you can select to view a particular snapshot: ![PIT snapshots](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/pit-recovery/pit-recovery-commits-drawer.png) ## Rolling back After pressing on a snapshot from the sidebar, you can view it and roll back the state of the folder to that point in time by pressing the **Rollback** button. ![PIT snapshot](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/pit-recovery/pit-recovery-rollback.png) Rolling back secrets to a past snapshot creates a creates a snapshot at the top of the stack and updates secret versions. Rollbacks are localized to not affect other folders within the same environment. This means each [folder](./folder) maintains its own independent history of changes, offering precise and isolated control over rollback actions. Put differently, every [folder](./folder) possesses a distinct and separate timeline, providing granular control when managing your secrets. # Alerting Learn how to set up alerting for expiring certificates with Infisical ## Concept In order to ensure that your certificates are always up-to-date and not expired, you can set up alerting for expiring CA and leaf certificates in Infisical. ## Workflow A typical alerting workflow for expiring certificates consists of the following steps: 1. Creating a PKI/Certificate collection and adding certificates that you wish to monitor for expiration to it. 2. Creating an alert and binding it to the PKI/Certificate collection. As part of the configuration, you specify when the alert should trigger based on the number of days before certificate expiration and the email addresses of the recipients to notify. ## Guide to Creating an Alert To create a PKI/Certificate collection, head to your Project > Internal PKI > Alerting > Certificate Collection and press **Create**. ![pki create collection](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/pki/alerting/collection-create.png) Give the collection a name and proceed to create the empty collection. ![pki create collection](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/pki/alerting/collection-create-2.png) Next, in the Collection Page, add the certificate authorities and leaf certificates that you wish to monitor for expiration to the collection. ![pki add cert to collection](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/pki/alerting/collection-add-cert.png) To create an alert, head to your Project > Internal PKI > Alerting > Alerts and press **Create**. ![pki create alert](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/pki/alerting/alert-create.png) Here, set the **Certificate Collection** to the PKI/Certificate collection you created in the previous step and fill out details for the alert. ![pki create alert](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/pki/alerting/alert-create-2.png) Here's some guidance on each field: * Name: A name for the alert. * Collection Collection: The PKI/Certificate collection to bind the alert to from the previous step. * Alert Before / Unit: The time before certificate expiration to trigger the alert. * Emails to Alert: A comma-delimited list of email addresses to notify when the alert triggers. Finally, press **Create** to create the alert. ![pki alerts](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/pki/alerting/alerts.png) Great! You've successfully created a PKI/Certificate collection and an alert to monitor the expiring certificates in the collection. Once the alert triggers, the specified email addresses will be notified. 1.1. To create a PKI/Certificate collection, make an API request to the [Create PKI Collection](/api-reference/endpoints/pki-collections/create) API endpoint. ### Sample request ```bash Request curl --location --request POST 'https://app.infisical.com/api/v1/pki/collections' \ --header 'Authorization: Bearer ' \ --header 'Content-Type: application/json' \ --data-raw '{ "projectId": "", "name": "My Certificate Collection" }' ``` ### Sample response ```bash Response { id: "", name: "My Certificate Collection", ... } ``` 1.2. Next, make an API request to the [Add Collection Item](/api-reference/endpoints/pki-collections/add-item) API endpoint to add a certificate to the collection. ### Sample request ```bash Request curl --location --request POST 'https://app.infisical.com/api/v1/pki/collections//items' \ --header 'Authorization: Bearer ' \ --header 'Content-Type: application/json' \ --data-raw '{ "type": "certificate", "itemId": "id-of-certificate" }' ``` ### Sample response ```bash Response { id: "", type: "certificate", itemId: "id-of-certificate" ... } ``` To create an alert, make an API request to the [Create Alert](/api-reference/endpoints/pki-alerts/create) API endpoint, specifying the PKI/Certificate collection to bind the alert to, the alert configuration, and the email addresses to notify. ### Sample request ```bash Request curl --location --request POST 'https://app.infisical.com/api/v1/pki/alerts' \ --header 'Authorization: Bearer ' \ --header 'Content-Type: application/json' \ --data-raw '{ "projectId": "", "pkiCollectionId": "", "name": "My Alert", "alertBeforeDays": 30, "emails": ["johndoe@gmail.com", "janedoe@gmail.com"] }' ``` ### Sample response ```bash Response { id: "", name: "My Alert", alertBeforeDays: 30, recipientEmails: "johndoe@gmail.com,janedoe@gmail.com" ... } ``` Great! You've successfully created a PKI/Certificate collection and an alert to monitor the expiring certificate in the collection. Once the alert triggers, the specified email addresses will be notified. # Certificates Learn how to issue X.509 certificates with Infisical. ## Concept Assuming that you've created a Private CA hierarchy with a root CA and an intermediate CA, you can now issue/revoke X.509 certificates using the intermediate CA.
```mermaid graph TD A[Root CA] A --> B[Intermediate CA] A --> C[Intermediate CA] B --> D[Leaf Certificate] C --> E[Leaf Certificate] ```
## Workflow The typical workflow for managing certificates consists of the following steps: 1. Issuing a certificate under an intermediate CA with details like name and validity period. As part of certificate issuance, you can either issue a certificate directly from a CA or do it via a certificate template. 2. Managing certificate lifecycle events such as certificate renewal and revocation. As part of the certificate revocation flow, you can also query for a Certificate Revocation List [CRL](https://en.wikipedia.org/wiki/Certificate_revocation_list), a time-stamped, signed data structure issued by a CA containing a list of revoked certificates to check if a certificate has been revoked. Note that this workflow can be executed via the Infisical UI or manually such as via API. ## Guide to Issuing Certificates In the following steps, we explore how to issue a X.509 certificate under a CA. A certificate template is a set of policies for certificates issued under that template; each template is bound to a specific CA and can also be bound to a certificate collection for alerting such that any certificate issued under the template is automatically added to the collection. With certificate templates, you can specify, for example, that issued certificates must have a common name (CN) adhering to a specific format like `.*.acme.com` or perhaps that the max TTL cannot be more than 1 year. Head to your Project > Certificate Authorities > Your Issuing CA and create a certificate template. ![pki certificate template modal](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/pki/certificate/cert-template-modal.png) Here's some guidance on each field: * Template Name: A name for the certificate template. * Issuing CA: The Certificate Authority (CA) that will issue certificates based on this template. * Certificate Collection (Optional): The certificate collection that certificates should be added to when issued under the template. * Common Name (CN): A regular expression used to validate the common name in certificate requests. * Alternative Names (SANs): A regular expression used to validate subject alternative names in certificate requests. * TTL: The maximum Time-to-Live (TTL) for certificates issued using this template. * Key Usage: The key usage constraint or default value for certificates issued using this template. * Extended Key Usage: The extended key usage constraint or default value for certificates issued using this template. To create a certificate, head to your Project > Internal PKI > Certificates and press **Issue** under the Certificates section. ![pki issue certificate](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/pki/certificate/cert-issue.png) Here, set the **Certificate Template** to the template from step 1 and fill out the rest of the details for the certificate to be issued. ![pki issue certificate modal](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/pki/certificate/cert-issue-modal.png) Here's some guidance on each field: * Friendly Name: A friendly name for the certificate; this is only for display and defaults to the common name of the certificate if left empty. * Common Name (CN): The (common) name for the certificate like `service.acme.com`. * Alternative Names (SANs): A comma-delimited list of Subject Alternative Names (SANs) for the certificate; these can be host names or email addresses like `app1.acme.com, app2.acme.com`. * TTL: The lifetime of the certificate in seconds. * Key Usage: The key usage extension of the certificate. * Extended Key Usage: The extended key usage extension of the certificate. Note that Infisical PKI supports issuing certificates without certificate templates as well. If this is desired, then you can set the **Certificate Template** field to **None** and specify the **Issuing CA** and optional **Certificate Collection** fields; the rest of the fields for the issued certificate remain the same. That said, we recommend using certificate templates to enforce policies and attach expiration monitoring on issued certificates. Once you have created the certificate from step 1, you'll be presented with the certificate details including the **Certificate Body**, **Certificate Chain**, and **Private Key**. ![pki certificate body](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/pki/certificate/cert-body.png) Make sure to download and store the **Private Key** in a secure location as it will only be displayed once at the time of certificate issuance. The **Certificate Body** and **Certificate Chain** will remain accessible and can be copied at any time. A certificate template is a set of policies for certificates issued under that template; each template is bound to a specific CA and can also be bound to a certificate collection for alerting such that any certificate issued under the template is automatically added to the collection. With certificate templates, you can specify, for example, that issued certificates must have a common name (CN) adhering to a specific format like .\*.acme.com or perhaps that the max TTL cannot be more than 1 year. To create a certificate template, make an API request to the [Create Certificate Template](/api-reference/endpoints/certificate-templates/create) API endpoint, specifying the issuing CA. ### Sample request ```bash Request curl --location --request POST 'https://app.infisical.com/api/v1/pki/certificate-templates' \ --header 'Content-Type: application/json' \ --data-raw '{ "caId": "", "name": "My Certificate Template", "commonName": ".*.acme.com", "subjectAlternativeName": ".*.acme.com", "ttl": "1y", }' ``` ### Sample response ```bash Response { id: "...", caId: "...", name: "...", commonName: "...", subjectAlternativeName: "...", ttl: "...", } ``` To create a certificate under the certificate template, make an API request to the [Issue Certificate](/api-reference/endpoints/certificates/issue-cert) API endpoint, specifying the issuing CA. ### Sample request ```bash Request curl --location --request POST 'https://app.infisical.com/api/v1/pki/certificates/issue-certificate' \ --header 'Content-Type: application/json' \ --data-raw '{ "certificateTemplateId": "", "commonName": "service.acme.com", "ttl": "1y", }' ``` ### Sample response ```bash Response { certificate: "...", certificateChain: "...", issuingCaCertificate: "...", privateKey: "...", serialNumber: "..." } ``` Note that Infisical PKI supports issuing certificates without certificate templates as well. If this is desired, then you can set the **Certificate Template** field to **None** and specify the **Issuing CA** and optional **Certificate Collection** fields; the rest of the fields for the issued certificate remain the same. That said, we recommend using certificate templates to enforce policies and attach expiration monitoring on issued certificates. Make sure to store the `privateKey` as it is only returned once here at the time of certificate issuance. The `certificate` and `certificateChain` will remain accessible and can be retrieved at any time. If you have an external private key, you can also create a certificate by making an API request containing a pem-encoded CSR (Certificate Signing Request) to the [Sign Certificate](/api-reference/endpoints/certificates/sign-certificate) API endpoint, specifying the issuing CA. ### Sample request ```bash Request curl --location --request POST 'https://app.infisical.com/api/v1/pki/certificates/sign-certificate' \ --header 'Content-Type: application/json' \ --data-raw '{ "certificateTemplateId": "", "csr": "...", "ttl": "1y", }' ``` ### Sample response ```bash Response { certificate: "...", certificateChain: "...", issuingCaCertificate: "...", privateKey: "...", serialNumber: "..." } ``` ## Guide to Revoking Certificates In the following steps, we explore how to revoke a X.509 certificate under a CA and obtain a Certificate Revocation List (CRL) for a CA. Assuming that you've issued a certificate under a CA, you can revoke it by selecting the **Revoke Certificate** option for it and specifying the reason for revocation. ![pki revoke certificate](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/pki/cert-revoke.png) ![pki revoke certificate modal](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/pki/cert-revoke-modal.png) In order to check the revocation status of a certificate, you can check it against the CRL of a CA by heading to its Issuing CA and downloading the CRL. ![pki view crl](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/pki/ca-crl.png) To verify a certificate against the downloaded CRL with OpenSSL, you can use the following command: ```bash openssl verify -crl_check -CAfile chain.pem -CRLfile crl.pem cert.pem ``` Note that you can also obtain the CRL from the certificate itself by referencing the CRL distribution point extension on the certificate itself. To check a certificate against the CRL distribution point specified within it with OpenSSL, you can use the following command: ```bash openssl verify -verbose -crl_check -crl_download -CAfile chain.pem cert.pem ``` Assuming that you've issued a certificate under a CA, you can revoke it by making an API request to the [Revoke Certificate](/api-reference/endpoints/certificate-authorities/revoke) API endpoint, specifying the serial number of the certificate and the reason for revocation. ### Sample request ```bash Request curl --location --request POST 'https://app.infisical.com/api/v1/pki/certificates//revoke' \ --header 'Authorization: Bearer ' \ --header 'Content-Type: application/json' \ --data-raw '{ "revocationReason": "UNSPECIFIED" }' ``` ### Sample response ```bash Response { message: "Successfully revoked certificate", serialNumber: "...", revokedAt: "..." } ``` In order to check the revocation status of a certificate, you can check it against the CRL of the issuing CA. To obtain the CRLs of the CA, make an API request to the [List CRLs](/api-reference/endpoints/certificate-authorities/crls) API endpoint. ### Sample request ```bash Request curl --location --request GET 'https://app.infisical.com/api/v1/pki/ca//crls' \ --header 'Authorization: Bearer ' ``` ### Sample response ```bash Response [ { id: "...", crl: "..." }, ... ] ``` To verify a certificate against the CRL with OpenSSL, you can use the following command: ```bash openssl verify -crl_check -CAfile chain.pem -CRLfile crl.pem cert.pem ``` ## FAQ To renew a certificate, you have to issue a new certificate from the same CA with the same common name as the old certificate. The original certificate will continue to be valid through its original TTL unless explicitly revoked. # Enrollment over Secure Transport (EST) Learn how to manage certificate enrollment of clients using EST ## Concept Enrollment over Secure Transport (EST) is a protocol used to automate the secure provisioning of digital certificates for devices and applications over a secure HTTPS connection. It is primarily used when a client device needs to obtain or renew a certificate from a Certificate Authority (CA) on Infisical in a secure and standardized manner. EST is commonly employed in environments requiring strong authentication and encrypted communication, such as in IoT, enterprise networks, and secure web services. Infisical's EST service is based on [RFC 7030](https://datatracker.ietf.org/doc/html/rfc7030) and implements the following endpoints: * **cacerts** - provides the necessary CA chain for the client to validate certificates issued by the CA. * **simpleenroll** - allows an EST client to request a new certificate from Infisical's EST server * **simplereenroll** - similar to the /simpleenroll endpoint but is used for renewing an existing certificate. These endpoints are exposed on port 8443 under the .well-known/est path e.g. `https://app.infisical.com:8443/.well-known/est/estLabel/cacerts` ## Prerequisites * You need to have an existing [CA hierarchy](/documentation/platform/pki/private-ca). * The client devices need to have a bootstrap/pre-installed certificate. * The client devices must trust the server certificates used by Infisical's EST server. If the devices are new or lack existing trust configurations, you need to manually establish trust for the appropriate certificates. * For Infisical Cloud users, the devices must be configured to trust the [Amazon root CA certificates](https://www.amazontrust.com/repository). ## Guide to configuring EST 1. Set up a certificate template with your selected issuing CA. This template will define the policies and parameters for certificates issued through EST. For detailed instructions on configuring a certificate template, refer to the certificate templates [documentation](/documentation/platform/pki/certificates#guide-to-issuing-certificates). 2. Proceed to the certificate template's enrollment settings ![est enrollment dashboard](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/pki/est/template-enroll-hover.png) 3. Select **EST** as the client enrollment method and fill up the remaining fields. ![est enrollment modal create](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/pki/est/template-enrollment-modal.png) * **Disable Bootstrap Certificate Validation** - Enable this if your devices are not configured with a bootstrap certificate. * **Certificate Authority Chain** - This is the certificate chain used to validate your devices' manufacturing/pre-installed certificates. This will be used to authenticate your devices with Infisical's EST server. * **Passphrase** - This is also used to authenticate your devices with Infisical's EST server. When configuring the clients, use the value defined here as the EST password. For security reasons, Infisical authenticates EST clients using both client certificate and passphrase. 4. Once the configuration of enrollment options is completed, a new **EST Label** field appears in the enrollment settings. This is the value to use as label in the URL when configuring the connection of EST clients to Infisical. ![est enrollment modal create](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/pki/est/template-enrollment-est-label.png) The complete URL of the supported EST endpoints will look like the following: * [https://app.infisical.com:8443/.well-known/est/f110f308-9888-40ab-b228-237b12de8b96/cacerts](https://app.infisical.com:8443/.well-known/est/f110f308-9888-40ab-b228-237b12de8b96/cacerts) * [https://app.infisical.com:8443/.well-known/est/f110f308-9888-40ab-b228-237b12de8b96/simpleenroll](https://app.infisical.com:8443/.well-known/est/f110f308-9888-40ab-b228-237b12de8b96/simpleenroll) * [https://app.infisical.com:8443/.well-known/est/f110f308-9888-40ab-b228-237b12de8b96/simplereenroll](https://app.infisical.com:8443/.well-known/est/f110f308-9888-40ab-b228-237b12de8b96/simplereenroll) ## Setting up EST clients * To use the EST passphrase in your clients, configure it as the EST password. The EST username can be set to any arbitrary value. * Use the appropriate client certificates for invoking the EST endpoints. * For `simpleenroll`, use the bootstrapped/manufacturer client certificate. * For `simplereenroll`, use a valid EST-issued client certificate. * When configuring the PKCS#12 objects for the client certificates, only include the leaf certificate and the private key. # Internal PKI Learn how to create a Private CA hierarchy and issue X.509 certificates. Infisical can be used to create a Private Certificate Authority (CA) hierarchy and issue X.509 certificates for internal use. This allows you to manage your own PKI infrastructure and issue digital certificates for services, applications, and devices. Infisical's internal PKI offering is split into two modules: * [Private CA](/documentation/platform/pki/private-ca): Infisical lets you create private CAs, including root and intermediary CAs. * [Certificates](/documentation/platform/pki/certificates): Infisical allows you to issue X.509 certificates using the private CAs you create. # Kubernetes Issuer Learn how to automatically provision and manage TLS certificates for in Kubernetes using Infisical PKI ## Concept The Infisical PKI Issuer is an installable Kubernetes [cert-manager](https://cert-manager.io/) controller that uses Infisical PKI to sign certificate requests. The issuer is perfect for getting X.509 certificates for ingresses and other Kubernetes resources and capable of automatically renewing certificates as needed. As part of the workflow, you install `cert-manager`, the Infisical PKI Issuer, and configure resources to represent the connection details to your Infisical PKI and the certificates you wish to issue. Each issued certificate and corresponding private key is made available in a Kubernetes secret. We recommend reading the [cert-manager documentation](https://cert-manager.io/docs/) for a fuller understanding of all the moving parts. ## Workflow A typical workflow for using the Infisical PKI Issuer to issue certificates for your Kubernetes resources consists of the following steps: 1. Creating a machine identity in Infisical. 2. Creating a Kubernetes secret to store the credentials of the machine identity. 3. Installing `cert-manager` into your Kubernetes cluster. 4. Installing the Infisical PKI Issuer controller into your Kubernetes cluster. 5. Creating an `Issuer` or `ClusterIssuer` resource in your Kubernetes cluster to represent the Infisical PKI issuer you wish to use. 6. Creating a `Certificate` resource in your Kubernetes cluster to represent a certificate you wish to issue. As part of this step, you specify the Kubernetes `Secret` to create and store the issued certificate and private key. 7. Consuming the issued certificate across your Kubernetes resources from the specified Kubernetes `Secret`. ## Guide In the following steps, we explore how to install the Infisical PKI Issuer using [kubectl](https://github.com/kubernetes/kubectl) and use it to obtain certificates for your Kubernetes resources. Follow the instructions [here](/documentation/platform/identities/universal-auth) to configure a [machine identity](/documentation/platform/identities/machine-identities) in Infisical with Universal Auth. By the end of this step, you should have a **Client ID** and **Client Secret** on hand as part of the Universal Auth configuration for the Infisical PKI Issuer to authenticate with Infisical; this will be useful in steps 4 and 5. Currently, the Infisical PKI Issuer only supports authenticating with Infisical via the [Universal Auth](/documentation/platform/identities/universal-auth) authentication method. We're planning to add support for [Kubernetes Auth](/documentation/platform/identities/kubernetes-auth) in the near future. Install `cert-manager` into your Kubernetes cluster by following the instructions [here](https://cert-manager.io/docs/installation/) or by running the following command: ```bash kubectl apply -f https://github.com/cert-manager/cert-manager/releases/download/v1.15.3/cert-manager.yaml ``` Install the Infisical PKI Issuer controller into your Kubernetes cluster by running the following command: ```bash kubectl apply -f https://raw.githubusercontent.com/Infisical/infisical-issuer/main/build/install.yaml ``` Start by creating a Kubernetes `Secret` containing the **Client Secret** from step 1. As mentioned previously, this will be used by the Infisical PKI issuer to authenticate with Infisical. ```bash kubectl create secret generic issuer-infisical-client-secret \ --namespace \ --from-literal=clientSecret= ``` ```yaml secret-issuer.yaml apiVersion: v1 kind: Secret metadata: name: issuer-infisical-client-secret namespace: data: clientSecret: ``` ```bash kubectl apply -f secret-issuer.yaml ``` Next, create the Infisical PKI Issuer by filling out `url`, `clientId`, either `caId` or `certificateTemplateId`, and applying the following configuration file for the `Issuer` resource. This configuration file specifies the connection details to your Infisical PKI CA to be used for issuing certificates. ```yaml infisical-issuer.yaml apiVersion: infisical-issuer.infisical.com/v1alpha1 kind: Issuer metadata: name: issuer-infisical namespace: spec: url: "https://app.infisical.com" # the URL of your Infisical instance caId: # the ID of the CA you want to use to issue certificates certificateTemplateId: # the ID of the certificate template you want to use to issue certificates against authentication: universalAuth: clientId: # the Client ID from step 1 secretRef: # reference to the Secret created in step 4 name: "issuer-infisical-client-secret" key: "clientSecret" ``` ``` kubectl apply -f infisical-issuer.yaml ``` The Infisical PKI Issuer supports issuing certificates against a specific CA or a specific certificate template. For this reason, you should only fill in the `caId` or the `certificateTemplateId` field but not both. We recommend using the `certificateTemplateId` field to issue certificates against a specific [certificate template](/documentation/platform/pki/certificate-templates) since templates let you enforce constraints on issued certificates and may have alerting policies bound to them. You can check that the issuer was created successfully by running the following command: ```bash kubectl get issuers.infisical-issuer.infisical.com -n -o wide ``` ```bash NAME AGE issuer-infisical 21h ``` An `Issuer` is a namespaced resource, and it is not possible to issue certificates from an `Issuer` in a different namespace. This means you will need to create an `Issuer` in each namespace you wish to obtain `Certificates` in. If you want to create a single `Issuer` that can be consumed in multiple namespaces, you should consider creating a `ClusterIssuer` resource. This is almost identical to the `Issuer` resource, however is non-namespaced so it can be used to issue `Certificates` across all namespaces. You can read more about the `Issuer` and `ClusterIssuer` resources [here](https://cert-manager.io/docs/configuration/). Finally, create a `Certificate` by applying the following configuration file. This configuration file specifies the details of the (end-entity/leaf) certificate to be issued. ```yaml certificate-issuer.yaml apiVersion: cert-manager.io/v1 kind: Certificate metadata: name: certificate-by-issuer namespace: spec: commonName: certificate-by-issuer.example.com # the common name for the certificate secretName: certificate-by-issuer # the name of the Kubernetes Secret to create and store the certificate and private key in issuerRef: name: issuer-infisical group: infisical-issuer.infisical.com kind: Issuer privateKey: # the algorithm and key size to use algorithm: ECDSA size: 256 duration: 48h # the ttl for the certificate renewBefore: 12h # the time before the certificate expiry that the certificate should be automatically renewed ``` The above sample configuration file specifies a certificate to be issued with the common name `certificate-by-issuer.example.com` and ECDSA private key using the P-256 curve, valid for 48 hours; the certificate will be automatically renewed by `cert-manager` 12 hours before expiry. The certificate is issued by the issuer `issuer-infisical` created in the previous step and the resulting certificate and private key will be stored in a secret named `certificate-by-issuer`. Note that the full list of the fields supported on the `Certificate` resource can be found in the API reference documentation [here](https://cert-manager.io/docs/reference/api-docs/#cert-manager.io/v1.CertificateSpec). You can check that the certificate was created successfully by running the following command: ```bash kubectl get certificates -n -o wide ``` ```bash NAME READY SECRET ISSUER STATUS AGE certificate-by-issuer True certificate-by-issuer issuer-infisical Certificate is up to date and has not expired 20h ``` Since the actual certificate and private key are stored in a Kubernetes secret, we can check that the secret was created successfully by running the following command: ```bash kubectl get secret certificate-by-issuer -n ``` ```bash NAME TYPE DATA AGE certificate-by-issuer kubernetes.io/tls 2 26h ``` We can `describe` the secret to get more information about it: ```bash kubectl describe secret certificate-by-issuer -n default ``` ```bash Name: certificate-by-issuer Namespace: default Labels: controller.cert-manager.io/fao=true Annotations: cert-manager.io/alt-names: cert-manager.io/certificate-name: certificate-by-issuer cert-manager.io/common-name: certificate-by-issuer.example.com cert-manager.io/ip-sans: cert-manager.io/issuer-group: infisical-issuer.infisical.com cert-manager.io/issuer-kind: Issuer cert-manager.io/issuer-name: issuer-infisical cert-manager.io/uri-sans: Type: kubernetes.io/tls Data ==== ca.crt: 1306 bytes tls.crt: 2380 bytes tls.key: 227 bytes ``` Here, `ca.crt` is the Root CA certificate, `tls.crt` is the requested certificate followed by the certificate chain, and `tls.key` is the private key for the certificate. We can decode the certificate and print it out using `openssl`: ```bash kubectl get secret certificate-by-issuer -n default -o jsonpath='{.data.tls\.crt}' | base64 --decode | openssl x509 -text -noout ``` In any case, the certificate is ready to be used as Kubernetes Secret by your Kubernetes resources. ## FAQ The full list of the fields supported on the `Certificate` resource can be found in the API reference documentation [here](https://cert-manager.io/docs/reference/api-docs/#cert-manager.io/v1.CertificateSpec). Currently, not all fields are supported by the Infisical PKI Issuer. Yes. `cert-manager` will automatically renew certificates according to the `renewBefore` threshold of expiry as specified in the corresponding `Certificate` resource. You can read more about the `renewBefore` field [here](https://cert-manager.io/docs/reference/api-docs/#cert-manager.io/v1.CertificateSpec). # Private CA Learn how to create a Private CA hierarchy with Infisical. ## Concept The first step to creating your Internal PKI is to create a Private Certificate Authority (CA) hierarchy that is a structure of entities used to issue digital certificates for services, applications, and devices.
```mermaid graph TD A[Root CA] A --> B[Intermediate CA] A --> C[Intermediate CA] ```
## Workflow A typical workflow for setting up a Private CA hierarchy consists of the following steps: 1. Configuring an Infisical root CA with details like name, validity period, and path length — This step is optional if you wish to use an external root CA. 2. Configuring and chaining intermediate CA(s) with details like name, validity period, path length, and imported certificate to your Root CA. 3. Managing the CA lifecycle events such as CA succession. Note that this workflow can be executed via the Infisical UI or manually such as via API. If manually executing the workflow, you may have to create a Certificate Signing Request (CSR) for the intermediate CA, create an intermediate certificate using the root CA private key and CSR, and import the intermediate certificate back to the intermediate CA as part of Step 2. ## Guide to Creating a CA Hierarchy In the following steps, we explore how to create a simple Private CA hierarchy consisting of an (optional) root CA and an intermediate CA. If you wish to use an external root CA, you can skip this step and head to step 2 to create an intermediate CA. To create a root CA, head to your Project > Internal PKI > Certificate Authorities and press **Create CA**. ![pki create ca](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/pki/ca/ca-create.png) Here, set the **CA Type** to **Root** and fill out details for the root CA. ![pki create root ca](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/pki/ca/ca-create-root.png) Here's some guidance on each field: * Valid Until: The date until which the CA is valid in the date time string format specified [here](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date#date_time_string_format). For example, the following formats would be valid: `YYYY`, `YYYY-MM`, `YYYY-MM-DD`, `YYYY-MM-DDTHH:mm:ss.sssZ`. * Path Length: The maximum number of intermediate CAs that can be chained to this CA. A path of `-1` implies no limit; a path of `0` implies no intermediate CAs can be chained. * Key Algorithm: The type of public key algorithm and size, in bits, of the key pair that the CA creates when it issues a certificate. Supported key algorithms are `RSA 2048`, `RSA 4096`, `ECDSA P-256`, and `ECDSA P-384` with the default being `RSA 2048`. * Friendly Name: A friendly name for the CA; this is only for display and defaults to the subject of the CA if left empty. * Organization (O): The organization name. * Country (C): The country code. * State or Province Name: The state or province. * Locality Name: The city or locality. * Common Name: The name of the CA. * Require Template for Certificate Issuance: Whether or not certificates for this CA can only be issued through certificate templates (recommended). The Organization, Country, State or Province Name, Locality Name, and Common Name make up the **Distinguished Name (DN)** or **subject** of the CA. At least one of these fields must be filled out. 2.1. To create an intermediate CA, press **Create CA** again but this time specifying the **CA Type** to be **Intermediate**. Fill out the details for the intermediate CA. ![pki create intermediate ca](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/pki/ca/ca-create-intermediate.png) 2.2. Next, press the **Install Certificate** option on the intermediate CA from step 1.1. ![pki install cert opt](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/pki/ca/ca-install-intermediate-opt.png) 2.3a. If you created a root CA in step 1, select **Infisical CA** for the **Parent CA Type** field. Next, set the **Parent CA** to the root CA created in step 1 and configure the intended **Valid Until** and **Path Length** fields on the intermediate CA; feel free to use the prefilled values. ![pki install cert](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/pki/ca/ca-install-intermediate.png) Here's some guidance on each field: * Parent CA: The parent CA to which this intermediate CA will be chained. In this case, it should be the root CA created in step 1. * Valid Until: The date until which the CA is valid in the date time string format specified [here](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date#date_time_string_format). The date must be within the validity period of the parent CA. * Path Length: The maximum number of intermediate CAs that can be chained to this CA. The path length must be less than the path length of the parent CA. Finally, press **Install** to chain the intermediate CA to the root CA; this creates a Certificate Signing Request (CSR) for the intermediate CA, creates an intermediate certificate using the root CA private key and CSR, and imports the signed certificate back to the intermediate CA. ![pki cas](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/pki/ca/cas.png) Great! You've successfully created a Private CA hierarchy with a root CA and an intermediate CA. Now check out the [Certificates](/documentation/platform/pki/certificates) page to learn more about how to issue X.509 certificates using the intermediate CA. 2.3b. If you have an external root CA, select **External CA** for the **Parent CA Type** field. Next, use the provided intermediate CSR to generate a certificate from your external root CA and paste the PEM-encoded certificate back into the **Certificate Body** field; the PEM-encoded external root CA certificate should be pasted under the **Certificate Chain** field. ![pki ca csr](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/pki/ca/ca-install-intermediate-csr.png) Finally, press **Install** to import the certificate and certificate chain as part of the installation step for the intermediate CA Great! You've successfully created a Private CA hierarchy with an intermediate CA chained to an external root CA. Now check out the [Certificates](/documentation/platform/pki/certificates) page to learn more about how to issue X.509 certificates using the intermediate CA. If you wish to use an external root CA, you can skip this step and head to step 2 to create an intermediate CA. To create a root CA, make an API request to the [Create CA](/api-reference/endpoints/certificate-authorities/create) API endpoint, specifying the `type` as `root`. ### Sample request ```bash Request curl --location --request POST 'https://app.infisical.com/api/v1/pki/ca' \ --header 'Authorization: Bearer ' \ --header 'Content-Type: application/json' \ --data-raw '{ "projectSlug": "", "type": "root", "commonName": "My Root CA" }' ``` ### Sample response ```bash Response { ca: { id: "", type: "root", commonName: "My Root CA", ... } } ``` By default, Infisical creates a root CA with the `RSA_2048` key algorithm, validity period of 10 years, with no restrictions on path length; you may override these defaults by specifying your own options when making the API request. 2.1. To create an intermediate CA, make an API request to the [Create CA](/api-reference/endpoints/certificate-authorities/create) API endpoint, specifying the `type` as `intermediate`. ### Sample request ```bash Request curl --location --request POST 'https://app.infisical.com/api/v1/pki/ca' \ --header 'Authorization: Bearer ' \ --header 'Content-Type: application/json' \ --data-raw '{ "projectSlug": "", "type": "intermediate", "commonName": "My Intermediate CA" }' ``` ### Sample response ```bash Response { ca: { id: "", type: "intermediate", commonName: "My Intermediate CA", ... } } ``` 2.2. Next, get a certificate signing request from the intermediate CA by making an API request to the [Get CSR](/api-reference/endpoints/certificate-authorities/csr) API endpoint. ### Sample request ```bash Request curl --location --request GET 'https://app.infisical.com/api/v1/pki/ca//csr' \ --header 'Authorization: Bearer ' \ --data-raw '' ``` ### Sample response ```bash Response { csr: "..." } ``` If using an external root CA, then use the CSR to generate a certificate for the intermediate CA using your external root CA and skip to step 2.4. 2.3. Next, create an intermediate certificate by making an API request to the [Sign Intermediate](/api-reference/endpoints/certificate-authorities/sign-intermediate) API endpoint containing the CSR from step 2.2, referencing the root CA created in step 1. ### Sample request ```bash Request curl --location --request POST 'https://app.infisical.com/api/v1/pki/ca//sign-intermediate' \ --header 'Content-Type: application/json' \ --data-raw '{ "csr": "", "notAfter": "2029-06-12" }' ``` ### Sample response ```bash Response { certificate: "...", certificateChain: "...", issuingCaCertificate: "...", serialNumber: "...", } ``` The `notAfter` value must be within the validity period of the root CA that is if the root CA is valid until `2029-06-12`, the intermediate CA must be valid until a date before `2029-06-12`. 2.4. Finally, import the intermediate certificate and certificate chain from step 2.3 back to the intermediate CA by making an API request to the [Import Certificate](/api-reference/endpoints/certificate-authorities/import-cert) API endpoint. If using an external root CA, then import the generated certificate and root CA certificate under certificate chain back into the intermediate CA. ### Sample request ```bash Request curl --location --request POST 'https://app.infisical.com/api/v1/pki/ca//import-certificate' \ --header 'Authorization: Bearer ' \ --header 'Content-Type: application/json' \ --data-raw '{ "certificate": "", "certificateChain": "" }' ``` ### Sample response ```bash Response { message: "Successfully imported certificate to CA", caId: "..." } ``` Great! You’ve successfully created a Private CA hierarchy with a root CA and an intermediate CA. Now check out the Certificates page to learn more about how to issue X.509 certificates using the intermediate CA. ## Guide to CA Renewal In the following steps, we explore how to renew a CA certificate. If renewing an intermediate CA chained to an Infisical CA, then Infisical will automate the process of generating a new certificate for the intermediate CA for you. If renewing an intermediate CA chained to an external parent CA, you'll be required to generate a new certificate from the external parent CA and manually import the certificate back to the intermediate CA. Head to the CA Page of the CA you wish you renew and press **Renew CA** on the left side. ![pki ca renewal page](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/pki/ca-renewal-page.png) Input a new **Valid Until** date to be used for the renewed CA certificate and press **Renew** to renew the CA. ![pki ca renewal. modal](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/pki/ca-renewal-modal.png) The new **Valid Until** date must be within the validity period of the parent CA. To renew a CA certificate, make an API request to the [Renew CA](/api-reference/endpoints/certificate-authorities/renew) API endpoint, specifying the new `notAfter` date for the CA. ### Sample request ```bash Request curl --location --request POST 'https://app.infisical.com/api/v1/pki/ca//renew' \ --header 'Authorization: Bearer ' \ --header 'Content-Type: application/json' \ --data-raw '{ "type": "existing", "notAfter": "2029-06-12" }' ``` ### Sample response ```bash Response { certificate: "...", certificateChain: "...", serialNumber: "..." } ``` ## FAQ Infisical supports `RSA 2048`, `RSA 4096`, `ECDSA P-256`, `ECDSA P-384` key algorithms specified at the time of creating a CA. At the moment, Infisical only supports CA renewal via same key pair. We anticipate supporting CA renewal via new key pair in the coming month. Yes. You may obtain a CSR from the Intermediate CA and use it to generate a certificate from your external CA. The certificate, along with the external CA certificate chain, can be imported back to the Intermediate CA as part of the CA installation step. # Approval Workflows Learn how to enable a set of policies to manage changes to sensitive secrets and environments. ## Problem at hand Updating secrets in high-stakes environments (e.g., production) can have a number of problematic issues: * Most developers should not have access to secrets in production environments. Yet, they are the ones who often need to add new secrets or change the existing ones. Many organizations have in-house policies with regards to what person should be contacted in the case of needing to make changes to secrets. This slows down software development lifecycle and distracts engineers from working on things that matter the most. * As a general rule, before making changes in production environments, those changes have to be looked over by at least another person. An extra pair of eyes can help reduce the risk of human error and make sure that the change will not affect the application in an unintended way. * After making updates to secrets, the corresponding applications need to be redeployed with the right set of secrets and configurations. This process is often not automated and hence prone to human error. ## Solution As a wide-spread software engineering practice, developers have to submit their code as a PR that needs to be approved before the code is merged into the main branch. In a similar way, to solve the above-mentioned issues, Infisical provides a feature called `Approval Workflows` for secret management. This is a set of policies and workflows that help advance access controls, compliance procedures, and stability of a particular environment. In other words, **Approval Workflows** help you secure, stabilize, and streamline the change of secrets in high-stakes environments. ### Setting a policy First, you would need to create a set of policies for a certain environment. In the example below, a generic change policy for a production environment is shown. In this case, any user who submits a change to `prod` would first have to get an approval by a predefined approver (or multiple approvers). ![create secret update policy](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/pr-workflows/secret-update-policy.png) ### Policy enforcement levels The enforcement level determines how strict the policy is. A **Hard** enforcement level means that any change that matches the policy will need full approval prior merging. A **Soft** enforcement level allows for break glass functionality on the request. If a change request is bypassed, the approvers will be notified via email. ### Example of creating a change policy When creating a policy, you can choose the type of policy you want to create. In this case, we will be creating a `Change Policy`. Other types of policies include `Access Policy` that creates policies for **[Access Requests](/documentation/platform/access-controls/access-requests)**. ![create panel secret update policy](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/pr-workflows/create-change-policy.png) ### Example of updating secrets with Approval workflows When a user submits a change to an enviropnment that is under a particular policy, a corresponsing change request will go to a predefined approver (or multiple approvers). ![secret update change requests](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/pr-workflows/secret-update-request.png) Approvers are notified by email and/or Slack as soon as the request is initiated. In the Infisical Dashboard, they will be able to `approve` and `merge` (or `deny`) a request for a change in a particular environment. After that, depending on the workflows setup, the change will be automatically propagated to the right applications (e.g., using [Infisical Kubernetes Operator](https://infisical.com/docs/integrations/platforms/kubernetes)). ![secrets update pull request](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/pr-workflows/secret-update-pr.png) # Projects Learn more and understand the concept of Infisical projects. A project in Infisical belongs to an [organization](./organization) and contains a number of environments, folders, and secrets. Only users and machine identities who belong to a project can access resources inside of it according to predefined permissions. ## Project environments For both visual and organizational structure, Infisical allows splitting up secrets into environments (e.g., development, staging, production). In project settings, such environments can be customized depending on the intended use case. ![project secrets overview](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/project/project-environments.png) ## Secrets Overview The **Secrets Overview** page captures a birds-eye-view of secrets and [folders](./folder) across environments. This is useful for comparing secrets, identifying if anything is missing, and making quick changes. ![project secrets overview](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/project/project-secrets-overview-open.png) ## Secrets Dashboard The **Secrets Dashboard** page appears when you press to manage the secrets of a specific environment. ![project dashboard](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/dashboard.png) ### Secrets To add a secret, press **Add Secret** button at the top of the dashboard. ![project add secret](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/project/project-secrets-add.png) For a new project, it can be convenient to populate the dashboard by dropping a `.env` file into the provided pane as shown below: ![project drop env file](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/project/project-secrets-drop-env.png) To delete a secret, hover over it and press the **X** button that appears on the right side. ![project delete secret](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/project/project-secrets-delete.png) To delete multiple secrets at once, hover over and select the secrets you'd like to delete and press the **Delete** button that appears at the top. ![project delete secret batch](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/project/project-secrets-delete-batch.png) ### Search To search for specific secrets by their key name, you can use the search bar. ![project search](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/project/project-secrets-search.png) To assist you with finding secrets, you can also group them by similar prefixes and filter them by tags (if applicable). ![project filter](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/project/project-secrets-filter.png) ### Hide/Un-hide To view/hide all secrets at once, toggle the hide or un-hide button. ![project filter](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/project/project-secrets-unhide.png) ### Download as .env To download/export secrets back into a `.env` file, press the download button. ![project download back env](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/project/project-secrets-download-env.png) ### Tags To better organize similar secrets, hover over them and label them with a tag. ![project tag secret](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/project/project-secrets-tag.png) ### Comments To provide more context about a given secret, especially for your team, hover over it and press the comment button. ![project comment secret](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/project/project-secrets-comment.png) ### Personal overrides Infisical employs the concept of **shared** and **personal** secrets to address the need for common and custom secret values, or branching, amongst members of a team during software development. To provide a helpful analogy: A shared value is to a `main` branch as a personal value is to a custom branch. Consider: * A team with users A, B, user C. * A project with an environment containing a shared secret called D with the value E. Suppose user A overrides the value of secret D with the value F. Then: * If user A fetches the secret D back, they get the value F. * If users B and C fetch the secret D back, they both get the value E. Please keep in mind that secret reminders won't work with personal overrides. ![project override secret](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/project/project-secrets-override.png) ### Drawer To view the full details of each secret, you can hover over it and press on the ellipses button. ![project secrets ellipses](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/project/project-secrets-ellipses.png) This opens up a side-drawer: ![project secrets drawer](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/project/project-secrets-drawer.png) # Project Templates Learn how to manage and apply project templates ## Concept Project Templates streamline your ability to set up projects by providing customizable templates to configure projects quickly with a predefined set of environments and roles. Project Templates is a paid feature. If you're using Infisical Cloud, then it is available under the **Enterprise Tier**. If you're self-hosting Infisical, then you should contact [team@infisical.com](mailto:team@infisical.com) to purchase an enterprise license to use it. ## Workflow The typical workflow for using Project Templates consists of the following steps: 1. Creating a project template: As part of this step, you will configure a set of environments and roles to be created when applying this template to a project. 2. Using a project template: When creating new projects, optionally specify a project template to provision the project with the configured roles and environments. Note that this workflow can be executed via the Infisical UI or through the API. ## Guide to Creating a Project Template In the following steps, we'll explore how to set up a project template. Navigate to the Project Templates tab on the Organization Settings page and tap on the **Add Template** button. ![project template add button](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/project-templates/project-template-add-button.png) Specify your template details. Here's some guidance on each field: * Name: A slug-friendly name for the template. * Description: An optional description of the intended usage of this template. ![project template create modal](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/project-templates/project-template-create.png) Once your template is created, you'll be directed to the configuration section. ![project template edit form](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/project-templates/project-template-edit-form.png) Customize the environments and roles to your needs. ![project template customized](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/project-templates/project-template-customized.png) Be sure to save your environment and role changes. To create a project template, make an API request to the [Create Project Template](/api-reference/endpoints/project-templates/create) API endpoint. ### Sample request ```bash Request curl --request POST \ --url https://app.infisical.com/api/v1/project-templates \ --header 'Content-Type: application/json' \ --data '{ "name": "my-project-template", "description": "...", "environments": "[...]", "roles": "[...]", }' ``` ### Sample response ```bash Response { "projectTemplate": { "id": "", "name": "my-project-template", "description": "...", "environments": "[...]", "roles": "[...]", "orgId": "", "createdAt": "2023-11-07T05:31:56Z", "updatedAt": "2023-11-07T05:31:56Z", } } ``` ## Guide to Using a Project Template In the following steps, we'll explore how to use a project template when creating a project. When creating a new project, select the desired template from the dropdown menu in the create project modal. ![kms key options](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/project-templates/project-template-apply.png) Your project will be provisioned with the configured template roles and environments. To use a project template, make an API request to the [Create Project](/api-reference/endpoints/workspaces/create-workspace) API endpoint with the specified template name included. ### Sample request ```bash Request curl --request POST \ --url https://app.infisical.com/api/v2/workspace \ --header 'Content-Type: application/json' \ --data '{ "projectName": "My Project", "template": "", // defaults to "default" }' ``` ### Sample response ```bash Response { "project": { "id": "", "environments": "[...]", // configured environments ... } } ``` Note that configured roles are not included in the project response. ## FAQ No. Project templates only apply at the time of project creation. # Azure SCIM Learn how to configure SCIM provisioning with Azure for Infisical. Azure SCIM provisioning is a paid feature. If you're using Infisical Cloud, then it is available under the **Enterprise Tier**. If you're self-hosting Infisical, then you should contact [sales@infisical.com](mailto:sales@infisical.com) to purchase an enterprise license to use it. Prerequisites: * [Configure Azure SAML for Infisical](/documentation/platform/sso/azure) In Infisical, head to your Organization Settings > Authentication > SCIM Configuration and press the **Enable SCIM provisioning** toggle to allow Azure to provision/deprovision users for your organization. ![SCIM enable provisioning](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/scim/scim-enable-provisioning.png) Next, press **Manage SCIM Tokens** and then **Create** to generate a SCIM token for Azure. ![SCIM create token](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/scim/scim-create-token.png) Next, copy the **SCIM URL** and **New SCIM Token** to use when configuring SCIM in Azure. ![SCIM copy token](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/scim/scim-copy-token.png) In Azure, navigate to Enterprise Application > Users and Groups. Add any users and/or groups to your application that you would like to be provisioned over to Infisical. ![SCIM Azure Users and Groups](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/scim/azure/scim-azure-add-users-and-groups.png) In Azure, head to your Enterprise Application > Provisioning > Overview and press **Get started**. ![SCIM Azure](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/scim/azure/scim-azure-get-started.png) Next, set the following fields: * Provisioning Mode: Select **Automatic**. * Tenant URL: Input **SCIM URL** from Step 1. * Secret Token: Input the **New SCIM Token** from Step 1. Afterwards, click **Enable SCIM** and press the **Test Connection** button to check that SCIM is configured properly. ![SCIM Azure](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/scim/azure/scim-azure-config.png) After you hit **Save**, select **Provision Microsoft Entra ID Users** under the **Mappings** subsection. ![SCIM Azure](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/scim/azure/scim-azure-select-user-mappings.png) Next, adjust the mappings so you have them configured as below: ![SCIM Azure](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/scim/azure/scim-azure-user-mappings.png) Finally, head to your Enterprise Application > Provisioning and set the **Provisioning Status** to **On**. ![SCIM Azure](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/scim/azure/scim-azure-provisioning-status.png) Alternatively, you can go to **Overview** and press **Start provisioning** to have Azure start provisioning/deprovisioning users to Infisical. ![SCIM Azure](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/scim/azure/scim-azure-start-provisioning.png) Now Azure can provision/deprovision users to/from your organization in Infisical. **FAQ** Infisical's SCIM implmentation accounts for retaining the end-to-end encrypted architecture of Infisical because we decouple the **authentication** and **decryption** steps in the platform. For this reason, SCIM-provisioned users are initialized but must finish setting up their account when logging in the first time by creating a master encryption/decryption key. With this implementation, IdPs and SCIM providers cannot and will not have access to the decryption key needed to decrypt your secrets. # SCIM Group Mappings Learn how to enhance your SCIM implementation using group mappings SCIM provisioning, and by extension group mapping, is a paid feature. If you're using Infisical Cloud, then it is available under the **Enterprise Tier**. If you're self-hosting Infisical, then you should contact [sales@infisical.com](mailto:sales@infisical.com) to purchase an enterprise license to use it. ## SCIM Group to Organization Role Mapping By default, when users are provisioned via SCIM, they will be assigned the default organization role configured in [Organization General Settings](/documentation/platform/organization#settings). For more precise control over membership roles, you can set up SCIM Group to Organization Role Mappings. This enables you to assign specific roles based on the group from which a user is provisioned. ![SCIM Group Mapping](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/scim/scim-group-mapping.png) To configure a mapping, simply enter the SCIM group's name and select the role you would like users to be assigned from this group. Be sure to tap **Update Mappings** once complete. SCIM Group Mappings only apply when users are first provisioned. Previously provisioned users will not be affected, allowing you to customize user roles after they are added. # JumpCloud SCIM Learn how to configure SCIM provisioning with JumpCloud for Infisical. JumpCloud SCIM provisioning is a paid feature. If you're using Infisical Cloud, then it is available under the **Enterprise Tier**. If you're self-hosting Infisical, then you should contact [sales@infisical.com](mailto:sales@infisical.com) to purchase an enterprise license to use it. Prerequisites: * [Configure JumpCloud SAML for Infisical](/documentation/platform/sso/jumpcloud) In Infisical, head to your Organization Settings > Authentication > SCIM Configuration and press the **Enable SCIM provisioning** toggle to allow JumpCloud to provision/deprovision users and user groups for your organization. ![SCIM enable provisioning](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/scim/scim-enable-provisioning.png) Next, press **Manage SCIM Tokens** and then **Create** to generate a SCIM token for JumpCloud. ![SCIM create token](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/scim/scim-create-token.png) Next, copy the **SCIM URL** and **New SCIM Token** to use when configuring SCIM in JumpCloud. ![SCIM copy token](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/scim/scim-copy-token.png) In JumpCloud, head to your Application > Identity Management > Configuration settings and make sure that **API Type** is set to **SCIM API** and **SCIM Version** is set to **SCIM 2.0**. ![SCIM JumpCloud](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/scim/jumpcloud/scim-jumpcloud-api-type.png) Next, set the following SCIM connection fields: * Base URL: Input the **SCIM URL** from Step 1. * Token Key: Input the **New SCIM Token** from Step 1. * Test User Email: Input a test user email to be used by JumpCloud for testing the SCIM connection. Alos, under HTTP Header > Authorization: Bearer, input the **New SCIM Token** from Step 1. ![SCIM JumpCloud](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/scim/jumpcloud/scim-jumpcloud-config.png) Next, press **Test Connection** to check that SCIM is configured properly. Finally, press **Activate** to have JumpCloud start provisioning/deprovisioning users to Infisical. ![SCIM JumpCloud](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/scim/jumpcloud/scim-jumpcloud-test-connection.png) Now JumpCloud can provision/deprovision users and user groups to/from your organization in Infisical. **FAQ** Infisical's SCIM implmentation accounts for retaining the end-to-end encrypted architecture of Infisical because we decouple the **authentication** and **decryption** steps in the platform. For this reason, SCIM-provisioned users are initialized but must finish setting up their account when logging in the first time by creating a master encryption/decryption key. With this implementation, IdPs and SCIM providers cannot and will not have access to the decryption key needed to decrypt your secrets. # Okta SCIM Learn how to configure SCIM provisioning with Okta for Infisical. Okta SCIM provisioning is a paid feature. If you're using Infisical Cloud, then it is available under the **Enterprise Tier**. If you're self-hosting Infisical, then you should contact [sales@infisical.com](mailto:sales@infisical.com) to purchase an enterprise license to use it. Prerequisites: * [Configure Okta SAML for Infisical](/documentation/platform/sso/okta) In Infisical, head to your Organization Settings > Authentication > SCIM Configuration and press the **Enable SCIM provisioning** toggle to allow Okta to provision/deprovision users and user groups for your organization. ![SCIM enable provisioning](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/scim/scim-enable-provisioning.png) Next, press **Manage SCIM Tokens** and then **Create** to generate a SCIM token for Okta. ![SCIM create token](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/scim/scim-create-token.png) Next, copy the **SCIM URL** and **New SCIM Token** to use when configuring SCIM in Okta. ![SCIM copy token](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/scim/scim-copy-token.png) In Okta, head to your Application > General > App Settings. Next, select **Edit** and check the box labled **Enable SCIM provisioning**. ![SCIM Okta](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/scim/okta/scim-okta-enable-provisioning.png) Next, head to Provisioning > Integration and set the following SCIM connection fields: * SCIM connector base URL: Input the **SCIM URL** from Step 1. * Unique identifier field for users: Input `email`. * Supported provisioning actions: Select **Push New Users**, **Push Profile Updates**, and **Push Groups**. * Authentication Mode: `HTTP Header`. ![SCIM Okta](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/scim/okta/scim-okta-config.png) Under HTTP Header > Authorization: Bearer, input the **New SCIM Token** from Step 1. ![SCIM Okta](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/scim/okta/scim-okta-auth.png) Next, press **Test Connector Configuration** to check that SCIM is configured properly. ![SCIM Okta](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/scim/okta/scim-okta-test.png) Next, head to Provisioning > To App and check the boxes labeled **Enable** for **Create Users**, **Update User Attributes**, and **Deactivate Users**. ![SCIM Okta](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/scim/okta/scim-okta-app-settings.png) Now Okta can provision/deprovision users and user groups to/from your organization in Infisical. **FAQ** Infisical's SCIM implmentation accounts for retaining the end-to-end encrypted architecture of Infisical because we decouple the **authentication** and **decryption** steps in the platform. For this reason, SCIM-provisioned users are initialized but must finish setting up their account when logging in the first time by creating a master encryption/decryption key. With this implementation, IdPs and SCIM providers cannot and will not have access to the decryption key needed to decrypt your secrets. # SCIM Overview Learn how to provision users for Infisical via SCIM. SCIM provisioning is a paid feature. If you're using Infisical Cloud, then it is available under the **Enterprise Tier**. If you're self-hosting Infisical, then you should contact [sales@infisical.com](mailto:sales@infisical.com) to purchase an enterprise license to use it. You can configure your organization in Infisical to have users and user groups be provisioned/deprovisioned using [SCIM](https://scim.cloud/#Implementations2) via providers like Okta, Azure, JumpCloud, etc. * Provisioning: The SCIM provider pushes user information to Infisical. If the user exists in Infisical, Infisical sends an email invitation to add them to the relevant organization in Infisical; if not, Infisical initializes a new user and sends them an email invitation to finish setting up their account in the organization. * Deprovisioning: The SCIM provider instructs Infisical to remove user(s) from an organization in Infisical. SCIM providers: * [Okta SCIM](/documentation/platform/scim/okta) * [Azure SCIM](/documentation/platform/scim/azure) * [JumpCloud SCIM](/documentation/platform/scim/jumpcloud) **FAQ** Infisical's SCIM implementation accounts for retaining the end-to-end encrypted architecture of Infisical because we decouple the **authentication** and **decryption** steps in the platform. For this reason, SCIM-provisioned users are initialized but must finish setting up their account when logging in the first time by creating a master encryption/decryption key. With this implementation, IdPs and SCIM providers cannot and will not have access to the decryption key needed to decrypt your secrets. # Secret Referencing and Importing Learn the fundamentals of secret referencing and importing in Infisical. ## Secret Referencing Infisical's secret referencing functionality makes it possible to reference the value of a "base" secret when defining the value of another secret. This means that updating the value of a base secret propagates directly to other secrets whose values depend on the base secret. ![secret referencing](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/secret-references-imports/secret-reference.png) Since secret referencing works by reconstructing values back on the client side, the client, be it a user, service token, or a machine identity, fetching back secrets must be permissioned access to all base and dependent secrets. For example, to access some secret `A` whose values depend on secrets `B` and `C` from different scopes, a client must have `read` access to the scopes of secrets `A`, `B`, and `C`. ### Syntax When defining a secret reference, interpolation syntax is used to define references to secrets in other environments and [folders](./folder). Suppose you have some secret `MY_SECRET` at the root of some environment and want to reference part of its value from another base secret `BASE_SECRET` located elsewhere. Then consider the following scenarios: * If `BASE_SECRET` is in the same environment and folder as `MY_SECRET`, then you'd reference it using `${BASE_SECRET}`. * If `BASE_SECRET` is at the root of another environment with the slug `dev`, then you'd reference it using `${dev.MY_SECRET}`. Here are a few more helpful examples for how to reference secrets in different contexts: | Reference syntax | Environment | Folder | Secret Key | | ----------------------- | ----------- | ----------------------------- | ---------- | | `${KEY1}` | same env | same folder | KEY1 | | `${dev.KEY2}` | `dev` | `/` (root of dev environment) | KEY2 | | `${prod.frontend.KEY2}` | `prod` | `/frontend` | KEY2 | ## Secret Imports Infisical's Secret Imports functionality makes it possible to import the secrets from another environment or folder into the current folder context. This can be useful if you have common secrets that need to be available across multiple environments/folders. To add a secret import, press the downward chevron to the right of the **Add Secret** button; then press on the **Add Import** button. ![add secret import](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/secret-references-imports/secret-import-add.png) Once added, a secret import will show up with a green import icon on the secrets dashboard. In the example below, you can see that the items in the path `/some-folder` are being imported into the current folder context. ![added secret import](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/secret-references-imports/secret-import-added.png) To delete a secret import, hover over it and press the **X** button that appears on the right side. ![delete secret import](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/secret-references-imports/secret-import-delete.png) Lastly, note that the order of secret imports matters. If two secret imports contain secrets with the same name, then the secret value from the bottom-most secret import is taken — "the last one wins." To reorder a secret import, hover over it and drag the arrows handle to the position you want. ![reorder secret import](https://mintlify.s3-us-west-1.amazonaws.com/infisical/images/platform/secret-references-imports/secret-import-reorder.png)