Update docs for CRL

This commit is contained in:
Tuan Dang
2024-08-22 12:16:37 -07:00
parent 2a79d5ba36
commit 8ef1cfda04
5 changed files with 21 additions and 16 deletions

View File

@@ -2,7 +2,7 @@ import { ForbiddenError } from "@casl/ability";
import * as x509 from "@peculiar/x509"; import * as x509 from "@peculiar/x509";
import { TCertificateAuthorityCrlDALFactory } from "@app/ee/services/certificate-authority-crl/certificate-authority-crl-dal"; import { TCertificateAuthorityCrlDALFactory } from "@app/ee/services/certificate-authority-crl/certificate-authority-crl-dal";
import { TLicenseServiceFactory } from "@app/ee/services/license/license-service"; // import { TLicenseServiceFactory } from "@app/ee/services/license/license-service";
import { TPermissionServiceFactory } from "@app/ee/services/permission/permission-service"; import { TPermissionServiceFactory } from "@app/ee/services/permission/permission-service";
import { ProjectPermissionActions, ProjectPermissionSub } from "@app/ee/services/permission/project-permission"; import { ProjectPermissionActions, ProjectPermissionSub } from "@app/ee/services/permission/project-permission";
import { BadRequestError, NotFoundError } from "@app/lib/errors"; import { BadRequestError, NotFoundError } from "@app/lib/errors";
@@ -19,7 +19,7 @@ type TCertificateAuthorityCrlServiceFactoryDep = {
projectDAL: Pick<TProjectDALFactory, "findOne" | "updateById" | "transaction">; projectDAL: Pick<TProjectDALFactory, "findOne" | "updateById" | "transaction">;
kmsService: Pick<TKmsServiceFactory, "decryptWithKmsKey" | "generateKmsKey">; kmsService: Pick<TKmsServiceFactory, "decryptWithKmsKey" | "generateKmsKey">;
permissionService: Pick<TPermissionServiceFactory, "getProjectPermission">; permissionService: Pick<TPermissionServiceFactory, "getProjectPermission">;
licenseService: Pick<TLicenseServiceFactory, "getPlan">; // licenseService: Pick<TLicenseServiceFactory, "getPlan">;
}; };
export type TCertificateAuthorityCrlServiceFactory = ReturnType<typeof certificateAuthorityCrlServiceFactory>; export type TCertificateAuthorityCrlServiceFactory = ReturnType<typeof certificateAuthorityCrlServiceFactory>;
@@ -29,8 +29,7 @@ export const certificateAuthorityCrlServiceFactory = ({
certificateAuthorityCrlDAL, certificateAuthorityCrlDAL,
projectDAL, projectDAL,
kmsService, kmsService,
permissionService, permissionService // licenseService
licenseService
}: TCertificateAuthorityCrlServiceFactoryDep) => { }: TCertificateAuthorityCrlServiceFactoryDep) => {
/** /**
* Return CRL with id [crlId] * Return CRL with id [crlId]
@@ -85,12 +84,12 @@ export const certificateAuthorityCrlServiceFactory = ({
ProjectPermissionSub.CertificateAuthorities ProjectPermissionSub.CertificateAuthorities
); );
const plan = await licenseService.getPlan(actorOrgId); // const plan = await licenseService.getPlan(actorOrgId);
if (!plan.caCrl) // if (!plan.caCrl)
throw new BadRequestError({ // throw new BadRequestError({
message: // message:
"Failed to get CA certificate revocation lists (CRLs) due to plan restriction. Upgrade plan to get the CA CRL." // "Failed to get CA certificate revocation lists (CRLs) due to plan restriction. Upgrade plan to get the CA CRL."
}); // });
const caCrls = await certificateAuthorityCrlDAL.find({ caId: ca.id }, { sort: [["createdAt", "desc"]] }); const caCrls = await certificateAuthorityCrlDAL.find({ caId: ca.id }, { sort: [["createdAt", "desc"]] });

View File

@@ -646,8 +646,8 @@ export const registerRoutes = async (
certificateAuthorityCrlDAL, certificateAuthorityCrlDAL,
projectDAL, projectDAL,
kmsService, kmsService,
permissionService, permissionService
licenseService // licenseService
}); });
const certificateTemplateService = certificateTemplateServiceFactory({ const certificateTemplateService = certificateTemplateServiceFactory({

View File

@@ -151,18 +151,24 @@ In the following steps, we explore how to revoke a X.509 certificate under a CA
</Step> </Step>
<Step title="Obtaining a CRL"> <Step title="Obtaining a CRL">
In order to check the revocation status of a certificate, you can check it In order to check the revocation status of a certificate, you can check it
against the CRL of a CA by selecting the **View CRL** option under the against the CRL of a CA by heading to its Issuing CA and downloading the CRL.
issuing CA and downloading the CRL file.
![pki view crl](/images/platform/pki/ca-crl.png) ![pki view crl](/images/platform/pki/ca-crl.png)
![pki download crl](/images/platform/pki/ca-crl-modal.png)
To verify a certificate against the To verify a certificate against the
downloaded CRL with OpenSSL, you can use the following command: downloaded CRL with OpenSSL, you can use the following command:
```bash ```bash
openssl verify -crl_check -CAfile chain.pem -CRLfile crl.pem cert.pem openssl verify -crl_check -CAfile chain.pem -CRLfile crl.pem cert.pem
```
Note that you can also obtain the CRL from the certificate itself by
referencing the CRL distribution point extension on the certificate itself.
To check a certificate against the CRL distribution point specified within it with OpenSSL, you can use the following command:
```bash
openssl verify -verbose -crl_check -crl_download -CAfile chain.pem cert.pem
``` ```
</Step> </Step>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 638 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 649 KiB

After

Width:  |  Height:  |  Size: 833 KiB