Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.
TypeScript acmeagentsai-agentscertificate-managementdevsecopsenvironment-variableskubernetesopen-sourcepampkipostgresprivate-caprivileged-access-managementsecret-managementsecret-managersecretssecrets-managementsecuritysecurity-toolsvault
feat: add support for mutual TLS (mTLS) in LDAP configuration
Victor Hugo dos Santos64e3f119f0c5
diff --git a/backend/src/db/migrations/20260519204340_add-ldap-client-certificate-mtls.ts b/backend/src/db/migrations/20260519204340_add-ldap-client-certificate-mtls.tsnew file mode 100644index 0000000000..78b97a8326--- /dev/null+++ b/backend/src/db/migrations/20260519204340_add-ldap-client-certificate-mtls.ts@@ -0,0 +1,27 @@+import { Knex } from "knex";++import { TableName } from "../schemas";++export async function up(knex: Knex): Promise<void> {+ const hasClientCertColumn = await knex.schema.hasColumn(TableName.LdapConfig, "encryptedLdapClientCertificate");+ const hasClientKeyColumn = await knex.schema.hasColumn(TableName.LdapConfig, "encryptedLdapClientKeyCertificate");++ if (!hasClientCertColumn || !hasClientKeyColumn) {+ await knex.schema.alterTable(TableName.LdapConfig, (t) => {+ if (!hasClientCertColumn) t.binary("encryptedLdapClientCertificate").nullable();+ if (!hasClientKeyColumn) t.binary("encryptedLdapClientKeyCertificate").nullable();+ });+ }+}++export async function down(knex: Knex): Promise<void> {+ const hasClientCertColumn = await knex.schema.hasColumn(TableName.LdapConfig, "encryptedLdapClientCertificate");+ const hasClientKeyColumn = await knex.schema.hasColumn(TableName.LdapConfig, "encryptedLdapClientKeyCertificate");++ if (hasClientCertColumn || hasClientKeyColumn) {+ await knex.schema.alterTable(TableName.LdapConfig, (t) => {+ if (hasClientCertColumn) t.dropColumn("encryptedLdapClientCertificate");+ if (hasClientKeyColumn) t.dropColumn("encryptedLdapClientKeyCertificate");+ });+ }+}diff --git a/backend/src/db/schemas/ldap-configs.ts b/backend/src/db/schemas/ldap-configs.tsindex 778e7be6e4..490e26118d 100644--- a/backend/src/db/schemas/ldap-configs.ts+++ b/backend/src/db/schemas/ldap-configs.ts@@ -32,7 +32,9 @@ export const LdapConfigsSchema = z.object({uniqueUserAttribute: z.string().default(""),encryptedLdapBindDN: zodBuffer,encryptedLdapBindPass: zodBuffer,- encryptedLdapCaCertificate: zodBuffer.nullable().optional()+ encryptedLdapCaCertificate: zodBuffer.nullable().optional(),+ encryptedLdapClientCertificate: zodBuffer.nullable().optional(),+ encryptedLdapClientKeyCertificate: zodBuffer.nullable().optional()});export type TLdapConfigs = z.infer<typeof LdapConfigsSchema>;diff --git a/backend/src/ee/routes/v1/ldap-router.ts b/backend/src/ee/routes/v1/ldap-router.tsindex cb19f53c29..90bf206fba 100644--- a/backend/src/ee/routes/v1/ldap-router.ts+++ b/backend/src/ee/routes/v1/ldap-router.ts@@ -183,7 +183,9 @@ export const registerLdapRouter = async (server: FastifyZodProvider) => {searchFilter: z.string(),groupSearchBase: z.string(),groupSearchFilter: z.string(),- caCert: z.string()+ caCert: z.string(),+ clientCertificate: z.string(),+ clientKeyCertificate: z.string()})}},@@ -230,7 +232,9 @@ export const registerLdapRouter = async (server: FastifyZodProvider) => {.trim().default("(|(memberUid={{.Username}})(member={{.UserDN}})(uniqueMember={{.UserDN}}))").describe(LdapSso.CREATE_CONFIG.groupSearchFilter),- caCert: z.string().trim().default("").describe(LdapSso.CREATE_CONFIG.caCert)+ caCert: z.string().trim().default("").describe(LdapSso.CREATE_CONFIG.caCert),+ clientCertificate: z.string().trim().default("").describe(LdapSso.CREATE_CONFIG.clientCertificate),+ clientKeyCertificate: z.string().trim().default("").describe(LdapSso.CREATE_CONFIG.clientKeyCertificate)}),response: {200: SanitizedLdapConfigSchema@@ -289,7 +293,9 @@ export const registerLdapRouter = async (server: FastifyZodProvider) => {searchFilter: z.string().trim().describe(LdapSso.UPDATE_CONFIG.searchFilter),groupSearchBase: z.string().trim().describe(LdapSso.UPDATE_CONFIG.groupSearchBase),groupSearchFilter: z.string().trim().describe(LdapSso.UPDATE_CONFIG.groupSearchFilter),- caCert: z.string().trim().describe(LdapSso.UPDATE_CONFIG.caCert)+ caCert: z.string().trim().describe(LdapSso.UPDATE_CONFIG.caCert),+ clientCertificate: z.string().trim().describe(LdapSso.UPDATE_CONFIG.clientCertificate),+ clientKeyCertificate: z.string().trim().describe(LdapSso.UPDATE_CONFIG.clientKeyCertificate)}).partial().merge(z.object({ organizationId: z.string().trim().describe(LdapSso.UPDATE_CONFIG.organizationId) })),@@ -437,7 +443,9 @@ export const registerLdapRouter = async (server: FastifyZodProvider) => {url: z.string().trim(),bindDN: z.string().trim(),bindPass: z.string().trim(),- caCert: z.string().trim()+ caCert: z.string().trim(),+ clientCertificate: z.string().trim().default(""),+ clientKeyCertificate: z.string().trim().default("")}),response: {200: z.boolean()diff --git a/backend/src/ee/services/ldap-config/ldap-config-service.ts b/backend/src/ee/services/ldap-config/ldap-config-service.tsindex 076734b0c9..26605441e0 100644--- a/backend/src/ee/services/ldap-config/ldap-config-service.ts+++ b/backend/src/ee/services/ldap-config/ldap-config-service.ts@@ -56,7 +56,7 @@ import {TTestLdapConnectionDTO,TUpdateLdapCfgDTO} from "./ldap-config-types";-import { searchGroups, testLDAPConfig } from "./ldap-fns";+import { buildLdapTlsOptions, searchGroups, testLDAPConfig } from "./ldap-fns";import { TLdapGroupMapDALFactory } from "./ldap-group-map-dal";type TLdapConfigServiceFactoryDep = {@@ -136,7 +136,9 @@ export const ldapConfigServiceFactory = ({searchFilter,groupSearchBase,groupSearchFilter,- caCert+ caCert,+ clientCertificate,+ clientKeyCertificate}: TCreateLdapCfgDTO) => {const { permission } = await permissionService.getOrgPermission({scope: OrganizationActionScope.ParentOrganization,@@ -170,6 +172,12 @@ export const ldapConfigServiceFactory = ({await blockLocalAndPrivateIpAddresses(url);+ if (Boolean(clientCertificate) !== Boolean(clientKeyCertificate)) {+ throw new BadRequestError({+ message: "clientCertificate and clientKeyCertificate must be provided together for mTLS."+ });+ }+const { encryptor } = await kmsService.createCipherPairWithDataKey({type: KmsDataKey.Organization,orgId@@ -179,6 +187,8 @@ export const ldapConfigServiceFactory = ({bindDN,bindPass,caCert,+ clientCertificate,+ clientKeyCertificate,url});@@ -199,7 +209,13 @@ export const ldapConfigServiceFactory = ({groupSearchFilter,encryptedLdapCaCertificate: encryptor({ plainText: Buffer.from(caCert) }).cipherTextBlob,encryptedLdapBindDN: encryptor({ plainText: Buffer.from(bindDN) }).cipherTextBlob,- encryptedLdapBindPass: encryptor({ plainText: Buffer.from(bindPass) }).cipherTextBlob+ encryptedLdapBindPass: encryptor({ plainText: Buffer.from(bindPass) }).cipherTextBlob,+ encryptedLdapClientCertificate: clientCertificate+ ? encryptor({ plainText: Buffer.from(clientCertificate) }).cipherTextBlob+ : null,+ encryptedLdapClientKeyCertificate: clientKeyCertificate+ ? encryptor({ plainText: Buffer.from(clientKeyCertificate) }).cipherTextBlob+ : null});return ldapConfig;@@ -233,6 +249,16 @@ export const ldapConfigServiceFactory = ({caCert = decryptor({ cipherTextBlob: ldapConfig.encryptedLdapCaCertificate }).toString();}+ let clientCertificate = "";+ if (ldapConfig.encryptedLdapClientCertificate) {+ clientCertificate = decryptor({ cipherTextBlob: ldapConfig.encryptedLdapClientCertificate }).toString();+ }++ let clientKeyCertificate = "";+ if (ldapConfig.encryptedLdapClientKeyCertificate) {+ clientKeyCertificate = decryptor({ cipherTextBlob: ldapConfig.encryptedLdapClientKeyCertificate }).toString();+ }+return {id: ldapConfig.id,organization: ldapConfig.orgId,@@ -245,7 +271,9 @@ export const ldapConfigServiceFactory = ({searchFilter: ldapConfig.searchFilter,groupSearchBase: ldapConfig.groupSearchBase,groupSearchFilter: ldapConfig.groupSearchFilter,- caCert+ caCert,+ clientCertificate,+ clientKeyCertificate};};@@ -264,7 +292,9 @@ export const ldapConfigServiceFactory = ({searchFilter,groupSearchBase,groupSearchFilter,- caCert+ caCert,+ clientCertificate,+ clientKeyCertificate}: TUpdateLdapCfgDTO) => {const { permission } = await permissionService.getOrgPermission({scope: OrganizationActionScope.ParentOrganization,@@ -327,10 +357,28 @@ export const ldapConfigServiceFactory = ({updateQuery.encryptedLdapCaCertificate = encryptor({ plainText: Buffer.from(caCert) }).cipherTextBlob;}+ if (clientCertificate !== undefined) {+ updateQuery.encryptedLdapClientCertificate = clientCertificate+ ? encryptor({ plainText: Buffer.from(clientCertificate) }).cipherTextBlob+ : null;+ }++ if (clientKeyCertificate !== undefined) {+ updateQuery.encryptedLdapClientKeyCertificate = clientKeyCertificate+ ? encryptor({ plainText: Buffer.from(clientKeyCertificate) }).cipherTextBlob+ : null;+ }+const config = await ldapConfigDAL.transaction(async (tx) => {const [updatedLdapCfg] = await ldapConfigDAL.update({ orgId }, updateQuery, tx);const decryptedLdapCfg = await getLdapCfg({ orgId }, tx);+ if (Boolean(decryptedLdapCfg.clientCertificate) !== Boolean(decryptedLdapCfg.clientKeyCertificate)) {+ throw new BadRequestError({+ message: "clientCertificate and clientKeyCertificate must be provided together for mTLS."+ });+ }+const isSoftDeletion = !decryptedLdapCfg.url && !decryptedLdapCfg.bindDN && !decryptedLdapCfg.bindPass;if (!isSoftDeletion) {const isConnected = await testLDAPConfig(decryptedLdapCfg);@@ -378,6 +426,7 @@ export const ldapConfigServiceFactory = ({isActive: true});+ const tlsOptions = buildLdapTlsOptions(ldapConfig);const opts = {server: {url: ldapConfig.url,@@ -387,13 +436,7 @@ export const ldapConfigServiceFactory = ({searchBase: ldapConfig.searchBase,searchFilter: ldapConfig.searchFilter || "(uid={{username}})",// searchAttributes: ["uid", "uidNumber", "givenName", "sn", "mail"],- ...(ldapConfig.caCert !== ""- ? {- tlsOptions: {- ca: [ldapConfig.caCert]- }- }- : {})+ ...(tlsOptions ? { tlsOptions } : {})},passReqToCallback: true};@@ -822,6 +865,8 @@ export const ldapConfigServiceFactory = ({bindDN,bindPass,caCert,+ clientCertificate,+ clientKeyCertificate,url}: TTestLdapConnectionDTO) => {const { permission } = await permissionService.getOrgPermission({@@ -844,6 +889,8 @@ export const ldapConfigServiceFactory = ({bindDN,bindPass,caCert,+ clientCertificate,+ clientKeyCertificate,url});};diff --git a/backend/src/ee/services/ldap-config/ldap-config-types.ts b/backend/src/ee/services/ldap-config/ldap-config-types.tsindex 580f7958bb..b56d7c508b 100644--- a/backend/src/ee/services/ldap-config/ldap-config-types.ts+++ b/backend/src/ee/services/ldap-config/ldap-config-types.ts@@ -12,6 +12,8 @@ export type TLDAPConfig = {groupSearchBase: string;groupSearchFilter: string;caCert: string;+ clientCertificate?: string;+ clientKeyCertificate?: string;};export type TTestLDAPConfigDTO = Omit<@@ -31,6 +33,8 @@ export type TCreateLdapCfgDTO = {groupSearchBase: string;groupSearchFilter: string;caCert: string;+ clientCertificate: string;+ clientKeyCertificate: string;} & TOrgPermission;export type TUpdateLdapCfgDTO = {@@ -46,6 +50,8 @@ export type TUpdateLdapCfgDTO = {groupSearchBase: string;groupSearchFilter: string;caCert: string;+ clientCertificate: string;+ clientKeyCertificate: string;}> &TOrgPermission;diff --git a/backend/src/ee/services/ldap-config/ldap-fns.ts b/backend/src/ee/services/ldap-config/ldap-fns.tsindex bcb9c803ba..dbf87b1741 100644--- a/backend/src/ee/services/ldap-config/ldap-fns.ts+++ b/backend/src/ee/services/ldap-config/ldap-fns.ts@@ -14,6 +14,30 @@ export const isValidLdapFilter = (filter: string) => {}};+type TLdapTlsConfigInput = Pick<TLDAPConfig, "url" | "caCert" | "clientCertificate" | "clientKeyCertificate">;++export const buildLdapTlsOptions = (cfg: TLdapTlsConfigInput) => {+ const tlsOptions: { ca?: string[]; cert?: string; key?: string; servername?: string } = {};+ if (cfg.caCert) tlsOptions.ca = [cfg.caCert];+ if (cfg.clientCertificate) tlsOptions.cert = cfg.clientCertificate;+ if (cfg.clientKeyCertificate) tlsOptions.key = cfg.clientKeyCertificate;++ if (Object.keys(tlsOptions).length === 0) return undefined;++ // SNI is required for mTLS against multi-tenant directories (e.g. Google Workspace Secure LDAP)+ // because @infisical/ldapjs does not propagate it from the URL. Scoped to mTLS only to avoid+ // changing TLS handshake behavior for existing non-mTLS configs.+ if (cfg.clientCertificate || cfg.clientKeyCertificate) {+ try {+ tlsOptions.servername = new URL(cfg.url).hostname;+ } catch {+ // Malformed URL — connection itself will surface the error.+ }+ }++ return tlsOptions;+};+/*** Test the LDAP configuration by attempting to bind to the LDAP server* @param ldapConfig - The LDAP configuration to test@@ -21,17 +45,12 @@ export const isValidLdapFilter = (filter: string) => {*/export const testLDAPConfig = async (ldapConfig: TTestLDAPConfigDTO): Promise<boolean> => {return new Promise((resolve) => {+ const tlsOptions = buildLdapTlsOptions(ldapConfig);const ldapClient = ldapjs.createClient({url: ldapConfig.url,bindDN: ldapConfig.bindDN,bindCredentials: ldapConfig.bindPass,- ...(ldapConfig.caCert !== ""- ? {- tlsOptions: {- ca: [ldapConfig.caCert]- }- }- : {})+ ...(tlsOptions ? { tlsOptions } : {})});ldapClient.on("error", (err) => {@@ -67,17 +86,12 @@ export const searchGroups = async (base: string): Promise<{ dn: string; cn: string }[]> => {return new Promise((resolve, reject) => {+ const tlsOptions = buildLdapTlsOptions(ldapConfig);const ldapClient = ldapjs.createClient({url: ldapConfig.url,bindDN: ldapConfig.bindDN,bindCredentials: ldapConfig.bindPass,- ...(ldapConfig.caCert !== ""- ? {- tlsOptions: {- ca: [ldapConfig.caCert]- }- }- : {})+ ...(tlsOptions ? { tlsOptions } : {})});ldapClient.search(diff --git a/backend/src/lib/api-docs/constants.ts b/backend/src/lib/api-docs/constants.tsindex fbf4b4afce..2e0fa6354b 100644--- a/backend/src/lib/api-docs/constants.ts+++ b/backend/src/lib/api-docs/constants.ts@@ -3595,7 +3595,11 @@ export const LdapSso = {groupSearchBase: "LDAP search base to use for group membership search such as `ou=Groups,dc=acme,dc=com`",groupSearchFilter:"The 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.",- caCert: "The CA certificate to use when verifying the LDAP server certificate."+ caCert: "The CA certificate to use when verifying the LDAP server certificate.",+ clientCertificate:+ "PEM-encoded client certificate presented during the TLS handshake for mutual TLS (mTLS). Must be provided together with clientKeyCertificate.",+ clientKeyCertificate:+ "PEM-encoded private key matching the client certificate, used during the TLS handshake for mutual TLS (mTLS). Must be provided together with clientCertificate."},UPDATE_CONFIG: {organizationId: "The ID of the organization to update the LDAP config for.",@@ -3612,7 +3616,11 @@ export const LdapSso = {groupSearchBase: "LDAP search base to use for group membership search such as `ou=Groups,dc=acme,dc=com`",groupSearchFilter:"The 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.",- caCert: "The CA certificate to use when verifying the LDAP server certificate."+ caCert: "The CA certificate to use when verifying the LDAP server certificate.",+ clientCertificate:+ "PEM-encoded client certificate presented during the TLS handshake for mutual TLS (mTLS). Must be provided together with clientKeyCertificate.",+ clientKeyCertificate:+ "PEM-encoded private key matching the client certificate, used during the TLS handshake for mutual TLS (mTLS). Must be provided together with clientCertificate."}};diff --git a/backend/src/server/routes/v1/identity-ldap-auth-router.ts b/backend/src/server/routes/v1/identity-ldap-auth-router.tsindex 82d3ba4a6a..725c407000 100644--- a/backend/src/server/routes/v1/identity-ldap-auth-router.ts+++ b/backend/src/server/routes/v1/identity-ldap-auth-router.ts@@ -179,7 +179,9 @@ export const registerIdentityLdapAuthRouter = async (server: FastifyZodProvider)isActive: true,groupSearchBase: "",uniqueUserAttribute: "",- groupSearchFilter: ""+ groupSearchFilter: "",+ clientCertificate: "",+ clientKeyCertificate: ""};// Authenticate with passport, wrapped in lockout protectiondiff --git a/docs/docs.json b/docs/docs.jsonindex f052044479..fd5c525d60 100644--- a/docs/docs.json+++ b/docs/docs.json@@ -267,6 +267,7 @@"pages": ["documentation/platform/ldap/overview","documentation/platform/ldap/jumpcloud",+ "documentation/platform/ldap/google-workspace","documentation/platform/ldap/general"]},diff --git a/docs/documentation/platform/ldap/google-workspace.mdx b/docs/documentation/platform/ldap/google-workspace.mdxnew file mode 100644index 0000000000..2796d6feed--- /dev/null+++ b/docs/documentation/platform/ldap/google-workspace.mdx@@ -0,0 +1,103 @@+---+title: "Google Workspace LDAP"+description: "Learn how to configure Google Workspace Secure LDAP for authenticating into Infisical."+---++<Note>+ SSO authentication requires [Email Domain Verification](/documentation/platform/email-domain).+ You must verify your organization's email domain before users can log in via SSO.+</Note>++<Info>+ 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 [email protected] to purchase an enterprise license to use+ it.+</Info>++Prerequisites:++- You must have an email address to use LDAP, regardless of whether or not you use that email address to sign in.+- Google Workspace's Secure LDAP service requires mutual TLS (mTLS): in addition to the standard bind DN and bind password, the client must present a TLS certificate and private key during the TLS handshake.++<Steps>+ <Step title="Prepare LDAP in Google Workspace">+ In the [Google Admin console](https://admin.google.com), head to **Apps > LDAP** and click **Add Client**.++ Give the client a name and an optional description.++ ++ On the next screen, configure the access permissions for the users and groups that should be able to authenticate through this LDAP client. Save the client.++ ++ After the client is created, Google generates a certificate and private key. Download the `.crt` and `.key` PEM files — you will paste their contents into Infisical.++ ++ Then click **Generate new credentials** to create the access credentials (username and password) — these are the bind credentials Infisical will use after the TLS handshake completes.++ Finally, make sure the client's **Service status** is set to **ON** so that connections are accepted.++ + </Step>+ <Step title="Prepare the LDAP configuration in Infisical">+ In Infisical, head to the **Settings** page and select the **SSO** tab. Select **Add Provider** and **LDAP**.++ ++ Next, input your Google Workspace LDAP server settings.++ Here's some guidance for each field:++ - URL: The LDAP server to connect to (`ldaps://ldap.google.com:636`).+ - Bind DN: The username from Google's generated access credentials.+ - Bind Pass: The password from Google's generated access credentials.+ - User Search Base / User DN: Base DN under which to perform user search (`dc=yourdomain,dc=com`, using your verified Google Workspace domain).+ - 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 (`dc=yourdomain,dc=com`).+ - Group Filter (optional): Template used when constructing the group membership query (`(&(objectClass=groupOfNames)(member=uid={{.Username}},ou=Users,dc=yourdomain,dc=com))`).+ - CA Certificate (optional): Leave empty, Google's LDAP server uses a publicly trusted certificate.+ - Client Certificate: Paste the contents of the `.crt` file downloaded from Google.+ - Client Private Key: Paste the contents of the `.key` file downloaded from Google.++ <Tip>+ The Client Certificate and Client Private Key must be provided together — providing only one will fail validation. These are the credentials presented during the TLS handshake; without them, the connection fails before LDAP-layer bind is attempted.+ </Tip>+ </Step>+ <Step title="Define mappings from LDAP groups to groups in Infisical">+ 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.++ ++ 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.++ ++ 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.+ <Note>+ 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).+ </Note>++ </Step>+ <Step title="Enable LDAP in Infisical">+ Enabling LDAP allows members in your organization to log into Infisical via LDAP.+ + </Step>++</Steps>++Resources:++- [Google Workspace Secure LDAP Guide](https://support.google.com/a/answer/9048516)diff --git a/docs/documentation/platform/ldap/overview.mdx b/docs/documentation/platform/ldap/overview.mdxindex c3319cd6fc..77640b3257 100644--- a/docs/documentation/platform/ldap/overview.mdx+++ b/docs/documentation/platform/ldap/overview.mdx@@ -23,6 +23,7 @@ LDAP providers:- Active Directory- [JumpCloud LDAP](/documentation/platform/ldap/jumpcloud)+- [Google Workspace Secure LDAP](/documentation/platform/ldap/google-workspace)- AWS Directory Service- Foxpassdiff --git a/docs/images/platform/ldap/google-workspace/ldap-google-workspace-access-permissions.png b/docs/images/platform/ldap/google-workspace/ldap-google-workspace-access-permissions.pngnew file mode 100644index 0000000000..f328b26447Binary files /dev/null and b/docs/images/platform/ldap/google-workspace/ldap-google-workspace-access-permissions.png differdiff --git a/docs/images/platform/ldap/google-workspace/ldap-google-workspace-add-client.png b/docs/images/platform/ldap/google-workspace/ldap-google-workspace-add-client.pngnew file mode 100644index 0000000000..0ad28a4538Binary files /dev/null and b/docs/images/platform/ldap/google-workspace/ldap-google-workspace-add-client.png differdiff --git a/docs/images/platform/ldap/google-workspace/ldap-google-workspace-download-certificate.png b/docs/images/platform/ldap/google-workspace/ldap-google-workspace-download-certificate.pngnew file mode 100644index 0000000000..b65aad0613Binary files /dev/null and b/docs/images/platform/ldap/google-workspace/ldap-google-workspace-download-certificate.png differdiff --git a/docs/images/platform/ldap/google-workspace/ldap-google-workspace-service-status.png b/docs/images/platform/ldap/google-workspace/ldap-google-workspace-service-status.pngnew file mode 100644index 0000000000..b4c61cedc2Binary files /dev/null and b/docs/images/platform/ldap/google-workspace/ldap-google-workspace-service-status.png differdiff --git a/docs/images/platform/ldap/google-workspace/ldap-group-mapping-form.png b/docs/images/platform/ldap/google-workspace/ldap-group-mapping-form.pngnew file mode 100644index 0000000000..f5f395e3f4Binary files /dev/null and b/docs/images/platform/ldap/google-workspace/ldap-group-mapping-form.png differdiff --git a/docs/images/platform/ldap/google-workspace/ldap-group-mapping.png b/docs/images/platform/ldap/google-workspace/ldap-group-mapping.pngnew file mode 100644index 0000000000..9bed170f38Binary files /dev/null and b/docs/images/platform/ldap/google-workspace/ldap-group-mapping.png differdiff --git a/docs/images/platform/ldap/google-workspace/ldap-sso-enabled.png b/docs/images/platform/ldap/google-workspace/ldap-sso-enabled.pngnew file mode 100644index 0000000000..a89dc03f86Binary files /dev/null and b/docs/images/platform/ldap/google-workspace/ldap-sso-enabled.png differdiff --git a/docs/images/platform/ldap/google-workspace/ldap-sso-provider.png b/docs/images/platform/ldap/google-workspace/ldap-sso-provider.pngnew file mode 100644index 0000000000..3f4433374eBinary files /dev/null and b/docs/images/platform/ldap/google-workspace/ldap-sso-provider.png differdiff --git a/frontend/src/hooks/api/ldapConfig/mutations.tsx b/frontend/src/hooks/api/ldapConfig/mutations.tsxindex 0d1c881bcb..970b23ca82 100644--- a/frontend/src/hooks/api/ldapConfig/mutations.tsx+++ b/frontend/src/hooks/api/ldapConfig/mutations.tsx@@ -20,7 +20,9 @@ export const useCreateLDAPConfig = () => {searchFilter,groupSearchBase,groupSearchFilter,- caCert+ caCert,+ clientCertificate,+ clientKeyCertificate}: {organizationId: string;isActive: boolean;@@ -33,6 +35,8 @@ export const useCreateLDAPConfig = () => {groupSearchBase: string;groupSearchFilter: string;caCert?: string;+ clientCertificate?: string;+ clientKeyCertificate?: string;}) => {const { data } = await apiRequest.post("/api/v1/ldap/config", {organizationId,@@ -45,7 +49,9 @@ export const useCreateLDAPConfig = () => {searchFilter,groupSearchBase,groupSearchFilter,- caCert+ caCert,+ clientCertificate,+ clientKeyCertificate});return data;@@ -72,7 +78,9 @@ export const useUpdateLDAPConfig = () => {searchFilter,groupSearchBase,groupSearchFilter,- caCert+ caCert,+ clientCertificate,+ clientKeyCertificate}: {organizationId: string;isActive?: boolean;@@ -85,6 +93,8 @@ export const useUpdateLDAPConfig = () => {groupSearchBase?: string;groupSearchFilter?: string;caCert?: string;+ clientCertificate?: string;+ clientKeyCertificate?: string;}) => {const { data } = await apiRequest.patch("/api/v1/ldap/config", {organizationId,@@ -97,7 +107,9 @@ export const useUpdateLDAPConfig = () => {searchFilter,groupSearchBase,groupSearchFilter,- caCert+ caCert,+ clientCertificate,+ clientKeyCertificate});return data;@@ -161,18 +173,24 @@ export const useTestLDAPConnection = () => {url,bindDN,bindPass,- caCert+ caCert,+ clientCertificate,+ clientKeyCertificate}: {url: string;bindDN: string;bindPass: string;caCert: string;+ clientCertificate?: string;+ clientKeyCertificate?: string;}) => {const { data } = await apiRequest.post<boolean>("/api/v1/ldap/config/test-connection", {url,bindDN,bindPass,- caCert+ caCert,+ clientCertificate,+ clientKeyCertificate});return data;}diff --git a/frontend/src/pages/organization/SettingsPage/components/OrgSsoTab/LDAPModal.tsx b/frontend/src/pages/organization/SettingsPage/components/OrgSsoTab/LDAPModal.tsxindex 44c79e4f42..958487d718 100644--- a/frontend/src/pages/organization/SettingsPage/components/OrgSsoTab/LDAPModal.tsx+++ b/frontend/src/pages/organization/SettingsPage/components/OrgSsoTab/LDAPModal.tsx@@ -1,4 +1,4 @@-import { useEffect } from "react";+import { CSSProperties, useEffect } from "react";import { Controller, useForm } from "react-hook-form";import { zodResolver } from "@hookform/resolvers/zod";import { Trash2 } from "lucide-react";@@ -39,17 +39,28 @@ import {} from "@app/hooks/api";import { UsePopUpState } from "@app/hooks/usePopUp";-const LDAPFormSchema = z.object({- url: z.string().trim().min(1, "URL is required"),- bindDN: z.string().trim().min(1, "Bind DN is required"),- bindPass: z.string().min(1, "Bind Pass is required"),- searchBase: z.string().trim().min(1, "User Search Base is required"),- groupSearchBase: z.string().default(""),- searchFilter: z.string().default(""),- uniqueUserAttribute: z.string().default(""),- groupSearchFilter: z.string().default(""),- caCert: z.string().optional()-});+const LDAPFormSchema = z+ .object({+ url: z.string().trim().min(1, "URL is required"),+ bindDN: z.string().trim().min(1, "Bind DN is required"),+ bindPass: z.string().min(1, "Bind Pass is required"),+ searchBase: z.string().trim().min(1, "User Search Base is required"),+ groupSearchBase: z.string().default(""),+ searchFilter: z.string().default(""),+ uniqueUserAttribute: z.string().default(""),+ groupSearchFilter: z.string().default(""),+ caCert: z.string().optional(),+ clientCertificate: z.string().optional(),+ clientKeyCertificate: z.string().optional()+ })+ .refine(+ (data) =>+ Boolean(data.clientCertificate?.trim()) === Boolean(data.clientKeyCertificate?.trim()),+ {+ message: "Client Certificate and Client Private Key must be provided together for mTLS.",+ path: ["clientKeyCertificate"]+ }+ );export type TLDAPFormData = z.infer<typeof LDAPFormSchema>;@@ -90,7 +101,9 @@ export const LDAPModal = ({ popUp, handlePopUpClose, handlePopUpToggle, hideDeleuniqueUserAttribute: "",groupSearchBase: "",groupSearchFilter: "",- caCert: ""+ caCert: "",+ clientCertificate: "",+ clientKeyCertificate: ""});createNotification({@@ -103,6 +116,8 @@ export const LDAPModal = ({ popUp, handlePopUpClose, handlePopUpToggle, hideDeleconst watchBindDN = watch("bindDN");const watchBindPass = watch("bindPass");const watchCaCert = watch("caCert");+ const watchClientCertificate = watch("clientCertificate");+ const watchClientKeyCertificate = watch("clientKeyCertificate");useEffect(() => {if (data) {@@ -115,6 +130,8 @@ export const LDAPModal = ({ popUp, handlePopUpClose, handlePopUpToggle, hideDelegroupSearchBase: data?.groupSearchBase ?? "",groupSearchFilter: data?.groupSearchFilter ?? "",caCert: data?.caCert ?? "",+ clientCertificate: data?.clientCertificate ?? "",+ clientKeyCertificate: data?.clientKeyCertificate ?? "",uniqueUserAttribute: data?.uniqueUserAttribute ?? ""});}@@ -129,7 +146,9 @@ export const LDAPModal = ({ popUp, handlePopUpClose, handlePopUpToggle, hideDelesearchFilter,groupSearchBase,groupSearchFilter,- caCert+ caCert,+ clientCertificate,+ clientKeyCertificate}: TLDAPFormData) => {if (!currentOrg) return;@@ -145,7 +164,9 @@ export const LDAPModal = ({ popUp, handlePopUpClose, handlePopUpToggle, hideDeleuniqueUserAttribute,groupSearchBase,groupSearchFilter,- caCert+ caCert,+ clientCertificate,+ clientKeyCertificate});} else {await updateMutateAsync({@@ -158,7 +179,9 @@ export const LDAPModal = ({ popUp, handlePopUpClose, handlePopUpToggle, hideDeleuniqueUserAttribute,groupSearchBase,groupSearchFilter,- caCert+ caCert,+ clientCertificate,+ clientKeyCertificate});}@@ -171,30 +194,23 @@ export const LDAPModal = ({ popUp, handlePopUpClose, handlePopUpToggle, hideDele};const handleTestLDAPConnection = async () => {- try {- const isConnected = await testLDAPConnection({- url: watchUrl,- bindDN: watchBindDN,- bindPass: watchBindPass,- caCert: watchCaCert ?? ""- });+ const isConnected = await testLDAPConnection({+ url: watchUrl,+ bindDN: watchBindDN,+ bindPass: watchBindPass,+ caCert: watchCaCert ?? "",+ clientCertificate: watchClientCertificate ?? "",+ clientKeyCertificate: watchClientKeyCertificate ?? ""+ });- if (isConnected) {- createNotification({- text: "Successfully tested the LDAP connection: Bind operation was successful",- type: "success"- });- } else {- createNotification({- text: "Failed to connect to the LDAP server. Verify the URL, bind DN/password, and CA certificate.",- type: "error"- });- }- } catch (err) {+ if (isConnected) {createNotification({- text:- (err as { response?: { data?: { message?: string } } })?.response?.data?.message ??- "Failed to test LDAP connection.",+ text: "Successfully tested the LDAP connection: Bind operation was successful",+ type: "success"+ });+ } else {+ createNotification({+ text: "Failed to connect to the LDAP server. Verify the URL, bind DN/password, and CA certificate.",type: "error"});}@@ -377,7 +393,7 @@ export const LDAPModal = ({ popUp, handlePopUpClose, handlePopUpToggle, hideDelename="caCert"render={({ field, fieldState: { error } }) => (<Field>- <FieldLabel htmlFor="ldap-ca-cert">CA Certificate</FieldLabel>+ <FieldLabel htmlFor="ldap-ca-cert">CA Certificate (Optional)</FieldLabel><TextAreaid="ldap-ca-cert"placeholder="-----BEGIN CERTIFICATE----- ..."@@ -388,6 +404,50 @@ export const LDAPModal = ({ popUp, handlePopUpClose, handlePopUpToggle, hideDele</Field>)}/>+ <Controller+ control={control}+ name="clientCertificate"+ render={({ field, fieldState: { error } }) => (+ <Field>+ <FieldLabel htmlFor="ldap-client-cert">+ Client Certificate (Optional)+ </FieldLabel>+ <TextArea+ id="ldap-client-cert"+ placeholder="-----BEGIN CERTIFICATE----- ..."+ isError={Boolean(error)}+ {...field}+ />+ <FieldError>{error?.message}</FieldError>+ <p className="mt-1 text-xs text-mineshaft-400">+ PEM-encoded client certificate used for mutual TLS (mTLS). Must be set+ together with the Client Private Key.+ </p>+ </Field>+ )}+ />+ <Controller+ control={control}+ name="clientKeyCertificate"+ render={({ field, fieldState: { error } }) => (+ <Field>+ <FieldLabel htmlFor="ldap-client-key">+ Client Private Key (Optional)+ </FieldLabel>+ <TextArea+ id="ldap-client-key"+ placeholder="-----BEGIN PRIVATE KEY----- ..."+ isError={Boolean(error)}+ style={{ WebkitTextSecurity: "disc" } as CSSProperties}+ {...field}+ />+ <FieldError>{error?.message}</FieldError>+ <p className="mt-1 text-xs text-mineshaft-400">+ PEM-encoded private key matching the Client Certificate.+ </p>+ </Field>+ )}+ /></FieldGroup><Buttontype="button"