Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose ssh endpoints to api reference, update ssh sign/issue endpoints #2893

Merged
merged 1 commit into from
Dec 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions backend/src/ee/routes/v1/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ import { registerSecretScanningRouter } from "./secret-scanning-router";
import { registerSecretVersionRouter } from "./secret-version-router";
import { registerSnapshotRouter } from "./snapshot-router";
import { registerSshCaRouter } from "./ssh-certificate-authority-router";
import { registerSshCertRouter } from "./ssh-certificate-router";
import { registerSshCertificateTemplateRouter } from "./ssh-certificate-template-router";
import { registerSshRouter } from "./ssh-router";
import { registerTrustedIpRouter } from "./trusted-ip-router";
import { registerUserAdditionalPrivilegeRouter } from "./user-additional-privilege-router";

Expand Down Expand Up @@ -73,8 +73,8 @@ export const registerV1EERoutes = async (server: FastifyZodProvider) => {

await server.register(
async (sshRouter) => {
await sshRouter.register(registerSshRouter, { prefix: "/" });
await sshRouter.register(registerSshCaRouter, { prefix: "/ca" });
await sshRouter.register(registerSshCertRouter, { prefix: "/certificates" });
await sshRouter.register(registerSshCertificateTemplateRouter, { prefix: "/certificate-templates" });
},
{ prefix: "/ssh" }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
import { AuthMode } from "@app/services/auth/auth-type";
import { CertKeyAlgorithm } from "@app/services/certificate/certificate-types";

export const registerSshRouter = async (server: FastifyZodProvider) => {
export const registerSshCertRouter = async (server: FastifyZodProvider) => {
server.route({
method: "POST",
url: "/sign",
Expand Down
4 changes: 4 additions & 0 deletions docs/api-reference/endpoints/ssh/ca/create.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
title: "Create"
openapi: "POST /api/v1/ssh/ca"
---
4 changes: 4 additions & 0 deletions docs/api-reference/endpoints/ssh/ca/delete.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
title: "Delete"
openapi: "DELETE /api/v1/ssh/ca/{sshCaId}"
---
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
title: "List templates"
openapi: "GET /api/v1/ssh/ca/{sshCaId}/certificate-templates"
---
4 changes: 4 additions & 0 deletions docs/api-reference/endpoints/ssh/ca/list.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
title: "List"
openapi: "GET /api/v2/workspace/{projectId}/ssh-cas"
---
4 changes: 4 additions & 0 deletions docs/api-reference/endpoints/ssh/ca/public-key.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
title: "Retrieve public key"
openapi: "GET /api/v1/ssh/ca/{sshCaId}/public-key"
---
4 changes: 4 additions & 0 deletions docs/api-reference/endpoints/ssh/ca/read.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
title: "Retrieve"
openapi: "GET /api/v1/ssh/ca/{sshCaId}"
---
4 changes: 4 additions & 0 deletions docs/api-reference/endpoints/ssh/ca/update.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
title: "Update"
openapi: "PATCH /api/v1/ssh/ca/{sshCaId}"
---
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
title: "Create"
openapi: "POST /api/v1/ssh/certificate-templates"
---
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
title: "Delete"
openapi: "DELETE /api/v1/ssh/certificate-templates/{certificateTemplateId}"
---
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
title: "List"
openapi: "GET /api/v2/workspace/{projectId}/ssh-certificate-templates"
---
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
title: "Retrieve"
openapi: "GET /api/v1/ssh/certificate-templates/{certificateTemplateId}"
---
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
title: "Update"
openapi: "PATCH /api/v1/ssh/certificate-templates/{certificateTemplateId}"
---
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
title: "Issue SSH Credentials"
openapi: "POST /api/v1/ssh/certificates/issue"
---
4 changes: 4 additions & 0 deletions docs/api-reference/endpoints/ssh/certificates/sign-key.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
title: "Sign SSH Public Key"
openapi: "POST /api/v1/ssh/certificates/sign"
---
34 changes: 34 additions & 0 deletions docs/mint.json
Original file line number Diff line number Diff line change
Expand Up @@ -847,6 +847,40 @@
}
]
},
{
"group": "Infisical SSH",
"pages": [
{
"group": "Certificates",
"pages": [
"api-reference/endpoints/ssh/certificates/issue-credentials",
"api-reference/endpoints/ssh/certificates/sign-key"
]
},
{
"group": "Certificate Authorities",
"pages": [
"api-reference/endpoints/ssh/ca/list",
"api-reference/endpoints/ssh/ca/create",
"api-reference/endpoints/ssh/ca/read",
"api-reference/endpoints/ssh/ca/update",
"api-reference/endpoints/ssh/ca/delete",
"api-reference/endpoints/ssh/ca/public-key",
"api-reference/endpoints/ssh/ca/list-certificate-templates"
]
},
{
"group": "Certificate Templates",
"pages": [
"api-reference/endpoints/ssh/certificate-templates/list",
"api-reference/endpoints/ssh/certificate-templates/create",
"api-reference/endpoints/ssh/certificate-templates/read",
"api-reference/endpoints/ssh/certificate-templates/update",
"api-reference/endpoints/ssh/certificate-templates/delete"
]
}
]
},
{
"group": "Infisical KMS",
"pages": [
Expand Down
10 changes: 8 additions & 2 deletions frontend/src/hooks/api/ssh-ca/mutations.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,10 @@ export const useSignSshKey = () => {
const queryClient = useQueryClient();
return useMutation<TSignSshKeyResponse, {}, TSignSshKeyDTO>({
mutationFn: async (body) => {
const { data } = await apiRequest.post<TSignSshKeyResponse>("/api/v1/ssh/sign", body);
const { data } = await apiRequest.post<TSignSshKeyResponse>(
"/api/v1/ssh/certificates/sign",
body
);
return data;
},
onSuccess: (_, { projectId }) => {
Expand All @@ -81,7 +84,10 @@ export const useIssueSshCreds = () => {
const queryClient = useQueryClient();
return useMutation<TIssueSshCredsResponse, {}, TIssueSshCredsDTO>({
mutationFn: async (body) => {
const { data } = await apiRequest.post<TIssueSshCredsResponse>("/api/v1/ssh/issue", body);
const { data } = await apiRequest.post<TIssueSshCredsResponse>(
"/api/v1/ssh/certificates/issue",
body
);
return data;
},
onSuccess: (_, { projectId }) => {
Expand Down
Loading