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(pki-discovery): surface ALLOW_INTERNAL_IP_CONNECTIONS for internal IP scans (#6157)
Saif Ur Rahman97c66a824e57
diff --git a/backend/src/ee/services/pki-discovery/pki-discovery-fns.ts b/backend/src/ee/services/pki-discovery/pki-discovery-fns.tsindex 8cdcd0429a..5caa62b989 100644--- a/backend/src/ee/services/pki-discovery/pki-discovery-fns.ts+++ b/backend/src/ee/services/pki-discovery/pki-discovery-fns.ts@@ -103,18 +103,23 @@ export const validateTargetConfig = (const singleIps = ipRanges.filter((r) => !r.includes("/"));if (shouldBlockPrivateIps(!!hasGateway)) {+ const appCfg = getConfig();+ const selfHostedHint = appCfg.isCloud+ ? ""+ : " If you are self-hosting, you can alternatively set the 'ALLOW_INTERNAL_IP_CONNECTIONS' environment variable to 'true' on your instance to scan private networks without a gateway.";+const privateIp = singleIps.find((ip) => isPrivateIp(ip));if (privateIp) {return {valid: false,- error: "Private/internal IP addresses require a gateway. Use a gateway to scan private networks."+ error: `Private/internal IP addresses require a gateway. Use a gateway to scan private networks.${selfHostedHint}`};}const privateCidr = cidrRanges.find((cidr) => isPrivateIp(cidr.split("/")[0]));if (privateCidr) {return {valid: false,- error: "Private/internal CIDR ranges require a gateway. Use a gateway to scan private networks."+ error: `Private/internal CIDR ranges require a gateway. Use a gateway to scan private networks.${selfHostedHint}`};}}diff --git a/docs/documentation/platform/pki/discovery/network.mdx b/docs/documentation/platform/pki/discovery/network.mdxindex 44aba032d4..247361e15a 100644--- a/docs/documentation/platform/pki/discovery/network.mdx+++ b/docs/documentation/platform/pki/discovery/network.mdx@@ -5,6 +5,10 @@ description: "Learn how to configure a Network discovery job to find certificateNetwork discovery scans network endpoints over TLS to discover certificates served by hosts across IP ranges and domains. Optionally, you can use an [Infisical Gateway](/documentation/platform/gateways/overview) to reach endpoints in private networks that are not accessible from the internet.+<Note>+ If you are self-hosting Infisical, you can alternatively set the [`ALLOW_INTERNAL_IP_CONNECTIONS`](/self-hosting/configuration/envars#param-allow-internal-ip-connections) environment variable to `true` on your instance to scan private networks directly without a gateway.+</Note>+<Tabs><Tab title="Infisical UI">1. Navigate to your Certificate Management Project > **Discovery** and press **Add Job**.diff --git a/docs/self-hosting/configuration/envars.mdx b/docs/self-hosting/configuration/envars.mdxindex 4d563a2748..8f3af8336f 100644--- a/docs/self-hosting/configuration/envars.mdx+++ b/docs/self-hosting/configuration/envars.mdx@@ -55,8 +55,8 @@ Example values:default="false"optional>- Determines whether App Connections and Dynamic Secrets are permitted to- connect with internal/private IP addresses.+ Determines whether App Connections, Dynamic Secrets, and PKI Certificate+ Discovery jobs are permitted to connect with internal/private IP addresses.</ParamField><ParamFielddiff --git a/frontend/src/pages/cert-manager/DiscoveryPage/components/DiscoveryJobModal.tsx b/frontend/src/pages/cert-manager/DiscoveryPage/components/DiscoveryJobModal.tsxindex b7585ccc7c..6e9abe6b1f 100644--- a/frontend/src/pages/cert-manager/DiscoveryPage/components/DiscoveryJobModal.tsx+++ b/frontend/src/pages/cert-manager/DiscoveryPage/components/DiscoveryJobModal.tsx@@ -15,6 +15,7 @@ import {Switch,TextArea} from "@app/components/v2";+import { isInfisicalCloud } from "@app/helpers/platform";import {gatewaysQueryKeys,PkiDiscoveryType,@@ -407,7 +408,26 @@ export const DiscoveryJobModal = ({ isOpen, onClose, projectId, discovery }: Prorender={({ field }) => (<FormControllabel="Gateway"- tooltipText="Use a gateway to discover certificates on private networks that are not directly accessible from the internet. The gateway acts as a proxy, routing scan traffic through your infrastructure."+ tooltipClassName="max-w-lg py-3"+ tooltipText={+ <div className="flex flex-col gap-3">+ <p>+ Use a gateway to discover certificates on private networks that are not+ directly accessible from the internet. The gateway acts as a proxy, routing+ scan traffic through your infrastructure.+ </p>+ {!isInfisicalCloud() && (+ <p>+ Alternatively, you can set the{" "}+ <span className="font-medium text-bunker-200">+ ALLOW_INTERNAL_IP_CONNECTIONS+ </span>{" "}+ environment variable to <span className="font-medium">true</span> on your+ instance to scan private networks directly without a gateway.+ </p>+ )}+ </div>+ }><Selectvalue={field.value}