mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-05 00:26:24 +00:00
Add skip dns ownership verification field
This commit is contained in:
@@ -47,7 +47,11 @@ export const registerCertificateProfilesRouter = async (server: FastifyZodProvid
|
|||||||
renewBeforeDays: z.number().min(1).max(30).optional()
|
renewBeforeDays: z.number().min(1).max(30).optional()
|
||||||
})
|
})
|
||||||
.optional(),
|
.optional(),
|
||||||
acmeConfig: z.object({}).optional(),
|
acmeConfig: z
|
||||||
|
.object({
|
||||||
|
skipDnsOwnershipVerification: z.boolean().optional()
|
||||||
|
})
|
||||||
|
.optional(),
|
||||||
externalConfigs: ExternalConfigUnionSchema
|
externalConfigs: ExternalConfigUnionSchema
|
||||||
})
|
})
|
||||||
.refine(
|
.refine(
|
||||||
|
|||||||
@@ -168,7 +168,11 @@ export const certificateProfileDALFactory = (db: TDbClient) => {
|
|||||||
db.ref("autoRenew").withSchema(TableName.PkiApiEnrollmentConfig).as("apiConfigAutoRenew"),
|
db.ref("autoRenew").withSchema(TableName.PkiApiEnrollmentConfig).as("apiConfigAutoRenew"),
|
||||||
db.ref("renewBeforeDays").withSchema(TableName.PkiApiEnrollmentConfig).as("apiConfigRenewBeforeDays"),
|
db.ref("renewBeforeDays").withSchema(TableName.PkiApiEnrollmentConfig).as("apiConfigRenewBeforeDays"),
|
||||||
db.ref("id").withSchema(TableName.PkiAcmeEnrollmentConfig).as("acmeConfigId"),
|
db.ref("id").withSchema(TableName.PkiAcmeEnrollmentConfig).as("acmeConfigId"),
|
||||||
db.ref("encryptedEabSecret").withSchema(TableName.PkiAcmeEnrollmentConfig).as("acmeConfigEncryptedEabSecret")
|
db.ref("encryptedEabSecret").withSchema(TableName.PkiAcmeEnrollmentConfig).as("acmeConfigEncryptedEabSecret"),
|
||||||
|
db
|
||||||
|
.ref("skipDnsOwnershipVerification")
|
||||||
|
.withSchema(TableName.PkiAcmeEnrollmentConfig)
|
||||||
|
.as("acmeConfigSkipDnsOwnershipVerification")
|
||||||
)
|
)
|
||||||
.where(`${TableName.PkiCertificateProfile}.id`, id)
|
.where(`${TableName.PkiCertificateProfile}.id`, id)
|
||||||
.first();
|
.first();
|
||||||
@@ -198,7 +202,8 @@ export const certificateProfileDALFactory = (db: TDbClient) => {
|
|||||||
const acmeConfig = result.acmeConfigId
|
const acmeConfig = result.acmeConfigId
|
||||||
? ({
|
? ({
|
||||||
id: result.acmeConfigId,
|
id: result.acmeConfigId,
|
||||||
encryptedEabSecret: result.acmeConfigEncryptedEabSecret
|
encryptedEabSecret: result.acmeConfigEncryptedEabSecret,
|
||||||
|
skipDnsOwnershipVerification: result.acmeConfigSkipDnsOwnershipVerification ?? false
|
||||||
} as TCertificateProfileWithConfigs["acmeConfig"])
|
} as TCertificateProfileWithConfigs["acmeConfig"])
|
||||||
: undefined;
|
: undefined;
|
||||||
|
|
||||||
|
|||||||
@@ -30,7 +30,11 @@ export const createCertificateProfileSchema = z
|
|||||||
renewBeforeDays: z.number().min(1).max(30).optional()
|
renewBeforeDays: z.number().min(1).max(30).optional()
|
||||||
})
|
})
|
||||||
.optional(),
|
.optional(),
|
||||||
acmeConfig: z.object({}).optional()
|
acmeConfig: z
|
||||||
|
.object({
|
||||||
|
skipDnsOwnershipVerification: z.boolean().optional()
|
||||||
|
})
|
||||||
|
.optional()
|
||||||
})
|
})
|
||||||
.refine(
|
.refine(
|
||||||
(data) => {
|
(data) => {
|
||||||
@@ -155,6 +159,11 @@ export const updateCertificateProfileSchema = z
|
|||||||
autoRenew: z.boolean().default(false),
|
autoRenew: z.boolean().default(false),
|
||||||
renewBeforeDays: z.number().min(1).max(30).optional()
|
renewBeforeDays: z.number().min(1).max(30).optional()
|
||||||
})
|
})
|
||||||
|
.optional(),
|
||||||
|
acmeConfig: z
|
||||||
|
.object({
|
||||||
|
skipDnsOwnershipVerification: z.boolean().optional()
|
||||||
|
})
|
||||||
.optional()
|
.optional()
|
||||||
})
|
})
|
||||||
.refine(
|
.refine(
|
||||||
|
|||||||
@@ -403,7 +403,13 @@ export const certificateProfileServiceFactory = ({
|
|||||||
apiConfigId = apiConfig.id;
|
apiConfigId = apiConfig.id;
|
||||||
} else if (data.enrollmentType === EnrollmentType.ACME && data.acmeConfig) {
|
} else if (data.enrollmentType === EnrollmentType.ACME && data.acmeConfig) {
|
||||||
const { encryptedEabSecret } = await generateAndEncryptAcmeEabSecret(projectId, kmsService, projectDAL);
|
const { encryptedEabSecret } = await generateAndEncryptAcmeEabSecret(projectId, kmsService, projectDAL);
|
||||||
const acmeConfig = await acmeEnrollmentConfigDAL.create({ encryptedEabSecret }, tx);
|
const acmeConfig = await acmeEnrollmentConfigDAL.create(
|
||||||
|
{
|
||||||
|
encryptedEabSecret,
|
||||||
|
skipDnsOwnershipVerification: data.acmeConfig.skipDnsOwnershipVerification ?? false
|
||||||
|
},
|
||||||
|
tx
|
||||||
|
);
|
||||||
acmeConfigId = acmeConfig.id;
|
acmeConfigId = acmeConfig.id;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -505,7 +511,7 @@ export const certificateProfileServiceFactory = ({
|
|||||||
const updatedData =
|
const updatedData =
|
||||||
finalIssuerType === IssuerType.SELF_SIGNED && existingProfile.caId ? { ...data, caId: null } : data;
|
finalIssuerType === IssuerType.SELF_SIGNED && existingProfile.caId ? { ...data, caId: null } : data;
|
||||||
|
|
||||||
const { estConfig, apiConfig, ...profileUpdateData } = updatedData;
|
const { estConfig, apiConfig, acmeConfig, ...profileUpdateData } = updatedData;
|
||||||
|
|
||||||
const updatedProfile = await certificateProfileDAL.transaction(async (tx) => {
|
const updatedProfile = await certificateProfileDAL.transaction(async (tx) => {
|
||||||
if (estConfig && existingProfile.estConfigId) {
|
if (estConfig && existingProfile.estConfigId) {
|
||||||
@@ -547,6 +553,16 @@ export const certificateProfileServiceFactory = ({
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (acmeConfig && existingProfile.acmeConfigId) {
|
||||||
|
await acmeEnrollmentConfigDAL.updateById(
|
||||||
|
existingProfile.acmeConfigId,
|
||||||
|
{
|
||||||
|
skipDnsOwnershipVerification: acmeConfig.skipDnsOwnershipVerification ?? false
|
||||||
|
},
|
||||||
|
tx
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
const profileResult = await certificateProfileDAL.updateById(profileId, profileUpdateData, tx);
|
const profileResult = await certificateProfileDAL.updateById(profileId, profileUpdateData, tx);
|
||||||
return profileResult;
|
return profileResult;
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -83,6 +83,7 @@ export type TCertificateProfileWithConfigs = TCertificateProfile & {
|
|||||||
id: string;
|
id: string;
|
||||||
directoryUrl: string;
|
directoryUrl: string;
|
||||||
encryptedEabSecret?: Buffer;
|
encryptedEabSecret?: Buffer;
|
||||||
|
skipDnsOwnershipVerification?: boolean;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user