Skip to content

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

Move ssh out to org level

Tuan Dangfb253d00ebb9
diff --cc backend/src/db/migrations/20241216013357_ssh-mgmt.ts
index 92831d382e,0000000000..92831d382e
mode 100644,000000..100644
--- a/backend/src/db/migrations/20241216013357_ssh-mgmt.ts
+++ b/backend/src/db/migrations/20241216013357_ssh-mgmt.ts
diff --cc backend/src/db/schemas/models.ts
index 0f2c1ae49a,f670ad6e90..3156c97420
--- a/backend/src/db/schemas/models.ts
+++ b/backend/src/db/schemas/models.ts
@@@ -201,5 -198,12 +203,13 @@@ export enum IdentityAuthMethod
GCP_AUTH = "gcp-auth",
AWS_AUTH = "aws-auth",
AZURE_AUTH = "azure-auth",
- OIDC_AUTH = "oidc-auth"
+ OIDC_AUTH = "oidc-auth",
+ JWT_AUTH = "jwt-auth"
+ }
+
+ export enum ProjectType {
+ SecretManager = "secret-manager",
+ CertificateManager = "cert-manager",
- KMS = "kms"
++ KMS = "kms",
++ SSH = "ssh"
}
diff --cc backend/src/ee/services/ssh-certificate-template/ssh-certificate-template-service.ts
index e68eb991a8,0000000000..cd93c40fb2
mode 100644,000000..100644
--- a/backend/src/ee/services/ssh-certificate-template/ssh-certificate-template-service.ts
+++ b/backend/src/ee/services/ssh-certificate-template/ssh-certificate-template-service.ts
@@@ -1,244 -1,0 +1,248 @@@
+import { ForbiddenError } from "@casl/ability";
+import ms from "ms";
+
++import { ProjectType } from "@app/db/schemas";
+import { TPermissionServiceFactory } from "@app/ee/services/permission/permission-service";
+import { ProjectPermissionActions, ProjectPermissionSub } from "@app/ee/services/permission/project-permission";
+import { BadRequestError, NotFoundError } from "@app/lib/errors";
-
+import { TSshCertificateAuthorityDALFactory } from "../ssh/ssh-certificate-authority-dal";
+import { TSshCertificateTemplateDALFactory } from "./ssh-certificate-template-dal";
+import {
+ SshCertTemplateStatus,
+ TCreateSshCertTemplateDTO,
+ TDeleteSshCertTemplateDTO,
+ TGetSshCertTemplateDTO,
+ TUpdateSshCertTemplateDTO
+} from "./ssh-certificate-template-types";
+
+type TSshCertificateTemplateServiceFactoryDep = {
+ sshCertificateTemplateDAL: Pick<
+ TSshCertificateTemplateDALFactory,
+ "transaction" | "getByName" | "create" | "updateById" | "deleteById" | "getById"
+ >;
+ sshCertificateAuthorityDAL: Pick<TSshCertificateAuthorityDALFactory, "findById">;
+ permissionService: Pick<TPermissionServiceFactory, "getProjectPermission">;
+};
+
+export type TSshCertificateTemplateServiceFactory = ReturnType<typeof sshCertificateTemplateServiceFactory>;
+
+export const sshCertificateTemplateServiceFactory = ({
+ sshCertificateTemplateDAL,
+ sshCertificateAuthorityDAL,
+ permissionService
+}: TSshCertificateTemplateServiceFactoryDep) => {
+ const createSshCertTemplate = async ({
+ sshCaId,
+ name,
+ ttl,
+ maxTTL,
+ allowUserCertificates,
+ allowHostCertificates,
+ allowedUsers,
+ allowedHosts,
+ allowCustomKeyIds,
+ actorId,
+ actorAuthMethod,
+ actor,
+ actorOrgId
+ }: TCreateSshCertTemplateDTO) => {
+ const ca = await sshCertificateAuthorityDAL.findById(sshCaId);
+ if (!ca) {
+ throw new NotFoundError({
+ message: `SSH CA with ID ${sshCaId} not found`
+ });
+ }
+
- const { permission } = await permissionService.getProjectPermission(
++ const { permission, ForbidOnInvalidProjectType } = await permissionService.getProjectPermission(
+ actor,
+ actorId,
+ ca.projectId,
+ actorAuthMethod,
+ actorOrgId
+ );
+
++ ForbidOnInvalidProjectType(ProjectType.SSH);
+ ForbiddenError.from(permission).throwUnlessCan(
+ ProjectPermissionActions.Create,
+ ProjectPermissionSub.SshCertificateTemplates
+ );
+
+ if (ms(ttl) > ms(maxTTL)) {
+ throw new BadRequestError({
+ message: "TTL cannot be greater than max TTL"
+ });
+ }
+
+ const newCertificateTemplate = await sshCertificateTemplateDAL.transaction(async (tx) => {
+ const existingTemplate = await sshCertificateTemplateDAL.getByName(name, ca.projectId, tx);
+ if (existingTemplate) {
+ throw new BadRequestError({
+ message: `SSH certificate template with name ${name} already exists`
+ });
+ }
+
+ const certificateTemplate = await sshCertificateTemplateDAL.create(
+ {
+ sshCaId,
+ name,
+ ttl,
+ maxTTL,
+ allowUserCertificates,
+ allowHostCertificates,
+ allowedUsers,
+ allowedHosts,
+ allowCustomKeyIds,
+ status: SshCertTemplateStatus.ACTIVE
+ },
+ tx
+ );
+
+ return certificateTemplate;
+ });
+
+ return { certificateTemplate: newCertificateTemplate, ca };
+ };
+
+ const updateSshCertTemplate = async ({
+ id,
+ status,
+ name,
+ ttl,
+ maxTTL,
+ allowUserCertificates,
+ allowHostCertificates,
+ allowedUsers,
+ allowedHosts,
+ allowCustomKeyIds,
+ actorId,
+ actorAuthMethod,
+ actor,
+ actorOrgId
+ }: TUpdateSshCertTemplateDTO) => {
+ const certTemplate = await sshCertificateTemplateDAL.getById(id);
+ if (!certTemplate) {
+ throw new NotFoundError({
+ message: `SSH certificate template with ID ${id} not found`
+ });
+ }
+
- const { permission } = await permissionService.getProjectPermission(
++ const { permission, ForbidOnInvalidProjectType } = await permissionService.getProjectPermission(
+ actor,
+ actorId,
+ certTemplate.projectId,
+ actorAuthMethod,
+ actorOrgId
+ );
+
++ ForbidOnInvalidProjectType(ProjectType.SSH);
+ ForbiddenError.from(permission).throwUnlessCan(
+ ProjectPermissionActions.Edit,
+ ProjectPermissionSub.SshCertificateTemplates
+ );
+
+ const updatedCertificateTemplate = await sshCertificateTemplateDAL.transaction(async (tx) => {
+ if (name) {
+ const existingTemplate = await sshCertificateTemplateDAL.getByName(name, certTemplate.projectId, tx);
+ if (existingTemplate && existingTemplate.id !== id) {
+ throw new BadRequestError({
+ message: `SSH certificate template with name ${name} already exists`
+ });
+ }
+ }
+
+ if (ms(ttl || certTemplate.ttl) > ms(maxTTL || certTemplate.maxTTL)) {
+ throw new BadRequestError({
+ message: "TTL cannot be greater than max TTL"
+ });
+ }
+
+ const certificateTemplate = await sshCertificateTemplateDAL.updateById(
+ id,
+ {
+ status,
+ name,
+ ttl,
+ maxTTL,
+ allowUserCertificates,
+ allowHostCertificates,
+ allowedUsers,
+ allowedHosts,
+ allowCustomKeyIds
+ },
+ tx
+ );
+
+ return certificateTemplate;
+ });
+
+ return {
+ certificateTemplate: updatedCertificateTemplate,
+ projectId: certTemplate.projectId
+ };
+ };
+
+ const deleteSshCertTemplate = async ({
+ id,
+ actorId,
+ actorAuthMethod,
+ actor,
+ actorOrgId
+ }: TDeleteSshCertTemplateDTO) => {
+ const certificateTemplate = await sshCertificateTemplateDAL.getById(id);
+ if (!certificateTemplate) {
+ throw new NotFoundError({
+ message: `SSH certificate template with ID ${id} not found`
+ });
+ }
+
- const { permission } = await permissionService.getProjectPermission(
++ const { permission, ForbidOnInvalidProjectType } = await permissionService.getProjectPermission(
+ actor,
+ actorId,
+ certificateTemplate.projectId,
+ actorAuthMethod,
+ actorOrgId
+ );
+
++ ForbidOnInvalidProjectType(ProjectType.SSH);
+ ForbiddenError.from(permission).throwUnlessCan(
+ ProjectPermissionActions.Delete,
+ ProjectPermissionSub.SshCertificateTemplates
+ );
+
+ await sshCertificateTemplateDAL.deleteById(certificateTemplate.id);
+
+ return certificateTemplate;
+ };
+
+ const getSshCertTemplate = async ({ id, actorId, actorAuthMethod, actor, actorOrgId }: TGetSshCertTemplateDTO) => {
+ const certTemplate = await sshCertificateTemplateDAL.getById(id);
+ if (!certTemplate) {
+ throw new NotFoundError({
+ message: `SSH certificate template with ID ${id} not found`
+ });
+ }
+
- const { permission } = await permissionService.getProjectPermission(
++ const { permission, ForbidOnInvalidProjectType } = await permissionService.getProjectPermission(
+ actor,
+ actorId,
+ certTemplate.projectId,
+ actorAuthMethod,
+ actorOrgId
+ );
+
++ ForbidOnInvalidProjectType(ProjectType.SSH);
+ ForbiddenError.from(permission).throwUnlessCan(
+ ProjectPermissionActions.Read,
+ ProjectPermissionSub.SshCertificateTemplates
+ );
+
+ return certTemplate;
+ };
+
+ return {
+ createSshCertTemplate,
+ updateSshCertTemplate,
+ deleteSshCertTemplate,
+ getSshCertTemplate
+ };
+};
diff --cc backend/src/ee/services/ssh/ssh-certificate-authority-service.ts
index 7fd542293a,0000000000..c18e3551ed
mode 100644,000000..100644
--- a/backend/src/ee/services/ssh/ssh-certificate-authority-service.ts
+++ b/backend/src/ee/services/ssh/ssh-certificate-authority-service.ts
@@@ -1,527 -1,0 +1,533 @@@
+import { ForbiddenError } from "@casl/ability";
-
++import { ProjectType } from "@app/db/schemas";
+import { TPermissionServiceFactory } from "@app/ee/services/permission/permission-service";
+import { ProjectPermissionActions, ProjectPermissionSub } from "@app/ee/services/permission/project-permission";
+import { TSshCertificateAuthorityDALFactory } from "@app/ee/services/ssh/ssh-certificate-authority-dal";
+import { TSshCertificateAuthoritySecretDALFactory } from "@app/ee/services/ssh/ssh-certificate-authority-secret-dal";
+import { TSshCertificateBodyDALFactory } from "@app/ee/services/ssh-certificate/ssh-certificate-body-dal";
+import { TSshCertificateDALFactory } from "@app/ee/services/ssh-certificate/ssh-certificate-dal";
+import { TSshCertificateTemplateDALFactory } from "@app/ee/services/ssh-certificate-template/ssh-certificate-template-dal";
+import { BadRequestError, NotFoundError } from "@app/lib/errors";
+import { TKmsServiceFactory } from "@app/services/kms/kms-service";
+import { KmsDataKey } from "@app/services/kms/kms-types";
-
+import { SshCertTemplateStatus } from "../ssh-certificate-template/ssh-certificate-template-types";
+import { createSshCert, createSshKeyPair, getSshPublicKey } from "./ssh-certificate-authority-fns";
+import {
+ SshCaStatus,
+ TCreateSshCaDTO,
+ TDeleteSshCaDTO,
+ TGetSshCaCertificateTemplatesDTO,
+ TGetSshCaDTO,
+ TGetSshCaPublicKeyDTO,
+ TIssueSshCredsDTO,
+ TSignSshKeyDTO,
+ TUpdateSshCaDTO
+} from "./ssh-certificate-authority-types";
+
+type TSshCertificateAuthorityServiceFactoryDep = {
+ sshCertificateAuthorityDAL: Pick<
+ TSshCertificateAuthorityDALFactory,
+ "transaction" | "create" | "findById" | "updateById" | "deleteById" | "findOne"
+ >;
+ sshCertificateAuthoritySecretDAL: Pick<TSshCertificateAuthoritySecretDALFactory, "create" | "findOne">;
+ sshCertificateTemplateDAL: Pick<TSshCertificateTemplateDALFactory, "find" | "getByName">;
+ sshCertificateDAL: Pick<TSshCertificateDALFactory, "create" | "transaction">;
+ sshCertificateBodyDAL: Pick<TSshCertificateBodyDALFactory, "create">;
+ kmsService: Pick<
+ TKmsServiceFactory,
+ "generateKmsKey" | "encryptWithKmsKey" | "decryptWithKmsKey" | "getOrgKmsKeyId" | "createCipherPairWithDataKey"
+ >;
+ permissionService: Pick<TPermissionServiceFactory, "getProjectPermission">;
+};
+
+export type TSshCertificateAuthorityServiceFactory = ReturnType<typeof sshCertificateAuthorityServiceFactory>;
+
+// TODO: secretManagerEncryptor -> sshEncryptor (cc akhil)
+
+export const sshCertificateAuthorityServiceFactory = ({
+ sshCertificateAuthorityDAL,
+ sshCertificateAuthoritySecretDAL,
+ sshCertificateTemplateDAL,
+ sshCertificateDAL,
+ sshCertificateBodyDAL,
+ kmsService,
+ permissionService
+}: TSshCertificateAuthorityServiceFactoryDep) => {
+ /**
+ * Generates a new SSH CA
+ */
+ const createSshCa = async ({
+ projectId,
+ friendlyName,
+ keyAlgorithm,
+ actorId,
+ actorAuthMethod,
+ actor,
+ actorOrgId
+ }: TCreateSshCaDTO) => {
- const { permission } = await permissionService.getProjectPermission(
++ const { permission, ForbidOnInvalidProjectType } = await permissionService.getProjectPermission(
+ actor,
+ actorId,
+ projectId,
+ actorAuthMethod,
+ actorOrgId
+ );
+
++ ForbidOnInvalidProjectType(ProjectType.SSH);
+ ForbiddenError.from(permission).throwUnlessCan(
+ ProjectPermissionActions.Create,
+ ProjectPermissionSub.SshCertificateAuthorities
+ );
+
+ const newCa = await sshCertificateAuthorityDAL.transaction(async (tx) => {
+ const ca = await sshCertificateAuthorityDAL.create(
+ {
+ projectId,
+ friendlyName,
+ status: SshCaStatus.ACTIVE,
+ keyAlgorithm
+ },
+ tx
+ );
+
+ const { publicKey, privateKey } = await createSshKeyPair(keyAlgorithm);
+
+ // TODO: update to sshEncryptor
+ const { encryptor: secretManagerEncryptor } = await kmsService.createCipherPairWithDataKey({
+ type: KmsDataKey.SecretManager,
+ projectId
+ });
+
+ await sshCertificateAuthoritySecretDAL.create(
+ {
+ sshCaId: ca.id,
+ encryptedPrivateKey: secretManagerEncryptor({ plainText: Buffer.from(privateKey, "utf8") }).cipherTextBlob
+ },
+ tx
+ );
+
+ return { ...ca, publicKey };
+ });
+
+ return newCa;
+ };
+
+ /**
+ * Return SSH CA with id [caId]
+ */
+ const getSshCaById = async ({ caId, actor, actorId, actorAuthMethod, actorOrgId }: TGetSshCaDTO) => {
+ const ca = await sshCertificateAuthorityDAL.findById(caId);
+ if (!ca) throw new NotFoundError({ message: `SSH CA with ID '${caId}' not found` });
+
- const { permission } = await permissionService.getProjectPermission(
++ const { permission, ForbidOnInvalidProjectType } = await permissionService.getProjectPermission(
+ actor,
+ actorId,
+ ca.projectId,
+ actorAuthMethod,
+ actorOrgId
+ );
+
++ ForbidOnInvalidProjectType(ProjectType.SSH);
+ ForbiddenError.from(permission).throwUnlessCan(
+ ProjectPermissionActions.Read,
+ ProjectPermissionSub.SshCertificateAuthorities
+ );
+
+ const sshCaSecret = await sshCertificateAuthoritySecretDAL.findOne({ sshCaId: ca.id });
+
+ // TODO: update to sshDecryptor
+ const { decryptor: secretManagerDecryptor } = await kmsService.createCipherPairWithDataKey({
+ type: KmsDataKey.SecretManager,
+ projectId: ca.projectId
+ });
+
+ const decryptedCaPrivateKey = secretManagerDecryptor({
+ cipherTextBlob: sshCaSecret.encryptedPrivateKey
+ });
+
+ const publicKey = await getSshPublicKey(decryptedCaPrivateKey.toString("utf-8"));
+
+ return { ...ca, publicKey };
+ };
+
+ /**
+ * Return public key of SSH CA with id [caId]
+ */
+ const getSshCaPublicKey = async ({ caId }: TGetSshCaPublicKeyDTO) => {
+ const ca = await sshCertificateAuthorityDAL.findById(caId);
+ if (!ca) throw new NotFoundError({ message: `SSH CA with ID '${caId}' not found` });
+
+ const sshCaSecret = await sshCertificateAuthoritySecretDAL.findOne({ sshCaId: ca.id });
+
+ // TODO: update to sshDecryptor
+ const { decryptor: secretManagerDecryptor } = await kmsService.createCipherPairWithDataKey({
+ type: KmsDataKey.SecretManager,
+ projectId: ca.projectId
+ });
+
+ const decryptedCaPrivateKey = secretManagerDecryptor({
+ cipherTextBlob: sshCaSecret.encryptedPrivateKey
+ });
+
+ const publicKey = await getSshPublicKey(decryptedCaPrivateKey.toString("utf-8"));
+
+ return publicKey;
+ };
+
+ /**
+ * Update SSH CA with id [caId]
+ * Note: Used to enable/disable CA
+ */
+ const updateSshCaById = async ({
+ caId,
+ friendlyName,
+ status,
+ actor,
+ actorId,
+ actorAuthMethod,
+ actorOrgId
+ }: TUpdateSshCaDTO) => {
+ const ca = await sshCertificateAuthorityDAL.findById(caId);
+ if (!ca) throw new NotFoundError({ message: `SSH CA with ID '${caId}' not found` });
+
- const { permission } = await permissionService.getProjectPermission(
++ const { permission, ForbidOnInvalidProjectType } = await permissionService.getProjectPermission(
+ actor,
+ actorId,
+ ca.projectId,
+ actorAuthMethod,
+ actorOrgId
+ );
+
++ ForbidOnInvalidProjectType(ProjectType.SSH);
+ ForbiddenError.from(permission).throwUnlessCan(
+ ProjectPermissionActions.Edit,
+ ProjectPermissionSub.SshCertificateAuthorities
+ );
+
+ const updatedCa = await sshCertificateAuthorityDAL.updateById(caId, { friendlyName, status });
+
+ const sshCaSecret = await sshCertificateAuthoritySecretDAL.findOne({ sshCaId: ca.id });
+
+ // TODO: update to sshDecryptor
+ const { decryptor: secretManagerDecryptor } = await kmsService.createCipherPairWithDataKey({
+ type: KmsDataKey.SecretManager,
+ projectId: ca.projectId
+ });
+
+ const decryptedCaPrivateKey = secretManagerDecryptor({
+ cipherTextBlob: sshCaSecret.encryptedPrivateKey
+ });
+
+ const publicKey = await getSshPublicKey(decryptedCaPrivateKey.toString("utf-8"));
+
+ return { ...updatedCa, publicKey };
+ };
+
+ /**
+ * Delete SSH CA with id [caId]
+ */
+ const deleteSshCaById = async ({ caId, actor, actorId, actorAuthMethod, actorOrgId }: TDeleteSshCaDTO) => {
+ const ca = await sshCertificateAuthorityDAL.findById(caId);
+ if (!ca) throw new NotFoundError({ message: `SSH CA with ID '${caId}' not found` });
+
- const { permission } = await permissionService.getProjectPermission(
++ const { permission, ForbidOnInvalidProjectType } = await permissionService.getProjectPermission(
+ actor,
+ actorId,
+ ca.projectId,
+ actorAuthMethod,
+ actorOrgId
+ );
+
++ ForbidOnInvalidProjectType(ProjectType.SSH);
+ ForbiddenError.from(permission).throwUnlessCan(
+ ProjectPermissionActions.Delete,
+ ProjectPermissionSub.SshCertificateAuthorities
+ );
+
+ const deletedCa = await sshCertificateAuthorityDAL.deleteById(caId);
+
+ return deletedCa;
+ };
+
+ /**
+ * Return SSH certificate and corresponding new SSH public-private key pair where
+ * SSH public key is signed using CA behind SSH certificate with name [templateName].
+ */
+ const issueSshCreds = async ({
+ projectId,
+ templateName,
+ keyAlgorithm,
+ certType,
+ principals,
+ ttl: requestedTtl,
+ keyId: requestedKeyId,
+ actor,
+ actorId,
+ actorAuthMethod,
+ actorOrgId
+ }: TIssueSshCredsDTO) => {
+ const sshCertificateTemplate = await sshCertificateTemplateDAL.getByName(templateName, projectId);
+ if (!sshCertificateTemplate) {
+ throw new NotFoundError({
+ message: "No SSH certificate template found with specified name"
+ });
+ }
+
- const { permission } = await permissionService.getProjectPermission(
++ const { permission, ForbidOnInvalidProjectType } = await permissionService.getProjectPermission(
+ actor,
+ actorId,
+ sshCertificateTemplate.projectId,
+ actorAuthMethod,
+ actorOrgId
+ );
+
++ ForbidOnInvalidProjectType(ProjectType.SSH);
+ ForbiddenError.from(permission).throwUnlessCan(
+ ProjectPermissionActions.Create,
+ ProjectPermissionSub.SshCertificates
+ );
+
+ if (sshCertificateTemplate.caStatus === SshCaStatus.DISABLED) {
+ throw new BadRequestError({
+ message: "SSH CA is disabled"
+ });
+ }
+
+ if (sshCertificateTemplate.status === SshCertTemplateStatus.DISABLED) {
+ throw new BadRequestError({
+ message: "SSH certificate template is disabled"
+ });
+ }
+
+ // set [keyId] depending on if [allowCustomKeyIds] is true or false
+ const keyId = sshCertificateTemplate.allowCustomKeyIds
+ ? requestedKeyId ?? `${actor}-${actorId}`
+ : `${actor}-${actorId}`;
+
+ const sshCaSecret = await sshCertificateAuthoritySecretDAL.findOne({ sshCaId: sshCertificateTemplate.sshCaId });
+
+ // TODO: update to sshDecryptor
+ const { decryptor: secretManagerDecryptor } = await kmsService.createCipherPairWithDataKey({
+ type: KmsDataKey.SecretManager,
+ projectId
+ });
+
+ const decryptedCaPrivateKey = secretManagerDecryptor({
+ cipherTextBlob: sshCaSecret.encryptedPrivateKey
+ });
+
+ // create user key pair
+ const { publicKey, privateKey } = await createSshKeyPair(keyAlgorithm);
+
+ const { serialNumber, signedPublicKey, ttl } = await createSshCert({
+ template: sshCertificateTemplate,
+ caPrivateKey: decryptedCaPrivateKey.toString("utf8"),
+ clientPublicKey: publicKey,
+ keyId,
+ principals,
+ requestedTtl,
+ certType
+ });
+
+ // TODO: update to sshEncryptor
+ const { encryptor: secretManagerEncryptor } = await kmsService.createCipherPairWithDataKey({
+ type: KmsDataKey.SecretManager,
+ projectId: sshCertificateTemplate.projectId
+ });
+
+ const encryptedCertificate = secretManagerEncryptor({
+ plainText: Buffer.from(signedPublicKey, "utf8")
+ }).cipherTextBlob;
+
+ await sshCertificateDAL.transaction(async (tx) => {
+ const cert = await sshCertificateDAL.create(
+ {
+ sshCaId: sshCertificateTemplate.sshCaId,
+ sshCertificateTemplateId: sshCertificateTemplate.id,
+ serialNumber,
+ certType,
+ principals,
+ keyId,
+ notBefore: new Date(),
+ notAfter: new Date(Date.now() + ttl * 1000)
+ },
+ tx
+ );
+
+ await sshCertificateBodyDAL.create(
+ {
+ sshCertId: cert.id,
+ encryptedCertificate
+ },
+ tx
+ );
+ });
+
+ return {
+ serialNumber,
+ signedPublicKey,
+ privateKey,
+ publicKey,
+ certificateTemplate: sshCertificateTemplate,
+ ttl,
+ keyId
+ };
+ };
+
+ /**
+ * Return SSH certificate by signing SSH public key [publicKey]
+ * using CA behind SSH certificate template with name [templateName]
+ */
+ const signSshKey = async ({
+ projectId,
+ templateName,
+ publicKey,
+ certType,
+ principals,
+ ttl: requestedTtl,
+ keyId: requestedKeyId,
+ actor,
+ actorId,
+ actorAuthMethod,
+ actorOrgId
+ }: TSignSshKeyDTO) => {
+ const sshCertificateTemplate = await sshCertificateTemplateDAL.getByName(templateName, projectId);
+ if (!sshCertificateTemplate) {
+ throw new NotFoundError({
+ message: "No SSH certificate template found with specified name"
+ });
+ }
+
- const { permission } = await permissionService.getProjectPermission(
++ const { permission, ForbidOnInvalidProjectType } = await permissionService.getProjectPermission(
+ actor,
+ actorId,
+ sshCertificateTemplate.projectId,
+ actorAuthMethod,
+ actorOrgId
+ );
+
++ ForbidOnInvalidProjectType(ProjectType.SSH);
+ ForbiddenError.from(permission).throwUnlessCan(
+ ProjectPermissionActions.Create,
+ ProjectPermissionSub.SshCertificates
+ );
+
+ if (sshCertificateTemplate.caStatus === SshCaStatus.DISABLED) {
+ throw new BadRequestError({
+ message: "SSH CA is disabled"
+ });
+ }
+
+ if (sshCertificateTemplate.status === SshCertTemplateStatus.DISABLED) {
+ throw new BadRequestError({
+ message: "SSH certificate template is disabled"
+ });
+ }
+
+ // set [keyId] depending on if [allowCustomKeyIds] is true or false
+ const keyId = sshCertificateTemplate.allowCustomKeyIds
+ ? requestedKeyId ?? `${actor}-${actorId}`
+ : `${actor}-${actorId}`;
+
+ const sshCaSecret = await sshCertificateAuthoritySecretDAL.findOne({ sshCaId: sshCertificateTemplate.sshCaId });
+
+ // TODO: update to sshDecryptor
+ const { decryptor: secretManagerDecryptor } = await kmsService.createCipherPairWithDataKey({
+ type: KmsDataKey.SecretManager,
+ projectId
+ });
+
+ const decryptedCaPrivateKey = secretManagerDecryptor({
+ cipherTextBlob: sshCaSecret.encryptedPrivateKey
+ });
+
+ const { serialNumber, signedPublicKey, ttl } = await createSshCert({
+ template: sshCertificateTemplate,
+ caPrivateKey: decryptedCaPrivateKey.toString("utf8"),
+ clientPublicKey: publicKey,
+ keyId,
+ principals,
+ requestedTtl,
+ certType
+ });
+
+ // TODO: update to sshEncryptor
+ const { encryptor: secretManagerEncryptor } = await kmsService.createCipherPairWithDataKey({
+ type: KmsDataKey.SecretManager,
+ projectId: sshCertificateTemplate.projectId
+ });
+
+ const encryptedCertificate = secretManagerEncryptor({
+ plainText: Buffer.from(signedPublicKey, "utf8")
+ }).cipherTextBlob;
+
+ await sshCertificateDAL.transaction(async (tx) => {
+ const cert = await sshCertificateDAL.create(
+ {
+ sshCaId: sshCertificateTemplate.sshCaId,
+ sshCertificateTemplateId: sshCertificateTemplate.id,
+ serialNumber,
+ certType,
+ principals,
+ keyId,
+ notBefore: new Date(),
+ notAfter: new Date(Date.now() + ttl * 1000)
+ },
+ tx
+ );
+
+ await sshCertificateBodyDAL.create(
+ {
+ sshCertId: cert.id,
+ encryptedCertificate
+ },
+ tx
+ );
+ });
+
+ return { serialNumber, signedPublicKey, certificateTemplate: sshCertificateTemplate, ttl, keyId };
+ };
+
+ const getSshCaCertificateTemplates = async ({
+ caId,
+ actor,
+ actorId,
+ actorAuthMethod,
+ actorOrgId
+ }: TGetSshCaCertificateTemplatesDTO) => {
+ const ca = await sshCertificateAuthorityDAL.findById(caId);
+ if (!ca) throw new NotFoundError({ message: `SSH CA with ID '${caId}' not found` });
+
- const { permission } = await permissionService.getProjectPermission(
++ const { permission, ForbidOnInvalidProjectType } = await permissionService.getProjectPermission(
+ actor,
+ actorId,
+ ca.projectId,
+ actorAuthMethod,
+ actorOrgId
+ );
+
++ ForbidOnInvalidProjectType(ProjectType.SSH);
+ ForbiddenError.from(permission).throwUnlessCan(
+ ProjectPermissionActions.Read,
+ ProjectPermissionSub.SshCertificateTemplates
+ );
+
+ const certificateTemplates = await sshCertificateTemplateDAL.find({ sshCaId: caId });
+
+ return {
+ certificateTemplates,
+ ca
+ };
+ };
+
+ return {
+ issueSshCreds,
+ signSshKey,
+ createSshCa,
+ getSshCaById,
+ getSshCaPublicKey,
+ updateSshCaById,
+ deleteSshCaById,
+ getSshCaCertificateTemplates
+ };
+};
diff --cc backend/src/server/routes/v1/project-router.ts
index f27462d02b,761020d74d..68d13842cf
--- a/backend/src/server/routes/v1/project-router.ts
+++ b/backend/src/server/routes/v1/project-router.ts
@@@ -135,7 -136,8 +136,10 @@@ export const registerProjectRouter = as
includeRoles: z
.enum(["true", "false"])
.default("false")
- .transform((value) => value === "true")
+ .transform((value) => value === "true"),
- type: z.enum([ProjectType.SecretManager, ProjectType.KMS, ProjectType.CertificateManager, "all"]).optional()
++ type: z
++ .enum([ProjectType.SecretManager, ProjectType.KMS, ProjectType.CertificateManager, ProjectType.SSH, "all"])
++ .optional()
}),
response: {
200: z.object({
diff --cc backend/src/services/project/project-service.ts
index e7742e4f76,c8a86f4996..f2b8f829e0
--- a/backend/src/services/project/project-service.ts
+++ b/backend/src/services/project/project-service.ts
@@@ -855,115 -896,6 +908,118 @@@ export const projectServiceFactory = (
};
};
+ /**
+ * Return list of SSH CAs for project
+ */
+ const listProjectSshCas = async ({
+ actorId,
+ actorOrgId,
+ actorAuthMethod,
+ actor,
+ projectId
+ }: TListProjectSshCasDTO) => {
- const { permission } = await permissionService.getProjectPermission(
++ const { permission, ForbidOnInvalidProjectType } = await permissionService.getProjectPermission(
+ actor,
+ actorId,
+ projectId,
+ actorAuthMethod,
+ actorOrgId
+ );
+
++ ForbidOnInvalidProjectType(ProjectType.SSH);
+ ForbiddenError.from(permission).throwUnlessCan(
+ ProjectPermissionActions.Read,
+ ProjectPermissionSub.SshCertificateAuthorities
+ );
+
+ const cas = await sshCertificateAuthorityDAL.find(
+ {
+ projectId
+ },
+ { sort: [["updatedAt", "desc"]] }
+ );
+
+ return cas;
+ };
+
+ /**
+ * Return list of SSH certificates for project
+ */
+ const listProjectSshCertificates = async ({
+ limit = 25,
+ offset = 0,
+ actorId,
+ actorOrgId,
+ actorAuthMethod,
+ actor,
+ projectId
+ }: TListProjectSshCertificatesDTO) => {
- const { permission } = await permissionService.getProjectPermission(
++ const { permission, ForbidOnInvalidProjectType } = await permissionService.getProjectPermission(
+ actor,
+ actorId,
+ projectId,
+ actorAuthMethod,
+ actorOrgId
+ );
+
++ ForbidOnInvalidProjectType(ProjectType.SSH);
+ ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.SshCertificates);
+
+ const cas = await sshCertificateAuthorityDAL.find({
+ projectId
+ });
+
+ const certificates = await sshCertificateDAL.find(
+ {
+ $in: {
+ sshCaId: cas.map((ca) => ca.id)
+ }
+ },
+ { offset, limit, sort: [["updatedAt", "desc"]] }
+ );
+
+ const count = await sshCertificateDAL.countSshCertificatesInProject(projectId);
+
+ return { certificates, totalCount: count };
+ };
+
+ /**
+ * Return list of SSH certificate templates for project
+ */
+ const listProjectSshCertificateTemplates = async ({
+ actorId,
+ actorOrgId,
+ actorAuthMethod,
+ actor,
+ projectId
+ }: TListProjectSshCertificateTemplatesDTO) => {
- const { permission } = await permissionService.getProjectPermission(
++ const { permission, ForbidOnInvalidProjectType } = await permissionService.getProjectPermission(
+ actor,
+ actorId,
+ projectId,
+ actorAuthMethod,
+ actorOrgId
+ );
+
++ ForbidOnInvalidProjectType(ProjectType.SSH);
+ ForbiddenError.from(permission).throwUnlessCan(
+ ProjectPermissionActions.Read,
+ ProjectPermissionSub.SshCertificateTemplates
+ );
+
+ const cas = await sshCertificateAuthorityDAL.find({
+ projectId
+ });
+
+ const certificateTemplates = await sshCertificateTemplateDAL.find({
+ $in: {
+ sshCaId: cas.map((ca) => ca.id)
+ }
+ });
+
+ return { certificateTemplates };
+ };
+
const updateProjectKmsKey = async ({
projectId,
kms,
diff --cc frontend/public/lotties/system-regular-126-verified-hover-verified.json
index 0000000000,0000000000..ce8777c0ab
new file mode 100644
--- /dev/null
+++ b/frontend/public/lotties/system-regular-126-verified-hover-verified.json
@@@ -1,0 -1,0 +1,1 @@@
++{"v":"5.12.1","fr":60,"ip":0,"op":60,"w":500,"h":500,"nm":"system-regular-126-verified","ddd":0,"assets":[{"id":"comp_1","nm":"hover-verified","fr":60,"layers":[{"ddd":0,"ind":1,"ty":4,"nm":".primary.design","cl":"primary design","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[250.004,250.003,0],"ix":2,"l":2},"a":{"a":0,"k":[250.004,250.003,0],"ix":1,"l":2},"s":{"a":0,"k":[100,100,100],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[0,0],[6.109,-6.116],[-6.115,-6.108],[0,0],[-4.002,0],[-3.055,3.051],[0,0],[6.107,6.115],[6.115,-6.107],[0,0]],"o":[[-6.115,-6.107],[-6.107,6.116],[0,0],[3.056,3.052],[4.002,0],[0,0],[6.115,-6.108],[-6.109,-6.116],[0,0],[0,0]],"v":[[-69.803,-8.539],[-91.936,-8.526],[-91.922,13.607],[-39.704,65.762],[-28.644,70.339],[-17.584,65.762],[91.922,-43.616],[91.936,-65.749],[69.803,-65.762],[-28.644,32.57]],"c":true},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"fl","c":{"a":0,"k":[1,1,1,1],"ix":4,"x":"var $bm_rt;\n$bm_rt = comp('system-regular-126-verified').layer('control').effect('primary')('Color');"},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":".primary","mn":"ADBE Vector Graphic - Fill","hd":false,"cl":"primary"},{"ty":"tr","p":{"a":0,"k":[263.158,242.187],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Group 1","np":2,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false},{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[0,0],[73.521,-47.165],[0,0],[0,0],[11.506,86.895],[0,0],[-39.84,20.453],[-33.146,-7.159]],"o":[[-11.51,86.919],[0,0],[0,0],[-73.503,-47.153],[0,0],[33.146,-7.159],[39.84,20.453],[0,0]],"v":[[149.277,-67.68],[15.49,143.298],[0,153.266],[-15.509,143.287],[-149.274,-67.655],[-154.479,-107.449],[0,-153.936],[154.479,-107.449]],"c":true},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ind":1,"ty":"sh","ix":2,"ks":{"a":0,"k":{"i":[[8.073,1.615],[32.173,20.107],[5.074,-3.172],[35.445,-7.092],[-1.068,-8.164],[0,0],[-81.252,-52.124],[0,0],[-2.944,0],[-2.579,1.66],[0,0],[-12.724,96.093],[0,0]],"o":[[-35.445,-7.092],[-5.074,-3.172],[-32.173,20.107],[-8.073,1.615],[0,0],[12.72,96.068],[0,0],[2.579,1.66],[2.944,0],[0,0],[81.27,-52.136],[0,0],[1.068,-8.164]],"v":[[174.946,-135.138],[8.294,-185.147],[-8.294,-185.147],[-174.946,-135.138],[-187.394,-117.763],[-180.307,-63.572],[-32.428,169.62],[-8.469,185.036],[0,187.526],[8.469,185.036],[32.409,169.632],[180.31,-63.596],[187.394,-117.763]],"c":true},"ix":2},"nm":"Path 2","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"fl","c":{"a":0,"k":[1,1,1,1],"ix":4,"x":"var $bm_rt;\n$bm_rt = comp('system-regular-126-verified').layer('control').effect('primary')('Color');"},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":".primary","mn":"ADBE Vector Graphic - Fill","hd":false,"cl":"primary"},{"ty":"tr","p":{"a":0,"k":[250.004,250.003],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Group 2","np":3,"cix":2,"bm":0,"ix":2,"mn":"ADBE Vector Group","hd":false}],"ip":60,"op":300,"st":1,"ct":1,"bm":0},{"ddd":0,"ind":2,"ty":4,"nm":".primary.design","cl":"primary design","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[250.004,250.003,0],"ix":2,"l":2},"a":{"a":0,"k":[250.004,250.003,0],"ix":1,"l":2},"s":{"a":0,"k":[100,100,100],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[0,0],[6.109,-6.116],[-6.115,-6.108],[0,0],[-4.002,0],[-3.055,3.051],[0,0],[6.107,6.115],[6.115,-6.107],[0,0]],"o":[[-6.115,-6.107],[-6.107,6.116],[0,0],[3.056,3.052],[4.002,0],[0,0],[6.115,-6.108],[-6.109,-6.116],[0,0],[0,0]],"v":[[-69.803,-8.539],[-91.936,-8.526],[-91.922,13.607],[-39.704,65.762],[-28.644,70.339],[-17.584,65.762],[91.922,-43.616],[91.936,-65.749],[69.803,-65.762],[-28.644,32.57]],"c":true},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"fl","c":{"a":0,"k":[1,1,1,1],"ix":4,"x":"var $bm_rt;\n$bm_rt = comp('system-regular-126-verified').layer('control').effect('primary')('Color');"},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":".primary","mn":"ADBE Vector Graphic - Fill","hd":false,"cl":"primary"},{"ty":"tr","p":{"a":0,"k":[263.158,242.187],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Group 1","np":2,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false},{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[0,0],[73.521,-47.165],[0,0],[0,0],[11.506,86.895],[0,0],[-39.84,20.453],[-33.146,-7.159]],"o":[[-11.51,86.919],[0,0],[0,0],[-73.503,-47.153],[0,0],[33.146,-7.159],[39.84,20.453],[0,0]],"v":[[149.277,-67.68],[15.49,143.298],[0,153.266],[-15.509,143.287],[-149.274,-67.655],[-154.479,-107.449],[0,-153.936],[154.479,-107.449]],"c":true},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ind":1,"ty":"sh","ix":2,"ks":{"a":0,"k":{"i":[[8.073,1.615],[32.173,20.107],[5.074,-3.172],[35.445,-7.092],[-1.068,-8.164],[0,0],[-81.252,-52.124],[0,0],[-2.944,0],[-2.579,1.66],[0,0],[-12.724,96.093],[0,0]],"o":[[-35.445,-7.092],[-5.074,-3.172],[-32.173,20.107],[-8.073,1.615],[0,0],[12.72,96.068],[0,0],[2.579,1.66],[2.944,0],[0,0],[81.27,-52.136],[0,0],[1.068,-8.164]],"v":[[174.946,-135.138],[8.294,-185.147],[-8.294,-185.147],[-174.946,-135.138],[-187.394,-117.763],[-180.307,-63.572],[-32.428,169.62],[-8.469,185.036],[0,187.526],[8.469,185.036],[32.409,169.632],[180.31,-63.596],[187.394,-117.763]],"c":true},"ix":2},"nm":"Path 2","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"fl","c":{"a":0,"k":[1,1,1,1],"ix":4,"x":"var $bm_rt;\n$bm_rt = comp('system-regular-126-verified').layer('control').effect('primary')('Color');"},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":".primary","mn":"ADBE Vector Graphic - Fill","hd":false,"cl":"primary"},{"ty":"tr","p":{"a":0,"k":[250.004,250.003],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Group 2","np":3,"cix":2,"bm":0,"ix":2,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":1,"st":0,"ct":1,"bm":0},{"ddd":0,"ind":3,"ty":4,"nm":".primary.design","cl":"primary design","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":1,"k":[{"i":{"x":[0.131],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":1,"s":[0]},{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.628],"y":[0]},"t":30,"s":[27]},{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":46,"s":[-11]},{"t":60,"s":[0]}],"ix":10},"p":{"a":0,"k":[249.998,250.004,0],"ix":2,"l":2},"a":{"a":0,"k":[0,0,0],"ix":1,"l":2},"s":{"a":0,"k":[100,100,100],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":1,"k":[{"i":{"x":0.131,"y":1},"o":{"x":0.333,"y":0},"t":1,"s":[{"i":[[0,0],[0,0],[77.333,-49.716],[0,0],[0,0],[0,0],[11.993,91.145],[0,0],[-41.666,26.039]],"o":[[0,0],[-11.99,91.149],[0,0],[0,0],[0,0],[-77.33,-49.714],[0,0],[0,0],[41.667,26.039]],"v":[[171.875,-119.795],[164.746,-65.6],[23.905,156.51],[0.007,171.873],[0,171.875],[-23.904,156.508],[-164.743,-65.592],[-171.875,-119.795],[0,-171.875]],"c":true}]},{"i":{"x":0.667,"y":1},"o":{"x":0.628,"y":0},"t":21,"s":[{"i":[[0,0],[0,0],[99.436,-63.925],[0,0],[0,0],[0,0],[15.421,117.196],[0,0],[-53.575,33.481]],"o":[[0,0],[-15.417,117.201],[0,0],[0,0],[0,0],[-99.432,-63.922],[0,0],[0,0],[53.576,33.481]],"v":[[191.412,-122.573],[182.245,-52.889],[1.15,232.704],[-29.579,252.458],[-29.588,252.46],[-60.324,232.701],[-241.417,-52.879],[-250.588,-122.573],[-29.588,-189.539]],"c":true}]},{"i":{"x":0.667,"y":1},"o":{"x":0.333,"y":0},"t":41.801,"s":[{"i":[[0,0],[0,0],[56.69,-36.445],[0,0],[0,0],[0,0],[8.792,66.816],[0,0],[-30.544,19.088]],"o":[[0,0],[-8.79,66.819],[0,0],[0,0],[0,0],[-56.688,-36.443],[0,0],[0,0],[30.545,19.088]],"v":[[125.996,-87.818],[120.77,-48.09],[17.524,114.733],[0.005,125.995],[0,125.996],[-17.523,114.731],[-120.768,-48.083],[-125.996,-87.818],[0,-125.996]],"c":true}]},{"t":60,"s":[{"i":[[0,0],[0,0],[77.333,-49.716],[0,0],[0,0],[0,0],[11.993,91.145],[0,0],[-41.666,26.039]],"o":[[0,0],[-11.99,91.149],[0,0],[0,0],[0,0],[-77.33,-49.714],[0,0],[0,0],[41.667,26.039]],"v":[[171.875,-119.795],[164.746,-65.6],[23.905,156.51],[0.007,171.873],[0,171.875],[-23.904,156.508],[-164.743,-65.592],[-171.875,-119.795],[0,-171.875]],"c":true}]}],"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"st","c":{"a":0,"k":[1,1,1,1],"ix":3,"x":"var $bm_rt;\n$bm_rt = comp('system-regular-126-verified').layer('control').effect('primary')('Color');"},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":31.3,"ix":5},"lc":2,"lj":2,"bm":0,"nm":".primary","mn":"ADBE Vector Graphic - Stroke","hd":false,"cl":"primary"},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Group 1","np":2,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":1,"op":60,"st":-239,"ct":1,"bm":0},{"ddd":0,"ind":4,"ty":4,"nm":".primary.design","cl":"primary design","parent":3,"sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[0.006,-0.001,0],"ix":2,"l":2},"a":{"a":0,"k":[0,0,0],"ix":1,"l":2},"s":{"a":0,"k":[100,100,100],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":1,"k":[{"i":{"x":0.157,"y":1},"o":{"x":0.333,"y":0},"t":1,"s":[{"i":[[0,0],[0,0],[0,0]],"o":[[0,0],[0,0],[0,0]],"v":[[153.363,-119.689],[-14.644,46.689],[-66.863,-5.466]],"c":false}]},{"i":{"x":0.667,"y":1},"o":{"x":0.6,"y":0},"t":21,"s":[{"i":[[0,0],[0,0],[0,0]],"o":[[0,0],[0,0],[0,0]],"v":[[167.916,-123.188],[-50.252,92.864],[-118.061,25.138]],"c":false}]},{"i":{"x":0.667,"y":1},"o":{"x":0.333,"y":0},"t":42,"s":[{"i":[[0,0],[0,0],[0,0]],"o":[[0,0],[0,0],[0,0]],"v":[[114.144,-89.081],[-10.899,34.749],[-49.764,-4.068]],"c":false}]},{"t":60,"s":[{"i":[[0,0],[0,0],[0,0]],"o":[[0,0],[0,0],[0,0]],"v":[[153.363,-119.689],[-14.644,46.689],[-66.863,-5.466]],"c":false}]}],"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"st","c":{"a":0,"k":[1,1,1,1],"ix":3,"x":"var $bm_rt;\n$bm_rt = comp('system-regular-126-verified').layer('control').effect('primary')('Color');"},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":31.3,"ix":5},"lc":2,"lj":2,"bm":0,"nm":".primary","mn":"ADBE Vector Graphic - Stroke","hd":false,"cl":"primary"},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Group 1","np":2,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false},{"ty":"tm","s":{"a":1,"k":[{"i":{"x":[0.833],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":1,"s":[100]},{"t":20,"s":[100],"h":1},{"i":{"x":[0.1],"y":[1]},"o":{"x":[0.167],"y":[0.167]},"t":28,"s":[0]},{"t":60,"s":[100]}],"ix":1},"e":{"a":1,"k":[{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.333],"y":[0]},"t":1,"s":[26.2]},{"t":20,"s":[100],"h":1},{"i":{"x":[0.1],"y":[1]},"o":{"x":[0.167],"y":[0.167]},"t":28,"s":[0]},{"t":60,"s":[26.2]}],"ix":2},"o":{"a":0,"k":0,"ix":3},"m":1,"ix":2,"nm":"Trim Paths 1","mn":"ADBE Vector Filter - Trim","hd":false}],"ip":1,"op":60,"st":0,"ct":1,"bm":0}]}],"layers":[{"ddd":0,"ind":1,"ty":3,"nm":"control","sr":1,"ks":{"o":{"a":0,"k":0,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[0,0],"ix":2,"l":2},"a":{"a":0,"k":[0,0,0],"ix":1,"l":2},"s":{"a":0,"k":[100,100,100],"ix":6,"l":2}},"ao":0,"ef":[{"ty":5,"nm":"primary","np":3,"mn":"ADBE Color Control","ix":1,"en":1,"ef":[{"ty":2,"nm":"Color","mn":"ADBE Color Control-0001","ix":1,"v":{"a":0,"k":[1,1,1],"ix":1}}]}],"ip":0,"op":131,"st":0,"bm":0},{"ddd":0,"ind":3,"ty":0,"nm":"hover-verified","refId":"comp_1","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[250,250,0],"ix":2,"l":2},"a":{"a":0,"k":[250,250,0],"ix":1,"l":2},"s":{"a":0,"k":[100,100,100],"ix":6,"l":2}},"ao":0,"w":500,"h":500,"ip":0,"op":70,"st":0,"bm":0}],"markers":[{"tm":0,"cm":"default:hover-verified","dr":60}],"props":{}}
diff --cc frontend/src/helpers/project.ts
index b6338ce355,8898f00c9a..0734335e72
--- a/frontend/src/helpers/project.ts
+++ b/frontend/src/helpers/project.ts
@@@ -59,4 -61,22 +61,27 @@@ export const initProjectHelper = async
return project;
};
- export { initProjectHelper };
+ export const getProjectHomePage = (workspace: Workspace) => {
+ if (workspace.type === ProjectType.SecretManager) {
+ return `/${workspace.type}/${workspace.id}/secrets/overview`;
+ }
+ if (workspace.type === ProjectType.CertificateManager) {
+ return `/${workspace.type}/${workspace.id}/certificates`;
+ }
+
- return `/${workspace.type}/${workspace.id}/kms`;
++ if (workspace.type === ProjectType.KMS) {
++ return `/${workspace.type}/${workspace.id}/kms`;
++ }
++
++ return `/${workspace.type}/${workspace.id}/ssh`;
+ };
+
+ export const getProjectTitle = (type: ProjectType) => {
+ const titleConvert = {
+ [ProjectType.SecretManager]: "Secret Management",
+ [ProjectType.KMS]: "Key Management",
- [ProjectType.CertificateManager]: "Cert Management"
++ [ProjectType.CertificateManager]: "Cert Management",
++ [ProjectType.SSH]: "SSH"
+ };
+ return titleConvert[type];
+ };
diff --cc frontend/src/hooks/api/workspace/types.ts
index 91cf3a9d89,558982d80f..0510bdbe7b
--- a/frontend/src/hooks/api/workspace/types.ts
+++ b/frontend/src/hooks/api/workspace/types.ts
@@@ -8,6 -8,12 +8,13 @@@ export enum ProjectVersion
V3 = 3
}
+ export enum ProjectType {
+ SecretManager = "secret-manager",
+ CertificateManager = "cert-manager",
- KMS = "kms"
++ KMS = "kms",
++ SSH = "ssh"
+ }
+
export enum ProjectUserMembershipTemporaryMode {
Relative = "relative"
}
diff --cc frontend/src/layouts/AppLayout/AppLayout.tsx
index b7ff487881,c084683cb8..918ec415a4
--- a/frontend/src/layouts/AppLayout/AppLayout.tsx
+++ b/frontend/src/layouts/AppLayout/AppLayout.tsx
@@@ -424,95 -381,6 +381,18 @@@ export const AppLayout = ({ children }
</MenuItem>
</a>
</Link>
- <Link href={`/project/${currentWorkspace?.id}/ssh`} passHref>
- <a>
- <MenuItem
- isSelected={router.asPath === `/project/${currentWorkspace?.id}/ssh`}
- icon="system-outline-90-lock-closed"
- >
- SSH
- </MenuItem>
- </a>
- </Link>
- <Link href={`/project/${currentWorkspace?.id}/members`} passHref>
++ <Link href={`/org/${currentOrg?.id}/ssh/overview`} passHref>
+ <a>
+ <MenuItem
+ isSelected={
- router.asPath === `/project/${currentWorkspace?.id}/members`
++ router.asPath === `/org/${currentWorkspace?.id}/ssh/overview`
+ }
- icon="system-outline-96-groups"
++ icon="system-regular-126-verified-hover-verified"
+ >
- Access Control
- </MenuItem>
- </a>
- </Link>
- <Link href={`/integrations/${currentWorkspace?.id}`} passHref>
- <a>
- <MenuItem
- isSelected={router.asPath.includes("/integrations")}
- icon="system-outline-82-extension"
- >
- {t("nav.menu.integrations")}
- </MenuItem>
- </a>
- </Link>
- <Link href={`/project/${currentWorkspace?.id}/secret-rotation`} passHref>
- <a className="relative">
- <MenuItem
- isSelected={
- router.asPath === `/project/${currentWorkspace?.id}/secret-rotation`
- }
- icon="rotation"
- >
- Secret Rotation
- </MenuItem>
- </a>
- </Link>
- <Link href={`/project/${currentWorkspace?.id}/approval`} passHref>
- <a className="relative">
- <MenuItem
- isSelected={
- router.asPath === `/project/${currentWorkspace?.id}/approval`
- }
- icon="system-outline-189-domain-verification"
- >
- Approvals
- {Boolean(
- secretApprovalReqCount?.open ||
- accessApprovalRequestCount?.pendingCount
- ) && (
- <span className="ml-2 rounded border border-primary-400 bg-primary-600 py-0.5 px-1 text-xs font-semibold text-black">
- {pendingRequestsCount}
- </span>
- )}
- </MenuItem>
- </a>
- </Link>
- <Link href={`/project/${currentWorkspace?.id}/settings`} passHref>
- <a>
- <MenuItem
- isSelected={
- router.asPath === `/project/${currentWorkspace?.id}/settings`
- }
- icon="system-outline-109-slider-toggle-settings"
- >
- {t("nav.menu.project-settings")}
- </MenuItem>
- </a>
- </Link>
- </Menu>
- ) : (
- <Menu className="mt-4">
- <Link href={`/org/${currentOrg?.id}/overview`} passHref>
- <a>
- <MenuItem
- isSelected={router.asPath.includes("/overview")}
- icon="system-outline-165-view-carousel"
- >
- Overview
++ SSH
+ </MenuItem>
+ </a>
+ </Link>
<Link href={`/org/${currentOrg?.id}/members`} passHref>
<a>
<MenuItem
diff --cc frontend/src/layouts/AppLayout/components/ProjectSidebarItems/ProjectSidebarItems.tsx
index 0000000000,6a18657372..9cd3d568fb
mode 000000,100644..100644
--- a/frontend/src/layouts/AppLayout/components/ProjectSidebarItems/ProjectSidebarItems.tsx
+++ b/frontend/src/layouts/AppLayout/components/ProjectSidebarItems/ProjectSidebarItems.tsx
@@@ -1,0 -1,158 +1,171 @@@
+ import { useTranslation } from "react-i18next";
+ import Link from "next/link";
+ import { useRouter } from "next/router";
+
+ import { Menu, MenuItem } from "@app/components/v2";
+ import { useWorkspace } from "@app/context";
+ import { useGetAccessRequestsCount, useGetSecretApprovalRequestCount } from "@app/hooks/api";
+ import { ProjectType } from "@app/hooks/api/workspace/types";
+
+ export const ProjectSidebarItem = () => {
+ const { currentWorkspace } = useWorkspace();
+ const router = useRouter();
+ const { t } = useTranslation();
+
+ const workspaceId = currentWorkspace?.id || "";
+ const projectSlug = currentWorkspace?.slug || "";
+
+ const { data: secretApprovalReqCount } = useGetSecretApprovalRequestCount({ workspaceId });
+ const { data: accessApprovalRequestCount } = useGetAccessRequestsCount({ projectSlug });
+
+ const pendingRequestsCount =
+ (secretApprovalReqCount?.open || 0) + (accessApprovalRequestCount?.pendingCount || 0);
+
+ if (
+ !currentWorkspace ||
+ router.asPath.startsWith("personal") ||
+ router.asPath.startsWith("integrations")
+ ) {
+ return <div />;
+ }
+
+ const isSecretManager = currentWorkspace?.type === ProjectType.SecretManager;
+ const isCertManager = currentWorkspace?.type === ProjectType.CertificateManager;
+ const isCmek = currentWorkspace?.type === ProjectType.KMS;
++ const isSsh = currentWorkspace?.type === ProjectType.SSH;
+
+ return (
+ <Menu>
+ {isSecretManager && (
+ <Link
+ href={`/${ProjectType.SecretManager}/${currentWorkspace?.id}/secrets/overview`}
+ passHref
+ >
+ <a>
+ <MenuItem
+ isSelected={router.asPath.includes(
+ `/${ProjectType.SecretManager}/${currentWorkspace?.id}/secrets`
+ )}
+ icon="system-outline-90-lock-closed"
+ >
+ {t("nav.menu.secrets")}
+ </MenuItem>
+ </a>
+ </Link>
+ )}
+ {isCertManager && (
+ <Link
+ href={`/${ProjectType.CertificateManager}/${currentWorkspace?.id}/certificates`}
+ passHref
+ >
+ <a>
+ <MenuItem
+ isSelected={
+ router.asPath ===
+ `/${ProjectType.CertificateManager}/${currentWorkspace?.id}/certificates`
+ }
+ icon="system-outline-90-lock-closed"
+ >
+ Overview
+ </MenuItem>
+ </a>
+ </Link>
+ )}
+ {isCmek && (
+ <Link href={`/${ProjectType.KMS}/${currentWorkspace?.id}/kms`} passHref>
+ <a>
+ <MenuItem
+ isSelected={router.asPath === `/${ProjectType.KMS}/${currentWorkspace?.id}/kms`}
+ icon="system-outline-90-lock-closed"
+ >
+ Overview
+ </MenuItem>
+ </a>
+ </Link>
+ )}
++ {isSsh && (
++ <Link href={`/${ProjectType.SSH}/${currentWorkspace?.id}/ssh`} passHref>
++ <a>
++ <MenuItem
++ isSelected={router.asPath === `/${ProjectType.SSH}/${currentWorkspace?.id}/ssh`}
++ icon="system-outline-90-lock-closed"
++ >
++ Overview
++ </MenuItem>
++ </a>
++ </Link>
++ )}
+ <Link href={`/${currentWorkspace.type}/${currentWorkspace?.id}/members`} passHref>
+ <a>
+ <MenuItem
+ isSelected={router.asPath.endsWith(`/${currentWorkspace?.id}/members`)}
+ icon="system-outline-96-groups"
+ >
+ Access Control
+ </MenuItem>
+ </a>
+ </Link>
+ {isSecretManager && (
+ <Link href={`/integrations/${currentWorkspace?.id}`} passHref>
+ <a>
+ <MenuItem
+ isSelected={router.asPath.includes("/integrations")}
+ icon="system-outline-82-extension"
+ >
+ {t("nav.menu.integrations")}
+ </MenuItem>
+ </a>
+ </Link>
+ )}
+ {isSecretManager && (
+ <Link
+ href={`/${ProjectType.SecretManager}/${currentWorkspace?.id}/secret-rotation`}
+ passHref
+ >
+ <a className="relative">
+ <MenuItem
+ isSelected={
+ router.asPath ===
+ `/${ProjectType.SecretManager}/${currentWorkspace?.id}/secret-rotation`
+ }
+ icon="rotation"
+ >
+ Secret Rotation
+ </MenuItem>
+ </a>
+ </Link>
+ )}
+ {isSecretManager && (
+ <Link href={`/secret-manager/${currentWorkspace?.id}/approval`} passHref>
+ <a className="relative">
+ <MenuItem
+ isSelected={
+ router.asPath === `/${ProjectType.SecretManager}/${currentWorkspace?.id}/approval`
+ }
+ icon="system-outline-189-domain-verification"
+ >
+ Approvals
+ {Boolean(
+ secretApprovalReqCount?.open || accessApprovalRequestCount?.pendingCount
+ ) && (
+ <span className="ml-2 rounded border border-primary-400 bg-primary-600 py-0.5 px-1 text-xs font-semibold text-black">
+ {pendingRequestsCount}
+ </span>
+ )}
+ </MenuItem>
+ </a>
+ </Link>
+ )}
+ <Link href={`/${currentWorkspace.type}/${currentWorkspace?.id}/settings`} passHref>
+ <a>
+ <MenuItem
+ isSelected={router.asPath.endsWith(`/${currentWorkspace?.id}/settings`)}
+ icon="system-outline-109-slider-toggle-settings"
+ >
+ {t("nav.menu.project-settings")}
+ </MenuItem>
+ </a>
+ </Link>
+ </Menu>
+ );
+ };
diff --cc frontend/src/pages/org/[id]/secret-manager/overview.tsx
index 0000000000,4fcc77ad06..313f7d7384
mode 000000,100644..100644
--- a/frontend/src/pages/org/[id]/secret-manager/overview.tsx
+++ b/frontend/src/pages/org/[id]/secret-manager/overview.tsx
@@@ -1,0 -1,527 +1,530 @@@
+ // REFACTOR(akhilmhdh): This file needs to be split into multiple components too complex
+
+ import { ReactNode, useMemo, useState } from "react";
+ import { useTranslation } from "react-i18next";
+ import Head from "next/head";
+ import Link from "next/link";
+ import { useRouter } from "next/router";
+ import { faFolderOpen, faStar } from "@fortawesome/free-regular-svg-icons";
+ import {
+ faArrowDownAZ,
+ faArrowRight,
+ faArrowUpZA,
+ faBorderAll,
+ faExclamationCircle,
+ faList,
+ faMagnifyingGlass,
+ faPlus,
+ faSearch,
+ faStar as faSolidStar
+ } from "@fortawesome/free-solid-svg-icons";
+ import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
+
+ import { createNotification } from "@app/components/notifications";
+ import { OrgPermissionCan } from "@app/components/permissions";
+ import {
+ Button,
+ IconButton,
+ Input,
+ Pagination,
+ Skeleton,
+ Tooltip,
+ UpgradePlanModal
+ } from "@app/components/v2";
+ import { NewProjectModal } from "@app/components/v2/projects";
+ import {
+ OrgPermissionActions,
+ OrgPermissionSubjects,
+ useOrganization,
+ useSubscription
+ } from "@app/context";
+ import { getProjectHomePage } from "@app/helpers/project";
+ import { usePagination, useResetPageHelper } from "@app/hooks";
+ import { useGetUserWorkspaces } from "@app/hooks/api";
+ import { OrderByDirection } from "@app/hooks/api/generic/types";
+ // import { fetchUserWsKey } from "@app/hooks/api/keys/queries";
+ import { useFetchServerStatus } from "@app/hooks/api/serverDetails";
+ import { Workspace } from "@app/hooks/api/types";
+ import { useUpdateUserProjectFavorites } from "@app/hooks/api/users/mutation";
+ import { useGetUserProjectFavorites } from "@app/hooks/api/users/queries";
+ import { ProjectType } from "@app/hooks/api/workspace/types";
+ import { usePopUp } from "@app/hooks/usePopUp";
+
+ enum ProjectsViewMode {
+ GRID = "grid",
+ LIST = "list"
+ }
+
+ enum ProjectOrderBy {
+ Name = "name"
+ }
+
+ const formatTitle = (type: ProjectType) => {
+ if (type === ProjectType.SecretManager) return "Secret Management";
+ if (type === ProjectType.CertificateManager) return "Cert Management";
- return "Key Management";
++ if (type === ProjectType.KMS) return "Key Management";
++ return "SSH";
+ };
+
+ const formatDescription = (type: ProjectType) => {
+ if (type === ProjectType.SecretManager)
+ return "Securely store, manage, and rotate various application secrets, such as database credentials, API keys, etc.";
+ if (type === ProjectType.CertificateManager)
+ return "Manage your PKI infrastructure and issue digital certificates for services, applications, and devices.";
- return "Centralize the management of keys for cryptographic operations, such as encryption and decryption.";
++ if (type === ProjectType.KMS)
++ return "Centralize the management of keys for cryptographic operations, such as encryption and decryption.";
++ return "Generate SSH credentials to provide secure and centralized SSH access control for your infrastructure.";
+ };
+
+ type Props = {
+ type: ProjectType;
+ };
+
+ // #TODO: Update all the workspaceIds
+ export const ProductOverview = ({ type }: Props) => {
+ const { t } = useTranslation();
+
+ const router = useRouter();
+
+ const { data: workspaces, isLoading: isWorkspaceLoading } = useGetUserWorkspaces({ type });
+ const { currentOrg } = useOrganization();
+ const orgWorkspaces = workspaces || [];
+ const { data: projectFavorites, isLoading: isProjectFavoritesLoading } =
+ useGetUserProjectFavorites(currentOrg?.id!);
+ const { mutateAsync: updateUserProjectFavorites } = useUpdateUserProjectFavorites();
+
+ const isProjectViewLoading = isWorkspaceLoading || isProjectFavoritesLoading;
+
+ const { popUp, handlePopUpOpen, handlePopUpToggle } = usePopUp([
+ "addNewWs",
+ "upgradePlan"
+ ] as const);
+
+ const [searchFilter, setSearchFilter] = useState("");
+ const { data: serverDetails } = useFetchServerStatus();
+ const [projectsViewMode, setProjectsViewMode] = useState<ProjectsViewMode>(
+ (localStorage.getItem("projectsViewMode") as ProjectsViewMode) || ProjectsViewMode.GRID
+ );
+
+ const { subscription } = useSubscription();
+
+ const isAddingProjectsAllowed = subscription?.workspaceLimit
+ ? subscription.workspacesUsed < subscription.workspaceLimit
+ : true;
+
+ const isWorkspaceEmpty = !isProjectViewLoading && orgWorkspaces?.length === 0;
+
+ const {
+ setPage,
+ perPage,
+ setPerPage,
+ page,
+ offset,
+ limit,
+ toggleOrderDirection,
+ orderDirection
+ } = usePagination(ProjectOrderBy.Name, { initPerPage: 24 });
+
+ const filteredWorkspaces = useMemo(
+ () =>
+ orgWorkspaces
+ .filter((ws) => ws?.name?.toLowerCase().includes(searchFilter.toLowerCase()))
+ .sort((a, b) =>
+ orderDirection === OrderByDirection.ASC
+ ? a.name.toLowerCase().localeCompare(b.name.toLowerCase())
+ : b.name.toLowerCase().localeCompare(a.name.toLowerCase())
+ ),
+ [searchFilter, orderDirection, orgWorkspaces]
+ );
+
+ useResetPageHelper({
+ setPage,
+ offset,
+ totalCount: filteredWorkspaces.length
+ });
+
+ const { workspacesWithFaveProp } = useMemo(() => {
+ const workspacesWithFav = filteredWorkspaces
+ .map((w): Workspace & { isFavorite: boolean } => ({
+ ...w,
+ isFavorite: Boolean(projectFavorites?.includes(w.id))
+ }))
+ .sort((a, b) => Number(b.isFavorite) - Number(a.isFavorite))
+ .slice(offset, limit * page);
+
+ return {
+ workspacesWithFaveProp: workspacesWithFav
+ };
+ }, [filteredWorkspaces, projectFavorites]);
+
+ const addProjectToFavorites = async (projectId: string) => {
+ try {
+ if (currentOrg?.id) {
+ await updateUserProjectFavorites({
+ orgId: currentOrg?.id,
+ projectFavorites: [...(projectFavorites || []), projectId]
+ });
+ }
+ } catch (err) {
+ createNotification({
+ text: "Failed to add project to favorites.",
+ type: "error"
+ });
+ }
+ };
+
+ const removeProjectFromFavorites = async (projectId: string) => {
+ try {
+ if (currentOrg?.id) {
+ await updateUserProjectFavorites({
+ orgId: currentOrg?.id,
+ projectFavorites: [...(projectFavorites || []).filter((entry) => entry !== projectId)]
+ });
+ }
+ } catch (err) {
+ createNotification({
+ text: "Failed to remove project from favorites.",
+ type: "error"
+ });
+ }
+ };
+
+ const renderProjectGridItem = (workspace: Workspace, isFavorite: boolean) => (
+ // eslint-disable-next-line jsx-a11y/no-static-element-interactions, jsx-a11y/click-events-have-key-events
+ <div
+ onClick={() => {
+ router.push(getProjectHomePage(workspace));
+ localStorage.setItem("projectData.id", workspace.id);
+ }}
+ key={workspace.id}
+ className="min-w-72 flex h-40 cursor-pointer flex-col rounded-md border border-mineshaft-600 bg-mineshaft-800 p-4"
+ >
+ <div className="flex flex-row justify-between">
+ <div className="mt-0 truncate text-lg text-mineshaft-100">{workspace.name}</div>
+ {isFavorite ? (
+ <FontAwesomeIcon
+ icon={faSolidStar}
+ className="text-sm text-yellow-600 hover:text-mineshaft-400"
+ onClick={(e) => {
+ e.stopPropagation();
+ removeProjectFromFavorites(workspace.id);
+ }}
+ />
+ ) : (
+ <FontAwesomeIcon
+ icon={faStar}
+ className="text-sm text-mineshaft-400 hover:text-mineshaft-300"
+ onClick={(e) => {
+ e.stopPropagation();
+ addProjectToFavorites(workspace.id);
+ }}
+ />
+ )}
+ </div>
+
+ <div
+ className="mt-1 mb-2.5 grow text-sm text-mineshaft-300"
+ style={{
+ overflow: "hidden",
+ display: "-webkit-box",
+ WebkitBoxOrient: "vertical",
+ WebkitLineClamp: 2
+ }}
+ >
+ {workspace.description}
+ </div>
+
+ <div className="flex w-full flex-row items-end justify-between place-self-end">
+ {type === ProjectType.SecretManager && (
+ <div className="mt-0 text-xs text-mineshaft-400">
+ {workspace.environments?.length || 0} environments
+ </div>
+ )}
+ <button type="button">
+ <div className="group ml-auto w-max cursor-pointer rounded-full border border-mineshaft-600 bg-mineshaft-900 py-2 px-4 text-sm text-mineshaft-300 transition-all hover:border-primary-500/80 hover:bg-primary-800/20 hover:text-mineshaft-200">
+ Explore{" "}
+ <FontAwesomeIcon
+ icon={faArrowRight}
+ className="pl-1.5 pr-0.5 duration-200 hover:pl-2 hover:pr-0"
+ />
+ </div>
+ </button>
+ </div>
+ </div>
+ );
+
+ const renderProjectListItem = (workspace: Workspace, isFavorite: boolean, index: number) => (
+ // eslint-disable-next-line jsx-a11y/no-static-element-interactions, jsx-a11y/click-events-have-key-events
+ <div
+ onClick={() => {
+ router.push(getProjectHomePage(workspace));
+ localStorage.setItem("projectData.id", workspace.id);
+ }}
+ key={workspace.id}
+ className={`min-w-72 group grid h-14 cursor-pointer grid-cols-6 border-t border-l border-r border-mineshaft-600 bg-mineshaft-800 px-6 hover:bg-mineshaft-700 ${
+ index === 0 && "rounded-t-md"
+ }`}
+ >
+ <div className="flex items-center sm:col-span-3 lg:col-span-4">
+ <div className="truncate text-sm text-mineshaft-100">{workspace.name}</div>
+ </div>
+ <div className="flex items-center justify-end sm:col-span-3 lg:col-span-2">
+ <div className="text-center text-sm text-mineshaft-300">
+ {workspace.environments?.length || 0} environments
+ </div>
+ {isFavorite ? (
+ <FontAwesomeIcon
+ icon={faSolidStar}
+ className="ml-6 text-sm text-yellow-600 hover:text-mineshaft-400"
+ onClick={(e) => {
+ e.stopPropagation();
+ removeProjectFromFavorites(workspace.id);
+ }}
+ />
+ ) : (
+ <FontAwesomeIcon
+ icon={faStar}
+ className="ml-6 text-sm text-mineshaft-400 hover:text-mineshaft-300"
+ onClick={(e) => {
+ e.stopPropagation();
+ addProjectToFavorites(workspace.id);
+ }}
+ />
+ )}
+ </div>
+ </div>
+ );
+
+ let projectsComponents: ReactNode;
+
+ if (filteredWorkspaces.length || isProjectViewLoading) {
+ switch (projectsViewMode) {
+ case ProjectsViewMode.GRID:
+ projectsComponents = (
+ <div className="mt-4 grid w-full grid-cols-1 gap-4 lg:grid-cols-2 xl:grid-cols-3 2xl:grid-cols-4">
+ {isProjectViewLoading &&
+ Array.apply(0, Array(3)).map((_x, i) => (
+ <div
+ key={`workspace-cards-loading-${i + 1}`}
+ className="min-w-72 flex h-40 flex-col justify-between rounded-md border border-mineshaft-600 bg-mineshaft-800 p-4"
+ >
+ <div className="mt-0 text-lg text-mineshaft-100">
+ <Skeleton className="w-3/4 bg-mineshaft-600" />
+ </div>
+ <div className="mt-0 pb-6 text-sm text-mineshaft-300">
+ <Skeleton className="w-1/2 bg-mineshaft-600" />
+ </div>
+ <div className="flex justify-end">
+ <Skeleton className="w-1/2 bg-mineshaft-600" />
+ </div>
+ </div>
+ ))}
+ {!isProjectViewLoading && (
+ <>
+ {workspacesWithFaveProp.map((workspace) =>
+ renderProjectGridItem(workspace, workspace.isFavorite)
+ )}
+ </>
+ )}
+ </div>
+ );
+
+ break;
+ case ProjectsViewMode.LIST:
+ default:
+ projectsComponents = (
+ <div className="mt-4 w-full rounded-md">
+ {isProjectViewLoading &&
+ Array.apply(0, Array(3)).map((_x, i) => (
+ <div
+ key={`workspace-cards-loading-${i + 1}`}
+ className={`min-w-72 group flex h-12 cursor-pointer flex-row items-center justify-between border border-mineshaft-600 bg-mineshaft-800 px-6 hover:bg-mineshaft-700 ${
+ i === 0 && "rounded-t-md"
+ } ${i === 2 && "rounded-b-md border-b"}`}
+ >
+ <Skeleton className="w-full bg-mineshaft-600" />
+ </div>
+ ))}
+ {!isProjectViewLoading &&
+ workspacesWithFaveProp.map((workspace, ind) =>
+ renderProjectListItem(workspace, workspace.isFavorite, ind)
+ )}
+ </div>
+ );
+ break;
+ }
+ } else if (orgWorkspaces.length && searchFilter) {
+ projectsComponents = (
+ <div className="mt-4 w-full rounded-md border border-mineshaft-700 bg-mineshaft-800 px-4 py-6 text-base text-mineshaft-300">
+ <FontAwesomeIcon
+ icon={faSearch}
+ className="mb-4 mt-2 w-full text-center text-5xl text-mineshaft-400"
+ />
+ <div className="text-center font-light">No projects match search...</div>
+ </div>
+ );
+ }
+
+ return (
+ <div className="mx-auto flex max-w-7xl flex-col justify-start bg-bunker-800 md:h-screen">
+ <Head>
+ <title>{t("common.head-title", { title: t("settings.members.title") })}</title>
+ <link rel="icon" href="/infisical.ico" />
+ </Head>
+ {!serverDetails?.redisConfigured && (
+ <div className="mb-4 flex flex-col items-start justify-start px-6 py-6 pb-0 text-3xl">
+ <p className="mr-4 mb-4 font-semibold text-white">Announcements</p>
+ <div className="flex w-full items-center rounded-md border border-blue-400/70 bg-blue-900/70 p-2 text-base text-mineshaft-100">
+ <FontAwesomeIcon
+ icon={faExclamationCircle}
+ className="mr-4 p-4 text-2xl text-mineshaft-50"
+ />
+ Attention: Updated versions of Infisical now require Redis for full functionality. Learn
+ how to configure it
+ <Link
+ href="https://infisical.com/docs/self-hosting/configuration/redis"
+ target="_blank"
+ >
+ <span className="cursor-pointer pl-1 text-white underline underline-offset-2 duration-100 hover:text-blue-200 hover:decoration-blue-400">
+ here
+ </span>
+ </Link>
+ .
+ </div>
+ </div>
+ )}
+ <div className="mb-4 flex flex-col items-start justify-start px-6 py-6 pb-0">
+ <div className="flex w-full justify-between">
+ <p className="mr-4 text-3xl font-semibold text-white">{formatTitle(type)}</p>
+ </div>
+ <div>
+ <p className="mr-4 mt-2 text-gray-400">{formatDescription(type)}</p>
+ </div>
+ <div className="mt-6 flex w-full flex-row">
+ <Input
+ className="h-[2.3rem] bg-mineshaft-800 text-sm placeholder-mineshaft-50 duration-200 focus:bg-mineshaft-700/80"
+ placeholder="Search by project name..."
+ value={searchFilter}
+ onChange={(e) => setSearchFilter(e.target.value)}
+ leftIcon={<FontAwesomeIcon icon={faMagnifyingGlass} />}
+ />
+ <div className="ml-2 flex rounded-md border border-mineshaft-600 bg-mineshaft-800 p-1">
+ <Tooltip content="Toggle Sort Direction">
+ <IconButton
+ className="min-w-[2.4rem] border-none hover:bg-mineshaft-600"
+ ariaLabel={`Sort ${
+ orderDirection === OrderByDirection.ASC ? "descending" : "ascending"
+ }`}
+ variant="plain"
+ size="xs"
+ colorSchema="secondary"
+ onClick={toggleOrderDirection}
+ >
+ <FontAwesomeIcon
+ icon={orderDirection === OrderByDirection.ASC ? faArrowDownAZ : faArrowUpZA}
+ />
+ </IconButton>
+ </Tooltip>
+ </div>
+ <div className="ml-2 flex rounded-md border border-mineshaft-600 bg-mineshaft-800 p-1">
+ <IconButton
+ variant="outline_bg"
+ onClick={() => {
+ localStorage.setItem("projectsViewMode", ProjectsViewMode.GRID);
+ setProjectsViewMode(ProjectsViewMode.GRID);
+ }}
+ ariaLabel="grid"
+ size="xs"
+ className={`${
+ projectsViewMode === ProjectsViewMode.GRID ? "bg-mineshaft-500" : "bg-transparent"
+ } min-w-[2.4rem] border-none hover:bg-mineshaft-600`}
+ >
+ <FontAwesomeIcon icon={faBorderAll} />
+ </IconButton>
+ <IconButton
+ variant="outline_bg"
+ onClick={() => {
+ localStorage.setItem("projectsViewMode", ProjectsViewMode.LIST);
+ setProjectsViewMode(ProjectsViewMode.LIST);
+ }}
+ ariaLabel="list"
+ size="xs"
+ className={`${
+ projectsViewMode === ProjectsViewMode.LIST ? "bg-mineshaft-500" : "bg-transparent"
+ } min-w-[2.4rem] border-none hover:bg-mineshaft-600`}
+ >
+ <FontAwesomeIcon icon={faList} />
+ </IconButton>
+ </div>
+ <OrgPermissionCan I={OrgPermissionActions.Create} an={OrgPermissionSubjects.Workspace}>
+ {(isAllowed) => (
+ <Button
+ isDisabled={!isAllowed}
+ colorSchema="primary"
+ leftIcon={<FontAwesomeIcon icon={faPlus} />}
+ onClick={() => {
+ if (isAddingProjectsAllowed) {
+ handlePopUpOpen("addNewWs");
+ } else {
+ handlePopUpOpen("upgradePlan");
+ }
+ }}
+ className="ml-2"
+ >
+ Add New Project
+ </Button>
+ )}
+ </OrgPermissionCan>
+ </div>
+ {projectsComponents}
+ {!isProjectViewLoading && Boolean(filteredWorkspaces.length) && (
+ <Pagination
+ className={
+ projectsViewMode === ProjectsViewMode.GRID
+ ? "col-span-full !justify-start border-transparent bg-transparent pl-2"
+ : "rounded-b-md border border-mineshaft-600"
+ }
+ perPage={perPage}
+ perPageList={[12, 24, 48, 96]}
+ count={filteredWorkspaces.length}
+ page={page}
+ onChangePage={setPage}
+ onChangePerPage={setPerPage}
+ />
+ )}
+ {isWorkspaceEmpty && (
+ <div className="mt-4 w-full rounded-md border border-mineshaft-700 bg-mineshaft-800 px-4 py-6 text-base text-mineshaft-300">
+ <FontAwesomeIcon
+ icon={faFolderOpen}
+ className="mb-4 mt-2 w-full text-center text-5xl text-mineshaft-400"
+ />
+ <div className="text-center font-light">
+ You are not part of any projects in this organization yet. When you are, they will
+ appear here.
+ </div>
+ <div className="mt-0.5 text-center font-light">
+ Create a new project, or ask other organization members to give you necessary
+ permissions.
+ </div>
+ </div>
+ )}
+ </div>
+ <NewProjectModal
+ isOpen={popUp.addNewWs.isOpen}
+ onOpenChange={(isOpen) => handlePopUpToggle("addNewWs", isOpen)}
+ projectType={type}
+ />
+ <UpgradePlanModal
+ isOpen={popUp.upgradePlan.isOpen}
+ onOpenChange={(isOpen) => handlePopUpToggle("upgradePlan", isOpen)}
+ text="You have exceeded the number of projects allowed on the free plan."
+ />
+ </div>
+ );
+ };
+
+ const SecretManagerOverviewPage = () => <ProductOverview type={ProjectType.SecretManager} />;
+
+ Object.assign(SecretManagerOverviewPage, { requireAuth: true });
+
+ export default SecretManagerOverviewPage;
diff --cc frontend/src/pages/org/[id]/ssh/overview.tsx
index 0000000000,0000000000..2ab3bb6cc2
new file mode 100644
--- /dev/null
+++ b/frontend/src/pages/org/[id]/ssh/overview.tsx
@@@ -1,0 -1,0 +1,9 @@@
++import { ProjectType } from "@app/hooks/api/workspace/types";
++
++import { ProductOverview } from "../secret-manager/overview";
++
++const SshManagerOverviewPage = () => <ProductOverview type={ProjectType.SSH} />;
++
++Object.assign(SshManagerOverviewPage, { requireAuth: true });
++
++export default SshManagerOverviewPage;
diff --cc frontend/src/pages/ssh/[id]/allowlist/index.tsx
index 0000000000,0000000000..73c25d802b
new file mode 100644
--- /dev/null
+++ b/frontend/src/pages/ssh/[id]/allowlist/index.tsx
@@@ -1,0 -1,0 +1,21 @@@
++import { useTranslation } from "react-i18next";
++import Head from "next/head";
++
++import { IPAllowlistPage } from "@app/views/Project/IPAllowListPage";
++
++const ProjectAllowlist = () => {
++ const { t } = useTranslation();
++ return (
++ <>
++ <Head>
++ <title>{t("common.head-title", { title: t("settings.project.title") })}</title>
++ <link rel="icon" href="/infisical.ico" />
++ </Head>
++ <IPAllowlistPage />
++ </>
++ );
++};
++
++export default ProjectAllowlist;
++
++ProjectAllowlist.requireAuth = true;
diff --cc frontend/src/pages/ssh/[id]/ca/[caId]/index.tsx
index cdaa4d0b21,0000000000..cdaa4d0b21
mode 100644,000000..100644
--- a/frontend/src/pages/ssh/[id]/ca/[caId]/index.tsx
+++ b/frontend/src/pages/ssh/[id]/ca/[caId]/index.tsx
diff --cc frontend/src/pages/ssh/[id]/identities/[identityId]/index.tsx
index 0000000000,0000000000..ae8b2716ad
new file mode 100644
--- /dev/null
+++ b/frontend/src/pages/ssh/[id]/identities/[identityId]/index.tsx
@@@ -1,0 -1,0 +1,20 @@@
++import { useTranslation } from "react-i18next";
++import Head from "next/head";
++
++import { IdentityDetailsPage } from "@app/views/Project/IdentityDetailsPage";
++
++export default function ProjectIdentityDetailsPage() {
++ const { t } = useTranslation();
++
++ return (
++ <>
++ <Head>
++ <title>{t("common.head-title", { title: t("settings.members.title") })}</title>
++ <link rel="icon" href="/infisical.ico" />
++ </Head>
++ <IdentityDetailsPage />
++ </>
++ );
++}
++
++ProjectIdentityDetailsPage.requireAuth = true;
diff --cc frontend/src/pages/ssh/[id]/members/[membershipId]/index.tsx
index 0000000000,0000000000..033aa2b15d
new file mode 100644
--- /dev/null
+++ b/frontend/src/pages/ssh/[id]/members/[membershipId]/index.tsx
@@@ -1,0 -1,0 +1,20 @@@
++import { useTranslation } from "react-i18next";
++import Head from "next/head";
++
++import { MemberDetailsPage } from "@app/views/Project/MemberDetailsPage";
++
++export default function Page() {
++ const { t } = useTranslation();
++
++ return (
++ <>
++ <Head>
++ <title>{t("common.head-title", { title: t("settings.members.title") })}</title>
++ <link rel="icon" href="/infisical.ico" />
++ </Head>
++ <MemberDetailsPage />
++ </>
++ );
++}
++
++Page.requireAuth = true;
diff --cc frontend/src/pages/ssh/[id]/members/index.tsx
index 0000000000,0000000000..4bcbb833e2
new file mode 100644
--- /dev/null
+++ b/frontend/src/pages/ssh/[id]/members/index.tsx
@@@ -1,0 -1,0 +1,21 @@@
++/* eslint-disable @typescript-eslint/no-unused-vars */
++import { useTranslation } from "react-i18next";
++import Head from "next/head";
++
++import { MembersPage } from "@app/views/Project/MembersPage";
++
++export default function WorkspaceMemberSettings() {
++ const { t } = useTranslation();
++
++ return (
++ <>
++ <Head>
++ <title>{t("common.head-title", { title: t("settings.members.title") })}</title>
++ <link rel="icon" href="/infisical.ico" />
++ </Head>
++ <MembersPage />
++ </>
++ );
++}
++
++WorkspaceMemberSettings.requireAuth = true;
diff --cc frontend/src/pages/ssh/[id]/roles/[roleSlug]/index.tsx
index 0000000000,0000000000..17c854cee7
new file mode 100644
--- /dev/null
+++ b/frontend/src/pages/ssh/[id]/roles/[roleSlug]/index.tsx
@@@ -1,0 -1,0 +1,20 @@@
++/* eslint-disable @typescript-eslint/no-unused-vars */
++import { useTranslation } from "react-i18next";
++import Head from "next/head";
++
++import { RolePage } from "@app/views/Project/RolePage";
++
++export default function Role() {
++ const { t } = useTranslation();
++ return (
++ <>
++ <Head>
++ <title>{t("common.head-title", { title: "Project Settings" })}</title>
++ <link rel="icon" href="/infisical.ico" />
++ </Head>
++ <RolePage />
++ </>
++ );
++}
++
++Role.requireAuth = true;
diff --cc frontend/src/pages/ssh/[id]/settings/index.tsx
index 0000000000,0000000000..331ba8cc58
new file mode 100644
--- /dev/null
+++ b/frontend/src/pages/ssh/[id]/settings/index.tsx
@@@ -1,0 -1,0 +1,22 @@@
++import { useTranslation } from "react-i18next";
++import Head from "next/head";
++
++import { ProjectSettingsPage } from "@app/views/Settings/ProjectSettingsPage";
++
++const ProjectSettings = () => {
++ const { t } = useTranslation();
++
++ return (
++ <>
++ <Head>
++ <title>{t("common.head-title", { title: t("settings.project.title") })}</title>
++ <link rel="icon" href="/infisical.ico" />
++ </Head>
++ <ProjectSettingsPage />
++ </>
++ );
++};
++
++export default ProjectSettings;
++
++ProjectSettings.requireAuth = true;
diff --cc frontend/src/pages/ssh/[id]/ssh/index.tsx
index f574566c18,0000000000..f574566c18
mode 100644,000000..100644
--- a/frontend/src/pages/ssh/[id]/ssh/index.tsx
+++ b/frontend/src/pages/ssh/[id]/ssh/index.tsx
diff --cc frontend/src/views/Project/SshPage/components/SshCaTable.tsx
index ab2d33dcf3,0000000000..0f29b37118
mode 100644,000000..100644
--- a/frontend/src/views/Project/SshPage/components/SshCaTable.tsx
+++ b/frontend/src/views/Project/SshPage/components/SshCaTable.tsx
@@@ -1,151 -1,0 +1,154 @@@
+import { useRouter } from "next/router";
+import { faBan, faCertificate, faEllipsis, faTrash } from "@fortawesome/free-solid-svg-icons";
+import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
+import { twMerge } from "tailwind-merge";
+
+import { ProjectPermissionCan } from "@app/components/permissions";
+import {
+ Badge,
+ DropdownMenu,
+ DropdownMenuContent,
+ DropdownMenuItem,
+ DropdownMenuTrigger,
+ EmptyState,
+ Table,
+ TableContainer,
+ TableSkeleton,
+ TBody,
+ Td,
+ Th,
+ THead,
+ Tooltip,
+ Tr
+} from "@app/components/v2";
- import { ProjectPermissionActions, ProjectPermissionSub,useWorkspace } from "@app/context";
++import { ProjectPermissionActions, ProjectPermissionSub, useWorkspace } from "@app/context";
+import { SshCaStatus, useListWorkspaceSshCas } from "@app/hooks/api";
+import { caStatusToNameMap, getCaStatusBadgeVariant } from "@app/hooks/api/ca/constants";
++import { ProjectType } from "@app/hooks/api/workspace/types";
+import { UsePopUpState } from "@app/hooks/usePopUp";
+
+type Props = {
+ handlePopUpOpen: (
+ popUpName: keyof UsePopUpState<["deleteSshCa", "sshCaStatus"]>,
+ data?: {}
+ ) => void;
+};
+
+export const SshCaTable = ({ handlePopUpOpen }: Props) => {
+ const router = useRouter();
+ const { currentWorkspace } = useWorkspace();
+ const { data, isLoading } = useListWorkspaceSshCas(currentWorkspace?.id || "");
+
+ return (
+ <div>
+ <TableContainer>
+ <Table>
+ <THead>
+ <Tr>
+ <Th>Friendly Name</Th>
+ <Th>Status</Th>
+ <Th />
+ </Tr>
+ </THead>
+ <TBody>
+ {isLoading && <TableSkeleton columns={3} innerKey="org-ssh-cas" />}
+ {!isLoading &&
+ data &&
+ data.length > 0 &&
+ data.map((ca) => {
+ return (
+ <Tr
+ className="h-10 cursor-pointer transition-colors duration-100 hover:bg-mineshaft-700"
+ key={`ca-${ca.id}`}
- onClick={() => router.push(`/project/${currentWorkspace?.id}/ssh/ca/${ca.id}`)}
++ onClick={() =>
++ router.push(`/${ProjectType.SSH}/${currentWorkspace?.id}/ca/${ca.id}`)
++ }
+ >
+ <Td>{ca.friendlyName}</Td>
+ <Td>
+ <Badge variant={getCaStatusBadgeVariant(ca.status)}>
+ {caStatusToNameMap[ca.status]}
+ </Badge>
+ </Td>
+ <Td className="flex justify-end">
+ <DropdownMenu>
+ <DropdownMenuTrigger asChild className="rounded-lg">
+ <div className="hover:text-primary-400 data-[state=open]:text-primary-400">
+ <Tooltip content="More options">
+ <FontAwesomeIcon size="lg" icon={faEllipsis} />
+ </Tooltip>
+ </div>
+ </DropdownMenuTrigger>
+ <DropdownMenuContent align="start" className="p-1">
+ {(ca.status === SshCaStatus.ACTIVE ||
+ ca.status === SshCaStatus.DISABLED) && (
+ <ProjectPermissionCan
+ I={ProjectPermissionActions.Edit}
+ a={ProjectPermissionSub.SshCertificateAuthorities}
+ >
+ {(isAllowed) => (
+ <DropdownMenuItem
+ className={twMerge(
+ !isAllowed &&
+ "pointer-events-none cursor-not-allowed opacity-50"
+ )}
+ onClick={(e) => {
+ e.stopPropagation();
+ handlePopUpOpen("sshCaStatus", {
+ caId: ca.id,
+ status:
+ ca.status === SshCaStatus.ACTIVE
+ ? SshCaStatus.DISABLED
+ : SshCaStatus.ACTIVE
+ });
+ }}
+ disabled={!isAllowed}
+ icon={<FontAwesomeIcon icon={faBan} />}
+ >
+ {`${
+ ca.status === SshCaStatus.ACTIVE ? "Disable" : "Enable"
+ } SSH CA`}
+ </DropdownMenuItem>
+ )}
+ </ProjectPermissionCan>
+ )}
+ <ProjectPermissionCan
+ I={ProjectPermissionActions.Delete}
+ a={ProjectPermissionSub.SshCertificateAuthorities}
+ >
+ {(isAllowed) => (
+ <DropdownMenuItem
+ className={twMerge(
+ !isAllowed && "pointer-events-none cursor-not-allowed opacity-50"
+ )}
+ onClick={(e) => {
+ e.stopPropagation();
+ handlePopUpOpen("deleteSshCa", {
+ caId: ca.id
+ });
+ }}
+ disabled={!isAllowed}
+ icon={<FontAwesomeIcon icon={faTrash} />}
+ >
+ Delete SSH CA
+ </DropdownMenuItem>
+ )}
+ </ProjectPermissionCan>
+ </DropdownMenuContent>
+ </DropdownMenu>
+ </Td>
+ </Tr>
+ );
+ })}
+ </TBody>
+ </Table>
+ {!isLoading && data?.length === 0 && (
+ <EmptyState
+ title="No SSH certificate authorities have been created"
+ icon={faCertificate}
+ />
+ )}
+ </TableContainer>
+ </div>
+ );
+};