mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-05 18:26:42 +00:00
misc: added audit logs
This commit is contained in:
@@ -371,6 +371,7 @@ export enum EventType {
|
|||||||
SIGN_CERTIFICATE_FROM_PROFILE = "sign-certificate-from-profile",
|
SIGN_CERTIFICATE_FROM_PROFILE = "sign-certificate-from-profile",
|
||||||
ORDER_CERTIFICATE_FROM_PROFILE = "order-certificate-from-profile",
|
ORDER_CERTIFICATE_FROM_PROFILE = "order-certificate-from-profile",
|
||||||
RENEW_CERTIFICATE = "renew-certificate",
|
RENEW_CERTIFICATE = "renew-certificate",
|
||||||
|
GET_CERTIFICATE_PROFILE_LATEST_ACTIVE_BUNDLE = "get-certificate-profile-latest-active-bundle",
|
||||||
UPDATE_CERTIFICATE_RENEWAL_CONFIG = "update-certificate-renewal-config",
|
UPDATE_CERTIFICATE_RENEWAL_CONFIG = "update-certificate-renewal-config",
|
||||||
DISABLE_CERTIFICATE_RENEWAL_CONFIG = "disable-certificate-renewal-config",
|
DISABLE_CERTIFICATE_RENEWAL_CONFIG = "disable-certificate-renewal-config",
|
||||||
ATTEMPT_CREATE_SLACK_INTEGRATION = "attempt-create-slack-integration",
|
ATTEMPT_CREATE_SLACK_INTEGRATION = "attempt-create-slack-integration",
|
||||||
@@ -2752,6 +2753,17 @@ interface OrderCertificateFromProfile {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
interface GetCertificateProfileLatestActiveBundle {
|
||||||
|
type: EventType.GET_CERTIFICATE_PROFILE_LATEST_ACTIVE_BUNDLE;
|
||||||
|
metadata: {
|
||||||
|
certificateProfileId: string;
|
||||||
|
certificateId: string;
|
||||||
|
commonName: string;
|
||||||
|
profileName: string;
|
||||||
|
serialNumber: string;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
interface RenewCertificate {
|
interface RenewCertificate {
|
||||||
type: EventType.RENEW_CERTIFICATE;
|
type: EventType.RENEW_CERTIFICATE;
|
||||||
metadata: {
|
metadata: {
|
||||||
@@ -4282,6 +4294,7 @@ export type Event =
|
|||||||
| DeleteCertificateProfile
|
| DeleteCertificateProfile
|
||||||
| GetCertificateProfile
|
| GetCertificateProfile
|
||||||
| ListCertificateProfiles
|
| ListCertificateProfiles
|
||||||
|
| GetCertificateProfileLatestActiveBundle
|
||||||
| IssueCertificateFromProfile
|
| IssueCertificateFromProfile
|
||||||
| SignCertificateFromProfile
|
| SignCertificateFromProfile
|
||||||
| OrderCertificateFromProfile
|
| OrderCertificateFromProfile
|
||||||
|
|||||||
@@ -522,7 +522,7 @@ export const registerCertificateProfilesRouter = async (server: FastifyZodProvid
|
|||||||
},
|
},
|
||||||
onRequest: verifyAuth([AuthMode.JWT, AuthMode.IDENTITY_ACCESS_TOKEN]),
|
onRequest: verifyAuth([AuthMode.JWT, AuthMode.IDENTITY_ACCESS_TOKEN]),
|
||||||
handler: async (req) => {
|
handler: async (req) => {
|
||||||
const bundle = await server.services.certificateProfile.getLatestActiveCertificateBundle({
|
const response = await server.services.certificateProfile.getLatestActiveCertificateBundle({
|
||||||
actor: req.permission.type,
|
actor: req.permission.type,
|
||||||
actorId: req.permission.id,
|
actorId: req.permission.id,
|
||||||
actorAuthMethod: req.permission.authMethod,
|
actorAuthMethod: req.permission.authMethod,
|
||||||
@@ -530,7 +530,7 @@ export const registerCertificateProfilesRouter = async (server: FastifyZodProvid
|
|||||||
profileId: req.params.id
|
profileId: req.params.id
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!bundle) {
|
if (!response) {
|
||||||
return {
|
return {
|
||||||
certificate: null,
|
certificate: null,
|
||||||
certificateChain: null,
|
certificateChain: null,
|
||||||
@@ -539,7 +539,27 @@ export const registerCertificateProfilesRouter = async (server: FastifyZodProvid
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
return bundle;
|
await server.services.auditLog.createAuditLog({
|
||||||
|
...req.auditLogInfo,
|
||||||
|
projectId: response.certObj.projectId,
|
||||||
|
event: {
|
||||||
|
type: EventType.GET_CERTIFICATE_PROFILE_LATEST_ACTIVE_BUNDLE,
|
||||||
|
metadata: {
|
||||||
|
certificateProfileId: response.profile.id,
|
||||||
|
certificateId: response.certObj.id,
|
||||||
|
commonName: response.certObj.commonName,
|
||||||
|
profileName: response.profile.slug,
|
||||||
|
serialNumber: response.certObj.serialNumber
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return {
|
||||||
|
certificate: response.certificate,
|
||||||
|
certificateChain: response.certificateChain,
|
||||||
|
privateKey: response.privateKey,
|
||||||
|
serialNumber: response.certObj.serialNumber
|
||||||
|
};
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -835,7 +835,8 @@ export const certificateProfileServiceFactory = ({
|
|||||||
certificate,
|
certificate,
|
||||||
certificateChain,
|
certificateChain,
|
||||||
privateKey,
|
privateKey,
|
||||||
serialNumber: cert.serialNumber
|
profile,
|
||||||
|
certObj: cert
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -268,7 +268,18 @@ export const eventToNameMap: { [K in EventType]: string } = {
|
|||||||
[EventType.PAM_RESOURCE_GET]: "PAM Resource Get",
|
[EventType.PAM_RESOURCE_GET]: "PAM Resource Get",
|
||||||
[EventType.PAM_RESOURCE_CREATE]: "PAM Resource Create",
|
[EventType.PAM_RESOURCE_CREATE]: "PAM Resource Create",
|
||||||
[EventType.PAM_RESOURCE_UPDATE]: "PAM Resource Update",
|
[EventType.PAM_RESOURCE_UPDATE]: "PAM Resource Update",
|
||||||
[EventType.PAM_RESOURCE_DELETE]: "PAM Resource Delete"
|
[EventType.PAM_RESOURCE_DELETE]: "PAM Resource Delete",
|
||||||
|
|
||||||
|
[EventType.CREATE_CERTIFICATE_PROFILE]: "Create Certificate Profile",
|
||||||
|
[EventType.UPDATE_CERTIFICATE_PROFILE]: "Update Certificate Profile",
|
||||||
|
[EventType.DELETE_CERTIFICATE_PROFILE]: "Delete Certificate Profile",
|
||||||
|
[EventType.GET_CERTIFICATE_PROFILE]: "Get Certificate Profile",
|
||||||
|
[EventType.LIST_CERTIFICATE_PROFILES]: "List Certificate Profiles",
|
||||||
|
[EventType.ISSUE_CERTIFICATE_FROM_PROFILE]: "Issue Certificate From Profile",
|
||||||
|
[EventType.SIGN_CERTIFICATE_FROM_PROFILE]: "Sign Certificate From Profile",
|
||||||
|
[EventType.ORDER_CERTIFICATE_FROM_PROFILE]: "Order Certificate From Profile",
|
||||||
|
[EventType.GET_CERTIFICATE_PROFILE_LATEST_ACTIVE_BUNDLE]:
|
||||||
|
"Get Certificate Profile Latest Active Bundle"
|
||||||
};
|
};
|
||||||
|
|
||||||
export const userAgentTypeToNameMap: { [K in UserAgentType]: string } = {
|
export const userAgentTypeToNameMap: { [K in UserAgentType]: string } = {
|
||||||
|
|||||||
@@ -260,5 +260,15 @@ export enum EventType {
|
|||||||
PAM_RESOURCE_GET = "pam-resource-get",
|
PAM_RESOURCE_GET = "pam-resource-get",
|
||||||
PAM_RESOURCE_CREATE = "pam-resource-create",
|
PAM_RESOURCE_CREATE = "pam-resource-create",
|
||||||
PAM_RESOURCE_UPDATE = "pam-resource-update",
|
PAM_RESOURCE_UPDATE = "pam-resource-update",
|
||||||
PAM_RESOURCE_DELETE = "pam-resource-delete"
|
PAM_RESOURCE_DELETE = "pam-resource-delete",
|
||||||
|
|
||||||
|
CREATE_CERTIFICATE_PROFILE = "create-certificate-profile",
|
||||||
|
UPDATE_CERTIFICATE_PROFILE = "update-certificate-profile",
|
||||||
|
DELETE_CERTIFICATE_PROFILE = "delete-certificate-profile",
|
||||||
|
GET_CERTIFICATE_PROFILE = "get-certificate-profile",
|
||||||
|
LIST_CERTIFICATE_PROFILES = "list-certificate-profiles",
|
||||||
|
ISSUE_CERTIFICATE_FROM_PROFILE = "issue-certificate-from-profile",
|
||||||
|
SIGN_CERTIFICATE_FROM_PROFILE = "sign-certificate-from-profile",
|
||||||
|
ORDER_CERTIFICATE_FROM_PROFILE = "order-certificate-from-profile",
|
||||||
|
GET_CERTIFICATE_PROFILE_LATEST_ACTIVE_BUNDLE = "get-certificate-profile-latest-active-bundle"
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user