mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-09-22 13:39:35 +00:00
fix: gateway improvements
This commit is contained in:
@@ -7,6 +7,7 @@ import https from "https";
|
|||||||
import { verifyHostInputValidity } from "@app/ee/services/dynamic-secret/dynamic-secret-fns";
|
import { verifyHostInputValidity } from "@app/ee/services/dynamic-secret/dynamic-secret-fns";
|
||||||
import { splitPemChain } from "@app/services/certificate/certificate-fns";
|
import { splitPemChain } from "@app/services/certificate/certificate-fns";
|
||||||
|
|
||||||
|
import { getConfig } from "../config/env";
|
||||||
import { BadRequestError } from "../errors";
|
import { BadRequestError } from "../errors";
|
||||||
import { GatewayProxyProtocol } from "../gateway/types";
|
import { GatewayProxyProtocol } from "../gateway/types";
|
||||||
import { logger } from "../logger";
|
import { logger } from "../logger";
|
||||||
@@ -80,6 +81,8 @@ const createGatewayConnection = async (
|
|||||||
gateway: { clientCertificate: string; clientPrivateKey: string; serverCertificateChain: string },
|
gateway: { clientCertificate: string; clientPrivateKey: string; serverCertificateChain: string },
|
||||||
protocol: GatewayProxyProtocol
|
protocol: GatewayProxyProtocol
|
||||||
): Promise<net.Socket> => {
|
): Promise<net.Socket> => {
|
||||||
|
const appCfg = getConfig();
|
||||||
|
|
||||||
const protocolToAlpn = {
|
const protocolToAlpn = {
|
||||||
[GatewayProxyProtocol.Http]: "infisical-http-proxy",
|
[GatewayProxyProtocol.Http]: "infisical-http-proxy",
|
||||||
[GatewayProxyProtocol.Tcp]: "infisical-tcp-proxy",
|
[GatewayProxyProtocol.Tcp]: "infisical-tcp-proxy",
|
||||||
@@ -94,7 +97,8 @@ const createGatewayConnection = async (
|
|||||||
minVersion: "TLSv1.2",
|
minVersion: "TLSv1.2",
|
||||||
maxVersion: "TLSv1.3",
|
maxVersion: "TLSv1.3",
|
||||||
rejectUnauthorized: true,
|
rejectUnauthorized: true,
|
||||||
ALPNProtocols: [protocolToAlpn[protocol]]
|
ALPNProtocols: [protocolToAlpn[protocol]],
|
||||||
|
checkServerIdentity: appCfg.isDevelopmentMode ? () => undefined : tls.checkServerIdentity
|
||||||
};
|
};
|
||||||
|
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
|
|||||||
@@ -719,7 +719,8 @@ export const identityKubernetesAuthServiceFactory = ({
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const shouldUpdateGatewayId = Boolean(gatewayId);
|
// Strict check to see if gateway ID is undefined. It should update the gateway ID to null if its strictly set to null.
|
||||||
|
const shouldUpdateGatewayId = Boolean(gatewayId !== undefined);
|
||||||
const gatewayIdValue = isGatewayV1 ? gatewayId : null;
|
const gatewayIdValue = isGatewayV1 ? gatewayId : null;
|
||||||
const gatewayV2IdValue = isGatewayV1 ? null : gatewayId;
|
const gatewayV2IdValue = isGatewayV1 ? null : gatewayId;
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
{{- if and .Values.serviceAccount.createAsAuthDelegator .Values.serviceAccount.create -}}
|
||||||
|
apiVersion: rbac.authorization.k8s.io/v1
|
||||||
|
kind: ClusterRoleBinding
|
||||||
|
metadata:
|
||||||
|
name: {{ include "infisical-gateway.serviceAccountName" . }}-system-auth-delegator-cluster-rolebinding
|
||||||
|
roleRef:
|
||||||
|
apiGroup: rbac.authorization.k8s.io
|
||||||
|
kind: ClusterRole
|
||||||
|
name: system:auth-delegator
|
||||||
|
subjects:
|
||||||
|
- kind: ServiceAccount
|
||||||
|
name: {{ include "infisical-gateway.serviceAccountName" . }}
|
||||||
|
namespace: {{ .Release.Namespace }}
|
||||||
|
{{- end }}
|
||||||
@@ -2,6 +2,7 @@
|
|||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
kind: ServiceAccount
|
kind: ServiceAccount
|
||||||
metadata:
|
metadata:
|
||||||
|
namespace: {{ .Release.Namespace }}
|
||||||
name: {{ include "infisical-gateway.serviceAccountName" . }}
|
name: {{ include "infisical-gateway.serviceAccountName" . }}
|
||||||
labels:
|
labels:
|
||||||
{{- include "infisical-gateway.labels" . | nindent 4 }}
|
{{- include "infisical-gateway.labels" . | nindent 4 }}
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ fullnameOverride: ""
|
|||||||
serviceAccount:
|
serviceAccount:
|
||||||
create: true
|
create: true
|
||||||
automount: true
|
automount: true
|
||||||
|
createAsAuthDelegator: true
|
||||||
annotations: {}
|
annotations: {}
|
||||||
name: ""
|
name: ""
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user