feat(ipsec): add certificate export functionality by name
Docker images / prepare-release (push) Successful in 12s
Docker images / backend-test (push) Successful in 2m41s
Docker images / frontend-image (push) Successful in 2m57s
Docker images / updater-image (push) Successful in 48s
Docker images / backend-image (push) Successful in 2m48s
Docker images / notify-webhook (push) Skipped
Docker images / publish-release (push) Successful in 13s

- Implemented a new backend route for exporting existing client certificates in .p12 format by name.
- Enhanced the frontend to support exporting certificates directly from the IPsec server grid.
- Updated the IPsec page to manage certificate states and handle exports effectively.
- Introduced new utility functions for certificate handling and improved data structures to accommodate the changes.
- Added tests to ensure the reliability of the new certificate export feature.
This commit is contained in:
Denozordec
2026-09-12 21:39:14 +07:00
parent 7365d8d8fb
commit 3eb75ea0b8
13 changed files with 520 additions and 73 deletions
+2
View File
@@ -25,6 +25,8 @@ export const certificateDtoSchema = z.object({
trusted: z.boolean(),
status: certStatusSchema,
acmeStatus: z.string().optional(),
/** Имя CA, которым серт подписан на устройстве (read-only поле `ca` RouterOS). */
signedByCertName: z.string().optional(),
})
export const certificatesListResponseSchema = z.object({
+11
View File
@@ -77,6 +77,8 @@ export const ipsecCertInfoDtoSchema = z.object({
trusted: z.boolean().optional(),
hasPrivateKey: z.boolean().optional(),
role: z.enum(["ca", "server", "client", "other"]).optional(),
/** Имя CA, которым серт подписан на устройстве (read-only поле `ca` RouterOS). */
signedBy: z.string().optional(),
managed: z.boolean(),
})
@@ -87,6 +89,8 @@ export const ipsecServerSummaryDtoSchema = z.object({
serverCountry: z.string().optional(),
/** Managed-набор (CA + серверный серт + peer + mode-config) инициализирован. */
initialized: z.boolean(),
/** Существующий IKEv2-сервер пригоден: есть peer + CA + серверный серт. */
ike2Ready: z.boolean(),
serverEndpoint: z.string().optional(),
/** Primary managed peer (обратная совместимость); для полного списка — `peers`. */
peer: ipsecPeerDtoSchema.optional(),
@@ -176,6 +180,12 @@ export const ipsecCertExportRequestSchema = z.object({
passphrase: z.string().min(4),
})
/** Экспорт .p12 существующего клиентского сертификата по имени (client1/anakondra и т.п.). */
export const ipsecCertExportByNameRequestSchema = z.object({
name: z.string().min(1),
passphrase: z.string().min(4),
})
/** Бандл для авторизации клиента: .p12 (+ strongSwan .sswan + инструкция). */
export const ipsecCertBundleSchema = z.object({
user: z.string(),
@@ -209,5 +219,6 @@ export type IpsecInitRequest = z.infer<typeof ipsecInitRequestSchema>
export type IpsecUserCreateRequest = z.infer<typeof ipsecUserCreateRequestSchema>
export type IpsecUserPatch = z.infer<typeof ipsecUserPatchSchema>
export type IpsecCertExportRequest = z.infer<typeof ipsecCertExportRequestSchema>
export type IpsecCertExportByNameRequest = z.infer<typeof ipsecCertExportByNameRequestSchema>
export type IpsecCertBundle = z.infer<typeof ipsecCertBundleSchema>
export type IpsecUserCreated = z.infer<typeof ipsecUserCreatedSchema>