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): add PowerDNS as a DNS-01 provider for ACME certificate authorities
Carlos Monastyrski78884ac118b4
diff --git a/backend/src/keystore/keystore.ts b/backend/src/keystore/keystore.tsindex a3d8072b1b..5b506b7b05 100644--- a/backend/src/keystore/keystore.ts+++ b/backend/src/keystore/keystore.ts@@ -63,6 +63,8 @@ export const KeyStorePrefixes = {`app-connection-concurrency-${connectionId}${targetHost ? `-${targetHost.toLowerCase()}` : ""}` as const,AppConnectionCommandLock: (connectionId: string, targetHost?: string) =>`app-connection-command-mutex-${connectionId}${targetHost ? `-${targetHost.toLowerCase()}` : ""}` as const,+ AcmeDnsRecordLock: (connectionId: string, zoneId: string, recordName: string) =>+ `acme-dns-record-mutex-${connectionId}-${zoneId.toLowerCase()}-${recordName.toLowerCase()}` as const,LdapHostLogin: (fingerprint: string) => `ldap-host-login-${fingerprint}` as const,LdapDirectoryMachines: (connectionId: string, search: string, limit: number) =>`ldap-directory-machines-${connectionId}-${limit}-${search}` as const,diff --git a/backend/src/server/routes/index.ts b/backend/src/server/routes/index.tsindex bfdc88c906..597093112b 100644--- a/backend/src/server/routes/index.ts+++ b/backend/src/server/routes/index.ts@@ -3443,7 +3443,9 @@ export const registerRoutes = async (pkiSyncDAL,pkiSyncQueue,internalCertificateAuthorityDAL,- hsmConnectorService+ hsmConnectorService,+ gatewayV2Service,+ gatewayPoolService});const internalCertificateAuthorityService = internalCertificateAuthorityServiceFactory({@@ -3514,7 +3516,8 @@ export const registerRoutes = async (hsmConnectorService,certificateAuthoritySecretDAL,licenseService,- telemetryService+ telemetryService,+ keyStore});const certificateEstService = certificateEstServiceFactory({@@ -3646,7 +3649,8 @@ export const registerRoutes = async (apiEnrollmentConfigDAL,gatewayV2Service,gatewayPoolService,- telemetryService+ telemetryService,+ keyStore});const certificateApprovalService = certificateApprovalServiceFactory({diff --git a/backend/src/server/routes/v1/app-connection-routers/app-connection-router.ts b/backend/src/server/routes/v1/app-connection-routers/app-connection-router.tsindex 3df65a765a..cbd408a9bd 100644--- a/backend/src/server/routes/v1/app-connection-routers/app-connection-router.ts+++ b/backend/src/server/routes/v1/app-connection-routers/app-connection-router.ts@@ -200,6 +200,10 @@ import {PostgresConnectionListItemSchema,SanitizedPostgresConnectionSchema} from "@app/services/app-connection/postgres";+import {+ PowerDnsConnectionListItemSchema,+ SanitizedPowerDnsConnectionSchema+} from "@app/services/app-connection/powerdns";import { QoveryConnectionListItemSchema, SanitizedQoveryConnectionSchema } from "@app/services/app-connection/qovery";import {RailwayConnectionListItemSchema,@@ -349,6 +353,7 @@ const SanitizedAppConnectionSchema = z.union([...SanitizedLiteLLMConnectionSchema.options,...SanitizedFireworksConnectionSchema.options,...SanitizedNutanixPrismCentralConnectionSchema.options,+ ...SanitizedPowerDnsConnectionSchema.options,...SanitizedSpaceliftConnectionSchema.options,...SanitizedDaytonaConnectionSchema.options]);@@ -436,6 +441,7 @@ const AppConnectionOptionsSchema = z.discriminatedUnion("app", [LiteLLMConnectionListItemSchema,FireworksConnectionListItemSchema,NutanixPrismCentralConnectionListItemSchema,+ PowerDnsConnectionListItemSchema,SpaceliftConnectionListItemSchema,DaytonaConnectionListItemSchema]);diff --git a/backend/src/server/routes/v1/app-connection-routers/index.ts b/backend/src/server/routes/v1/app-connection-routers/index.tsindex 1c0bd300ce..e7597f36d7 100644--- a/backend/src/server/routes/v1/app-connection-routers/index.ts+++ b/backend/src/server/routes/v1/app-connection-routers/index.ts@@ -63,6 +63,7 @@ import { registerOpenRouterConnectionRouter } from "./open-router-connection-rouimport { registerOpenAIConnectionRouter } from "./openai-connection-router";import { registerOvhConnectionRouter } from "./ovh-connection-router";import { registerPostgresConnectionRouter } from "./postgres-connection-router";+import { registerPowerDnsConnectionRouter } from "./powerdns-connection-router";import { registerQoveryConnectionRouter } from "./qovery-connection-router";import { registerRailwayConnectionRouter } from "./railway-connection-router";import { registerRedisConnectionRouter } from "./redis-connection-router";@@ -105,6 +106,7 @@ export const APP_CONNECTION_REGISTER_ROUTER_MAP: Record<AppConnection, (server:[AppConnection.TerraformCloud]: registerTerraformCloudConnectionRouter,[AppConnection.Vercel]: registerVercelConnectionRouter,[AppConnection.Postgres]: registerPostgresConnectionRouter,+ [AppConnection.PowerDns]: registerPowerDnsConnectionRouter,[AppConnection.MsSql]: registerMsSqlConnectionRouter,[AppConnection.MySql]: registerMySqlConnectionRouter,[AppConnection.Camunda]: registerCamundaConnectionRouter,diff --git a/backend/src/server/routes/v1/app-connection-routers/powerdns-connection-router.ts b/backend/src/server/routes/v1/app-connection-routers/powerdns-connection-router.tsnew file mode 100644index 0000000000..c250cf3c5f--- /dev/null+++ b/backend/src/server/routes/v1/app-connection-routers/powerdns-connection-router.ts@@ -0,0 +1,51 @@+import z from "zod";++import { readLimit } from "@app/server/config/rateLimiter";+import { verifyAuth } from "@app/server/plugins/auth/verify-auth";+import { AppConnection } from "@app/services/app-connection/app-connection-enums";+import {+ CreatePowerDnsConnectionSchema,+ SanitizedPowerDnsConnectionSchema,+ UpdatePowerDnsConnectionSchema+} from "@app/services/app-connection/powerdns";+import { AuthMode } from "@app/services/auth/auth-type";++import { registerAppConnectionEndpoints } from "./app-connection-endpoints";++export const registerPowerDnsConnectionRouter = async (server: FastifyZodProvider) => {+ registerAppConnectionEndpoints({+ app: AppConnection.PowerDns,+ server,+ sanitizedResponseSchema: SanitizedPowerDnsConnectionSchema,+ createSchema: CreatePowerDnsConnectionSchema,+ updateSchema: UpdatePowerDnsConnectionSchema+ });++ server.route({+ method: "GET",+ url: `/:connectionId/zones`,+ config: {+ rateLimit: readLimit+ },+ schema: {+ operationId: "listPowerDnsZones",+ params: z.object({+ connectionId: z.string().uuid().describe("The ID of the PowerDNS Connection to list zones from.")+ }),+ response: {+ 200: z+ .object({+ id: z.string().describe("The PowerDNS zone ID."),+ name: z.string().describe("The name of the PowerDNS zone.")+ })+ .array()+ }+ },+ onRequest: verifyAuth([AuthMode.JWT, AuthMode.OAUTH]),+ handler: async (req) => {+ const { connectionId } = req.params;+ const zones = await server.services.appConnection.powerDns.listZones(connectionId, req.permission);+ return zones;+ }+ });+};diff --git a/backend/src/services/app-connection/app-connection-enums.ts b/backend/src/services/app-connection/app-connection-enums.tsindex fc25ba96ee..47daf35f48 100644--- a/backend/src/services/app-connection/app-connection-enums.ts+++ b/backend/src/services/app-connection/app-connection-enums.ts@@ -81,6 +81,7 @@ export enum AppConnection {KempLoadMaster = "kemp-loadmaster",MicrosoftIntune = "microsoft-intune",NutanixPrismCentral = "nutanix-prism-central",+ PowerDns = "powerdns",Spacelift = "spacelift",Daytona = "daytona"}diff --git a/backend/src/services/app-connection/app-connection-fns.ts b/backend/src/services/app-connection/app-connection-fns.tsindex f406d616cd..0187364106 100644--- a/backend/src/services/app-connection/app-connection-fns.ts+++ b/backend/src/services/app-connection/app-connection-fns.ts@@ -240,6 +240,11 @@ import {import { getOpenAIConnectionListItem, OpenAIConnectionMethod, validateOpenAIConnectionCredentials } from "./openai";import { getOvhConnectionListItem, OVHConnectionMethod, validateOvhConnectionCredentials } from "./ovh";import { getPostgresConnectionListItem, PostgresConnectionMethod } from "./postgres";+import {+ getPowerDnsConnectionListItem,+ PowerDnsConnectionMethod,+ validatePowerDnsConnectionCredentials+} from "./powerdns";import { getQoveryConnectionListItem, QoveryConnectionMethod, validateQoveryConnectionCredentials } from "./qovery";import { getRailwayConnectionListItem, validateRailwayConnectionCredentials } from "./railway";import { getRedisConnectionListItem, RedisConnectionMethod, validateRedisConnectionCredentials } from "./redis";@@ -328,6 +333,7 @@ const PKI_APP_CONNECTIONS = [AppConnection.Chef,AppConnection.DNSMadeEasy,AppConnection.AzureDNS,+ AppConnection.PowerDns,AppConnection.Venafi,AppConnection.VenafiTpp,AppConnection.NetScaler,@@ -426,6 +432,7 @@ export const listAppConnectionOptions = (projectType?: ProjectType) => {getLiteLLMConnectionListItem(),getFireworksConnectionListItem(),getNutanixPrismCentralConnectionListItem(),+ getPowerDnsConnectionListItem(),getSpaceliftConnectionListItem(),getDaytonaConnectionListItem()]@@ -682,6 +689,7 @@ export const validateAppConnectionCredentials = async ([AppConnection.Fireworks]: validateFireworksConnectionCredentials as TAppConnectionCredentialsValidator,[AppConnection.NutanixPrismCentral]:validateNutanixPrismCentralConnectionCredentials as TAppConnectionCredentialsValidator,+ [AppConnection.PowerDns]: validatePowerDnsConnectionCredentials as TAppConnectionCredentialsValidator,[AppConnection.Spacelift]: validateSpaceliftConnectionCredentials as TAppConnectionCredentialsValidator,[AppConnection.Daytona]: validateDaytonaConnectionCredentials as TAppConnectionCredentialsValidator};@@ -792,6 +800,7 @@ export const getAppConnectionMethodName = (method: TAppConnection["method"]) =>case TriggerDevConnectionMethod.ApiKey:case DatadogConnectionMethod.ApiKey:case NutanixPrismCentralConnectionMethod.ApiKey:+ case PowerDnsConnectionMethod.ApiKey:case DaytonaConnectionMethod.ApiKey:return "API Key";case ChefConnectionMethod.UserKey:@@ -954,6 +963,7 @@ export const TRANSITION_CONNECTION_CREDENTIALS_TO_PLATFORM: Record<[AppConnection.LiteLLM]: platformManagedCredentialsNotSupported,[AppConnection.Fireworks]: platformManagedCredentialsNotSupported,[AppConnection.NutanixPrismCentral]: platformManagedCredentialsNotSupported,+ [AppConnection.PowerDns]: platformManagedCredentialsNotSupported,[AppConnection.Spacelift]: platformManagedCredentialsNotSupported,[AppConnection.Daytona]: platformManagedCredentialsNotSupported};diff --git a/backend/src/services/app-connection/app-connection-maps.ts b/backend/src/services/app-connection/app-connection-maps.tsindex ed5a59f6eb..310c5b426b 100644--- a/backend/src/services/app-connection/app-connection-maps.ts+++ b/backend/src/services/app-connection/app-connection-maps.ts@@ -82,6 +82,7 @@ export const APP_CONNECTION_NAME_MAP: Record<AppConnection, string> = {[AppConnection.LiteLLM]: "LiteLLM",[AppConnection.Fireworks]: "Fireworks",[AppConnection.NutanixPrismCentral]: "Nutanix Prism Central",+ [AppConnection.PowerDns]: "PowerDNS",[AppConnection.Spacelift]: "Spacelift",[AppConnection.Daytona]: "Daytona",[AppConnection.MicrosoftIntune]: "Microsoft Intune"@@ -169,6 +170,7 @@ export const APP_CONNECTION_PLAN_MAP: Record<AppConnection, AppConnectionPlanTyp[AppConnection.LiteLLM]: AppConnectionPlanType.Regular,[AppConnection.Fireworks]: AppConnectionPlanType.Regular,[AppConnection.NutanixPrismCentral]: AppConnectionPlanType.Regular,+ [AppConnection.PowerDns]: AppConnectionPlanType.Regular,[AppConnection.Spacelift]: AppConnectionPlanType.Regular,[AppConnection.Daytona]: AppConnectionPlanType.Regular,[AppConnection.MicrosoftIntune]: AppConnectionPlanType.Enterprisediff --git a/backend/src/services/app-connection/app-connection-service.ts b/backend/src/services/app-connection/app-connection-service.tsindex fe8a3940a0..9e3e697c2d 100644--- a/backend/src/services/app-connection/app-connection-service.ts+++ b/backend/src/services/app-connection/app-connection-service.ts@@ -164,6 +164,7 @@ import { ValidateOpenAIConnectionCredentialsSchema } from "./openai";import { openaiConnectionService } from "./openai/openai-connection-service";import { ValidateOvhConnectionCredentialsSchema } from "./ovh";import { ValidatePostgresConnectionCredentialsSchema } from "./postgres";+import { powerDnsConnectionService, ValidatePowerDnsConnectionCredentialsSchema } from "./powerdns";import { ValidateQoveryConnectionCredentialsSchema } from "./qovery";import { qoveryConnectionService } from "./qovery/qovery-connection-service";import { ValidateRailwayConnectionCredentialsSchema } from "./railway";@@ -307,6 +308,7 @@ const VALIDATE_APP_CONNECTION_CREDENTIALS_MAP: Record<AppConnection, TValidateAp[AppConnection.LiteLLM]: ValidateLiteLLMConnectionCredentialsSchema,[AppConnection.Fireworks]: ValidateFireworksConnectionCredentialsSchema,[AppConnection.NutanixPrismCentral]: ValidateNutanixPrismCentralConnectionCredentialsSchema,+ [AppConnection.PowerDns]: ValidatePowerDnsConnectionCredentialsSchema,[AppConnection.Spacelift]: ValidateSpaceliftConnectionCredentialsSchema,[AppConnection.Daytona]: ValidateDaytonaConnectionCredentialsSchema};@@ -1436,6 +1438,7 @@ export const appConnectionServiceFactory = ({gatewayV2Service,gatewayPoolService),+ powerDns: powerDnsConnectionService(connectAppConnectionById, gatewayV2Service, gatewayPoolService),spacelift: spaceliftConnectionService(connectAppConnectionById)};};diff --git a/backend/src/services/app-connection/app-connection-types.ts b/backend/src/services/app-connection/app-connection-types.tsindex 27a67e730c..3c84a14550 100644--- a/backend/src/services/app-connection/app-connection-types.ts+++ b/backend/src/services/app-connection/app-connection-types.ts@@ -371,6 +371,12 @@ import {TPostgresConnectionInput,TValidatePostgresConnectionCredentialsSchema} from "./postgres";+import {+ TPowerDnsConnection,+ TPowerDnsConnectionConfig,+ TPowerDnsConnectionInput,+ TValidatePowerDnsConnectionCredentialsSchema+} from "./powerdns";import {TQoveryConnection,TQoveryConnectionConfig,@@ -583,6 +589,7 @@ export type TAppConnection = { id: string; configuration?: TAppConnectionConfigu| TLiteLLMConnection| TFireworksConnection| TNutanixPrismCentralConnection+ | TPowerDnsConnection| TSpaceliftConnection| TDaytonaConnection);@@ -678,6 +685,7 @@ export type TAppConnectionInput = { id: string } & (| TLiteLLMConnectionInput| TFireworksConnectionInput| TNutanixPrismCentralConnectionInput+ | TPowerDnsConnectionInput| TSpaceliftConnectionInput| TDaytonaConnectionInput);@@ -805,6 +813,7 @@ export type TAppConnectionConfig =| TLiteLLMConnectionConfig| TFireworksConnectionConfig| TNutanixPrismCentralConnectionConfig+ | TPowerDnsConnectionConfig| TSpaceliftConnectionConfig| TDaytonaConnectionConfig;@@ -891,6 +900,7 @@ export type TValidateAppConnectionCredentialsSchema =| TValidateLiteLLMConnectionCredentialsSchema| TValidateFireworksConnectionCredentialsSchema| TValidateNutanixPrismCentralConnectionCredentialsSchema+ | TValidatePowerDnsConnectionCredentialsSchema| TValidateSpaceliftConnectionCredentialsSchema| TValidateDaytonaConnectionCredentialsSchema;diff --git a/backend/src/services/app-connection/powerdns/index.ts b/backend/src/services/app-connection/powerdns/index.tsnew file mode 100644index 0000000000..19aec6f992--- /dev/null+++ b/backend/src/services/app-connection/powerdns/index.ts@@ -0,0 +1,24 @@+export { PowerDnsConnectionMethod } from "./powerdns-connection-enums";+export {+ getPowerDnsConnectionListItem,+ getPowerDnsErrorMessage,+ getPowerDnsZoneRrset,+ listPowerDnsZones,+ patchPowerDnsZoneRrsets,+ validatePowerDnsConnectionCredentials+} from "./powerdns-connection-fns";+export {+ CreatePowerDnsConnectionSchema,+ PowerDnsConnectionListItemSchema,+ SanitizedPowerDnsConnectionSchema,+ UpdatePowerDnsConnectionSchema,+ ValidatePowerDnsConnectionCredentialsSchema+} from "./powerdns-connection-schemas";+export { powerDnsConnectionService } from "./powerdns-connection-service";+export type {+ TPowerDnsConnection,+ TPowerDnsConnectionConfig,+ TPowerDnsConnectionInput,+ TPowerDnsZone,+ TValidatePowerDnsConnectionCredentialsSchema+} from "./powerdns-connection-types";diff --git a/backend/src/services/app-connection/powerdns/powerdns-connection-enums.ts b/backend/src/services/app-connection/powerdns/powerdns-connection-enums.tsnew file mode 100644index 0000000000..0ecb50d7aa--- /dev/null+++ b/backend/src/services/app-connection/powerdns/powerdns-connection-enums.ts@@ -0,0 +1,3 @@+export enum PowerDnsConnectionMethod {+ ApiKey = "api-key"+}diff --git a/backend/src/services/app-connection/powerdns/powerdns-connection-fns.ts b/backend/src/services/app-connection/powerdns/powerdns-connection-fns.tsnew file mode 100644index 0000000000..3137997c06--- /dev/null+++ b/backend/src/services/app-connection/powerdns/powerdns-connection-fns.ts@@ -0,0 +1,244 @@+import { AxiosRequestConfig, isAxiosError } from "axios";++import { verifyHostInputValidity } from "@app/ee/services/dynamic-secret/dynamic-secret-fns";+import { TGatewayServiceFactory } from "@app/ee/services/gateway/gateway-service";+import { TGatewayPoolServiceFactory } from "@app/ee/services/gateway-pool/gateway-pool-service";+import { TGatewayV2ServiceFactory } from "@app/ee/services/gateway-v2/gateway-v2-service";+import { request } from "@app/lib/config/request";+import { BadRequestError } from "@app/lib/errors";+import { removeTrailingSlash } from "@app/lib/fn";+import { GatewayProxyProtocol } from "@app/lib/gateway";+import { withGatewayV2Proxy } from "@app/lib/gateway-v2/gateway-v2";+import { logger } from "@app/lib/logger";+import { getSharedHttpsAgent, safeRequest } from "@app/lib/validator/safe-request";+import { AppConnection } from "@app/services/app-connection/app-connection-enums";++import { PowerDnsConnectionMethod } from "./powerdns-connection-enums";+import { TPowerDnsConnectionConfig, TPowerDnsRrset, TPowerDnsZone } from "./powerdns-connection-types";++const POWERDNS_DEFAULT_SERVER_ID = "localhost";+const POWERDNS_REQUEST_TIMEOUT_MS = 30_000;+const POWERDNS_MAX_RESPONSE_BYTES = 10 * 1024 * 1024;++export type TPowerDnsGatewayDeps = {+ gatewayV2Service?: Pick<TGatewayV2ServiceFactory, "getPlatformConnectionDetailsByGatewayId">;+ gatewayPoolService?: Pick<TGatewayPoolServiceFactory, "resolveEffectiveGatewayId">;+};++type TPowerDnsRequest = {+ method: "GET" | "POST" | "PATCH" | "PUT" | "DELETE";+ path: string;+ data?: unknown;+ params?: Record<string, string>;+};++export const getPowerDnsConnectionListItem = () => {+ return {+ name: "PowerDNS" as const,+ app: AppConnection.PowerDns as const,+ methods: Object.values(PowerDnsConnectionMethod) as [PowerDnsConnectionMethod.ApiKey]+ };+};++export const getPowerDnsApiUrl = (apiUrl: string, path: string, serverId?: string) =>+ `${removeTrailingSlash(apiUrl)}/api/v1/servers/${encodeURIComponent(serverId || POWERDNS_DEFAULT_SERVER_ID)}${path}`;++export const getPowerDnsErrorMessage = (error: unknown, fallback: string) => {+ if (isAxiosError(error)) {+ const body = error.response?.data as { error?: string } | string | undefined;++ if (error.response?.status === 401) return "PowerDNS rejected the API key";+ if (error.response?.status === 404) {+ return "PowerDNS returned 404. Verify the API URL and Server ID, and that the PowerDNS API is enabled";+ }+ if (typeof body === "object" && typeof body?.error === "string") return body.error;++ return error.message || fallback;+ }++ return error instanceof Error ? error.message : fallback;+};++export const powerDnsRequest = async <T>(+ config: Pick<TPowerDnsConnectionConfig, "credentials" | "gatewayId" | "gatewayPoolId">,+ { method, path, data, params }: TPowerDnsRequest,+ { gatewayV2Service, gatewayPoolService }: TPowerDnsGatewayDeps = {}+): Promise<T> => {+ const { credentials, gatewayId: directGatewayId, gatewayPoolId } = config;+ const { apiUrl, apiKey, serverId, sslCertificate, sslRejectUnauthorized } = credentials;++ if (gatewayPoolId && !gatewayPoolService) {+ throw new BadRequestError({+ message: "This PowerDNS connection uses a Gateway pool, which is not supported on this operation"+ });+ }++ const gatewayId =+ gatewayPoolId && gatewayPoolService+ ? await gatewayPoolService.resolveEffectiveGatewayId({ gatewayId: directGatewayId, gatewayPoolId })+ : directGatewayId;++ if (gatewayId && !gatewayV2Service) {+ throw new BadRequestError({+ message: "This PowerDNS connection uses a Gateway, which is not supported on this operation"+ });+ }++ const url = new URL(getPowerDnsApiUrl(apiUrl, path, serverId));+ const headers = {+ "X-API-Key": apiKey,+ Accept: "application/json",+ ...(data !== undefined && { "Content-Type": "application/json" })+ };++ const baseRequestConfig: AxiosRequestConfig = {+ method,+ params,+ ...(data !== undefined && { data }),+ timeout: POWERDNS_REQUEST_TIMEOUT_MS,+ maxContentLength: POWERDNS_MAX_RESPONSE_BYTES,+ maxBodyLength: POWERDNS_MAX_RESPONSE_BYTES+ };++ if (!gatewayId || !gatewayV2Service) {+ const { data: responseData } = await safeRequest.request<T>({+ ...baseRequestConfig,+ url: url.toString(),+ headers,+ ca: sslCertificate,+ rejectUnauthorized: sslRejectUnauthorized+ });++ return responseData;+ }++ const [targetHost] = await verifyHostInputValidity({ host: url.hostname, isGateway: true, isDynamicSecret: false });+ const isHttps = url.protocol === "https:";+ const targetPort = url.port ? Number(url.port) : (isHttps && 443) || 80;++ const platformConnectionDetails = await gatewayV2Service.getPlatformConnectionDetailsByGatewayId({+ gatewayId,+ targetHost,+ targetPort+ });++ if (!platformConnectionDetails) {+ throw new BadRequestError({ message: "Unable to connect to the Gateway assigned to this PowerDNS connection" });+ }++ return withGatewayV2Proxy(+ async (proxyPort) => {+ const proxiedUrl = new URL(url.toString());+ proxiedUrl.host = `localhost:${proxyPort}`;++ const { data: responseData } = await request.request<T>({+ ...baseRequestConfig,+ url: proxiedUrl.toString(),+ headers: { ...headers, Host: url.host },+ maxRedirects: 0,+ ...(isHttps && {+ httpsAgent: getSharedHttpsAgent({+ servername: targetHost,+ ca: sslCertificate,+ rejectUnauthorized: sslRejectUnauthorized ?? true+ })+ })+ });++ return responseData;+ },+ {+ protocol: GatewayProxyProtocol.Tcp,+ ...platformConnectionDetails+ }+ );+};++export const listPowerDnsZones = async (+ config: TPowerDnsConnectionConfig,+ deps: TPowerDnsGatewayDeps = {}+): Promise<TPowerDnsZone[]> => {+ try {+ const zones = await powerDnsRequest<{ id: string; name: string }[]>(+ config,+ { method: "GET", path: "/zones" },+ deps+ );++ if (!Array.isArray(zones)) return [];++ return zones.filter((zone) => zone.id && zone.name).map((zone) => ({ id: zone.id, name: zone.name }));+ } catch (error) {+ if (error instanceof BadRequestError) throw error;++ logger.error(error, "Failed to list PowerDNS zones");+ throw new BadRequestError({+ message: `Failed to list PowerDNS zones: ${getPowerDnsErrorMessage(error, "verify the API URL and API key")}`+ });+ }+};++export const getPowerDnsZoneRrset = async (+ config: TPowerDnsConnectionConfig,+ { zoneId, name, type }: { zoneId: string; name: string; type: string },+ deps: TPowerDnsGatewayDeps = {}+): Promise<TPowerDnsRrset | undefined> => {+ try {+ const zone = await powerDnsRequest<{ rrsets?: TPowerDnsRrset[] }>(+ config,+ {+ method: "GET",+ path: `/zones/${encodeURIComponent(zoneId)}`,+ params: { rrset_name: name, rrset_type: type }+ },+ deps+ );++ return zone.rrsets?.find((rrset) => rrset.name === name && rrset.type === type);+ } catch (error) {+ if (error instanceof BadRequestError) throw error;++ logger.error(error, `Failed to read PowerDNS zone [zoneId=${zoneId}] [name=${name}]`);+ throw new Error(`Failed to read PowerDNS zone '${zoneId}': ${getPowerDnsErrorMessage(error, "unknown error")}`);+ }+};++export const patchPowerDnsZoneRrsets = async (+ config: TPowerDnsConnectionConfig,+ { zoneId, rrsets }: { zoneId: string; rrsets: (TPowerDnsRrset & { changetype: "REPLACE" | "DELETE" })[] },+ deps: TPowerDnsGatewayDeps = {}+): Promise<void> => {+ try {+ await powerDnsRequest(+ config,+ { method: "PATCH", path: `/zones/${encodeURIComponent(zoneId)}`, data: { rrsets } },+ deps+ );+ } catch (error) {+ if (error instanceof BadRequestError) throw error;++ logger.error(error, `Failed to update PowerDNS records [zoneId=${zoneId}]`);+ throw new Error(+ `Failed to update PowerDNS records in zone '${zoneId}': ${getPowerDnsErrorMessage(error, "unknown error")}`+ );+ }+};++export const validatePowerDnsConnectionCredentials = async (+ config: TPowerDnsConnectionConfig,+ _gatewayService: Pick<TGatewayServiceFactory, "fnGetGatewayClientTlsByGatewayId">,+ gatewayV2Service: Pick<TGatewayV2ServiceFactory, "getPlatformConnectionDetailsByGatewayId">+) => {+ try {+ await powerDnsRequest(config, { method: "GET", path: "/zones" }, { gatewayV2Service });+ } catch (error) {+ if (error instanceof BadRequestError) throw error;++ logger.error(error, "Failed to validate PowerDNS connection credentials");+ throw new BadRequestError({+ message: `Unable to validate PowerDNS connection: ${getPowerDnsErrorMessage(error, "verify the API URL and API key")}`+ });+ }++ return config.credentials;+};diff --git a/backend/src/services/app-connection/powerdns/powerdns-connection-schemas.ts b/backend/src/services/app-connection/powerdns/powerdns-connection-schemas.tsnew file mode 100644index 0000000000..a8a94f3eaa--- /dev/null+++ b/backend/src/services/app-connection/powerdns/powerdns-connection-schemas.ts@@ -0,0 +1,118 @@+import RE2 from "re2";+import z from "zod";++import { AppConnections } from "@app/lib/api-docs";+import { AppConnection } from "@app/services/app-connection/app-connection-enums";+import {+ BaseAppConnectionSchema,+ GenericCreateAppConnectionFieldsSchema,+ GenericUpdateAppConnectionFieldsSchema+} from "@app/services/app-connection/app-connection-schemas";++import { APP_CONNECTION_NAME_MAP } from "../app-connection-maps";+import { PowerDnsConnectionMethod } from "./powerdns-connection-enums";++const API_PATH_SUFFIX = new RE2("/api(/v\\d+)?/*$");+const SERVER_ID_FORMAT = new RE2("^[a-zA-Z0-9][a-zA-Z0-9._-]*$");++export const PowerDnsConnectionApiKeyCredentialsSchema = z.object({+ apiUrl: z+ .string()+ .trim()+ .url("API URL must be a valid URL")+ .max(512, "API URL cannot exceed 512 characters")+ .refine((value) => ["http:", "https:"].includes(new URL(value).protocol), {+ message: "API URL must use http or https"+ })+ .refine((value) => !API_PATH_SUFFIX.test(new URL(value).pathname), {+ message:+ "API URL must not include the /api/v1 path, only the web server address (e.g. https://pdns.example.com:8081)"+ })+ .describe("The base URL of the PowerDNS web server, excluding the /api/v1 path."),+ apiKey: z+ .string()+ .trim()+ .min(1, "API key required")+ .max(512, "API key cannot exceed 512 characters")+ .describe("The value of the PowerDNS api-key setting."),+ serverId: z+ .string()+ .trim()+ .max(64, "Server ID cannot exceed 64 characters")+ .refine((value) => !value || SERVER_ID_FORMAT.test(value), {+ message: "Server ID may only contain letters, numbers, dots, hyphens and underscores"+ })+ .refine((value) => !value.includes(".."), { message: "Server ID cannot contain '..'" })+ .transform((value) => value || undefined)+ .optional()+ .describe(+ "The PowerDNS API server ID. Leave unset unless you connect through a proxy fronting several servers; the Authoritative Server always reports 'localhost'."+ ),+ sslRejectUnauthorized: z+ .boolean()+ .optional()+ .describe("Whether to reject PowerDNS TLS certificates that are not trusted. Defaults to true."),+ sslCertificate: z+ .string()+ .trim()+ .max(8192, "SSL certificate cannot exceed 8192 characters")+ .transform((value) => value || undefined)+ .optional()+ .describe("A PEM-encoded CA certificate to trust when connecting to PowerDNS over HTTPS.")+});++const BasePowerDnsConnectionSchema = BaseAppConnectionSchema.extend({+ app: z.literal(AppConnection.PowerDns)+});++export const PowerDnsConnectionSchema = BasePowerDnsConnectionSchema.extend({+ method: z.literal(PowerDnsConnectionMethod.ApiKey),+ credentials: PowerDnsConnectionApiKeyCredentialsSchema+});++export const SanitizedPowerDnsConnectionSchema = z.discriminatedUnion("method", [+ BasePowerDnsConnectionSchema.extend({+ method: z.literal(PowerDnsConnectionMethod.ApiKey),+ credentials: PowerDnsConnectionApiKeyCredentialsSchema.pick({+ apiUrl: true,+ serverId: true,+ sslRejectUnauthorized: true,+ sslCertificate: true+ })+ }).describe(JSON.stringify({ title: `${APP_CONNECTION_NAME_MAP[AppConnection.PowerDns]} (API Key)` }))+]);++export const ValidatePowerDnsConnectionCredentialsSchema = z.discriminatedUnion("method", [+ z.object({+ method: z.literal(PowerDnsConnectionMethod.ApiKey).describe(AppConnections.CREATE(AppConnection.PowerDns).method),+ credentials: PowerDnsConnectionApiKeyCredentialsSchema.describe(+ AppConnections.CREATE(AppConnection.PowerDns).credentials+ )+ })+]);++export const CreatePowerDnsConnectionSchema = ValidatePowerDnsConnectionCredentialsSchema.and(+ GenericCreateAppConnectionFieldsSchema(AppConnection.PowerDns, {+ supportsGateways: true+ })+);++export const UpdatePowerDnsConnectionSchema = z+ .object({+ credentials: PowerDnsConnectionApiKeyCredentialsSchema.optional().describe(+ AppConnections.UPDATE(AppConnection.PowerDns).credentials+ )+ })+ .and(+ GenericUpdateAppConnectionFieldsSchema(AppConnection.PowerDns, {+ supportsGateways: true+ })+ );++export const PowerDnsConnectionListItemSchema = z+ .object({+ name: z.literal("PowerDNS"),+ app: z.literal(AppConnection.PowerDns),+ methods: z.nativeEnum(PowerDnsConnectionMethod).array()+ })+ .describe(JSON.stringify({ title: APP_CONNECTION_NAME_MAP[AppConnection.PowerDns] }));diff --git a/backend/src/services/app-connection/powerdns/powerdns-connection-service.ts b/backend/src/services/app-connection/powerdns/powerdns-connection-service.tsnew file mode 100644index 0000000000..a6d36ec83b--- /dev/null+++ b/backend/src/services/app-connection/powerdns/powerdns-connection-service.ts@@ -0,0 +1,30 @@+import { TGatewayPoolServiceFactory } from "@app/ee/services/gateway-pool/gateway-pool-service";+import { TGatewayV2ServiceFactory } from "@app/ee/services/gateway-v2/gateway-v2-service";+import { OrgServiceActor } from "@app/lib/types";+import { AppConnection } from "@app/services/app-connection/app-connection-enums";++import { listPowerDnsZones } from "./powerdns-connection-fns";+import { TPowerDnsConnection, TPowerDnsConnectionConfig } from "./powerdns-connection-types";++type TGetAppConnectionFunc = (+ app: AppConnection,+ connectionId: string,+ actor: OrgServiceActor+) => Promise<TPowerDnsConnection>;++export const powerDnsConnectionService = (+ getAppConnection: TGetAppConnectionFunc,+ gatewayV2Service?: Pick<TGatewayV2ServiceFactory, "getPlatformConnectionDetailsByGatewayId">,+ gatewayPoolService?: Pick<TGatewayPoolServiceFactory, "resolveEffectiveGatewayId">+) => {+ const listZones = async (connectionId: string, actor: OrgServiceActor) => {+ const appConnection = await getAppConnection(AppConnection.PowerDns, connectionId, actor);++ return listPowerDnsZones({ ...appConnection, orgId: actor.orgId } as TPowerDnsConnectionConfig, {+ gatewayV2Service,+ gatewayPoolService+ });+ };++ return { listZones };+};diff --git a/backend/src/services/app-connection/powerdns/powerdns-connection-types.ts b/backend/src/services/app-connection/powerdns/powerdns-connection-types.tsnew file mode 100644index 0000000000..b1f8ea000e--- /dev/null+++ b/backend/src/services/app-connection/powerdns/powerdns-connection-types.ts@@ -0,0 +1,42 @@+import z from "zod";++import { DiscriminativePick } from "@app/lib/types";++import { AppConnection } from "../app-connection-enums";+import {+ CreatePowerDnsConnectionSchema,+ PowerDnsConnectionSchema,+ ValidatePowerDnsConnectionCredentialsSchema+} from "./powerdns-connection-schemas";++export type TPowerDnsConnection = z.infer<typeof PowerDnsConnectionSchema>;++export type TPowerDnsConnectionInput = z.infer<typeof CreatePowerDnsConnectionSchema> & {+ app: AppConnection.PowerDns;+};++export type TValidatePowerDnsConnectionCredentialsSchema = typeof ValidatePowerDnsConnectionCredentialsSchema;++export type TPowerDnsConnectionConfig = DiscriminativePick<+ TPowerDnsConnectionInput,+ "method" | "app" | "credentials" | "gatewayId" | "gatewayPoolId"+> & {+ orgId: string;+};++export type TPowerDnsZone = {+ id: string;+ name: string;+};++export type TPowerDnsRecord = {+ content: string;+ disabled?: boolean;+};++export type TPowerDnsRrset = {+ name: string;+ type: string;+ ttl?: number;+ records?: TPowerDnsRecord[];+};diff --git a/backend/src/services/certificate-authority/acme/acme-certificate-authority-enums.ts b/backend/src/services/certificate-authority/acme/acme-certificate-authority-enums.tsindex 7c1fcedd29..e592df2a98 100644--- a/backend/src/services/certificate-authority/acme/acme-certificate-authority-enums.ts+++ b/backend/src/services/certificate-authority/acme/acme-certificate-authority-enums.ts@@ -2,5 +2,6 @@ export enum AcmeDnsProvider {Route53 = "route53",Cloudflare = "cloudflare",DNSMadeEasy = "dns-made-easy",- AzureDNS = "azure-dns"+ AzureDNS = "azure-dns",+ PowerDns = "powerdns"}diff --git a/backend/src/services/certificate-authority/acme/acme-certificate-authority-fns.ts b/backend/src/services/certificate-authority/acme/acme-certificate-authority-fns.tsindex aba2873825..fc30aec1ee 100644--- a/backend/src/services/certificate-authority/acme/acme-certificate-authority-fns.ts+++ b/backend/src/services/certificate-authority/acme/acme-certificate-authority-fns.ts@@ -6,6 +6,9 @@ import net from "net";import RE2 from "re2";import { TableName } from "@app/db/schemas";+import { TGatewayPoolServiceFactory } from "@app/ee/services/gateway-pool/gateway-pool-service";+import { TGatewayV2ServiceFactory } from "@app/ee/services/gateway-v2/gateway-v2-service";+import { TKeyStoreFactory } from "@app/keystore/keystore";import { getConfig } from "@app/lib/config/env";import { crypto } from "@app/lib/crypto/cryptography";import { delay } from "@app/lib/delay";@@ -23,6 +26,7 @@ import { TAwsConnection } from "@app/services/app-connection/aws/aws-connection-import { TAzureDnsConnection } from "@app/services/app-connection/azure-dns/azure-dns-connection-types";import { TCloudflareConnection } from "@app/services/app-connection/cloudflare/cloudflare-connection-types";import { TDNSMadeEasyConnection } from "@app/services/app-connection/dns-made-easy/dns-made-easy-connection-types";+import { TPowerDnsConnection } from "@app/services/app-connection/powerdns/powerdns-connection-types";import { TCertificateBodyDALFactory } from "@app/services/certificate/certificate-body-dal";import { TCertificateDALFactory } from "@app/services/certificate/certificate-dal";import { extractCertificateFields, linkRenewedCertificate } from "@app/services/certificate/certificate-fns";@@ -59,6 +63,7 @@ import {import { azureDnsDeleteTxtRecord, azureDnsInsertTxtRecord } from "./dns-providers/azure-dns";import { cloudflareDeleteTxtRecord, cloudflareInsertTxtRecord } from "./dns-providers/cloudflare";import { dnsMadeEasyDeleteTxtRecord, dnsMadeEasyInsertTxtRecord } from "./dns-providers/dns-made-easy";+import { powerDnsDeleteTxtRecord, powerDnsInsertTxtRecord, TPowerDnsProviderDeps } from "./dns-providers/powerdns";const UNCHANGED_CREDENTIAL_SENTINEL = "__INFISICAL_UNCHANGED__";@@ -150,6 +155,9 @@ type TAcmeCertificateAuthorityFnsDeps = {pkiSyncQueue: Pick<TPkiSyncQueueFactory, "queuePkiSyncSyncCertificatesById">;projectDAL: Pick<TProjectDALFactory, "findById" | "findOne" | "updateById" | "transaction">;certificateProfileDAL?: Pick<TCertificateProfileDALFactory, "findById">;+ gatewayV2Service?: Pick<TGatewayV2ServiceFactory, "getPlatformConnectionDetailsByGatewayId">;+ gatewayPoolService?: Pick<TGatewayPoolServiceFactory, "resolveEffectiveGatewayId">;+ keyStore?: Pick<TKeyStoreFactory, "acquireLock">;};type TOrderCertificateDeps = {@@ -165,6 +173,9 @@ type TOrderCertificateDeps = {>;projectDAL: Pick<TProjectDALFactory, "findById" | "findOne" | "updateById" | "transaction">;certificateProfileDAL?: Pick<TCertificateProfileDALFactory, "findById">;+ gatewayV2Service?: Pick<TGatewayV2ServiceFactory, "getPlatformConnectionDetailsByGatewayId">;+ gatewayPoolService?: Pick<TGatewayPoolServiceFactory, "resolveEffectiveGatewayId">;+ keyStore?: Pick<TKeyStoreFactory, "acquireLock">;};type DBConfigurationColumn = {@@ -344,9 +355,14 @@ export const executeAcmeOrder = async (certificateSecretDAL,kmsService,projectDAL,- certificateProfileDAL+ certificateProfileDAL,+ gatewayV2Service,+ gatewayPoolService,+ keyStore} = deps;+ const powerDnsDeps: TPowerDnsProviderDeps = { gatewayV2Service, gatewayPoolService, keyStore };+const ca = await certificateAuthorityDAL.findByIdWithAssociatedCa(caId, tx);if (!ca.externalCa || ca.externalCa.type !== CaType.ACME) {throw new BadRequestError({ message: "CA is not an ACME CA" });@@ -482,6 +498,16 @@ export const executeAcmeOrder = async ();break;}+ case AcmeDnsProvider.PowerDns: {+ await powerDnsInsertTxtRecord(+ connection as TPowerDnsConnection,+ acmeCa.configuration.dnsProviderConfig.hostedZoneId,+ recordName,+ recordValue,+ powerDnsDeps+ );+ break;+ }default: {throw new Error(`Unsupported DNS provider: ${acmeCa.configuration.dnsProviderConfig.provider as string}`);}@@ -542,6 +568,16 @@ export const executeAcmeOrder = async ();break;}+ case AcmeDnsProvider.PowerDns: {+ await powerDnsDeleteTxtRecord(+ connection as TPowerDnsConnection,+ acmeCa.configuration.dnsProviderConfig.hostedZoneId,+ recordName,+ recordValue,+ powerDnsDeps+ );+ break;+ }default: {throw new Error(`Unsupported DNS provider: ${acmeCa.configuration.dnsProviderConfig.provider as string}`);}@@ -659,7 +695,10 @@ export const AcmeCertificateAuthorityFns = ({pkiSubscriberDAL,pkiSyncDAL,pkiSyncQueue,- certificateProfileDAL+ certificateProfileDAL,+ gatewayV2Service,+ gatewayPoolService,+ keyStore}: TAcmeCertificateAuthorityFnsDeps) => {const createCertificateAuthority = async ({name,@@ -712,6 +751,12 @@ export const AcmeCertificateAuthorityFns = ({});}+ if (dnsProviderConfig.provider === AcmeDnsProvider.PowerDns && appConnection.app !== AppConnection.PowerDns) {+ throw new BadRequestError({+ message: `App connection with ID '${dnsAppConnectionId}' is not a PowerDNS connection`+ });+ }+if (dnsResolver) {validateDnsResolver(dnsResolver);}@@ -826,6 +871,12 @@ export const AcmeCertificateAuthorityFns = ({});}+ if (dnsProviderConfig.provider === AcmeDnsProvider.PowerDns && appConnection.app !== AppConnection.PowerDns) {+ throw new BadRequestError({+ message: `App connection with ID '${dnsAppConnectionId}' is not a PowerDNS connection`+ });+ }+if (dnsResolver) {validateDnsResolver(dnsResolver);}@@ -1021,7 +1072,10 @@ export const AcmeCertificateAuthorityFns = ({certificateSecretDAL,kmsService,projectDAL,- certificateProfileDAL+ certificateProfileDAL,+ gatewayV2Service,+ gatewayPoolService,+ keyStore});};diff --git a/backend/src/services/certificate-authority/acme/dns-providers/powerdns.ts b/backend/src/services/certificate-authority/acme/dns-providers/powerdns.tsnew file mode 100644index 0000000000..c9099bdc95--- /dev/null+++ b/backend/src/services/certificate-authority/acme/dns-providers/powerdns.ts@@ -0,0 +1,156 @@+import { KeyStorePrefixes, TKeyStoreFactory } from "@app/keystore/keystore";+import { logger } from "@app/lib/logger";+import {+ getPowerDnsZoneRrset,+ patchPowerDnsZoneRrsets,+ TPowerDnsGatewayDeps+} from "@app/services/app-connection/powerdns/powerdns-connection-fns";+import {+ TPowerDnsConnection,+ TPowerDnsConnectionConfig+} from "@app/services/app-connection/powerdns/powerdns-connection-types";++const ACME_CHALLENGE_TTL_SECONDS = 60;+const RRSET_LOCK_TTL_MS = 60 * 1000;+const RRSET_LOCK_RETRY = { retryCount: 20, retryDelay: 1_000, retryJitter: 300 };++export type TPowerDnsProviderDeps = TPowerDnsGatewayDeps & {+ keyStore?: Pick<TKeyStoreFactory, "acquireLock">;+};++const toFqdn = (name: string) => (name.endsWith(".") ? name : `${name}.`);++const toConnectionConfig = (connection: TPowerDnsConnection) => connection as unknown as TPowerDnsConnectionConfig;++const pendingRrsetOperations = new Map<string, Promise<void>>();++const withLocalRrsetLock = async <T>(key: string, operation: () => Promise<T>): Promise<T> => {+ const pending = pendingRrsetOperations.get(key) ?? Promise.resolve();+ const result = pending.then(operation, operation);+ const settled = result.then(+ () => undefined,+ () => undefined+ );++ pendingRrsetOperations.set(key, settled);+ void settled.then(() => {+ if (pendingRrsetOperations.get(key) === settled) pendingRrsetOperations.delete(key);+ });++ return result;+};++const withRrsetLock = async <T>(+ { connectionId, zoneId, name }: { connectionId: string; zoneId: string; name: string },+ keyStore: Pick<TKeyStoreFactory, "acquireLock"> | undefined,+ operation: () => Promise<T>+): Promise<T> =>+ withLocalRrsetLock(`${connectionId}|${zoneId}|${name}`, async () => {+ if (!keyStore) return operation();++ const lock = await keyStore+ .acquireLock(+ [KeyStorePrefixes.AcmeDnsRecordLock(connectionId, zoneId, name)],+ RRSET_LOCK_TTL_MS,+ RRSET_LOCK_RETRY+ )+ .catch(() => null);++ if (!lock) {+ throw new Error(+ `Timed out waiting to update the PowerDNS record '${name}'. Another certificate order is using it. Retry the order.`+ );+ }++ try {+ return await operation();+ } finally {+ await lock.release().catch((error) => {+ logger.warn(error, `Failed to release PowerDNS record lock [zoneId=${zoneId}] [name=${name}]`);+ });+ }+ });++export const powerDnsInsertTxtRecord = async (+ connection: TPowerDnsConnection,+ hostedZoneId: string,+ domain: string,+ value: string,+ deps: TPowerDnsProviderDeps = {}+) => {+ const { keyStore, ...gatewayDeps } = deps;+ const config = toConnectionConfig(connection);+ const name = toFqdn(domain);+ const zoneId = toFqdn(hostedZoneId);++ logger.info({ zoneId, name }, `Inserting TXT record for PowerDNS [zoneId=${zoneId}] [name=${name}]`);++ await withRrsetLock({ connectionId: connection.id, zoneId, name }, keyStore, async () => {+ const existing = await getPowerDnsZoneRrset(config, { zoneId, name, type: "TXT" }, gatewayDeps);+ const existingRecords = existing?.records ?? [];++ if (existingRecords.some((record) => record.content === value)) return;++ await patchPowerDnsZoneRrsets(+ config,+ {+ zoneId,+ rrsets: [+ {+ name,+ type: "TXT",+ ttl: ACME_CHALLENGE_TTL_SECONDS,+ changetype: "REPLACE",+ records: [...existingRecords, { content: value, disabled: false }]+ }+ ]+ },+ gatewayDeps+ );+ });+};++export const powerDnsDeleteTxtRecord = async (+ connection: TPowerDnsConnection,+ hostedZoneId: string,+ domain: string,+ value: string,+ deps: TPowerDnsProviderDeps = {}+) => {+ const { keyStore, ...gatewayDeps } = deps;+ const config = toConnectionConfig(connection);+ const name = toFqdn(domain);+ const zoneId = toFqdn(hostedZoneId);++ logger.info({ zoneId, name }, `Deleting TXT record for PowerDNS [zoneId=${zoneId}] [name=${name}]`);++ await withRrsetLock({ connectionId: connection.id, zoneId, name }, keyStore, async () => {+ const existing = await getPowerDnsZoneRrset(config, { zoneId, name, type: "TXT" }, gatewayDeps);+ const existingRecords = existing?.records ?? [];+ const remainingRecords = existingRecords.filter((record) => record.content !== value);++ if (remainingRecords.length === existingRecords.length) {+ logger.warn({ zoneId, name }, `PowerDNS TXT record to delete not found [zoneId=${zoneId}] [name=${name}]`);+ return;+ }++ await patchPowerDnsZoneRrsets(+ config,+ {+ zoneId,+ rrsets: remainingRecords.length+ ? [+ {+ name,+ type: "TXT",+ ttl: existing?.ttl ?? ACME_CHALLENGE_TTL_SECONDS,+ changetype: "REPLACE",+ records: remainingRecords+ }+ ]+ : [{ name, type: "TXT", changetype: "DELETE" }]+ },+ gatewayDeps+ );+ });+};diff --git a/backend/src/services/certificate-authority/certificate-authority-queue.ts b/backend/src/services/certificate-authority/certificate-authority-queue.tsindex 849bb9b66a..77aedcdf1a 100644--- a/backend/src/services/certificate-authority/certificate-authority-queue.ts+++ b/backend/src/services/certificate-authority/certificate-authority-queue.ts@@ -1,4 +1,6 @@/* eslint-disable no-await-in-loop, no-continue */+import { TGatewayPoolServiceFactory } from "@app/ee/services/gateway-pool/gateway-pool-service";+import { TGatewayV2ServiceFactory } from "@app/ee/services/gateway-v2/gateway-v2-service";import { KeyStorePrefixes, TKeyStoreFactory } from "@app/keystore/keystore";import { getConfig } from "@app/lib/config/env";import { CronJobName, TCronJobFactory } from "@app/lib/cron/cron-job";@@ -55,6 +57,8 @@ type TCertificateAuthorityQueueFactoryDep = {pkiSyncQueue: Pick<TPkiSyncQueueFactory, "queuePkiSyncSyncCertificatesById">;internalCertificateAuthorityDAL: Pick<TInternalCertificateAuthorityDALFactory, "find">;hsmConnectorService: Pick<THsmConnectorServiceFactory, "sign">;+ gatewayV2Service: Pick<TGatewayV2ServiceFactory, "getPlatformConnectionDetailsByGatewayId">;+ gatewayPoolService: Pick<TGatewayPoolServiceFactory, "resolveEffectiveGatewayId">;};export type TCertificateAuthorityQueueFactory = ReturnType<typeof certificateAuthorityQueueFactory>;@@ -78,7 +82,9 @@ export const certificateAuthorityQueueFactory = ({pkiSyncDAL,pkiSyncQueue,internalCertificateAuthorityDAL,- hsmConnectorService+ hsmConnectorService,+ gatewayV2Service,+ gatewayPoolService}: TCertificateAuthorityQueueFactoryDep) => {const acmeFns = AcmeCertificateAuthorityFns({appConnectionDAL,@@ -92,7 +98,9 @@ export const certificateAuthorityQueueFactory = ({pkiSubscriberDAL,projectDAL,pkiSyncDAL,- pkiSyncQueue+ pkiSyncQueue,+ gatewayV2Service,+ gatewayPoolService});const azureAdCsFns = AzureAdCsCertificateAuthorityFns({diff --git a/backend/src/services/certificate-authority/certificate-authority-service.ts b/backend/src/services/certificate-authority/certificate-authority-service.tsindex 3fd9a2ea7c..6c0ef6a17b 100644--- a/backend/src/services/certificate-authority/certificate-authority-service.ts+++ b/backend/src/services/certificate-authority/certificate-authority-service.ts@@ -10,6 +10,7 @@ import {ProjectPermissionCertificateAuthorityActions,ProjectPermissionSub} from "@app/ee/services/permission/project-permission";+import { TKeyStoreFactory } from "@app/keystore/keystore";import { getProcessedPermissionRules } from "@app/lib/casl/permission-filter-utils";import { BadRequestError, NotFoundError } from "@app/lib/errors";import { OrgServiceActor, TProjectPermission } from "@app/lib/types";@@ -159,6 +160,7 @@ type TCertificateAuthorityServiceFactoryDep = {resourceMetadataDAL: Pick<TResourceMetadataDALFactory, "find" | "insertMany">;gatewayV2Service: Pick<TGatewayV2ServiceFactory, "getPlatformConnectionDetailsByGatewayId">;gatewayPoolService: Pick<TGatewayPoolServiceFactory, "resolveEffectiveGatewayId">;+ keyStore: Pick<TKeyStoreFactory, "acquireLock">;usageMeteringService: Pick<TUsageMeteringServiceFactory, "emitForProject">;hsmConnectorService: Pick<THsmConnectorServiceFactory, "assertAttachPermission">;certificateAuthoritySecretDAL: Pick<TCertificateAuthoritySecretDALFactory, "findOne">;@@ -188,6 +190,7 @@ export const certificateAuthorityServiceFactory = ({resourceMetadataDAL,gatewayV2Service,gatewayPoolService,+ keyStore,usageMeteringService,hsmConnectorService,certificateAuthoritySecretDAL,@@ -206,7 +209,10 @@ export const certificateAuthorityServiceFactory = ({projectDAL,pkiSyncDAL,pkiSyncQueue,- certificateProfileDAL+ certificateProfileDAL,+ gatewayV2Service,+ gatewayPoolService,+ keyStore});const azureAdCsFns = AzureAdCsCertificateAuthorityFns({diff --git a/backend/src/services/certificate-authority/certificate-issuance-queue.ts b/backend/src/services/certificate-authority/certificate-issuance-queue.tsindex 4dfa9c0cd7..1a099dc677 100644--- a/backend/src/services/certificate-authority/certificate-issuance-queue.ts+++ b/backend/src/services/certificate-authority/certificate-issuance-queue.ts@@ -3,6 +3,7 @@ import { UnrecoverableError } from "bullmq";import { TGatewayPoolServiceFactory } from "@app/ee/services/gateway-pool/gateway-pool-service";import { TGatewayV2ServiceFactory } from "@app/ee/services/gateway-v2/gateway-v2-service";+import { TKeyStoreFactory } from "@app/keystore/keystore";import { crypto } from "@app/lib/crypto/cryptography";import { NotFoundError } from "@app/lib/errors";import { logger } from "@app/lib/logger";@@ -183,6 +184,7 @@ type TCertificateIssuanceQueueFactoryDep = {apiEnrollmentConfigDAL?: Pick<TApiEnrollmentConfigDALFactory, "findById">;gatewayV2Service: Pick<TGatewayV2ServiceFactory, "getPlatformConnectionDetailsByGatewayId">;gatewayPoolService: Pick<TGatewayPoolServiceFactory, "resolveEffectiveGatewayId">;+ keyStore: Pick<TKeyStoreFactory, "acquireLock">;telemetryService: Pick<TTelemetryServiceFactory, "sendPostHogEvents">;};@@ -212,6 +214,7 @@ export const certificateIssuanceQueueFactory = ({apiEnrollmentConfigDAL,gatewayV2Service,gatewayPoolService,+ keyStore,telemetryService}: TCertificateIssuanceQueueFactoryDep) => {const acmeFns = AcmeCertificateAuthorityFns({@@ -227,7 +230,10 @@ export const certificateIssuanceQueueFactory = ({projectDAL,pkiSyncDAL,pkiSyncQueue,- certificateProfileDAL+ certificateProfileDAL,+ gatewayV2Service,+ gatewayPoolService,+ keyStore});const azureAdCsFns = AzureAdCsCertificateAuthorityFns({diff --git a/docs/api-reference/endpoints/app-connections/powerdns/available.mdx b/docs/api-reference/endpoints/app-connections/powerdns/available.mdxnew file mode 100644index 0000000000..ee680ab387--- /dev/null+++ b/docs/api-reference/endpoints/app-connections/powerdns/available.mdx@@ -0,0 +1,4 @@+---+title: "Available"+openapi: "GET /api/v1/app-connections/powerdns/available"+---diff --git a/docs/api-reference/endpoints/app-connections/powerdns/create.mdx b/docs/api-reference/endpoints/app-connections/powerdns/create.mdxnew file mode 100644index 0000000000..ff592da131--- /dev/null+++ b/docs/api-reference/endpoints/app-connections/powerdns/create.mdx@@ -0,0 +1,10 @@+---+title: "Create"+openapi: "POST /api/v1/app-connections/powerdns"+---++<Note>+ Check out the configuration docs for [PowerDNS+ Connections](/integrations/app-connections/powerdns) to learn how to obtain the required+ credentials.+</Note>diff --git a/docs/api-reference/endpoints/app-connections/powerdns/delete.mdx b/docs/api-reference/endpoints/app-connections/powerdns/delete.mdxnew file mode 100644index 0000000000..4652f84c9f--- /dev/null+++ b/docs/api-reference/endpoints/app-connections/powerdns/delete.mdx@@ -0,0 +1,4 @@+---+title: "Delete"+openapi: "DELETE /api/v1/app-connections/powerdns/{connectionId}"+---diff --git a/docs/api-reference/endpoints/app-connections/powerdns/get-by-id.mdx b/docs/api-reference/endpoints/app-connections/powerdns/get-by-id.mdxnew file mode 100644index 0000000000..92db7b91ec--- /dev/null+++ b/docs/api-reference/endpoints/app-connections/powerdns/get-by-id.mdx@@ -0,0 +1,4 @@+---+title: "Get by ID"+openapi: "GET /api/v1/app-connections/powerdns/{connectionId}"+---diff --git a/docs/api-reference/endpoints/app-connections/powerdns/get-by-name.mdx b/docs/api-reference/endpoints/app-connections/powerdns/get-by-name.mdxnew file mode 100644index 0000000000..c910dd96df--- /dev/null+++ b/docs/api-reference/endpoints/app-connections/powerdns/get-by-name.mdx@@ -0,0 +1,4 @@+---+title: "Get by name"+openapi: "GET /api/v1/app-connections/powerdns/connection-name/{connectionName}"+---diff --git a/docs/api-reference/endpoints/app-connections/powerdns/list.mdx b/docs/api-reference/endpoints/app-connections/powerdns/list.mdxnew file mode 100644index 0000000000..781d06abe9--- /dev/null+++ b/docs/api-reference/endpoints/app-connections/powerdns/list.mdx@@ -0,0 +1,4 @@+---+title: "List"+openapi: "GET /api/v1/app-connections/powerdns"+---diff --git a/docs/api-reference/endpoints/app-connections/powerdns/update.mdx b/docs/api-reference/endpoints/app-connections/powerdns/update.mdxnew file mode 100644index 0000000000..fe20ab9936--- /dev/null+++ b/docs/api-reference/endpoints/app-connections/powerdns/update.mdx@@ -0,0 +1,10 @@+---+title: "Update"+openapi: "PATCH /api/v1/app-connections/powerdns/{connectionId}"+---++<Note>+ Check out the configuration docs for [PowerDNS+ Connections](/integrations/app-connections/powerdns) to learn how to obtain the required+ credentials.+</Note>diff --git a/docs/docs.json b/docs/docs.jsonindex b260bd5af5..7aa8fef5a2 100644--- a/docs/docs.json+++ b/docs/docs.json@@ -1074,6 +1074,7 @@"integrations/app-connections/oracledb","integrations/app-connections/ovh","integrations/app-connections/postgres",+ "integrations/app-connections/powerdns","integrations/app-connections/qovery","integrations/app-connections/railway","integrations/app-connections/redis",@@ -2288,6 +2289,18 @@"api-reference/endpoints/app-connections/postgres/delete"]},+ {+ "group": "PowerDNS",+ "pages": [+ "api-reference/endpoints/app-connections/powerdns/list",+ "api-reference/endpoints/app-connections/powerdns/available",+ "api-reference/endpoints/app-connections/powerdns/get-by-id",+ "api-reference/endpoints/app-connections/powerdns/get-by-name",+ "api-reference/endpoints/app-connections/powerdns/create",+ "api-reference/endpoints/app-connections/powerdns/update",+ "api-reference/endpoints/app-connections/powerdns/delete"+ ]+ },{"group": "Qovery","pages": [diff --git a/docs/documentation/platform/pki/ca/acme-ca.mdx b/docs/documentation/platform/pki/ca/acme-ca.mdxindex b3430dfb86..b8d85973c3 100644--- a/docs/documentation/platform/pki/ca/acme-ca.mdx+++ b/docs/documentation/platform/pki/ca/acme-ca.mdx@@ -17,7 +17,7 @@ their **ACME Directory URL** such as:- ZeroSSL: `https://acme.zerossl.com/v2/DV90`.- SSL.com: `https://acme.ssl.com/sslcom-dv-rsa`.-When Infisical requests a certificate from an ACME-compatible CA, it creates a TXT record at `_acme-challenge.{your-domain}` in your configured DNS provider (e.g. Route53, Cloudflare, Azure DNS, DNS Made Easy, etc.); this TXT record contains the challenge token issued by the ACME-compatible CA to validate domain control for the requested certificate.+When Infisical requests a certificate from an ACME-compatible CA, it creates a TXT record at `_acme-challenge.{your-domain}` in your configured DNS provider (e.g. Route53, Cloudflare, Azure DNS, DNS Made Easy, PowerDNS, etc.); this TXT record contains the challenge token issued by the ACME-compatible CA to validate domain control for the requested certificate.The ACME provider checks for the existence of this TXT record to verify domain control before issuing the certificate back to Infisical.After validation completes successfully, Infisical automatically removes the TXT record from your DNS provider.@@ -132,6 +132,13 @@ In the following steps, we explore how to connect Infisical to an ACME-compatiblFor detailed instructions on setting up a DNS Made Easy connection, see the [DNS Made Easy Connection](/integrations/app-connections/dns-made-easy) documentation.</Tab>+ <Tab title="PowerDNS">+ 1. In **Certificate Manager**, go to **Settings → App Connections** and create a new PowerDNS connection.++ 2. Enable the HTTP API on your PowerDNS Authoritative Server and set an `api-key`. If the server is not reachable from the internet, attach a Gateway to the connection.++ For detailed instructions on setting up a PowerDNS connection, see the [PowerDNS Connection](/integrations/app-connections/powerdns) documentation.+ </Tab></Tabs></Step><Step title="Register an ACME-compatible CA">@@ -215,7 +222,7 @@ In the following steps, we explore how to connect Infisical to an ACME-compatibl<AccordionGroup><Accordion title="What DNS validation methods are supported?">- Currently, Infisical supports DNS-01 validation through AWS Route53, Cloudflare, Azure DNS, and DNS Made Easy. The DNS-01 challenge method is preferred for ACME integrations because it:+ Currently, Infisical supports DNS-01 validation through AWS Route53, Cloudflare, Azure DNS, DNS Made Easy, and PowerDNS. The DNS-01 challenge method is preferred for ACME integrations because it:- Works with wildcard certificates- Doesn't require your servers to be publicly accessiblediff --git a/docs/integrations/app-connections/powerdns.mdx b/docs/integrations/app-connections/powerdns.mdxnew file mode 100644index 0000000000..e3e08caaa3--- /dev/null+++ b/docs/integrations/app-connections/powerdns.mdx@@ -0,0 +1,71 @@+---+title: "PowerDNS connection"+sidebarTitle: "PowerDNS"+description: "Learn how to configure a PowerDNS Connection for Infisical."+---++Infisical connects to the PowerDNS Authoritative Server through its HTTP API and authenticates with an API key. Use this connection to let Infisical create and remove the TXT records that answer an ACME DNS-01 challenge in a zone that server is authoritative for.++<Note>+ The PowerDNS API key grants full control over every zone the server hosts. PowerDNS has no+ per-zone or read-only API scopes, so treat the key as an administrative credential.+</Note>++## Prerequisites++- A PowerDNS Authoritative Server 4.1 or later with the HTTP API enabled.+- A zone on that server for the domain you want certificates issued for.+- If the server isn't reachable from the internet, an [Infisical Gateway](/documentation/platform/gateways/overview) with network access to it.++## Enable the PowerDNS API++The API is off by default. Add the following to `pdns.conf` and restart `pdns_server`:++```ini+api=yes+api-key=<a-long-random-secret>+webserver=yes+webserver-address=0.0.0.0+webserver-port=8081+webserver-allow-from=<the address Infisical or your Gateway connects from>+```++Keep `webserver-allow-from` as narrow as your network allows. PowerDNS rejects every request from an address outside that range before it checks the API key.++Confirm the API answers before you create the connection:++```bash+curl -H "X-API-Key: <your-api-key>" http://<your-server>:8081/api/v1/servers/localhost/zones+```++## Setup PowerDNS connection in Infisical++<Steps>+ <Step title="Navigate to App Connections">+ In **Certificate Manager**, go to **Settings → App Connections**.+ + </Step>+ <Step title="Add Connection">+ Select the **PowerDNS Connection** option from the connection options modal.+ </Step>+ <Step title="Create Connection">+ Fill in the **API URL** with the address of the PowerDNS web server, such as `https://pdns.example.com:8081`. Infisical appends the `/api/v1` path itself and rejects a URL that already includes it.++ Fill in the **API Key** with the value of your `api-key` setting.++ If your PowerDNS server sits on a private network, select a **Gateway** to route the requests through.++ Leave **Server ID** empty unless you connect through a proxy that fronts several PowerDNS servers and gives each one its own ID. A PowerDNS Authoritative Server always reports its API server ID as `localhost`, and Infisical uses that by default.++ On the **SSL** tab you can supply a CA certificate for a reverse proxy that presents a private certificate, or turn off **Reject Unauthorized** to accept a self-signed one.+ </Step>+ <Step title="Connection Created">+ Your **PowerDNS Connection** is now available for use in Certificate Manager.+ </Step>+</Steps>++## Use with ACME certificate authorities++Select **PowerDNS** as the DNS provider when you register an external ACME certificate authority, then pick the zone Infisical should write challenge records into. Infisical reads the zone list from your server, and the zone must be authoritative for the domains you request certificates for.++Infisical adds each challenge value to the `_acme-challenge` record set, then removes only that value once the certificate authority has validated it. Any other records you keep at the same name stay in place. See [ACME certificate authorities](/documentation/platform/pki/ca/acme-ca) for the rest of the setup.diff --git a/docs/snippets/AppConnectionsBrowser.jsx b/docs/snippets/AppConnectionsBrowser.jsxindex 7d41a18ca5..96557c813c 100644--- a/docs/snippets/AppConnectionsBrowser.jsx+++ b/docs/snippets/AppConnectionsBrowser.jsx@@ -267,6 +267,13 @@ export const AppConnectionsBrowser = () => {description: "Learn how to connect Infisical to Azure DNS for ACME DNS validation.",category: "Networking & DNS",},+ {+ name: "PowerDNS",+ slug: "powerdns",+ path: "/integrations/app-connections/powerdns",+ description: "Learn how to connect Infisical to PowerDNS for ACME DNS validation.",+ category: "Networking & DNS",+ },{name: "Windmill",slug: "windmill",diff --git a/frontend/public/images/integrations/PowerDNS.png b/frontend/public/images/integrations/PowerDNS.pngnew file mode 100644index 0000000000..e6e3dfaa0aBinary files /dev/null and b/frontend/public/images/integrations/PowerDNS.png differdiff --git a/frontend/src/helpers/appConnections.ts b/frontend/src/helpers/appConnections.tsindex 3f127e4f4a..60ecfc1fd1 100644--- a/frontend/src/helpers/appConnections.ts+++ b/frontend/src/helpers/appConnections.ts@@ -86,6 +86,7 @@ import { OnaConnectionMethod } from "@app/hooks/api/appConnections/types/ona-conimport { OpenAIConnectionMethod } from "@app/hooks/api/appConnections/types/open-ai-connection";import { OpenRouterConnectionMethod } from "@app/hooks/api/appConnections/types/open-router-connection";import { OVHConnectionMethod } from "@app/hooks/api/appConnections/types/ovh-connection";+import { PowerDnsConnectionMethod } from "@app/hooks/api/appConnections/types/powerdns-connection";import { RailwayConnectionMethod } from "@app/hooks/api/appConnections/types/railway-connection";import { RenderConnectionMethod } from "@app/hooks/api/appConnections/types/render-connection";import { RundeckConnectionMethod } from "@app/hooks/api/appConnections/types/rundeck-connection";@@ -320,6 +321,12 @@ export const APP_CONNECTION_MAP: Record<category: "DNS",description: "Manage DNS records on DNS Made Easy."},+ [AppConnection.PowerDns]: {+ name: "PowerDNS",+ image: "PowerDNS.png",+ category: "DNS",+ description: "Manage DNS records on a self-hosted PowerDNS server."+ },[AppConnection.Zabbix]: {name: "Zabbix",image: "Zabbix.png",@@ -741,6 +748,7 @@ export const getAppConnectionMethodDetails = (method: TAppConnection["method"])case TriggerDevConnectionMethod.ApiKey:case DatadogConnectionMethod.ApiKey:case DaytonaConnectionMethod.ApiKey:+ case PowerDnsConnectionMethod.ApiKey:return { name: "API Key", icon: KeyRoundIcon };case ChefConnectionMethod.UserKey:return { name: "User Key", icon: KeyRoundIcon };diff --git a/frontend/src/hooks/api/appConnections/enums.ts b/frontend/src/hooks/api/appConnections/enums.tsindex 179e3988d2..4a543c24d1 100644--- a/frontend/src/hooks/api/appConnections/enums.ts+++ b/frontend/src/hooks/api/appConnections/enums.ts@@ -11,6 +11,7 @@ export enum AppConnection {AzureADCS = "azure-adcs",ADCS = "adcs",AzureDNS = "azure-dns",+ PowerDns = "powerdns",Databricks = "databricks",Humanitec = "humanitec",TerraformCloud = "terraform-cloud",diff --git a/frontend/src/hooks/api/appConnections/powerdns/index.ts b/frontend/src/hooks/api/appConnections/powerdns/index.tsnew file mode 100644index 0000000000..2c1906d369--- /dev/null+++ b/frontend/src/hooks/api/appConnections/powerdns/index.ts@@ -0,0 +1,2 @@+export * from "./queries";+export * from "./types";diff --git a/frontend/src/hooks/api/appConnections/powerdns/queries.tsx b/frontend/src/hooks/api/appConnections/powerdns/queries.tsxnew file mode 100644index 0000000000..34fc8136bb--- /dev/null+++ b/frontend/src/hooks/api/appConnections/powerdns/queries.tsx@@ -0,0 +1,37 @@+import { useQuery, UseQueryOptions } from "@tanstack/react-query";++import { apiRequest } from "@app/config/request";++import { appConnectionKeys } from "../queries";+import { TPowerDnsZone } from "./types";++const powerDnsConnectionKeys = {+ all: [...appConnectionKeys.all, "powerdns"] as const,+ listZones: (connectionId: string) =>+ [...powerDnsConnectionKeys.all, "zones", connectionId] as const+};++export const usePowerDnsConnectionListZones = (+ connectionId: string,+ options?: Omit<+ UseQueryOptions<+ TPowerDnsZone[],+ unknown,+ TPowerDnsZone[],+ ReturnType<typeof powerDnsConnectionKeys.listZones>+ >,+ "queryKey" | "queryFn"+ >+) => {+ return useQuery({+ queryKey: powerDnsConnectionKeys.listZones(connectionId),+ queryFn: async () => {+ const { data } = await apiRequest.get<TPowerDnsZone[]>(+ `/api/v1/app-connections/powerdns/${connectionId}/zones`+ );++ return data;+ },+ ...options+ });+};diff --git a/frontend/src/hooks/api/appConnections/powerdns/types.ts b/frontend/src/hooks/api/appConnections/powerdns/types.tsnew file mode 100644index 0000000000..a4c03cda49--- /dev/null+++ b/frontend/src/hooks/api/appConnections/powerdns/types.ts@@ -0,0 +1,4 @@+export type TPowerDnsZone = {+ id: string;+ name: string;+};diff --git a/frontend/src/hooks/api/appConnections/types/app-options.ts b/frontend/src/hooks/api/appConnections/types/app-options.tsindex 0fbb1fa7fd..4b3dc93eb9 100644--- a/frontend/src/hooks/api/appConnections/types/app-options.ts+++ b/frontend/src/hooks/api/appConnections/types/app-options.ts@@ -216,6 +216,10 @@ export type TAzureDNSConnectionOption = TAppConnectionOptionBase & {app: AppConnection.AzureDNS;};+export type TPowerDnsConnectionOption = TAppConnectionOptionBase & {+ app: AppConnection.PowerDns;+};+export type TSshConnectionOption = TAppConnectionOptionBase & {app: AppConnection.SSH;};@@ -400,6 +404,7 @@ export type TAppConnectionOption =| TChefConnectionOption| TDNSMadeEasyConnectionOption| TAzureDNSConnectionOption+ | TPowerDnsConnectionOption| TOctopusDeployConnectionOption| TSshConnectionOption| TDbtConnectionOption@@ -484,6 +489,7 @@ export type TAppConnectionOptionMap = {[AppConnection.LaravelForge]: TLaravelForgeConnectionOption;[AppConnection.Chef]: TChefConnectionOption;[AppConnection.AzureDNS]: TAzureDNSConnectionOption;+ [AppConnection.PowerDns]: TPowerDnsConnectionOption;[AppConnection.OctopusDeploy]: TOctopusDeployConnectionOption;[AppConnection.SSH]: TSshConnectionOption;[AppConnection.Dbt]: TDbtConnectionOption;diff --git a/frontend/src/hooks/api/appConnections/types/index.ts b/frontend/src/hooks/api/appConnections/types/index.tsindex 1eeb819542..b985e67404 100644--- a/frontend/src/hooks/api/appConnections/types/index.ts+++ b/frontend/src/hooks/api/appConnections/types/index.ts@@ -63,6 +63,7 @@ import { TOpenRouterConnection } from "./open-router-connection";import { TOracleDBConnection } from "./oracledb-connection";import { TOvhConnection } from "./ovh-connection";import { TPostgresConnection } from "./postgres-connection";+import { TPowerDnsConnection } from "./powerdns-connection";import { TQoveryConnection } from "./qovery-connection";import { TRailwayConnection } from "./railway-connection";import { TRedisConnection } from "./redis-connection";@@ -145,6 +146,7 @@ export * from "./open-router-connection";export * from "./oracledb-connection";export * from "./ovh-connection";export * from "./postgres-connection";+export * from "./powerdns-connection";export * from "./qovery-connection";export * from "./railway-connection";export * from "./redis-connection";@@ -250,6 +252,7 @@ export type TAppConnection =| TLiteLLMConnection| TFireworksConnection| TNutanixPrismCentralConnection+ | TPowerDnsConnection| TSpaceliftConnection| TDaytonaConnection;diff --git a/frontend/src/hooks/api/appConnections/types/powerdns-connection.ts b/frontend/src/hooks/api/appConnections/types/powerdns-connection.tsnew file mode 100644index 0000000000..69aee8ff01--- /dev/null+++ b/frontend/src/hooks/api/appConnections/types/powerdns-connection.ts@@ -0,0 +1,17 @@+import { AppConnection } from "@app/hooks/api/appConnections/enums";+import { TRootAppConnection } from "@app/hooks/api/appConnections/types/root-connection";++export enum PowerDnsConnectionMethod {+ ApiKey = "api-key"+}++export type TPowerDnsConnection = TRootAppConnection & { app: AppConnection.PowerDns } & {+ method: PowerDnsConnectionMethod.ApiKey;+ credentials: {+ apiUrl: string;+ apiKey: string;+ serverId?: string;+ sslRejectUnauthorized?: boolean;+ sslCertificate?: string;+ };+};diff --git a/frontend/src/hooks/api/ca/constants.tsx b/frontend/src/hooks/api/ca/constants.tsxindex ca1fa7a641..d2142f597f 100644--- a/frontend/src/hooks/api/ca/constants.tsx+++ b/frontend/src/hooks/api/ca/constants.tsx@@ -16,14 +16,16 @@ export const ACME_DNS_PROVIDER_NAME_MAP: Record<AcmeDnsProvider, string> = {[AcmeDnsProvider.ROUTE53]: "Route53",[AcmeDnsProvider.Cloudflare]: "Cloudflare",[AcmeDnsProvider.DNSMadeEasy]: "DNS Made Easy",- [AcmeDnsProvider.AzureDNS]: "Azure DNS"+ [AcmeDnsProvider.AzureDNS]: "Azure DNS",+ [AcmeDnsProvider.PowerDns]: "PowerDNS"};export const ACME_DNS_PROVIDER_APP_CONNECTION_MAP: Record<AcmeDnsProvider, AppConnection> = {[AcmeDnsProvider.ROUTE53]: AppConnection.AWS,[AcmeDnsProvider.Cloudflare]: AppConnection.Cloudflare,[AcmeDnsProvider.DNSMadeEasy]: AppConnection.DNSMadeEasy,- [AcmeDnsProvider.AzureDNS]: AppConnection.AzureDNS+ [AcmeDnsProvider.AzureDNS]: AppConnection.AzureDNS,+ [AcmeDnsProvider.PowerDns]: AppConnection.PowerDns};export const CA_TYPE_CAPABILITIES_MAP: Record<CaType, CaCapability[]> = {diff --git a/frontend/src/hooks/api/ca/enums.tsx b/frontend/src/hooks/api/ca/enums.tsxindex 3f069d106d..86d38a9edb 100644--- a/frontend/src/hooks/api/ca/enums.tsx+++ b/frontend/src/hooks/api/ca/enums.tsx@@ -29,7 +29,8 @@ export enum AcmeDnsProvider {ROUTE53 = "route53",Cloudflare = "cloudflare",DNSMadeEasy = "dns-made-easy",- AzureDNS = "azure-dns"+ AzureDNS = "azure-dns",+ PowerDns = "powerdns"}export enum CaRenewalStatus {diff --git a/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/ExternalCaFields/AcmeFields.tsx b/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/ExternalCaFields/AcmeFields.tsxindex 0fe9ec7dab..56c467610f 100644--- a/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/ExternalCaFields/AcmeFields.tsx+++ b/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/ExternalCaFields/AcmeFields.tsx@@ -22,6 +22,7 @@ import { TAvailableAppConnection } from "@app/hooks/api/appConnections";import { TAzureDNSZone } from "@app/hooks/api/appConnections/azure-dns";import { TCloudflareZone } from "@app/hooks/api/appConnections/cloudflare";import { TDNSMadeEasyZone } from "@app/hooks/api/appConnections/dns-made-easy";+import { TPowerDnsZone } from "@app/hooks/api/appConnections/powerdns";import { AcmeDnsProvider } from "@app/hooks/api/ca";import {ACME_DNS_PROVIDER_APP_CONNECTION_MAP,@@ -46,6 +47,9 @@ type Props = {isDNSMadeEasyZonesPending: boolean;azureDnsZones: TAzureDNSZone[];isAzureDNSZonesPending: boolean;+ powerDnsZones: TPowerDnsZone[];+ isPowerDnsZonesPending: boolean;+ onDnsSelectionChange: () => void;};export const AcmeFields = ({@@ -61,7 +65,10 @@ export const AcmeFields = ({dnsMadeEasyZones,isDNSMadeEasyZonesPending,azureDnsZones,- isAzureDNSZonesPending+ isAzureDNSZonesPending,+ powerDnsZones,+ isPowerDnsZonesPending,+ onDnsSelectionChange}: Props) => (<><Controller@@ -71,7 +78,14 @@ export const AcmeFields = ({render={({ field: { onChange, value }, fieldState: { error } }) => (<Field className="mb-4"><FieldLabel>DNS Provider</FieldLabel>- <Select value={value} onValueChange={(val) => onChange(val)} disabled={isExistingCa}>+ <Select+ value={value}+ onValueChange={(val) => {+ onChange(val);+ onDnsSelectionChange();+ }}+ disabled={isExistingCa}+ ><SelectTrigger className="w-full" isError={Boolean(error)}><SelectValue /></SelectTrigger>@@ -91,6 +105,7 @@ export const AcmeFields = ({control={control}name="configuration.dnsAppConnection"label="DNS App Connection"+ onAfterChange={onDnsSelectionChange}options={availableConnections}isLoading={isPending}tooltip={@@ -199,6 +214,34 @@ export const AcmeFields = ({)}/>)}+ {dnsProvider === AcmeDnsProvider.PowerDns && (+ <Controller+ name="configuration.dnsProviderConfig.hostedZoneId"+ control={control}+ render={({ field: { value, onChange }, fieldState: { error } }) => (+ <Field className="mb-4">+ <FieldLabel>Zone</FieldLabel>+ <FilterableSelect+ isLoading={isPowerDnsZonesPending && !!dnsAppConnection.id}+ isDisabled={!dnsAppConnection.id}+ value={+ powerDnsZones.find((zone) => zone.id === value) ||+ (value ? { id: value, name: value } : null)+ }+ onChange={(option) => {+ onChange((option as SingleValue<TPowerDnsZone>)?.id ?? null);+ }}+ options={powerDnsZones}+ placeholder="Select a zone..."+ getOptionLabel={(option) => option.name}+ getOptionValue={(option) => option.id}+ isError={Boolean(error)}+ />+ <FieldError errors={[error]} />+ </Field>+ )}+ />+ )}<Controllercontrol={control}defaultValue=""diff --git a/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/ExternalCaFields/AppConnectionSelectField.tsx b/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/ExternalCaFields/AppConnectionSelectField.tsxindex 728d13cd00..424108959f 100644--- a/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/ExternalCaFields/AppConnectionSelectField.tsx+++ b/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/ExternalCaFields/AppConnectionSelectField.tsx@@ -27,6 +27,7 @@ type Props = {isLoading: boolean;required?: boolean;menuPlacement?: "top" | "bottom" | "auto";+ onAfterChange?: () => void;};export const AppConnectionSelectField = ({@@ -37,7 +38,8 @@ export const AppConnectionSelectField = ({options,isLoading,required,- menuPlacement+ menuPlacement,+ onAfterChange}: Props) => (<Controllercontrol={control}@@ -56,7 +58,10 @@ export const AppConnectionSelectField = ({<FilterableSelect{...(menuPlacement ? { menuPlacement } : {})}value={(value as AppConnectionValue)?.id ? (value as AppConnectionValue) : null}- onChange={(newValue) => onChange(newValue)}+ onChange={(newValue) => {+ onChange(newValue);+ onAfterChange?.();+ }}isLoading={isLoading}options={options}placeholder="Select connection..."diff --git a/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/ExternalCaModal.tsx b/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/ExternalCaModal.tsxindex 3b59a9658d..2b79464634 100644--- a/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/ExternalCaModal.tsx+++ b/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/ExternalCaModal.tsx@@ -35,6 +35,7 @@ import {} from "@app/hooks/api/appConnections/digicert";import { useDNSMadeEasyConnectionListZones } from "@app/hooks/api/appConnections/dns-made-easy";import { AppConnection } from "@app/hooks/api/appConnections/enums";+import { usePowerDnsConnectionListZones } from "@app/hooks/api/appConnections/powerdns";import {AcmeDnsProvider,CaStatus,@@ -394,6 +395,11 @@ export const ExternalCaModal = ({ popUp, handlePopUpToggle }: Props) => {enabled: caType === CaType.ACME});+ const { data: availablePowerDnsConnections, isPending: isPowerDnsPending } =+ useListAvailableAppConnections(AppConnection.PowerDns, currentProject.id, {+ enabled: caType === CaType.ACME+ });+const { data: availableAzureConnections, isPending: isAzurePending } =useListAvailableAppConnections(AppConnection.AzureADCS, currentProject.id, {enabled: caType === CaType.AZURE_AD_CS@@ -450,7 +456,8 @@ export const ExternalCaModal = ({ popUp, handlePopUpToggle }: Props) => {...(availableRoute53Connections || []),...(availableCloudflareConnections || []),...(availableDNSMadeEasyConnections || []),- ...(availableAzureDNSConnections || [])+ ...(availableAzureDNSConnections || []),+ ...(availablePowerDnsConnections || [])];}, [caType,@@ -458,6 +465,7 @@ export const ExternalCaModal = ({ popUp, handlePopUpToggle }: Props) => {availableCloudflareConnections,availableDNSMadeEasyConnections,availableAzureDNSConnections,+ availablePowerDnsConnections,availableAzureConnections,availableAdcsConnections,availableAwsConnections,@@ -467,7 +475,11 @@ export const ExternalCaModal = ({ popUp, handlePopUpToggle }: Props) => {]);const isPending =- ((isRoute53Pending || isCloudflarePending || isDNSMadeEasyPending || isAzureDNSPending) &&+ ((isRoute53Pending ||+ isCloudflarePending ||+ isDNSMadeEasyPending ||+ isAzureDNSPending ||+ isPowerDnsPending) &&caType === CaType.ACME) ||(isAzurePending && caType === CaType.AZURE_AD_CS) ||(isAdcsPending && caType === CaType.ADCS) ||@@ -496,6 +508,11 @@ export const ExternalCaModal = ({ popUp, handlePopUpToggle }: Props) => {enabled: dnsProvider === AcmeDnsProvider.AzureDNS && !!dnsAppConnection.id});+ const { data: powerDnsZones = [], isPending: isPowerDnsZonesPending } =+ usePowerDnsConnectionListZones(dnsAppConnection.id, {+ enabled: dnsProvider === AcmeDnsProvider.PowerDns && !!dnsAppConnection.id+ });+// Populate form with CA data when editinguseEffect(() => {if (ca && !isCaLoading) {@@ -955,6 +972,13 @@ export const ExternalCaModal = ({ popUp, handlePopUpToggle }: Props) => {isDNSMadeEasyZonesPending={isDNSMadeEasyZonesPending}azureDnsZones={azureDnsZones}isAzureDNSZonesPending={isAzureDNSZonesPending}+ powerDnsZones={powerDnsZones}+ isPowerDnsZonesPending={isPowerDnsZonesPending}+ onDnsSelectionChange={() =>+ setValue("configuration.dnsProviderConfig.hostedZoneId", "", {+ shouldDirty: true+ })+ }/>)}{caType === CaType.AZURE_AD_CS && (diff --git a/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/AppConnectionForm.tsx b/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/AppConnectionForm.tsxindex ef03e0bf80..6b48239097 100644--- a/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/AppConnectionForm.tsx+++ b/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/AppConnectionForm.tsx@@ -77,6 +77,7 @@ import { OpenRouterConnectionForm } from "./OpenRouterConnectionForm";import { OracleDBConnectionForm } from "./OracleDBConnectionForm";import { OVHConnectionForm } from "./OVHConnectionForm";import { PostgresConnectionForm } from "./PostgresConnectionForm";+import { PowerDnsConnectionForm } from "./PowerDnsConnectionForm";import { QoveryConnectionForm } from "./QoveryConnectionForm";import { RailwayConnectionForm } from "./RailwayConnectionForm";import { RedisConnectionForm } from "./RedisConnectionForm";@@ -365,6 +366,8 @@ const CreateForm = ({ app, onComplete, projectId }: CreateFormProps) => {return <RundeckConnectionForm onSubmit={onSubmit} />;case AppConnection.NutanixPrismCentral:return <NutanixPrismCentralConnectionForm onSubmit={onSubmit} />;+ case AppConnection.PowerDns:+ return <PowerDnsConnectionForm onSubmit={onSubmit} />;default:throw new Error(`Unhandled App ${app}`);}@@ -638,6 +641,8 @@ const UpdateForm = ({ appConnection, onComplete }: UpdateFormProps) => {return (<NutanixPrismCentralConnectionForm onSubmit={onSubmit} appConnection={appConnection} />);+ case AppConnection.PowerDns:+ return <PowerDnsConnectionForm onSubmit={onSubmit} appConnection={appConnection} />;case AppConnection.Venafi:return <VenafiConnectionForm onSubmit={onSubmit} appConnection={appConnection} />;case AppConnection.VenafiTpp:diff --git a/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/PowerDnsConnectionForm.tsx b/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/PowerDnsConnectionForm.tsxnew file mode 100644index 0000000000..1c9111b3ec--- /dev/null+++ b/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/PowerDnsConnectionForm.tsx@@ -0,0 +1,327 @@+import { useState } from "react";+import { Controller, FormProvider, useForm } from "react-hook-form";+import { zodResolver } from "@hookform/resolvers/zod";+import { Info } from "lucide-react";+import { z } from "zod";++import { OrgPermissionCan } from "@app/components/permissions";+import {+ Field,+ FieldContent,+ FieldDescription,+ FieldError,+ FieldLabel,+ Input,+ Label,+ SecretInput,+ Select,+ SelectContent,+ SelectItem,+ SelectTrigger,+ SelectValue,+ Tabs,+ TabsContent,+ TabsList,+ TabsTrigger,+ TextArea,+ Toggle,+ Tooltip,+ TooltipContent,+ TooltipTrigger+} from "@app/components/v3";+import { GatewayPicker } from "@app/components/v3/platform/GatewayPicker";+import { OrgPermissionSubjects } from "@app/context";+import { OrgGatewayPermissionActions } from "@app/context/OrgPermissionContext/types";+import { APP_CONNECTION_MAP, getAppConnectionMethodDetails } from "@app/helpers/appConnections";+import { useScopeVariant } from "@app/hooks";+import { TPowerDnsConnection } from "@app/hooks/api/appConnections";+import { AppConnection } from "@app/hooks/api/appConnections/enums";+import { PowerDnsConnectionMethod } from "@app/hooks/api/appConnections/types/powerdns-connection";++import { AppConnectionFormFooter } from "./AppConnectionFormFooter";+import {+ genericAppConnectionFieldsSchema,+ GenericAppConnectionsFields+} from "./GenericAppConnectionFields";++type Props = {+ appConnection?: TPowerDnsConnection;+ onSubmit: (formData: FormData) => Promise<void>;+};++const rootSchema = genericAppConnectionFieldsSchema.extend({+ app: z.literal(AppConnection.PowerDns)+});++const formSchema = z.discriminatedUnion("method", [+ rootSchema.extend({+ method: z.literal(PowerDnsConnectionMethod.ApiKey),+ credentials: z.object({+ apiUrl: z+ .string()+ .trim()+ .url("API URL must be a valid URL")+ .max(512, "API URL cannot exceed 512 characters")+ .refine((value) => ["http:", "https:"].includes(new URL(value).protocol), {+ message: "API URL must use http or https"+ })+ .refine((value) => !/\/api(\/v\d+)?\/*$/.test(new URL(value).pathname), {+ message: "Enter the web server address only, without the /api/v1 path"+ }),+ apiKey: z+ .string()+ .trim()+ .min(1, "API key required")+ .max(512, "API key cannot exceed 512 characters"),+ serverId: z+ .string()+ .trim()+ .max(64, "Server ID cannot exceed 64 characters")+ .refine((value) => !value || /^[a-zA-Z0-9][a-zA-Z0-9._-]*$/.test(value), {+ message: "Server ID may only contain letters, numbers, dots, hyphens and underscores"+ })+ .refine((value) => !value.includes(".."), { message: "Server ID cannot contain '..'" })+ .transform((value) => value || undefined)+ .optional(),+ sslRejectUnauthorized: z.boolean(),+ sslCertificate: z+ .string()+ .trim()+ .max(8192, "SSL certificate cannot exceed 8192 characters")+ .transform((value) => value || undefined)+ .optional()+ })+ })+]);++type FormData = z.infer<typeof formSchema>;++export const PowerDnsConnectionForm = ({ appConnection, onSubmit }: Props) => {+ const isUpdate = Boolean(appConnection);+ const [selectedTab, setSelectedTab] = useState("configuration");++ const form = useForm<FormData>({+ resolver: zodResolver(formSchema),+ defaultValues: appConnection ?? {+ app: AppConnection.PowerDns,+ method: PowerDnsConnectionMethod.ApiKey,+ gatewayId: null,+ gatewayPoolId: null,+ credentials: {+ sslRejectUnauthorized: true,+ sslCertificate: undefined+ }+ }+ });++ const { handleSubmit, control, setValue, watch } = form;+ const scopeVariant = useScopeVariant();++ const gatewayId = watch("gatewayId");+ const gatewayPoolId = watch("gatewayPoolId");++ return (+ <FormProvider {...form}>+ <form onSubmit={handleSubmit(onSubmit)}>+ {!isUpdate && <GenericAppConnectionsFields />}+ <OrgPermissionCan+ I={OrgGatewayPermissionActions.AttachGateways}+ a={OrgPermissionSubjects.Gateway}+ >+ {(isAllowed) => {+ const picker = (+ <GatewayPicker+ isDisabled={!isAllowed}+ value={{ gatewayId: gatewayId ?? null, gatewayPoolId: gatewayPoolId ?? null }}+ onChange={({ gatewayId: newGwId, gatewayPoolId: newPoolId }) => {+ setValue("gatewayId", newGwId, { shouldDirty: true });+ setValue("gatewayPoolId", newPoolId, { shouldDirty: true });+ }}+ />+ );++ return (+ <Field className="mb-4">+ <FieldLabel>Gateway</FieldLabel>+ <FieldDescription>+ Route requests through a Gateway when your PowerDNS server is not reachable from+ the internet.+ </FieldDescription>+ {isAllowed ? (+ picker+ ) : (+ <Tooltip>+ <TooltipTrigger asChild>+ <span className="block w-full cursor-not-allowed">{picker}</span>+ </TooltipTrigger>+ <TooltipContent>+ Restricted access. You don't have permission to attach gateways to+ resources.+ </TooltipContent>+ </Tooltip>+ )}+ </Field>+ );+ }}+ </OrgPermissionCan>+ <Controller+ name="method"+ control={control}+ render={({ field: { value, onChange }, fieldState: { error } }) => (+ <Field className="mb-4">+ <FieldLabel htmlFor="method">+ Method+ <Tooltip>+ <TooltipTrigger asChild>+ <Info />+ </TooltipTrigger>+ <TooltipContent className="max-w-sm">+ {`The method you would like to use to connect with ${+ APP_CONNECTION_MAP[AppConnection.PowerDns].name+ }. This field cannot be changed after creation.`}+ </TooltipContent>+ </Tooltip>+ </FieldLabel>+ <Select disabled={isUpdate} value={value} onValueChange={(val) => onChange(val)}>+ <SelectTrigger id="method" className="w-full" isError={Boolean(error)}>+ <SelectValue placeholder="Select a method..." />+ </SelectTrigger>+ <SelectContent position="popper">+ {Object.values(PowerDnsConnectionMethod).map((m) => {+ return (+ <SelectItem value={m} key={m}>+ {getAppConnectionMethodDetails(m).name}+ </SelectItem>+ );+ })}+ </SelectContent>+ </Select>+ <FieldError errors={[error]} />+ </Field>+ )}+ />+ <Tabs value={selectedTab} onValueChange={setSelectedTab} className="mb-4">+ <TabsList variant={scopeVariant}>+ <TabsTrigger value="configuration">Configuration</TabsTrigger>+ <TabsTrigger value="ssl">SSL</TabsTrigger>+ </TabsList>+ <TabsContent value="configuration">+ <Controller+ name="credentials.apiUrl"+ control={control}+ render={({ field: { value, onChange }, fieldState: { error } }) => (+ <Field className="mb-4">+ <FieldLabel htmlFor="api-url">API URL</FieldLabel>+ <FieldDescription>+ The address of the PowerDNS web server, without the /api/v1 path.+ </FieldDescription>+ <Input+ id="api-url"+ value={value}+ onChange={(e) => onChange(e.target.value)}+ placeholder="https://pdns.example.com:8081"+ isError={Boolean(error?.message)}+ />+ <FieldError errors={[error]} />+ </Field>+ )}+ />+ <Controller+ name="credentials.apiKey"+ control={control}+ render={({ field: { value, onChange }, fieldState: { error } }) => (+ <Field className="mb-4">+ <FieldLabel htmlFor="api-key">API Key</FieldLabel>+ <FieldDescription>+ The value of the api-key setting in your PowerDNS configuration.+ </FieldDescription>+ <SecretInput+ aria-describedby={error ? "api-key-error" : undefined}+ isError={Boolean(error)}+ id="api-key"+ value={value}+ onChange={(e) => onChange(e.target.value)}+ />+ <FieldError id="api-key-error" errors={[error]} />+ </Field>+ )}+ />+ <Controller+ name="credentials.serverId"+ control={control}+ render={({ field, fieldState: { error } }) => (+ <Field className="mb-4">+ <FieldLabel htmlFor="server-id">+ Server ID <span className="text-muted">(optional)</span>+ </FieldLabel>+ <FieldDescription>+ Leave empty unless you connect through a proxy fronting several PowerDNS+ servers. A PowerDNS Authoritative Server always reports localhost.+ </FieldDescription>+ <Input+ id="server-id"+ {...field}+ value={field.value ?? ""}+ placeholder="localhost"+ isError={Boolean(error?.message)}+ />+ <FieldError errors={[error]} />+ </Field>+ )}+ />+ </TabsContent>+ <TabsContent value="ssl">+ <Controller+ name="credentials.sslCertificate"+ control={control}+ render={({ field, fieldState: { error } }) => (+ <Field className="mb-4">+ <FieldLabel htmlFor="ssl-certificate">+ SSL Certificate <span className="text-muted">(optional)</span>+ </FieldLabel>+ <TextArea+ id="ssl-certificate"+ className="h-[3.6rem] resize-none!"+ {...field}+ placeholder="-----BEGIN CERTIFICATE----- ... -----END CERTIFICATE-----"+ isError={Boolean(error?.message)}+ />+ <FieldError errors={[error]} />+ </Field>+ )}+ />+ <Controller+ name="credentials.sslRejectUnauthorized"+ control={control}+ render={({ field: { value, onChange }, fieldState: { error } }) => (+ <Field>+ <Field orientation="horizontal">+ <FieldContent>+ <Label htmlFor="ssl-reject-unauthorized">Reject Unauthorized</Label>+ <FieldDescription>+ If enabled, Infisical will only connect if PowerDNS presents a valid,+ trusted SSL certificate. Disable this for self-signed certificates or+ provide a CA certificate above.+ </FieldDescription>+ </FieldContent>+ <Toggle+ aria-invalid={Boolean(error)}+ id="ssl-reject-unauthorized"+ variant={scopeVariant}+ checked={value}+ onCheckedChange={onChange}+ />+ </Field>+ <FieldError errors={[error]} />+ </Field>+ )}+ />+ </TabsContent>+ </Tabs>+ <AppConnectionFormFooter+ submitLabel={isUpdate ? "Update Credentials" : "Connect to PowerDNS"}+ />+ </form>+ </FormProvider>+ );+};