Skip to content

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

fix: patch server name

Sheen Capadngane3afe954918c
diff --git a/backend/src/ee/services/dynamic-secret/providers/azure-sql-database.ts b/backend/src/ee/services/dynamic-secret/providers/azure-sql-database.ts
index 863dfbd6c7..f2da209370 100644
--- a/backend/src/ee/services/dynamic-secret/providers/azure-sql-database.ts
+++ b/backend/src/ee/services/dynamic-secret/providers/azure-sql-database.ts
@@ -11,6 +11,7 @@ import { getMissingGatewayMessage } from "@app/lib/gateway-v2/gateway-errors";
import { withGatewayV2Proxy } from "@app/lib/gateway-v2/gateway-v2";
import { GatewayProxyProtocol } from "@app/lib/gateway-v2/types";
import { validateHandlebarTemplate } from "@app/lib/template/validate-handlebars";
+import { getTlsServerNameOptions } from "@app/lib/tls";
import { ActorIdentityAttributes } from "../../dynamic-secret-lease/dynamic-secret-lease-types";
import { TGatewayPoolServiceFactory } from "../../gateway-pool/gateway-pool-service";
@@ -149,7 +150,7 @@ export const AzureSqlDatabaseProvider = ({
? {
rejectUnauthorized: providerInputs.sslRejectUnauthorized,
ca: providerInputs.ca,
- servername: providerInputs.originalHost
+ ...getTlsServerNameOptions(providerInputs.originalHost)
}
: undefined;
diff --git a/backend/src/ee/services/dynamic-secret/providers/redis.ts b/backend/src/ee/services/dynamic-secret/providers/redis.ts
index 9860363346..04a56678a8 100644
--- a/backend/src/ee/services/dynamic-secret/providers/redis.ts
+++ b/backend/src/ee/services/dynamic-secret/providers/redis.ts
@@ -7,6 +7,7 @@ import { TDynamicSecrets } from "@app/db/schemas";
import { BadRequestError } from "@app/lib/errors";
import { sanitizeString } from "@app/lib/fn";
import { validateHandlebarTemplate } from "@app/lib/template/validate-handlebars";
+import { getTlsServerNameOptions } from "@app/lib/tls";
import { ActorIdentityAttributes } from "../../dynamic-secret-lease/dynamic-secret-lease-types";
import { verifyHostInputValidity } from "../dynamic-secret-fns";
@@ -79,7 +80,7 @@ export const RedisDatabaseProvider = (): TDynamicProviderFns => {
tls: {
ca: providerInputs.ca,
rejectUnauthorized: providerInputs.sslRejectUnauthorized,
- servername: providerInputs.host
+ ...getTlsServerNameOptions(providerInputs.host)
}
})
});
diff --git a/backend/src/ee/services/dynamic-secret/providers/sql-database.ts b/backend/src/ee/services/dynamic-secret/providers/sql-database.ts
index 19f3fe9226..730dc5bbdd 100644
--- a/backend/src/ee/services/dynamic-secret/providers/sql-database.ts
+++ b/backend/src/ee/services/dynamic-secret/providers/sql-database.ts
@@ -11,6 +11,7 @@ import { getMissingGatewayMessage } from "@app/lib/gateway-v2/gateway-errors";
import { withGatewayV2Proxy } from "@app/lib/gateway-v2/gateway-v2";
import { GatewayProxyProtocol } from "@app/lib/gateway-v2/types";
import { validateHandlebarTemplate } from "@app/lib/template/validate-handlebars";
+import { getTlsServerNameOptions } from "@app/lib/tls";
import { generatePasswordWithConstraints } from "@app/services/secret-validation-rule/secret-validation-rule-password-generator";
import { ActorIdentityAttributes } from "../../dynamic-secret-lease/dynamic-secret-lease-types";
@@ -158,7 +159,7 @@ export const SqlDatabaseProvider = ({
? {
rejectUnauthorized: providerInputs.sslRejectUnauthorized,
ca: providerInputs.ca,
- servername: providerInputs.originalHost
+ ...getTlsServerNameOptions(providerInputs.originalHost)
}
: undefined;
diff --git a/backend/src/ee/services/ldap-config/ldap-fns.ts b/backend/src/ee/services/ldap-config/ldap-fns.ts
index 24b1b3ad26..802bfb2c18 100644
--- a/backend/src/ee/services/ldap-config/ldap-fns.ts
+++ b/backend/src/ee/services/ldap-config/ldap-fns.ts
@@ -1,4 +1,5 @@
import { createPrivateKey, X509Certificate } from "node:crypto";
+import { isIP } from "node:net";
import ldapjs from "@infisical/ldapjs";
@@ -62,7 +63,8 @@ export const buildLdapTlsOptions = (cfg: TLdapTlsConfigInput) => {
// changing TLS handshake behavior for existing non-mTLS configs.
if (cfg.clientCertificate || cfg.clientKeyCertificate) {
try {
- tlsOptions.servername = new URL(cfg.url).hostname;
+ const { hostname } = new URL(cfg.url);
+ if (!isIP(hostname)) tlsOptions.servername = hostname;
} catch {
// Malformed URL — connection itself will surface the error.
}
diff --git a/backend/src/ee/services/pam-discovery/active-directory/active-directory-discovery-factory.ts b/backend/src/ee/services/pam-discovery/active-directory/active-directory-discovery-factory.ts
index 291f2329ea..38fb217c82 100644
--- a/backend/src/ee/services/pam-discovery/active-directory/active-directory-discovery-factory.ts
+++ b/backend/src/ee/services/pam-discovery/active-directory/active-directory-discovery-factory.ts
@@ -8,6 +8,7 @@ import { BadRequestError } from "@app/lib/errors";
import { WinRmRpcEndpoint } from "@app/lib/gateway-v2/winrm-rpc";
import { buildDomainBaseDN, getLdapAttribute, getLdapAttributeBuffer, searchLdap } from "@app/lib/ldap/ldap-search-fns";
import { logger } from "@app/lib/logger";
+import { getTlsServerNameOptions } from "@app/lib/tls";
import { TGatewayV2ServiceFactory } from "../../gateway-v2/gateway-v2-service";
import { PamAccountType } from "../../pam/pam-enums";
@@ -74,7 +75,7 @@ const runLdap = <T>(
...(conn.useLdaps && {
tlsOptions: {
rejectUnauthorized: conn.ldapRejectUnauthorized,
- servername: conn.ldapTlsServerName || conn.dcAddress,
+ ...getTlsServerNameOptions(conn.ldapTlsServerName || conn.dcAddress),
...(conn.ldapCaCert && { ca: [conn.ldapCaCert] })
}
})
diff --git a/backend/src/ee/services/pam-discovery/pam-discovery-fns.ts b/backend/src/ee/services/pam-discovery/pam-discovery-fns.ts
index 63f0356651..4d72488c3c 100644
--- a/backend/src/ee/services/pam-discovery/pam-discovery-fns.ts
+++ b/backend/src/ee/services/pam-discovery/pam-discovery-fns.ts
@@ -6,6 +6,7 @@ import { callPortSweep, callSshExec, SshExecCredentials } from "@app/lib/gateway
import { GatewayFailureKind } from "@app/lib/gateway-v2/test-connection-rpc";
import { GatewayProxyProtocol } from "@app/lib/gateway-v2/types";
import { callWinRmEndpoint, WinRmRpcEndpoint } from "@app/lib/gateway-v2/winrm-rpc";
+import { getTlsServerNameOptions } from "@app/lib/tls";
import { verifyHostInputValidity } from "../dynamic-secret/dynamic-secret-fns";
import { TGatewayV2ServiceFactory } from "../gateway-v2/gateway-v2-service";
@@ -140,7 +141,7 @@ export const ldapBindCheckViaGateway = async (
...(useLdaps && {
tlsOptions: {
rejectUnauthorized,
- servername: tlsServerName || dcAddress,
+ ...getTlsServerNameOptions(tlsServerName || dcAddress),
...(caCert && { ca: [caCert] })
}
})
diff --git a/backend/src/ee/services/pam-discovery/postgres/postgres-discovery-factory.ts b/backend/src/ee/services/pam-discovery/postgres/postgres-discovery-factory.ts
index db6115f7cc..f36dd75922 100644
--- a/backend/src/ee/services/pam-discovery/postgres/postgres-discovery-factory.ts
+++ b/backend/src/ee/services/pam-discovery/postgres/postgres-discovery-factory.ts
@@ -5,6 +5,7 @@ import RE2 from "re2";
import { BadRequestError } from "@app/lib/errors";
import { logger } from "@app/lib/logger";
+import { getTlsServerNameOptions } from "@app/lib/tls";
import { PamAccountType, PamPostgresAuthMethod } from "../../pam/pam-enums";
import { executeWithGateway, sweepReachableTargets } from "../pam-discovery-fns";
@@ -115,7 +116,7 @@ export const postgresDiscoveryFactory: TPamDiscoveryFactory = ({
ssl: account.sslEnabled
? {
rejectUnauthorized: account.sslRejectUnauthorized,
- servername: host,
+ ...getTlsServerNameOptions(host),
...(account.sslCertificate ? { ca: account.sslCertificate } : {})
}
: false
diff --git a/backend/src/ee/services/pki-discovery/pki-discovery-fns.ts b/backend/src/ee/services/pki-discovery/pki-discovery-fns.ts
index 5caa62b989..f8d905764f 100644
--- a/backend/src/ee/services/pki-discovery/pki-discovery-fns.ts
+++ b/backend/src/ee/services/pki-discovery/pki-discovery-fns.ts
@@ -197,7 +197,7 @@ export const scanEndpoint = async (
const certificates: TScanCertificateResult[] = [];
let servername: string | undefined;
- if (sniHostname) {
+ if (sniHostname && !isIpAddress(sniHostname)) {
servername = sniHostname;
} else if (!isIpAddress(host)) {
servername = host;
diff --git a/backend/src/lib/tls/index.ts b/backend/src/lib/tls/index.ts
new file mode 100644
index 0000000000..bb759e4b2a
--- /dev/null
+++ b/backend/src/lib/tls/index.ts
@@ -0,0 +1,12 @@
+import { isIP } from "node:net";
+import tls from "node:tls";
+
+// Node 26 throws when servername is an IP (SNI cannot carry one, RFC 6066). Earlier versions skipped the
+// SNI but still verified the certificate against that IP, so keep the check: many callers dial a local
+// gateway proxy, where Node would otherwise verify against "localhost".
+export const getTlsServerNameOptions = (
+ host?: string
+): Pick<tls.ConnectionOptions, "servername" | "checkServerIdentity"> => {
+ if (!host || !isIP(host)) return { servername: host };
+ return { checkServerIdentity: (_hostname, cert) => tls.checkServerIdentity(host, cert) };
+};
diff --git a/backend/src/lib/validator/safe-request.ts b/backend/src/lib/validator/safe-request.ts
index 7258467eb7..faa792ee67 100644
--- a/backend/src/lib/validator/safe-request.ts
+++ b/backend/src/lib/validator/safe-request.ts
@@ -13,6 +13,7 @@ import { request } from "@app/lib/config/request";
import { logger } from "@app/lib/logger";
import { sanitizeUrlForLog } from "@app/lib/logger/sanitize-url";
import { recordSafeRequestAgentEvictionMetric } from "@app/lib/telemetry/metrics";
+import { getTlsServerNameOptions } from "@app/lib/tls";
import { BadRequestError } from "../errors";
import { isPrivateIp } from "../ip/ipRange";
@@ -260,7 +261,7 @@ const constructAgent = (
...baseOpts,
...(opts.ca !== undefined && { ca: opts.ca }),
...(opts.rejectUnauthorized !== undefined && { rejectUnauthorized: opts.rejectUnauthorized }),
- ...(opts.servername !== undefined && { servername: opts.servername }),
+ ...(opts.servername !== undefined && getTlsServerNameOptions(opts.servername)),
...(opts.checkServerIdentity !== undefined && { checkServerIdentity: opts.checkServerIdentity })
};
return new https.Agent(httpsOpts);
diff --git a/backend/src/services/app-connection/azure-key-vault/azure-key-vault-connection-fns.ts b/backend/src/services/app-connection/azure-key-vault/azure-key-vault-connection-fns.ts
index 8270541235..94c4ef81a6 100644
--- a/backend/src/services/app-connection/azure-key-vault/azure-key-vault-connection-fns.ts
+++ b/backend/src/services/app-connection/azure-key-vault/azure-key-vault-connection-fns.ts
@@ -12,6 +12,7 @@ import { getMissingGatewayMessage } from "@app/lib/gateway-v2/gateway-errors";
import { withGatewayV2Proxy } from "@app/lib/gateway-v2/gateway-v2";
import { GatewayProxyProtocol } from "@app/lib/gateway-v2/types";
import { logger } from "@app/lib/logger";
+import { getTlsServerNameOptions } from "@app/lib/tls";
import { blockLocalAndPrivateIpAddresses } from "@app/lib/validator";
import {
decryptAppConnectionCredentials,
@@ -99,7 +100,7 @@ export const requestWithAzureKeyVaultGateway = async <T>(
},
...(isHttps && {
httpsAgent: new https.Agent({
- servername: targetHost
+ ...getTlsServerNameOptions(targetHost)
})
})
};
diff --git a/backend/src/services/app-connection/f5-big-ip/f5-big-ip-connection-fns.ts b/backend/src/services/app-connection/f5-big-ip/f5-big-ip-connection-fns.ts
index 5574fb7761..260968eb25 100644
--- a/backend/src/services/app-connection/f5-big-ip/f5-big-ip-connection-fns.ts
+++ b/backend/src/services/app-connection/f5-big-ip/f5-big-ip-connection-fns.ts
@@ -7,6 +7,7 @@ import { BadRequestError } from "@app/lib/errors";
import { getMissingGatewayMessage } from "@app/lib/gateway-v2/gateway-errors";
import { withGatewayV2Proxy } from "@app/lib/gateway-v2/gateway-v2";
import { GatewayProxyProtocol } from "@app/lib/gateway-v2/types";
+import { getTlsServerNameOptions } from "@app/lib/tls";
import { blockLocalAndPrivateIpAddresses, buildSsrfSafeAgent } from "@app/lib/validator";
import { AppConnection } from "@app/services/app-connection/app-connection-enums";
@@ -49,7 +50,7 @@ const requestWithF5BigIpGateway = async <T>(
return withGatewayV2Proxy(
async (proxyPort) => {
const httpsAgent = new https.Agent({
- servername: hostname,
+ ...getTlsServerNameOptions(hostname),
rejectUnauthorized: credentials.sslRejectUnauthorized,
ca: credentials.sslCertificate ? [credentials.sslCertificate] : undefined
});
@@ -195,7 +196,7 @@ export const executeF5BigIpOperationWithGateway = async <T>(
return withGatewayV2Proxy(
async (proxyPort) => {
const httpsAgent = new https.Agent({
- servername: hostname,
+ ...getTlsServerNameOptions(hostname),
rejectUnauthorized: credentials.sslRejectUnauthorized,
ca: credentials.sslCertificate ? [credentials.sslCertificate] : undefined
});
diff --git a/backend/src/services/app-connection/github/github-connection-fns.ts b/backend/src/services/app-connection/github/github-connection-fns.ts
index dbd0490153..0f4428c598 100644
--- a/backend/src/services/app-connection/github/github-connection-fns.ts
+++ b/backend/src/services/app-connection/github/github-connection-fns.ts
@@ -13,6 +13,7 @@ import { getMissingGatewayMessage } from "@app/lib/gateway-v2/gateway-errors";
import { withGatewayV2Proxy } from "@app/lib/gateway-v2/gateway-v2";
import { GatewayProxyProtocol } from "@app/lib/gateway-v2/types";
import { logger } from "@app/lib/logger";
+import { getTlsServerNameOptions } from "@app/lib/tls";
import { blockLocalAndPrivateIpAddresses, safeRequest } from "@app/lib/validator";
import { getAppConnectionMethodName } from "@app/services/app-connection/app-connection-fns";
import { TGitHubAppDALFactory } from "@app/services/github-app/github-app-dal";
@@ -230,7 +231,7 @@ export const requestWithGitHubGateway = async <T>(
return withGatewayV2Proxy(
async (proxyPort) => {
const httpsAgent = new https.Agent({
- servername: targetHost
+ ...getTlsServerNameOptions(targetHost)
});
url.protocol = "https:";
diff --git a/backend/src/services/app-connection/hc-vault/hc-vault-connection-fns.ts b/backend/src/services/app-connection/hc-vault/hc-vault-connection-fns.ts
index 2fc1945b14..a81c200436 100644
--- a/backend/src/services/app-connection/hc-vault/hc-vault-connection-fns.ts
+++ b/backend/src/services/app-connection/hc-vault/hc-vault-connection-fns.ts
@@ -12,6 +12,7 @@ import { getMissingGatewayMessage } from "@app/lib/gateway-v2/gateway-errors";
import { withGatewayV2Proxy } from "@app/lib/gateway-v2/gateway-v2";
import { GatewayProxyProtocol } from "@app/lib/gateway-v2/types";
import { logger } from "@app/lib/logger";
+import { getTlsServerNameOptions } from "@app/lib/tls";
import { blockLocalAndPrivateIpAddresses } from "@app/lib/validator";
import { AppConnection } from "@app/services/app-connection/app-connection-enums";
@@ -209,7 +210,7 @@ export const requestWithHCVaultGateway = async <T>(
},
...(isHttps && {
httpsAgent: new https.Agent({
- servername: targetHost
+ ...getTlsServerNameOptions(targetHost)
})
})
};
diff --git a/backend/src/services/app-connection/kemp-loadmaster/kemp-loadmaster-connection-fns.ts b/backend/src/services/app-connection/kemp-loadmaster/kemp-loadmaster-connection-fns.ts
index c9db00349a..9188c5a977 100644
--- a/backend/src/services/app-connection/kemp-loadmaster/kemp-loadmaster-connection-fns.ts
+++ b/backend/src/services/app-connection/kemp-loadmaster/kemp-loadmaster-connection-fns.ts
@@ -8,6 +8,7 @@ import { request } from "@app/lib/config/request";
import { BadRequestError } from "@app/lib/errors";
import { withGatewayV2Proxy } from "@app/lib/gateway-v2/gateway-v2";
import { GatewayProxyProtocol } from "@app/lib/gateway-v2/types";
+import { getTlsServerNameOptions } from "@app/lib/tls";
import { safeRequest } from "@app/lib/validator";
import { AppConnection } from "@app/services/app-connection/app-connection-enums";
@@ -87,7 +88,7 @@ export const executeKempLoadMasterOperationWithGateway = async <T>(
return withGatewayV2Proxy(
async (proxyPort) => {
const httpsAgent = new https.Agent({
- servername: hostname,
+ ...getTlsServerNameOptions(hostname),
rejectUnauthorized: credentials.sslRejectUnauthorized,
ca: credentials.sslCertificate ? [credentials.sslCertificate] : undefined
});
diff --git a/backend/src/services/app-connection/ldap/ldap-connection-fns.ts b/backend/src/services/app-connection/ldap/ldap-connection-fns.ts
index a2b7337ef0..f31d87c528 100644
--- a/backend/src/services/app-connection/ldap/ldap-connection-fns.ts
+++ b/backend/src/services/app-connection/ldap/ldap-connection-fns.ts
@@ -9,6 +9,7 @@ import { BadRequestError } from "@app/lib/errors";
import { withGatewayV2Proxy } from "@app/lib/gateway-v2/gateway-v2";
import { GatewayProxyProtocol } from "@app/lib/gateway-v2/types";
import { logger } from "@app/lib/logger";
+import { getTlsServerNameOptions } from "@app/lib/tls";
import { blockLocalAndPrivateIpAddresses } from "@app/lib/validator";
import { AppConnection } from "@app/services/app-connection/app-connection-enums";
@@ -264,7 +265,7 @@ export const executeWithPotentialGateway = async <T>(
? {
rejectUnauthorized: config.credentials.sslRejectUnauthorized,
ca: config.credentials.sslCertificate ? [config.credentials.sslCertificate] : undefined,
- servername: host,
+ ...getTlsServerNameOptions(host),
// bypass hostname verification for development
...(appCfg.isDevelopmentMode ? { checkServerIdentity: () => undefined } : {})
}
diff --git a/backend/src/services/app-connection/netscaler/netscaler-connection-fns.ts b/backend/src/services/app-connection/netscaler/netscaler-connection-fns.ts
index 58f6d09ae2..3e2c7924e2 100644
--- a/backend/src/services/app-connection/netscaler/netscaler-connection-fns.ts
+++ b/backend/src/services/app-connection/netscaler/netscaler-connection-fns.ts
@@ -7,6 +7,7 @@ import { BadRequestError } from "@app/lib/errors";
import { getMissingGatewayMessage } from "@app/lib/gateway-v2/gateway-errors";
import { withGatewayV2Proxy } from "@app/lib/gateway-v2/gateway-v2";
import { GatewayProxyProtocol } from "@app/lib/gateway-v2/types";
+import { getTlsServerNameOptions } from "@app/lib/tls";
import { blockLocalAndPrivateIpAddresses } from "@app/lib/validator";
import { AppConnection } from "@app/services/app-connection/app-connection-enums";
@@ -56,7 +57,7 @@ const requestWithNetScalerGateway = async <T>(
return withGatewayV2Proxy(
async (proxyPort) => {
const httpsAgent = new https.Agent({
- servername: hostname,
+ ...getTlsServerNameOptions(hostname),
rejectUnauthorized: credentials.sslRejectUnauthorized,
ca: credentials.sslCertificate ? [credentials.sslCertificate] : undefined
});
@@ -179,7 +180,7 @@ export const executeNetScalerOperationWithGateway = async <T>(
return withGatewayV2Proxy(
async (proxyPort) => {
const httpsAgent = new https.Agent({
- servername: hostname,
+ ...getTlsServerNameOptions(hostname),
rejectUnauthorized: credentials.sslRejectUnauthorized,
ca: credentials.sslCertificate ? [credentials.sslCertificate] : undefined
});
diff --git a/backend/src/services/app-connection/nutanix-prism-central/nutanix-prism-central-connection-fns.ts b/backend/src/services/app-connection/nutanix-prism-central/nutanix-prism-central-connection-fns.ts
index 7abf9e7153..0a62e61db6 100644
--- a/backend/src/services/app-connection/nutanix-prism-central/nutanix-prism-central-connection-fns.ts
+++ b/backend/src/services/app-connection/nutanix-prism-central/nutanix-prism-central-connection-fns.ts
@@ -7,6 +7,7 @@ import { request } from "@app/lib/config/request";
import { BadRequestError } from "@app/lib/errors";
import { withGatewayV2Proxy } from "@app/lib/gateway-v2/gateway-v2";
import { GatewayProxyProtocol } from "@app/lib/gateway-v2/types";
+import { getTlsServerNameOptions } from "@app/lib/tls";
import { blockLocalAndPrivateIpAddresses, buildSsrfSafeAgent } from "@app/lib/validator";
import { AppConnection } from "@app/services/app-connection/app-connection-enums";
@@ -83,7 +84,7 @@ export const executeNutanixOperationWithGateway = async <T>(
return withGatewayV2Proxy(
async (proxyPort) => {
const httpsAgent = new https.Agent({
- servername: hostname,
+ ...getTlsServerNameOptions(hostname),
rejectUnauthorized: credentials.sslRejectUnauthorized,
ca: credentials.sslCertificate ? [credentials.sslCertificate] : undefined
});
diff --git a/backend/src/services/app-connection/shared/sql/sql-connection-fns.ts b/backend/src/services/app-connection/shared/sql/sql-connection-fns.ts
index ad6b35c597..ad9dd569cd 100644
--- a/backend/src/services/app-connection/shared/sql/sql-connection-fns.ts
+++ b/backend/src/services/app-connection/shared/sql/sql-connection-fns.ts
@@ -15,6 +15,7 @@ import { getMissingGatewayMessage } from "@app/lib/gateway-v2/gateway-errors";
import { withGatewayV2Proxy } from "@app/lib/gateway-v2/gateway-v2";
import { GatewayProxyProtocol } from "@app/lib/gateway-v2/types";
import { alphaNumericNanoId } from "@app/lib/nanoid";
+import { getTlsServerNameOptions } from "@app/lib/tls";
import { AppConnection } from "@app/services/app-connection/app-connection-enums";
import { TAppConnectionRaw, TSqlConnection } from "@app/services/app-connection/app-connection-types";
import { TSqlConnectionConfig } from "@app/services/app-connection/shared/sql/sql-connection-types";
@@ -46,7 +47,7 @@ export const getConnectionConfig = ({
? {
rejectUnauthorized: sslRejectUnauthorized,
ca: sslCertificate,
- servername: host
+ ...getTlsServerNameOptions(host)
}
: false
};
diff --git a/backend/src/services/app-connection/venafi-tpp/venafi-tpp-connection-fns.ts b/backend/src/services/app-connection/venafi-tpp/venafi-tpp-connection-fns.ts
index f33ee73907..4a6386ea95 100644
--- a/backend/src/services/app-connection/venafi-tpp/venafi-tpp-connection-fns.ts
+++ b/backend/src/services/app-connection/venafi-tpp/venafi-tpp-connection-fns.ts
@@ -9,6 +9,7 @@ import { BadRequestError } from "@app/lib/errors";
import { withGatewayV2Proxy } from "@app/lib/gateway-v2/gateway-v2";
import { GatewayProxyProtocol } from "@app/lib/gateway-v2/types";
import { logger } from "@app/lib/logger";
+import { getTlsServerNameOptions } from "@app/lib/tls";
import { blockLocalAndPrivateIpAddresses } from "@app/lib/validator/validate-url";
import { AppConnection } from "@app/services/app-connection/app-connection-enums";
@@ -87,7 +88,7 @@ export const requestWithVenafiTppGateway = async <T>(
},
...(isHttps && {
httpsAgent: new https.Agent({
- servername: targetHost
+ ...getTlsServerNameOptions(targetHost)
})
})
};
diff --git a/backend/src/services/external-migration/external-migration-fns/vault.ts b/backend/src/services/external-migration/external-migration-fns/vault.ts
index 1f425c1163..b033008454 100644
--- a/backend/src/services/external-migration/external-migration-fns/vault.ts
+++ b/backend/src/services/external-migration/external-migration-fns/vault.ts
@@ -9,6 +9,7 @@ import { getMissingGatewayMessage } from "@app/lib/gateway-v2/gateway-errors";
import { withGatewayV2Proxy } from "@app/lib/gateway-v2/gateway-v2";
import { GatewayProxyProtocol } from "@app/lib/gateway-v2/types";
import { logger } from "@app/lib/logger";
+import { getTlsServerNameOptions } from "@app/lib/tls";
import { blockLocalAndPrivateIpAddresses, isValidFolderName } from "@app/lib/validator";
import { convertVaultValueToString, JsonValue } from "../../app-connection/hc-vault";
@@ -45,7 +46,7 @@ const vaultFactory = (gatewayV2Service: Pick<TGatewayV2ServiceFactory, "getPlatf
}
const isHttps = targetProtocol === "https";
- const httpsAgent = isHttps ? new https.Agent({ servername: targetHostname }) : undefined;
+ const httpsAgent = isHttps ? new https.Agent(getTlsServerNameOptions(targetHostname)) : undefined;
return withGatewayV2Proxy(
async (port) => gatewayCallback(`${targetProtocol}://localhost`, port, httpsAgent, targetHostname),