Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

Add ca / cert audit logs

Tuan Dangda7da27572b5
diff --git a/backend/src/ee/services/audit-log/audit-log-types.ts b/backend/src/ee/services/audit-log/audit-log-types.ts
index 4158149982..8a0d2aef92 100644
--- a/backend/src/ee/services/audit-log/audit-log-types.ts
+++ b/backend/src/ee/services/audit-log/audit-log-types.ts
@@ -1,5 +1,6 @@
import { TProjectPermission } from "@app/lib/types";
import { ActorType } from "@app/services/auth/auth-type";
+import { CaStatus } from "@app/services/certificate-authority/certificate-authority-types";
import { TIdentityTrustedIp } from "@app/services/identity/identity-types";
export type TListProjectAuditLogDTO = {
@@ -104,7 +105,21 @@ export enum EventType {
SECRET_APPROVAL_MERGED = "secret-approval-merged",
SECRET_APPROVAL_REQUEST = "secret-approval-request",
SECRET_APPROVAL_CLOSED = "secret-approval-closed",
- SECRET_APPROVAL_REOPENED = "secret-approval-reopened"
+ SECRET_APPROVAL_REOPENED = "secret-approval-reopened",
+ CREATE_CA = "create-certificate-authority",
+ GET_CA = "get-certificate-authority",
+ UPDATE_CA = "update-certificate-authority",
+ DELETE_CA = "delete-certificate-authority",
+ GET_CA_CSR = "get-certificate-authority-csr",
+ GET_CA_CERT = "get-certificate-authority-cert",
+ SIGN_INTERMEDIATE = "sign-intermediate",
+ IMPORT_CA_CERT = "import-certificate-authority-cert",
+ GET_CA_CRL = "get-certificate-authority-crl",
+ ISSUE_CERT = "issue-cert",
+ GET_CERT = "get-cert",
+ DELETE_CERT = "delete-cert",
+ REVOKE_CERT = "revoke-cert",
+ GET_CERT_BODY = "get-cert-body"
}
interface UserActorMetadata {
@@ -843,6 +858,125 @@ interface SecretApprovalRequest {
};
}
+interface CreateCa {
+ type: EventType.CREATE_CA;
+ metadata: {
+ caId: string;
+ dn: string;
+ };
+}
+
+interface GetCa {
+ type: EventType.GET_CA;
+ metadata: {
+ caId: string;
+ dn: string;
+ };
+}
+
+interface UpdateCa {
+ type: EventType.UPDATE_CA;
+ metadata: {
+ caId: string;
+ dn: string;
+ status: CaStatus;
+ };
+}
+
+interface DeleteCa {
+ type: EventType.DELETE_CA;
+ metadata: {
+ caId: string;
+ dn: string;
+ };
+}
+
+interface GetCaCsr {
+ type: EventType.GET_CA_CSR;
+ metadata: {
+ caId: string;
+ dn: string;
+ };
+}
+
+interface GetCaCert {
+ type: EventType.GET_CA_CERT;
+ metadata: {
+ caId: string;
+ dn: string;
+ };
+}
+
+interface SignIntermediate {
+ type: EventType.SIGN_INTERMEDIATE;
+ metadata: {
+ caId: string;
+ dn: string;
+ serialNumber: string;
+ };
+}
+
+interface ImportCaCert {
+ type: EventType.IMPORT_CA_CERT;
+ metadata: {
+ caId: string;
+ dn: string;
+ };
+}
+
+interface GetCaCrl {
+ type: EventType.GET_CA_CRL;
+ metadata: {
+ caId: string;
+ dn: string;
+ };
+}
+
+interface IssueCert {
+ type: EventType.ISSUE_CERT;
+ metadata: {
+ caId: string;
+ dn: string;
+ serialNumber: string;
+ };
+}
+
+interface GetCert {
+ type: EventType.GET_CERT;
+ metadata: {
+ certId: string;
+ cn: string;
+ serialNumber: string;
+ };
+}
+
+interface DeleteCert {
+ type: EventType.DELETE_CERT;
+ metadata: {
+ certId: string;
+ cn: string;
+ serialNumber: string;
+ };
+}
+
+interface RevokeCert {
+ type: EventType.REVOKE_CERT;
+ metadata: {
+ certId: string;
+ cn: string;
+ serialNumber: string;
+ };
+}
+
+interface GetCertBody {
+ type: EventType.GET_CERT_BODY;
+ metadata: {
+ certId: string;
+ cn: string;
+ serialNumber: string;
+ };
+}
+
export type Event =
| GetSecretsEvent
| GetSecretEvent
@@ -910,4 +1044,18 @@ export type Event =
| SecretApprovalMerge
| SecretApprovalClosed
| SecretApprovalRequest
- | SecretApprovalReopened;
+ | SecretApprovalReopened
+ | CreateCa
+ | GetCa
+ | UpdateCa
+ | DeleteCa
+ | GetCaCsr
+ | GetCaCert
+ | SignIntermediate
+ | ImportCaCert
+ | GetCaCrl
+ | IssueCert
+ | GetCert
+ | DeleteCert
+ | RevokeCert
+ | GetCertBody;
diff --git a/backend/src/server/routes/v1/certificate-authority-router.ts b/backend/src/server/routes/v1/certificate-authority-router.ts
index ff84e86f1c..d013bfdadf 100644
--- a/backend/src/server/routes/v1/certificate-authority-router.ts
+++ b/backend/src/server/routes/v1/certificate-authority-router.ts
@@ -2,6 +2,7 @@ import ms from "ms";
import { z } from "zod";
import { CertificateAuthoritiesSchema } from "@app/db/schemas";
+import { EventType } from "@app/ee/services/audit-log/audit-log-types";
import { readLimit, writeLimit } from "@app/server/config/rateLimiter";
import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
import { AuthMode } from "@app/services/auth/auth-type";
@@ -63,6 +64,19 @@ export const registerCaRouter = async (server: FastifyZodProvider) => {
actorOrgId: req.permission.orgId,
...req.body
});
+
+ await server.services.auditLog.createAuditLog({
+ ...req.auditLogInfo,
+ projectId: ca.projectId,
+ event: {
+ type: EventType.CREATE_CA,
+ metadata: {
+ caId: ca.id,
+ dn: ca.dn
+ }
+ }
+ });
+
return {
ca
};
@@ -95,6 +109,19 @@ export const registerCaRouter = async (server: FastifyZodProvider) => {
actorAuthMethod: req.permission.authMethod,
actorOrgId: req.permission.orgId
});
+
+ await server.services.auditLog.createAuditLog({
+ ...req.auditLogInfo,
+ projectId: ca.projectId,
+ event: {
+ type: EventType.GET_CA,
+ metadata: {
+ caId: ca.id,
+ dn: ca.dn
+ }
+ }
+ });
+
return {
ca
};
@@ -131,6 +158,20 @@ export const registerCaRouter = async (server: FastifyZodProvider) => {
actorOrgId: req.permission.orgId,
...req.body
});
+
+ await server.services.auditLog.createAuditLog({
+ ...req.auditLogInfo,
+ projectId: ca.projectId,
+ event: {
+ type: EventType.UPDATE_CA,
+ metadata: {
+ caId: ca.id,
+ dn: ca.dn,
+ status: ca.status as CaStatus
+ }
+ }
+ });
+
return {
ca
};
@@ -163,6 +204,19 @@ export const registerCaRouter = async (server: FastifyZodProvider) => {
actorAuthMethod: req.permission.authMethod,
actorOrgId: req.permission.orgId
});
+
+ await server.services.auditLog.createAuditLog({
+ ...req.auditLogInfo,
+ projectId: ca.projectId,
+ event: {
+ type: EventType.DELETE_CA,
+ metadata: {
+ caId: ca.id,
+ dn: ca.dn
+ }
+ }
+ });
+
return {
ca
};
@@ -188,13 +242,26 @@ export const registerCaRouter = async (server: FastifyZodProvider) => {
}
},
handler: async (req) => {
- const csr = await server.services.certificateAuthority.getCaCsr({
+ const { ca, csr } = await server.services.certificateAuthority.getCaCsr({
caId: req.params.caId,
actor: req.permission.type,
actorId: req.permission.id,
actorAuthMethod: req.permission.authMethod,
actorOrgId: req.permission.orgId
});
+
+ await server.services.auditLog.createAuditLog({
+ ...req.auditLogInfo,
+ projectId: ca.projectId,
+ event: {
+ type: EventType.GET_CA_CSR,
+ metadata: {
+ caId: ca.id,
+ dn: ca.dn
+ }
+ }
+ });
+
return {
csr
};
@@ -222,13 +289,26 @@ export const registerCaRouter = async (server: FastifyZodProvider) => {
}
},
handler: async (req) => {
- const { certificate, certificateChain, serialNumber } = await server.services.certificateAuthority.getCaCert({
+ const { certificate, certificateChain, serialNumber, ca } = await server.services.certificateAuthority.getCaCert({
caId: req.params.caId,
actor: req.permission.type,
actorId: req.permission.id,
actorAuthMethod: req.permission.authMethod,
actorOrgId: req.permission.orgId
});
+
+ await server.services.auditLog.createAuditLog({
+ ...req.auditLogInfo,
+ projectId: ca.projectId,
+ event: {
+ type: EventType.GET_CA_CERT,
+ metadata: {
+ caId: ca.id,
+ dn: ca.dn
+ }
+ }
+ });
+
return {
certificate,
certificateChain,
@@ -265,7 +345,7 @@ export const registerCaRouter = async (server: FastifyZodProvider) => {
}
},
handler: async (req) => {
- const { certificate, certificateChain, issuingCaCertificate, serialNumber } =
+ const { certificate, certificateChain, issuingCaCertificate, serialNumber, ca } =
await server.services.certificateAuthority.signIntermediate({
caId: req.params.caId,
actor: req.permission.type,
@@ -274,6 +354,20 @@ export const registerCaRouter = async (server: FastifyZodProvider) => {
actorOrgId: req.permission.orgId,
...req.body
});
+
+ await server.services.auditLog.createAuditLog({
+ ...req.auditLogInfo,
+ projectId: ca.projectId,
+ event: {
+ type: EventType.SIGN_INTERMEDIATE,
+ metadata: {
+ caId: ca.id,
+ dn: ca.dn,
+ serialNumber
+ }
+ }
+ });
+
return {
certificate,
certificateChain,
@@ -307,7 +401,7 @@ export const registerCaRouter = async (server: FastifyZodProvider) => {
}
},
handler: async (req) => {
- await server.services.certificateAuthority.importCertToCa({
+ const { ca } = await server.services.certificateAuthority.importCertToCa({
caId: req.params.caId,
actor: req.permission.type,
actorId: req.permission.id,
@@ -316,6 +410,18 @@ export const registerCaRouter = async (server: FastifyZodProvider) => {
...req.body
});
+ await server.services.auditLog.createAuditLog({
+ ...req.auditLogInfo,
+ projectId: ca.projectId,
+ event: {
+ type: EventType.IMPORT_CA_CERT,
+ metadata: {
+ caId: ca.id,
+ dn: ca.dn
+ }
+ }
+ });
+
return {
message: "Successfully imported certificate to CA",
caId: req.params.caId
@@ -364,7 +470,7 @@ export const registerCaRouter = async (server: FastifyZodProvider) => {
}
},
handler: async (req) => {
- const { certificate, certificateChain, issuingCaCertificate, privateKey, serialNumber } =
+ const { certificate, certificateChain, issuingCaCertificate, privateKey, serialNumber, ca } =
await server.services.certificateAuthority.issueCertFromCa({
caId: req.params.caId,
actor: req.permission.type,
@@ -374,6 +480,19 @@ export const registerCaRouter = async (server: FastifyZodProvider) => {
...req.body
});
+ await server.services.auditLog.createAuditLog({
+ ...req.auditLogInfo,
+ projectId: ca.projectId,
+ event: {
+ type: EventType.ISSUE_CERT,
+ metadata: {
+ caId: ca.id,
+ dn: ca.dn,
+ serialNumber
+ }
+ }
+ });
+
return {
certificate,
certificateChain,
@@ -403,13 +522,26 @@ export const registerCaRouter = async (server: FastifyZodProvider) => {
}
},
handler: async (req) => {
- const { crl } = await server.services.certificateAuthority.getCaCrl({
+ const { crl, ca } = await server.services.certificateAuthority.getCaCrl({
caId: req.params.caId,
actor: req.permission.type,
actorId: req.permission.id,
actorAuthMethod: req.permission.authMethod,
actorOrgId: req.permission.orgId
});
+
+ await server.services.auditLog.createAuditLog({
+ ...req.auditLogInfo,
+ projectId: ca.projectId,
+ event: {
+ type: EventType.GET_CA_CRL,
+ metadata: {
+ caId: ca.id,
+ dn: ca.dn
+ }
+ }
+ });
+
return {
crl
};
diff --git a/backend/src/server/routes/v1/certificate-router.ts b/backend/src/server/routes/v1/certificate-router.ts
index 3d99936954..27da184311 100644
--- a/backend/src/server/routes/v1/certificate-router.ts
+++ b/backend/src/server/routes/v1/certificate-router.ts
@@ -1,6 +1,7 @@
import { z } from "zod";
import { CertificatesSchema } from "@app/db/schemas";
+import { EventType } from "@app/ee/services/audit-log/audit-log-types";
import { readLimit, writeLimit } from "@app/server/config/rateLimiter";
import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
import { AuthMode } from "@app/services/auth/auth-type";
@@ -26,15 +27,29 @@ export const registerCertRouter = async (server: FastifyZodProvider) => {
}
},
handler: async (req) => {
- const certificate = await server.services.certificate.getCert({
+ const { cert, ca } = await server.services.certificate.getCert({
serialNumber: req.params.serialNumber,
actor: req.permission.type,
actorId: req.permission.id,
actorAuthMethod: req.permission.authMethod,
actorOrgId: req.permission.orgId
});
+
+ await server.services.auditLog.createAuditLog({
+ ...req.auditLogInfo,
+ projectId: ca.projectId,
+ event: {
+ type: EventType.GET_CERT,
+ metadata: {
+ certId: cert.id,
+ cn: cert.commonName,
+ serialNumber: cert.serialNumber
+ }
+ }
+ });
+
return {
- certificate
+ certificate: cert
};
}
});
@@ -63,7 +78,7 @@ export const registerCertRouter = async (server: FastifyZodProvider) => {
}
},
handler: async (req) => {
- const { revokedAt } = await server.services.certificate.revokeCert({
+ const { revokedAt, cert, ca } = await server.services.certificate.revokeCert({
serialNumber: req.params.serialNumber,
actor: req.permission.type,
actorId: req.permission.id,
@@ -71,6 +86,20 @@ export const registerCertRouter = async (server: FastifyZodProvider) => {
actorOrgId: req.permission.orgId,
...req.body
});
+
+ await server.services.auditLog.createAuditLog({
+ ...req.auditLogInfo,
+ projectId: ca.projectId,
+ event: {
+ type: EventType.REVOKE_CERT,
+ metadata: {
+ certId: cert.id,
+ cn: cert.commonName,
+ serialNumber: cert.serialNumber
+ }
+ }
+ });
+
return {
message: "Successfully revoked certificate",
serialNumber: req.params.serialNumber,
@@ -98,15 +127,29 @@ export const registerCertRouter = async (server: FastifyZodProvider) => {
}
},
handler: async (req) => {
- const certificate = await server.services.certificate.deleteCert({
+ const { deletedCert, ca } = await server.services.certificate.deleteCert({
serialNumber: req.params.serialNumber,
actor: req.permission.type,
actorId: req.permission.id,
actorAuthMethod: req.permission.authMethod,
actorOrgId: req.permission.orgId
});
+
+ await server.services.auditLog.createAuditLog({
+ ...req.auditLogInfo,
+ projectId: ca.projectId,
+ event: {
+ type: EventType.DELETE_CERT,
+ metadata: {
+ certId: deletedCert.id,
+ cn: deletedCert.commonName,
+ serialNumber: deletedCert.serialNumber
+ }
+ }
+ });
+
return {
- certificate
+ certificate: deletedCert
};
}
});
@@ -132,13 +175,27 @@ export const registerCertRouter = async (server: FastifyZodProvider) => {
}
},
handler: async (req) => {
- const { certificate, certificateChain, serialNumber } = await server.services.certificate.getCertBody({
+ const { certificate, certificateChain, serialNumber, cert, ca } = await server.services.certificate.getCertBody({
serialNumber: req.params.serialNumber,
actor: req.permission.type,
actorId: req.permission.id,
actorAuthMethod: req.permission.authMethod,
actorOrgId: req.permission.orgId
});
+
+ await server.services.auditLog.createAuditLog({
+ ...req.auditLogInfo,
+ projectId: ca.projectId,
+ event: {
+ type: EventType.DELETE_CERT,
+ metadata: {
+ certId: cert.id,
+ cn: cert.commonName,
+ serialNumber: cert.serialNumber
+ }
+ }
+ });
+
return {
certificate,
certificateChain,
diff --git a/backend/src/services/certificate-authority/certificate-authority-service.ts b/backend/src/services/certificate-authority/certificate-authority-service.ts
index a97e2df7e7..7d753f8792 100644
--- a/backend/src/services/certificate-authority/certificate-authority-service.ts
+++ b/backend/src/services/certificate-authority/certificate-authority-service.ts
@@ -373,7 +373,10 @@ export const certificateAuthorityServiceFactory = ({
attributes: [new x509.ChallengePasswordAttribute("password")]
});
- return csrObj.toString("pem");
+ return {
+ csr: csrObj.toString("pem"),
+ ca
+ };
};
/**
@@ -407,7 +410,8 @@ export const certificateAuthorityServiceFactory = ({
return {
certificate: caCert,
certificateChain: caCertChain,
- serialNumber
+ serialNumber,
+ ca
};
};
@@ -535,7 +539,8 @@ export const certificateAuthorityServiceFactory = ({
certificate: intermediateCert.toString("pem"),
issuingCaCertificate,
certificateChain: `${issuingCaCertificate}\n${caCertChain}`.trim(),
- serialNumber: intermediateCert.serialNumber
+ serialNumber: intermediateCert.serialNumber,
+ ca
};
};
@@ -639,6 +644,8 @@ export const certificateAuthorityServiceFactory = ({
tx
);
});
+
+ return { ca };
};
/**
@@ -797,7 +804,8 @@ export const certificateAuthorityServiceFactory = ({
certificateChain: `${issuingCaCertificate}\n${caCertChain}`.trim(),
issuingCaCertificate,
privateKey: skLeaf,
- serialNumber
+ serialNumber,
+ ca
};
};
@@ -841,7 +849,8 @@ export const certificateAuthorityServiceFactory = ({
const crlPem = `-----BEGIN X509 CRL-----\n${base64crl.match(/.{1,64}/g)?.join("\n")}\n-----END X509 CRL-----`;
return {
- crl: crlPem
+ crl: crlPem,
+ ca
};
};
diff --git a/backend/src/services/certificate/certificate-service.ts b/backend/src/services/certificate/certificate-service.ts
index 569b387918..0a7548df89 100644
--- a/backend/src/services/certificate/certificate-service.ts
+++ b/backend/src/services/certificate/certificate-service.ts
@@ -59,7 +59,10 @@ export const certificateServiceFactory = ({
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.Certificates);
- return cert;
+ return {
+ cert,
+ ca
+ };
};
/**
@@ -80,7 +83,11 @@ export const certificateServiceFactory = ({
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Delete, ProjectPermissionSub.Certificates);
const deletedCert = await certificateDAL.deleteById(cert.id);
- return deletedCert;
+
+ return {
+ deletedCert,
+ ca
+ };
};
/**
@@ -134,7 +141,7 @@ export const certificateServiceFactory = ({
kmsService
});
- return { revokedAt };
+ return { revokedAt, cert, ca };
};
/**
@@ -181,7 +188,9 @@ export const certificateServiceFactory = ({
return {
certificate: certObj.toString("pem"),
certificateChain: `${caCert}\n${caCertChain}`.trim(),
- serialNumber: certObj.serialNumber
+ serialNumber: certObj.serialNumber,
+ cert,
+ ca
};
};
diff --git a/frontend/src/hooks/api/auditLogs/constants.tsx b/frontend/src/hooks/api/auditLogs/constants.tsx
index 3487003749..082bff02cd 100644
--- a/frontend/src/hooks/api/auditLogs/constants.tsx
+++ b/frontend/src/hooks/api/auditLogs/constants.tsx
@@ -26,7 +26,6 @@ export const eventToNameMap: { [K in EventType]: string } = {
[EventType.CREATE_IDENTITY_UNIVERSAL_AUTH_CLIENT_SECRET]: "Create universal auth client secret",
[EventType.REVOKE_IDENTITY_UNIVERSAL_AUTH_CLIENT_SECRET]: "Revoke universal auth client secret",
[EventType.GET_IDENTITY_UNIVERSAL_AUTH_CLIENT_SECRETS]: "Get universal auth client secrets",
- [EventType.GET_IDENTITY_UNIVERSAL_AUTH]: "Get universal auth",
[EventType.CREATE_ENVIRONMENT]: "Create environment",
[EventType.UPDATE_ENVIRONMENT]: "Update environment",
[EventType.DELETE_ENVIRONMENT]: "Delete environment",
@@ -43,7 +42,21 @@ export const eventToNameMap: { [K in EventType]: string } = {
[EventType.UPDATE_SECRET_IMPORT]: "Update secret import",
[EventType.DELETE_SECRET_IMPORT]: "Delete secret import",
[EventType.UPDATE_USER_WORKSPACE_DENIED_PERMISSIONS]: "Update denied permissions",
- [EventType.UPDATE_USER_WORKSPACE_ROLE]: "Update user role"
+ [EventType.UPDATE_USER_WORKSPACE_ROLE]: "Update user role",
+ [EventType.CREATE_CA]: "Create CA",
+ [EventType.GET_CA]: "Get CA",
+ [EventType.UPDATE_CA]: "Update CA",
+ [EventType.DELETE_CA]: "Delete CA",
+ [EventType.GET_CA_CSR]: "Get CA CSR",
+ [EventType.GET_CA_CERT]: "Get CA certificate",
+ [EventType.SIGN_INTERMEDIATE]: "Sign intermediate",
+ [EventType.IMPORT_CA_CERT]: "Import CA certificate",
+ [EventType.GET_CA_CRL]: "Get CA CRL",
+ [EventType.ISSUE_CERT]: "Issue certificate",
+ [EventType.GET_CERT]: "Get certificate",
+ [EventType.DELETE_CERT]: "Delete certificate",
+ [EventType.REVOKE_CERT]: "Revoke certificate",
+ [EventType.GET_CERT_BODY]: "Get certificate body"
};
export const userAgentTTypeoNameMap: { [K in UserAgentType]: string } = {
diff --git a/frontend/src/hooks/api/auditLogs/enums.tsx b/frontend/src/hooks/api/auditLogs/enums.tsx
index f6ccd8f81c..ad49998c50 100644
--- a/frontend/src/hooks/api/auditLogs/enums.tsx
+++ b/frontend/src/hooks/api/auditLogs/enums.tsx
@@ -56,5 +56,19 @@ export enum EventType {
UPDATE_SECRET_IMPORT = "update-secret-import",
DELETE_SECRET_IMPORT = "delete-secret-import",
UPDATE_USER_WORKSPACE_ROLE = "update-user-workspace-role",
- UPDATE_USER_WORKSPACE_DENIED_PERMISSIONS = "update-user-workspace-denied-permissions"
+ UPDATE_USER_WORKSPACE_DENIED_PERMISSIONS = "update-user-workspace-denied-permissions",
+ CREATE_CA = "create-certificate-authority",
+ GET_CA = "get-certificate-authority",
+ UPDATE_CA = "update-certificate-authority",
+ DELETE_CA = "delete-certificate-authority",
+ GET_CA_CSR = "get-certificate-authority-csr",
+ GET_CA_CERT = "get-certificate-authority-cert",
+ SIGN_INTERMEDIATE = "sign-intermediate",
+ IMPORT_CA_CERT = "import-certificate-authority-cert",
+ GET_CA_CRL = "get-certificate-authority-crl",
+ ISSUE_CERT = "issue-cert",
+ GET_CERT = "get-cert",
+ DELETE_CERT = "delete-cert",
+ REVOKE_CERT = "revoke-cert",
+ GET_CERT_BODY = "get-cert-body"
}
diff --git a/frontend/src/hooks/api/auditLogs/types.tsx b/frontend/src/hooks/api/auditLogs/types.tsx
index 92611c8143..3b607e5962 100644
--- a/frontend/src/hooks/api/auditLogs/types.tsx
+++ b/frontend/src/hooks/api/auditLogs/types.tsx
@@ -1,3 +1,4 @@
+import { CaStatus } from "../ca";
import { IdentityTrustedIp } from "../identities/types";
import { ActorType, EventType, UserAgentType } from "./enums";
@@ -462,6 +463,125 @@ interface UpdateUserDeniedPermissions {
};
}
+interface CreateCa {
+ type: EventType.CREATE_CA;
+ metadata: {
+ caId: string;
+ dn: string;
+ };
+}
+
+interface GetCa {
+ type: EventType.GET_CA;
+ metadata: {
+ caId: string;
+ dn: string;
+ };
+}
+
+interface UpdateCa {
+ type: EventType.UPDATE_CA;
+ metadata: {
+ caId: string;
+ dn: string;
+ status: CaStatus;
+ };
+}
+
+interface DeleteCa {
+ type: EventType.DELETE_CA;
+ metadata: {
+ caId: string;
+ dn: string;
+ };
+}
+
+interface GetCaCsr {
+ type: EventType.GET_CA_CSR;
+ metadata: {
+ caId: string;
+ dn: string;
+ };
+}
+
+interface GetCaCert {
+ type: EventType.GET_CA_CERT;
+ metadata: {
+ caId: string;
+ dn: string;
+ };
+}
+
+interface SignIntermediate {
+ type: EventType.SIGN_INTERMEDIATE;
+ metadata: {
+ caId: string;
+ dn: string;
+ serialNumber: string;
+ };
+}
+
+interface ImportCaCert {
+ type: EventType.IMPORT_CA_CERT;
+ metadata: {
+ caId: string;
+ dn: string;
+ };
+}
+
+interface GetCaCrl {
+ type: EventType.GET_CA_CRL;
+ metadata: {
+ caId: string;
+ dn: string;
+ };
+}
+
+interface IssueCert {
+ type: EventType.ISSUE_CERT;
+ metadata: {
+ caId: string;
+ dn: string;
+ serialNumber: string;
+ };
+}
+
+interface GetCert {
+ type: EventType.GET_CERT;
+ metadata: {
+ certId: string;
+ cn: string;
+ serialNumber: string;
+ };
+}
+
+interface DeleteCert {
+ type: EventType.DELETE_CERT;
+ metadata: {
+ certId: string;
+ cn: string;
+ serialNumber: string;
+ };
+}
+
+interface RevokeCert {
+ type: EventType.REVOKE_CERT;
+ metadata: {
+ certId: string;
+ cn: string;
+ serialNumber: string;
+ };
+}
+
+interface GetCertBody {
+ type: EventType.GET_CERT_BODY;
+ metadata: {
+ certId: string;
+ cn: string;
+ serialNumber: string;
+ };
+}
+
export type Event =
| GetSecretsEvent
| GetSecretEvent
@@ -504,7 +624,21 @@ export type Event =
| UpdateSecretImportEvent
| DeleteSecretImportEvent
| UpdateUserRole
- | UpdateUserDeniedPermissions;
+ | UpdateUserDeniedPermissions
+ | CreateCa
+ | GetCa
+ | UpdateCa
+ | DeleteCa
+ | GetCaCsr
+ | GetCaCert
+ | SignIntermediate
+ | ImportCaCert
+ | GetCaCrl
+ | IssueCert
+ | GetCert
+ | DeleteCert
+ | RevokeCert
+ | GetCertBody;
export type AuditLog = {
id: string;
diff --git a/frontend/src/views/Project/AuditLogsPage/components/LogsTableRow.tsx b/frontend/src/views/Project/AuditLogsPage/components/LogsTableRow.tsx
index 7fc69400ed..f4b740e35e 100644
--- a/frontend/src/views/Project/AuditLogsPage/components/LogsTableRow.tsx
+++ b/frontend/src/views/Project/AuditLogsPage/components/LogsTableRow.tsx
@@ -320,6 +320,30 @@ export const LogsTableRow = ({ auditLog }: Props) => {
})}
</Td>
);
+ case EventType.CREATE_CA:
+ case EventType.GET_CA:
+ case EventType.UPDATE_CA:
+ case EventType.DELETE_CA:
+ case EventType.GET_CA_CSR:
+ case EventType.GET_CA_CERT:
+ case EventType.IMPORT_CA_CERT:
+ case EventType.GET_CA_CRL:
+ case EventType.SIGN_INTERMEDIATE:
+ case EventType.ISSUE_CERT:
+ return (
+ <Td>
+ <p>{`CA DN: ${event.metadata.dn}`}</p>
+ </Td>
+ );
+ case EventType.GET_CERT:
+ case EventType.DELETE_CERT:
+ case EventType.REVOKE_CERT:
+ case EventType.GET_CERT_BODY:
+ return (
+ <Td>
+ <p>{`Cert CN: ${event.metadata.cn}`}</p>
+ </Td>
+ );
default:
return <Td />;
}