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
misc: removed gateway v1
Sheen Capadnganc44090bf6fa1
diff --git a/backend/src/ee/routes/v1/gateway-router.ts b/backend/src/ee/routes/v1/gateway-router.tsdeleted file mode 100644index a77180e40c..0000000000--- a/backend/src/ee/routes/v1/gateway-router.ts+++ /dev/null@@ -1,295 +0,0 @@-import { z } from "zod";--import { GatewaysSchema } from "@app/db/schemas";-import { isValidIp } from "@app/lib/ip";-import { logger } from "@app/lib/logger";-import { readLimit, writeLimit } from "@app/server/config/rateLimiter";-import { slugSchema } from "@app/server/lib/schemas";-import { getTelemetryDistinctId } from "@app/server/lib/telemetry";-import { verifyAuth } from "@app/server/plugins/auth/verify-auth";-import { AuthMode } from "@app/services/auth/auth-type";-import { PostHogEventTypes } from "@app/services/telemetry/telemetry-types";--const SanitizedGatewaySchema = GatewaysSchema.pick({- id: true,- identityId: true,- name: true,- createdAt: true,- updatedAt: true,- issuedAt: true,- serialNumber: true,- heartbeat: true-});--const isValidRelayAddress = (relayAddress: string) => {- const [ip, port] = relayAddress.split(":");- return isValidIp(ip) && Number(port) <= 65535 && Number(port) >= 40000;-};--export const registerGatewayRouter = async (server: FastifyZodProvider) => {- server.route({- method: "POST",- url: "/register-identity",- config: {- rateLimit: writeLimit- },- schema: {- response: {- 200: z.object({- turnServerUsername: z.string(),- turnServerPassword: z.string(),- turnServerRealm: z.string(),- turnServerAddress: z.string(),- infisicalStaticIp: z.string().optional()- })- }- },- onRequest: verifyAuth([AuthMode.IDENTITY_ACCESS_TOKEN]),- handler: async (req) => {- const relayDetails = await server.services.gateway.getGatewayRelayDetails(- req.permission.id,- req.permission.orgId,- req.permission.authMethod- );- return relayDetails;- }- });-- server.route({- method: "POST",- url: "/exchange-cert",- config: {- rateLimit: writeLimit- },- schema: {- body: z.object({- relayAddress: z.string().refine(isValidRelayAddress, { message: "Invalid relay address" })- }),- response: {- 200: z.object({- serialNumber: z.string(),- privateKey: z.string(),- certificate: z.string(),- certificateChain: z.string()- })- }- },- onRequest: verifyAuth([AuthMode.IDENTITY_ACCESS_TOKEN]),- handler: async (req) => {- const gatewayCertificates = await server.services.gateway.exchangeAllocatedRelayAddress({- identityOrg: req.permission.orgId,- identityId: req.permission.id,- relayAddress: req.body.relayAddress,- identityOrgAuthMethod: req.permission.authMethod- });-- void server.services.telemetry- .sendPostHogEvents({- event: PostHogEventTypes.GatewayCertExchanged,- distinctId: getTelemetryDistinctId(req),- organizationId: req.permission.orgId,- properties: {- certificateSerialNumber: gatewayCertificates.serialNumber,- identityId: req.permission.id,- orgId: req.permission.orgId- }- })- .catch((err) => logger.error(err, "Failed to send GatewayCertExchanged telemetry event"));-- return gatewayCertificates;- }- });-- server.route({- method: "POST",- url: "/heartbeat",- config: {- rateLimit: writeLimit- },- schema: {- response: {- 200: z.object({- message: z.string()- })- }- },- onRequest: verifyAuth([AuthMode.IDENTITY_ACCESS_TOKEN]),- handler: async (req) => {- await server.services.gateway.heartbeat({- orgPermission: req.permission- });- return { message: "Successfully registered heartbeat" };- }- });-- server.route({- method: "GET",- url: "/",- config: {- rateLimit: readLimit- },- schema: {- querystring: z.object({- projectId: z.string().optional()- }),- response: {- 200: z.object({- gateways: SanitizedGatewaySchema.extend({- identity: z.object({- name: z.string(),- id: z.string()- })- }).array()- })- }- },- onRequest: verifyAuth([AuthMode.IDENTITY_ACCESS_TOKEN, AuthMode.JWT]),- handler: async (req) => {- const gateways = await server.services.gateway.listGateways({- orgPermission: req.permission- });- return { gateways };- }- });-- server.route({- method: "GET",- url: "/projects/:projectId",- config: {- rateLimit: readLimit- },- schema: {- params: z.object({- projectId: z.string()- }),- response: {- 200: z.object({- gateways: SanitizedGatewaySchema.extend({- identity: z.object({- name: z.string(),- id: z.string()- })- }).array()- })- }- },- onRequest: verifyAuth([AuthMode.IDENTITY_ACCESS_TOKEN, AuthMode.JWT]),- handler: async (req) => {- const gateways = await server.services.gateway.listGateways({- orgPermission: req.permission- });- return { gateways };- }- });-- server.route({- method: "GET",- url: "/:id",- config: {- rateLimit: readLimit- },- schema: {- params: z.object({- id: z.string()- }),- response: {- 200: z.object({- gateway: SanitizedGatewaySchema.extend({- identity: z.object({- name: z.string(),- id: z.string()- })- })- })- }- },- onRequest: verifyAuth([AuthMode.IDENTITY_ACCESS_TOKEN, AuthMode.JWT]),- handler: async (req) => {- const gateway = await server.services.gateway.getGatewayById({- orgPermission: req.permission,- id: req.params.id- });- return { gateway };- }- });-- server.route({- method: "PATCH",- url: "/:id",- config: {- rateLimit: writeLimit- },- schema: {- params: z.object({- id: z.string()- }),- body: z.object({- name: slugSchema({ field: "name" }).optional()- }),- response: {- 200: z.object({- gateway: SanitizedGatewaySchema- })- }- },- onRequest: verifyAuth([AuthMode.IDENTITY_ACCESS_TOKEN, AuthMode.JWT]),- handler: async (req) => {- const gateway = await server.services.gateway.updateGatewayById({- orgPermission: req.permission,- id: req.params.id,- name: req.body.name- });-- void server.services.telemetry- .sendPostHogEvents({- event: PostHogEventTypes.GatewayUpdated,- distinctId: getTelemetryDistinctId(req),- organizationId: req.permission.orgId,- properties: {- gatewayId: gateway.id- }- })- .catch(() => {});-- return { gateway };- }- });-- server.route({- method: "DELETE",- url: "/:id",- config: {- rateLimit: writeLimit- },- schema: {- params: z.object({- id: z.string()- }),- response: {- 200: z.object({- gateway: SanitizedGatewaySchema- })- }- },- onRequest: verifyAuth([AuthMode.IDENTITY_ACCESS_TOKEN, AuthMode.JWT]),- handler: async (req) => {- const gateway = await server.services.gateway.deleteGatewayById({- orgPermission: req.permission,- id: req.params.id- });-- void server.services.telemetry- .sendPostHogEvents({- event: PostHogEventTypes.GatewayDeleted,- distinctId: getTelemetryDistinctId(req),- organizationId: req.permission.orgId,- properties: {- gatewayId: gateway.id- }- })- .catch(() => {});-- return { gateway };- }- });-};diff --git a/backend/src/ee/routes/v1/index.ts b/backend/src/ee/routes/v1/index.tsindex e01b59e78e..d580356b72 100644--- a/backend/src/ee/routes/v1/index.ts+++ b/backend/src/ee/routes/v1/index.ts@@ -19,7 +19,6 @@ import { registerEmailDomainRouter } from "./email-domain-router";import { registerExternalKmsRouter } from "./external-kms-router";import { EXTERNAL_KMS_REGISTER_ROUTER_MAP } from "./external-kms-routers";import { registerGatewayPoolRouter } from "./gateway-pool-router";-import { registerGatewayRouter } from "./gateway-router";import { registerGithubOrgSyncRouter } from "./github-org-sync-router";import { registerGroupRouter } from "./group-router";import { registerHoneyTokenRouter } from "./honey-token-router";@@ -120,7 +119,6 @@ export const registerV1EERoutes = async (server: FastifyZodProvider) => {{ prefix: "/dynamic-secrets" });- await server.register(registerGatewayRouter, { prefix: "/gateways" });await server.register(registerGatewayPoolRouter, { prefix: "/gateway-pools" });await server.register(registerRelayRouter, { prefix: "/relays" });await server.register(registerGithubOrgSyncRouter, { prefix: "/github-org-sync-config" });diff --git a/docs/cli/commands/gateway.mdx b/docs/cli/commands/gateway.mdxindex ef4e3f2ea0..cc38e67e2f 100644--- a/docs/cli/commands/gateway.mdx+++ b/docs/cli/commands/gateway.mdx@@ -22,13 +22,6 @@ The Infisical gateway provides secure access to private resources using modern TThe gateway system uses SSH reverse tunnels over TCP, eliminating firewall complexity and providing excellent performance for enterprise environments.-<Warning>-**Deprecation and Migration Notice:** The legacy `infisical gateway` command (v1) will be removed in a future release. Please migrate to `infisical gateway start` (Gateway v2).--If you are moving from Gateway v1 to Gateway v2, this is NOT a drop-in switch. Gateway v2 creates new gateway instances with new gateway IDs. You must update any existing resources that reference gateway IDs (for example: dynamic secret configs, app connections, or other gateway-bound resources) to point to the new Gateway v2 gateway resource. Until you update those references, traffic will continue to target the old v1 gateway.--</Warning>-## Subcommands & flags<AccordionGroup>@@ -201,88 +194,7 @@ sudo systemctl disable my-gateway # Disable auto-start on bootsudo infisical gateway systemd uninstall my-gateway```-The gateway name is provided as a positional argument. If no service matching the gateway name is found, it will fall back to removing a legacy `infisical-gateway` service if one exists.--</Accordion>-</AccordionGroup>--## Legacy Gateway Commands--<AccordionGroup>-<Accordion title="infisical gateway (deprecated)">- <Warning>- **This command is deprecated and will be removed in a future release.**-- Please migrate to `infisical gateway start` for the new TCP-based SSH tunnel architecture.--**Migration required:** If you are currently using Gateway v1 (via `infisical gateway`), moving to Gateway v2 is not in-place. Gateway v2 provisions new gateway instances with new gateway IDs. Update any resources that reference a gateway ID (for example: dynamic secret configs, app connections, or other gateway-bound resources) to use the new Gateway v2 gateway ID. Until you update those references, traffic will continue to target the old v1 gateway.-- </Warning>--Run the legacy Infisical gateway in the foreground. The gateway will connect to the relay service and maintain a persistent connection.--```bash-infisical gateway --domain=<domain> --auth-method=<auth-method>-```--### Other Flags-- <AccordionGroup>- <Accordion title="--domain">- Domain of your self-hosted Infisical instance.-- ```bash- # Example- infisical gateway --domain=https://app.your-domain.com- ```-- </Accordion>- </AccordionGroup>-</Accordion>--<Accordion title="infisical gateway install (deprecated)">- <Warning>- **This command is deprecated and will be removed in a future release.**-- Please migrate to `infisical gateway systemd install` for the new TCP-based SSH tunnel architecture with enhanced security and better performance.--**Migration required:** If you previously installed Gateway v1 via `infisical gateway install`, moving to Gateway v2 is not in-place. Gateway v2 provisions new gateway instances with new gateway IDs. Update any resources that reference a gateway ID (for example: dynamic secret configs, app connections, or other gateway-bound resources) to use the new Gateway v2 gateway ID. Until you update those references, traffic will continue to target the old v1 gateway.-- </Warning>--Install and enable the legacy gateway as a systemd service. This command must be run with sudo on Linux.--```bash-sudo infisical gateway install --token=<token> --domain=<domain>-```--### Requirements--- Must be run on Linux-- Must be run with root/sudo privileges-- Requires systemd--### Service Details--The systemd service is installed with secure defaults:--- Service file: `/etc/systemd/system/infisical-gateway.service`-- Config file: `/etc/infisical/gateway.conf`-- Runs with restricted privileges:- - InaccessibleDirectories=/home- - PrivateTmp=yes- - Resource limits configured for stability-- Automatically restarts on failure-- Enabled to start on boot--After installation, manage the service with standard systemd commands:--```bash-sudo systemctl start infisical-gateway # Start the service-sudo systemctl stop infisical-gateway # Stop the service-sudo systemctl status infisical-gateway # Check service status-sudo systemctl disable infisical-gateway # Disable auto-start on boot-```+The gateway name is provided as a positional argument.</Accordion></AccordionGroup>