Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.
TypeScript acmeagentsai-agentscertificate-managementdevsecopsenvironment-variableskubernetesopen-sourcepampkipostgresprivate-caprivileged-access-managementsecret-managementsecret-managersecretssecrets-managementsecuritysecurity-toolsvault
windows local account secret rotation
Victor Santosc79a16b06695
diff --git a/backend/src/ee/routes/v2/secret-rotation-v2-routers/index.ts b/backend/src/ee/routes/v2/secret-rotation-v2-routers/index.tsindex f32a3d4b4c..351bc84496 100644--- a/backend/src/ee/routes/v2/secret-rotation-v2-routers/index.ts+++ b/backend/src/ee/routes/v2/secret-rotation-v2-routers/index.ts@@ -13,6 +13,7 @@ import { registerOracleDBCredentialsRotationRouter } from "./oracledb-credentialimport { registerPostgresCredentialsRotationRouter } from "./postgres-credentials-rotation-router";import { registerRedisCredentialsRotationRouter } from "./redis-credentials-rotation-router";import { registerUnixLinuxLocalAccountRotationRouter } from "./unix-linux-local-account-rotation-router";+import { registerWindowsLocalAccountRotationRouter } from "./windows-local-account-rotation-router";export * from "./secret-rotation-v2-router";@@ -32,5 +33,6 @@ export const SECRET_ROTATION_REGISTER_ROUTER_MAP: Record<[SecretRotation.RedisCredentials]: registerRedisCredentialsRotationRouter,[SecretRotation.MongoDBCredentials]: registerMongoDBCredentialsRotationRouter,[SecretRotation.DatabricksServicePrincipalSecret]: registerDatabricksServicePrincipalSecretRotationRouter,- [SecretRotation.UnixLinuxLocalAccount]: registerUnixLinuxLocalAccountRotationRouter+ [SecretRotation.UnixLinuxLocalAccount]: registerUnixLinuxLocalAccountRotationRouter,+ [SecretRotation.WindowsLocalAccount]: registerWindowsLocalAccountRotationRouter};diff --git a/backend/src/ee/routes/v2/secret-rotation-v2-routers/unix-linux-local-account-rotation-router.ts b/backend/src/ee/routes/v2/secret-rotation-v2-routers/unix-linux-local-account-rotation-router.tsindex eebfec6819..5a7ebb8577 100644--- a/backend/src/ee/routes/v2/secret-rotation-v2-routers/unix-linux-local-account-rotation-router.ts+++ b/backend/src/ee/routes/v2/secret-rotation-v2-routers/unix-linux-local-account-rotation-router.ts@@ -54,8 +54,8 @@ export const registerUnixLinuxLocalAccountRotationRouter = async (server: Fastifhandler: async (req) => {const { rotationId } = req.params;- const result = await server.services.secretRotationV2.reconcileUnixLinuxLocalAccountRotation(- { rotationId },+ const result = await server.services.secretRotationV2.reconcileLocalAccountRotation(+ { rotationId, type: SecretRotation.UnixLinuxLocalAccount },req.permission);diff --git a/backend/src/ee/routes/v2/secret-rotation-v2-routers/windows-local-account-rotation-router.ts b/backend/src/ee/routes/v2/secret-rotation-v2-routers/windows-local-account-rotation-router.tsnew file mode 100644index 0000000000..5056adc081--- /dev/null+++ b/backend/src/ee/routes/v2/secret-rotation-v2-routers/windows-local-account-rotation-router.ts@@ -0,0 +1,82 @@+import { z } from "zod";++import { EventType } from "@app/ee/services/audit-log/audit-log-types";+import { SecretRotation } from "@app/ee/services/secret-rotation-v2/secret-rotation-v2-enums";+import {+ CreateWindowsLocalAccountRotationSchema,+ TWindowsLocalAccountRotation,+ UpdateWindowsLocalAccountRotationSchema,+ WindowsLocalAccountRotationGeneratedCredentialsSchema,+ WindowsLocalAccountRotationSchema+} from "@app/ee/services/secret-rotation-v2/windows-local-account-rotation";+import { ApiDocsTags, SecretRotations } from "@app/lib/api-docs";+import { writeLimit } from "@app/server/config/rateLimiter";+import { verifyAuth } from "@app/server/plugins/auth/verify-auth";+import { AuthMode } from "@app/services/auth/auth-type";++import { registerSecretRotationEndpoints } from "./secret-rotation-v2-endpoints";++export const registerWindowsLocalAccountRotationRouter = async (server: FastifyZodProvider) => {+ // Register standard CRUD endpoints+ registerSecretRotationEndpoints({+ type: SecretRotation.WindowsLocalAccount,+ server,+ responseSchema: WindowsLocalAccountRotationSchema,+ createSchema: CreateWindowsLocalAccountRotationSchema,+ updateSchema: UpdateWindowsLocalAccountRotationSchema,+ generatedCredentialsSchema: WindowsLocalAccountRotationGeneratedCredentialsSchema+ });++ // Add reconcile endpoint for Windows Local Account rotation+ server.route({+ method: "POST",+ url: "/:rotationId/reconcile",+ config: {+ rateLimit: writeLimit+ },+ schema: {+ hide: false,+ tags: [ApiDocsTags.SecretRotations],+ description:+ "Reconcile Windows Local Account rotation credentials. This operation uses the SSH app connection credentials to reset the password when credentials are out of sync.",+ params: z.object({+ rotationId: z.string().uuid().describe(SecretRotations.RECONCILE.rotationId)+ }),+ response: {+ 200: z.object({+ message: z.string(),+ reconciled: z.boolean(),+ secretRotation: WindowsLocalAccountRotationSchema+ })+ }+ },+ onRequest: verifyAuth([AuthMode.JWT, AuthMode.IDENTITY_ACCESS_TOKEN]),+ handler: async (req) => {+ const { rotationId } = req.params;++ const result = await server.services.secretRotationV2.reconcileLocalAccountRotation(+ { rotationId, type: SecretRotation.WindowsLocalAccount },+ req.permission+ );++ await server.services.auditLog.createAuditLog({+ ...req.auditLogInfo,+ projectId: result.secretRotation.projectId,+ event: {+ type: EventType.RECONCILE_SECRET_ROTATION,+ metadata: {+ type: SecretRotation.WindowsLocalAccount,+ rotationId,+ reconciled: result.reconciled+ }+ }+ });++ return {+ message: result.message,+ reconciled: result.reconciled,+ secretRotation: result.secretRotation as TWindowsLocalAccountRotation+ };+ }+ });+};diff --git a/backend/src/ee/services/secret-rotation-v2/secret-rotation-v2-enums.ts b/backend/src/ee/services/secret-rotation-v2/secret-rotation-v2-enums.tsindex f848876cf1..d85925c8a8 100644--- a/backend/src/ee/services/secret-rotation-v2/secret-rotation-v2-enums.ts+++ b/backend/src/ee/services/secret-rotation-v2/secret-rotation-v2-enums.ts@@ -11,7 +11,8 @@ export enum SecretRotation {RedisCredentials = "redis-credentials",MongoDBCredentials = "mongodb-credentials",DatabricksServicePrincipalSecret = "databricks-service-principal-secret",- UnixLinuxLocalAccount = "unix-linux-local-account"+ UnixLinuxLocalAccount = "unix-linux-local-account",+ WindowsLocalAccount = "windows-local-account"}export enum SecretRotationStatus {diff --git a/backend/src/ee/services/secret-rotation-v2/secret-rotation-v2-fns.ts b/backend/src/ee/services/secret-rotation-v2/secret-rotation-v2-fns.tsindex 4de49f6afe..69ae5662e6 100644--- a/backend/src/ee/services/secret-rotation-v2/secret-rotation-v2-fns.ts+++ b/backend/src/ee/services/secret-rotation-v2/secret-rotation-v2-fns.ts@@ -32,6 +32,10 @@ import {TUnixLinuxLocalAccountRotation,UNIX_LINUX_LOCAL_ACCOUNT_ROTATION_LIST_OPTION} from "./unix-linux-local-account-rotation";+import {+ TWindowsLocalAccountRotation,+ WINDOWS_LOCAL_ACCOUNT_ROTATION_LIST_OPTION+} from "./windows-local-account-rotation";const SECRET_ROTATION_LIST_OPTIONS: Record<SecretRotation, TSecretRotationV2ListItem> = {[SecretRotation.PostgresCredentials]: POSTGRES_CREDENTIALS_ROTATION_LIST_OPTION,@@ -46,7 +50,8 @@ const SECRET_ROTATION_LIST_OPTIONS: Record<SecretRotation, TSecretRotationV2List[SecretRotation.RedisCredentials]: REDIS_CREDENTIALS_ROTATION_LIST_OPTION,[SecretRotation.MongoDBCredentials]: MONGODB_CREDENTIALS_ROTATION_LIST_OPTION,[SecretRotation.DatabricksServicePrincipalSecret]: DATABRICKS_SERVICE_PRINCIPAL_SECRET_ROTATION_LIST_OPTION,- [SecretRotation.UnixLinuxLocalAccount]: UNIX_LINUX_LOCAL_ACCOUNT_ROTATION_LIST_OPTION+ [SecretRotation.UnixLinuxLocalAccount]: UNIX_LINUX_LOCAL_ACCOUNT_ROTATION_LIST_OPTION,+ [SecretRotation.WindowsLocalAccount]: WINDOWS_LOCAL_ACCOUNT_ROTATION_LIST_OPTION};export const listSecretRotationOptions = () => {@@ -288,6 +293,17 @@ export const throwOnImmutableParameterUpdate = (throw new BadRequestError({ message: "Cannot update rotation method or username" });}break;+ case SecretRotation.WindowsLocalAccount:+ if (+ haveUnequalProperties(+ updatePayload.parameters as TWindowsLocalAccountRotation["parameters"],+ secretRotation.parameters as TWindowsLocalAccountRotation["parameters"],+ ["rotationMethod", "username"]+ )+ ) {+ throw new BadRequestError({ message: "Cannot update rotation method or username" });+ }+ break;default:// do nothing}diff --git a/backend/src/ee/services/secret-rotation-v2/secret-rotation-v2-maps.ts b/backend/src/ee/services/secret-rotation-v2/secret-rotation-v2-maps.tsindex bfc39f39ec..e19983e264 100644--- a/backend/src/ee/services/secret-rotation-v2/secret-rotation-v2-maps.ts+++ b/backend/src/ee/services/secret-rotation-v2/secret-rotation-v2-maps.ts@@ -14,7 +14,8 @@ export const SECRET_ROTATION_NAME_MAP: Record<SecretRotation, string> = {[SecretRotation.RedisCredentials]: "Redis Credentials",[SecretRotation.MongoDBCredentials]: "MongoDB Credentials",[SecretRotation.DatabricksServicePrincipalSecret]: "Databricks Service Principal Secret",- [SecretRotation.UnixLinuxLocalAccount]: "Unix/Linux Local Account"+ [SecretRotation.UnixLinuxLocalAccount]: "Unix/Linux Local Account",+ [SecretRotation.WindowsLocalAccount]: "Windows Local Account"};export const SECRET_ROTATION_CONNECTION_MAP: Record<SecretRotation, AppConnection> = {@@ -30,5 +31,6 @@ export const SECRET_ROTATION_CONNECTION_MAP: Record<SecretRotation, AppConnectio[SecretRotation.RedisCredentials]: AppConnection.Redis,[SecretRotation.MongoDBCredentials]: AppConnection.MongoDB,[SecretRotation.DatabricksServicePrincipalSecret]: AppConnection.Databricks,- [SecretRotation.UnixLinuxLocalAccount]: AppConnection.SSH+ [SecretRotation.UnixLinuxLocalAccount]: AppConnection.SSH,+ [SecretRotation.WindowsLocalAccount]: AppConnection.SSH};diff --git a/backend/src/ee/services/secret-rotation-v2/secret-rotation-v2-service.ts b/backend/src/ee/services/secret-rotation-v2/secret-rotation-v2-service.tsindex fe7efeed46..d50b221270 100644--- a/backend/src/ee/services/secret-rotation-v2/secret-rotation-v2-service.ts+++ b/backend/src/ee/services/secret-rotation-v2/secret-rotation-v2-service.ts@@ -95,6 +95,17 @@ import {TUnixLinuxLocalAccountRotation,TUnixLinuxLocalAccountRotationGeneratedCredentials} from "./unix-linux-local-account-rotation/unix-linux-local-account-rotation-types";+import { windowsLocalAccountRotationFactory } from "./windows-local-account-rotation/windows-local-account-rotation-fns";+import { WindowsLocalAccountRotationMethod } from "./windows-local-account-rotation/windows-local-account-rotation-schemas";+import {+ TWindowsLocalAccountRotation,+ TWindowsLocalAccountRotationGeneratedCredentials+} from "./windows-local-account-rotation/windows-local-account-rotation-types";++type TLocalAccountRotation = TUnixLinuxLocalAccountRotation | TWindowsLocalAccountRotation;+type TLocalAccountRotationGeneratedCredentials =+ | TUnixLinuxLocalAccountRotationGeneratedCredentials+ | TWindowsLocalAccountRotationGeneratedCredentials;export type TSecretRotationV2ServiceFactoryDep = {secretRotationV2DAL: TSecretRotationV2DALFactory;@@ -146,7 +157,8 @@ const SECRET_ROTATION_FACTORY_MAP: Record<SecretRotation, TRotationFactoryImplem[SecretRotation.MongoDBCredentials]: mongodbCredentialsRotationFactory as TRotationFactoryImplementation,[SecretRotation.DatabricksServicePrincipalSecret]:databricksServicePrincipalSecretRotationFactory as TRotationFactoryImplementation,- [SecretRotation.UnixLinuxLocalAccount]: unixLinuxLocalAccountRotationFactory as TRotationFactoryImplementation+ [SecretRotation.UnixLinuxLocalAccount]: unixLinuxLocalAccountRotationFactory as TRotationFactoryImplementation,+ [SecretRotation.WindowsLocalAccount]: windowsLocalAccountRotationFactory as TRotationFactoryImplementation};export const secretRotationV2ServiceFactory = ({@@ -1381,8 +1393,11 @@ export const secretRotationV2ServiceFactory = ({return secretRotations as TSecretRotationV2[];};- const reconcileUnixLinuxLocalAccountRotation = async (- { rotationId }: { rotationId: string },+ const reconcileLocalAccountRotation = async (+ {+ rotationId,+ type+ }: { rotationId: string; type: SecretRotation.UnixLinuxLocalAccount | SecretRotation.WindowsLocalAccount },actor: OrgServiceActor) => {const plan = await licenseService.getPlan(actor.orgId);@@ -1400,9 +1415,12 @@ export const secretRotationV2ServiceFactory = ({message: `Could not find Secret Rotation with ID "${rotationId}"`});- if (secretRotation.type !== SecretRotation.UnixLinuxLocalAccount)+ if (+ secretRotation.type !== SecretRotation.UnixLinuxLocalAccount &&+ secretRotation.type !== SecretRotation.WindowsLocalAccount+ )throw new BadRequestError({- message: "Reconcile operation is only supported for Unix/Linux Local Account rotations"+ message: `Reconcile operation is only supported for Unix/Linux Local Account and Windows Local Account rotations`});const { projectId, environment, folder, connection, encryptedGeneratedCredentials, parameters, folderId } =@@ -1425,12 +1443,22 @@ export const secretRotationV2ServiceFactory = ({}));- const unixLinuxParams = parameters as TUnixLinuxLocalAccountRotation["parameters"];+ const localAccountParams = parameters as TLocalAccountRotation["parameters"];++ const loginAsTargetMethod =+ type === SecretRotation.UnixLinuxLocalAccount+ ? UnixLinuxLocalAccountRotationMethod.LoginAsTarget+ : WindowsLocalAccountRotationMethod.LoginAsTarget;++ const loginAsRootMethod =+ type === SecretRotation.UnixLinuxLocalAccount+ ? UnixLinuxLocalAccountRotationMethod.LoginAsRoot+ : WindowsLocalAccountRotationMethod.LoginAsRoot;- // Only allow reconcile for self-rotation mode- if (unixLinuxParams.rotationMethod !== UnixLinuxLocalAccountRotationMethod.LoginAsTarget) {+ // Only allow reconcile for login-as-target mode+ if (localAccountParams.rotationMethod !== loginAsTargetMethod) {throw new BadRequestError({- message: "Reconcile operation is only supported for self-rotation mode Unix/Linux Local Account rotations"+ message: `Reconcile operation is only supported for login-as-target mode Unix/Linux Local Account and Windows Local Account rotations`});}@@ -1443,17 +1471,17 @@ export const secretRotationV2ServiceFactory = ({const activeCredentials = generatedCredentials[secretRotation.activeIndex- ] as TUnixLinuxLocalAccountRotationGeneratedCredentials[number];+ ] as TLocalAccountRotationGeneratedCredentials[number];const appConnection = await decryptAppConnection(connection, kmsService);// Use the rotation factory to perform a rotation using the app connection credentials- const rotationFactory = SECRET_ROTATION_FACTORY_MAP[SecretRotation.UnixLinuxLocalAccount](+ const rotationFactory = SECRET_ROTATION_FACTORY_MAP[type]({...secretRotation,- // Override rotation method to managed so it uses the app connection credentials+ // Override rotation method to login-as-root so it uses the app connection credentialsparameters: {- ...unixLinuxParams,- rotationMethod: UnixLinuxLocalAccountRotationMethod.LoginAsRoot+ ...localAccountParams,+ rotationMethod: loginAsRootMethod},connection: appConnection} as TSecretRotationV2WithConnection,@@ -1463,12 +1491,12 @@ export const secretRotationV2ServiceFactory = ({gatewayV2Service);- // Issue new credentials using managed mode (app connection credentials)+ // Issue new credentials using login-as-root mode (app connection credentials)const updatedRotation = await rotationFactory.issueCredentials(async (newCredentials) => {- const unixLinuxCredentials = newCredentials as TUnixLinuxLocalAccountRotationGeneratedCredentials[number];+ const localAccountCredentials = newCredentials as TLocalAccountRotationGeneratedCredentials[number];const updatedCredentials = [...generatedCredentials];- updatedCredentials[secretRotation.activeIndex] = unixLinuxCredentials;+ updatedCredentials[secretRotation.activeIndex] = localAccountCredentials;const encryptedUpdatedCredentials = await encryptSecretRotationCredentials({projectId,@@ -1483,7 +1511,7 @@ export const secretRotationV2ServiceFactory = ({});// Update the password secret with the new value- const secretsMapping = secretRotation.secretsMapping as TUnixLinuxLocalAccountRotation["secretsMapping"];+ const secretsMapping = secretRotation.secretsMapping as TLocalAccountRotation["secretsMapping"];await fnSecretBulkUpdate({folderId,@@ -1498,7 +1526,7 @@ export const secretRotationV2ServiceFactory = ({},data: {encryptedValue: encryptor({- plainText: Buffer.from(unixLinuxCredentials.password)+ plainText: Buffer.from(localAccountCredentials.password)}).cipherTextBlob,references: []}@@ -1538,7 +1566,7 @@ export const secretRotationV2ServiceFactory = ({});return {- message: "Unix/Linux Local Account credentials reconciled successfully",+ message: `${type === SecretRotation.UnixLinuxLocalAccount ? "Unix/Linux Local Account" : "Windows Local Account"} rotation credentials reconciled successfully`,reconciled: true,secretRotation: await expandSecretRotation(updatedRotation, kmsService)};@@ -1558,6 +1586,6 @@ export const secretRotationV2ServiceFactory = ({getDashboardSecretRotationCount,getDashboardSecretRotations,getQuickSearchSecretRotations,- reconcileUnixLinuxLocalAccountRotation+ reconcileLocalAccountRotation};};diff --git a/backend/src/ee/services/secret-rotation-v2/secret-rotation-v2-types.ts b/backend/src/ee/services/secret-rotation-v2/secret-rotation-v2-types.tsindex 9b6c89ad10..ff9e5110ae 100644--- a/backend/src/ee/services/secret-rotation-v2/secret-rotation-v2-types.ts+++ b/backend/src/ee/services/secret-rotation-v2/secret-rotation-v2-types.ts@@ -95,6 +95,13 @@ import {TUnixLinuxLocalAccountRotationListItem,TUnixLinuxLocalAccountRotationWithConnection} from "./unix-linux-local-account-rotation";+import {+ TWindowsLocalAccountRotation,+ TWindowsLocalAccountRotationGeneratedCredentials,+ TWindowsLocalAccountRotationInput,+ TWindowsLocalAccountRotationListItem,+ TWindowsLocalAccountRotationWithConnection+} from "./windows-local-account-rotation";export type TSecretRotationV2 =| TPostgresCredentialsRotation@@ -109,7 +116,8 @@ export type TSecretRotationV2 =| TRedisCredentialsRotation| TMongoDBCredentialsRotation| TDatabricksServicePrincipalSecretRotation- | TUnixLinuxLocalAccountRotation;+ | TUnixLinuxLocalAccountRotation+ | TWindowsLocalAccountRotation;export type TSecretRotationV2WithConnection =| TPostgresCredentialsRotationWithConnection@@ -124,7 +132,8 @@ export type TSecretRotationV2WithConnection =| TRedisCredentialsRotationWithConnection| TMongoDBCredentialsRotationWithConnection| TDatabricksServicePrincipalSecretRotationWithConnection- | TUnixLinuxLocalAccountRotationWithConnection;+ | TUnixLinuxLocalAccountRotationWithConnection+ | TWindowsLocalAccountRotationWithConnection;export type TSecretRotationV2GeneratedCredentials =| TSqlCredentialsRotationGeneratedCredentials@@ -135,7 +144,8 @@ export type TSecretRotationV2GeneratedCredentials =| TOktaClientSecretRotationGeneratedCredentials| TRedisCredentialsRotationGeneratedCredentials| TDatabricksServicePrincipalSecretRotationGeneratedCredentials- | TUnixLinuxLocalAccountRotationGeneratedCredentials;+ | TUnixLinuxLocalAccountRotationGeneratedCredentials+ | TWindowsLocalAccountRotationGeneratedCredentials;export type TSecretRotationV2Input =| TPostgresCredentialsRotationInput@@ -150,7 +160,8 @@ export type TSecretRotationV2Input =| TRedisCredentialsRotationInput| TMongoDBCredentialsRotationInput| TDatabricksServicePrincipalSecretRotationInput- | TUnixLinuxLocalAccountRotationInput;+ | TUnixLinuxLocalAccountRotationInput+ | TWindowsLocalAccountRotationInput;export type TSecretRotationV2ListItem =| TPostgresCredentialsRotationListItem@@ -165,11 +176,13 @@ export type TSecretRotationV2ListItem =| TRedisCredentialsRotationListItem| TMongoDBCredentialsRotationListItem| TDatabricksServicePrincipalSecretRotationListItem- | TUnixLinuxLocalAccountRotationListItem;+ | TUnixLinuxLocalAccountRotationListItem+ | TWindowsLocalAccountRotationListItem;export type TSecretRotationV2TemporaryParameters =| TLdapPasswordRotationInput["temporaryParameters"]| TUnixLinuxLocalAccountRotationInput["temporaryParameters"]+ | TWindowsLocalAccountRotationInput["temporaryParameters"]| undefined;export type TSecretRotationV2Raw = NonNullable<Awaited<ReturnType<TSecretRotationV2DALFactory["findById"]>>>;diff --git a/backend/src/ee/services/secret-rotation-v2/secret-rotation-v2-union-schema.ts b/backend/src/ee/services/secret-rotation-v2/secret-rotation-v2-union-schema.tsindex ef30328102..a8c15305b2 100644--- a/backend/src/ee/services/secret-rotation-v2/secret-rotation-v2-union-schema.ts+++ b/backend/src/ee/services/secret-rotation-v2/secret-rotation-v2-union-schema.ts@@ -13,6 +13,7 @@ import { OracleDBCredentialsRotationSchema } from "@app/ee/services/secret-rotatimport { PostgresCredentialsRotationSchema } from "@app/ee/services/secret-rotation-v2/postgres-credentials";import { RedisCredentialsRotationSchema } from "@app/ee/services/secret-rotation-v2/redis-credentials";import { UnixLinuxLocalAccountRotationSchema } from "@app/ee/services/secret-rotation-v2/unix-linux-local-account-rotation";+import { WindowsLocalAccountRotationSchema } from "@app/ee/services/secret-rotation-v2/windows-local-account-rotation";export const SecretRotationV2Schema = z.discriminatedUnion("type", [PostgresCredentialsRotationSchema,@@ -27,5 +28,6 @@ export const SecretRotationV2Schema = z.discriminatedUnion("type", [RedisCredentialsRotationSchema,MongoDBCredentialsRotationSchema,DatabricksServicePrincipalSecretRotationSchema,- UnixLinuxLocalAccountRotationSchema+ UnixLinuxLocalAccountRotationSchema,+ WindowsLocalAccountRotationSchema]);diff --git a/backend/src/ee/services/secret-rotation-v2/windows-local-account-rotation/index.ts b/backend/src/ee/services/secret-rotation-v2/windows-local-account-rotation/index.tsnew file mode 100644index 0000000000..2477be10c5--- /dev/null+++ b/backend/src/ee/services/secret-rotation-v2/windows-local-account-rotation/index.ts@@ -0,0 +1,4 @@+export * from "./windows-local-account-rotation-constants";+export * from "./windows-local-account-rotation-fns";+export * from "./windows-local-account-rotation-schemas";+export * from "./windows-local-account-rotation-types";diff --git a/backend/src/ee/services/secret-rotation-v2/windows-local-account-rotation/windows-local-account-rotation-constants.ts b/backend/src/ee/services/secret-rotation-v2/windows-local-account-rotation/windows-local-account-rotation-constants.tsnew file mode 100644index 0000000000..89bc21753b--- /dev/null+++ b/backend/src/ee/services/secret-rotation-v2/windows-local-account-rotation/windows-local-account-rotation-constants.ts@@ -0,0 +1,16 @@+import { SecretRotation } from "@app/ee/services/secret-rotation-v2/secret-rotation-v2-enums";+import { AppConnection } from "@app/services/app-connection/app-connection-enums";++import { TWindowsLocalAccountRotationListItem } from "./windows-local-account-rotation-types";++export const WINDOWS_LOCAL_ACCOUNT_ROTATION_LIST_OPTION: TWindowsLocalAccountRotationListItem = {+ name: "Windows Local Account",+ type: SecretRotation.WindowsLocalAccount,+ connection: AppConnection.SSH,+ template: {+ secretsMapping: {+ username: "WINDOWS_USERNAME",+ password: "WINDOWS_PASSWORD"+ }+ }+};diff --git a/backend/src/ee/services/secret-rotation-v2/windows-local-account-rotation/windows-local-account-rotation-fns.ts b/backend/src/ee/services/secret-rotation-v2/windows-local-account-rotation/windows-local-account-rotation-fns.tsnew file mode 100644index 0000000000..bb48f6119d--- /dev/null+++ b/backend/src/ee/services/secret-rotation-v2/windows-local-account-rotation/windows-local-account-rotation-fns.ts@@ -0,0 +1,232 @@+import { Client } from "ssh2";++import {+ TRotationFactory,+ TRotationFactoryGetSecretsPayload,+ TRotationFactoryIssueCredentials,+ TRotationFactoryRevokeCredentials,+ TRotationFactoryRotateCredentials+} from "@app/ee/services/secret-rotation-v2/secret-rotation-v2-types";+import { BadRequestError } from "@app/lib/errors";+import { logger } from "@app/lib/logger";+import {+ executeWithPotentialGateway,+ getSshConnectionClient,+ SshConnectionMethod,+ TSshConnectionConfig+} from "@app/services/app-connection/ssh";++import { generatePassword } from "../shared/utils";+import { WindowsLocalAccountRotationMethod } from "./windows-local-account-rotation-schemas";+import {+ TWindowsLocalAccountRotationGeneratedCredentials,+ TWindowsLocalAccountRotationInput,+ TWindowsLocalAccountRotationWithConnection+} from "./windows-local-account-rotation-types";++// Execute command over SSH and return stdout+const executeCommand = (client: Client, command: string): Promise<string> => {+ return new Promise((resolve, reject) => {+ client.exec(command, (err, stream) => {+ if (err) {+ reject(new Error(`SSH exec error: ${err.message}`));+ return;+ }++ let stdout = "";+ let stderr = "";++ stream.on("close", (code: number) => {+ if (code !== 0) {+ reject(new Error(`Command failed with exit code ${code}: ${stderr || "Unknown error"}`));+ } else {+ resolve(stdout);+ }+ });++ stream.on("data", (data: Buffer) => {+ stdout += data.toString();+ });++ stream.stderr.on("data", (data: Buffer) => {+ stderr += data.toString();+ });+ });+ });+};++// Change password for managed rotation (admin changing another user's password)+const changeManagedPassword = async (client: Client, username: string, newPassword: string): Promise<void> => {+ // Using base64 encoding to avoid any shell escaping issues+ const encodedPassword = Buffer.from(newPassword).toString("base64");+ const encodedUsername = Buffer.from(username).toString("base64");+ const command = `powershell -Command "$u = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String('${encodedUsername}')); $p = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String('${encodedPassword}')); net user $u $p"`;++ try {+ await executeCommand(client, command);+ } catch (error) {+ logger.error(error, "Windows Local Account Rotation: Failed to change password (managed)");+ throw new Error(`Failed to change password: ${(error as Error).message}`);+ }+};++// Change password for self rotation (user changing their own password)+// Windows net user command works the same for self-rotation on local accounts+const changeSelfPassword = async (client: Client, username: string, newPassword: string): Promise<void> => {+ // Using base64 encoding to avoid any shell escaping issues+ const encodedPassword = Buffer.from(newPassword).toString("base64");+ const encodedUsername = Buffer.from(username).toString("base64");+ const command = `powershell -Command "$u = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String('${encodedUsername}')); $p = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String('${encodedPassword}')); net user $u $p"`;++ try {+ await executeCommand(client, command);+ } catch (error) {+ logger.error(error, "Windows Local Account Rotation: Failed to change password (self)");+ throw new Error(`Failed to change password: ${(error as Error).message}`);+ }+};++export const windowsLocalAccountRotationFactory: TRotationFactory<+ TWindowsLocalAccountRotationWithConnection,+ TWindowsLocalAccountRotationGeneratedCredentials,+ TWindowsLocalAccountRotationInput["temporaryParameters"]+> = (secretRotation, appConnectionDAL, kmsService, _gatewayService, gatewayV2Service) => {+ const { connection, parameters, secretsMapping, activeIndex } = secretRotation;+ const { username, passwordRequirements, rotationMethod = WindowsLocalAccountRotationMethod.LoginAsRoot } = parameters;++ // Helper to verify SSH credentials work+ const $verifyCredentials = async (targetUsername: string, targetPassword: string): Promise<void> => {+ const verifyConfig: TSshConnectionConfig = {+ method: SshConnectionMethod.Password,+ app: connection.app,+ orgId: connection.orgId,+ gatewayId: connection.gatewayId,+ credentials: {+ host: connection.credentials.host,+ port: connection.credentials.port,+ username: targetUsername,+ password: targetPassword+ }+ };++ try {+ await executeWithPotentialGateway(verifyConfig, gatewayV2Service, async (targetHost, targetPort) => {+ const client = await getSshConnectionClient(verifyConfig, targetHost, targetPort);+ client.destroy();+ });+ } catch (error) {+ throw new Error(`Failed to verify credentials - ${(error as Error).message}`);+ }+ };++ // Main password rotation logic+ const $rotatePassword = async (currentPassword?: string): Promise<{ username: string; password: string }> => {+ const { credentials } = connection;+ const newPassword = generatePassword(passwordRequirements);++ const isSelfRotation = rotationMethod === WindowsLocalAccountRotationMethod.LoginAsTarget;+ if (username === credentials.username)+ throw new BadRequestError({ message: "Provided username is used in Infisical app connections." });++ const privilegedAccounts = ["administrator", "admin"];+ if (privilegedAccounts.includes(username.toLowerCase()))+ throw new BadRequestError({ message: "Cannot rotate passwords for privileged system accounts." });++ // Determine which credentials to use for the SSH connection+ let connectConfig: TSshConnectionConfig;++ if (isSelfRotation && currentPassword) {+ // For self-rotation with current password, connect as the target user+ connectConfig = {+ method: SshConnectionMethod.Password,+ app: connection.app,+ orgId: connection.orgId,+ gatewayId: connection.gatewayId,+ credentials: {+ host: credentials.host,+ port: credentials.port,+ username,+ password: currentPassword+ }+ };+ } else {+ // For managed rotation, connect with the app connection credentials (admin)+ connectConfig = {+ method: connection.method,+ app: connection.app,+ orgId: connection.orgId,+ gatewayId: connection.gatewayId,+ credentials: connection.credentials+ } as TSshConnectionConfig;+ }++ await executeWithPotentialGateway(connectConfig, gatewayV2Service, async (targetHost, targetPort) => {+ const client = await getSshConnectionClient(connectConfig, targetHost, targetPort);++ try {+ if (isSelfRotation && currentPassword) {+ // Self rotation: user changes their own password using net user command+ await changeSelfPassword(client, username, newPassword);+ } else {+ // Managed rotation: admin changes user's password using net user command+ await changeManagedPassword(client, username, newPassword);+ }+ } finally {+ client.destroy();+ }+ });++ // Verify the new credentials work+ await $verifyCredentials(username, newPassword);++ return { username, password: newPassword };+ };++ const issueCredentials: TRotationFactoryIssueCredentials<+ TWindowsLocalAccountRotationGeneratedCredentials,+ TWindowsLocalAccountRotationInput["temporaryParameters"]+ > = async (callback, temporaryParameters) => {+ const credentials = await $rotatePassword(temporaryParameters?.password);+ return callback(credentials);+ };++ const revokeCredentials: TRotationFactoryRevokeCredentials<TWindowsLocalAccountRotationGeneratedCredentials> = async (+ credentialsToRevoke,+ callback+ ) => {+ const currentPassword = credentialsToRevoke[activeIndex].password;+ // We just rotate to a new password, essentially revoking old credentials+ // For self rotation: we need current password to authenticate+ // For managed rotation: admin uses their own credentials+ await $rotatePassword(currentPassword);+ return callback();+ };++ const rotateCredentials: TRotationFactoryRotateCredentials<TWindowsLocalAccountRotationGeneratedCredentials> = async (+ _,+ callback,+ activeCredentials+ ) => {+ // For both methods, pass the current password+ // Self rotation: needed to authenticate as the user+ // Managed rotation: admin doesn't need it but it's harmless to pass+ const credentials = await $rotatePassword(activeCredentials.password);+ return callback(credentials);+ };++ const getSecretsPayload: TRotationFactoryGetSecretsPayload<TWindowsLocalAccountRotationGeneratedCredentials> = (+ generatedCredentials+ ) => {+ return [+ { key: secretsMapping.username, value: generatedCredentials.username },+ { key: secretsMapping.password, value: generatedCredentials.password }+ ];+ };++ return {+ issueCredentials,+ revokeCredentials,+ rotateCredentials,+ getSecretsPayload+ };+};diff --git a/backend/src/ee/services/secret-rotation-v2/windows-local-account-rotation/windows-local-account-rotation-schemas.ts b/backend/src/ee/services/secret-rotation-v2/windows-local-account-rotation/windows-local-account-rotation-schemas.tsnew file mode 100644index 0000000000..bac7d5b5cd--- /dev/null+++ b/backend/src/ee/services/secret-rotation-v2/windows-local-account-rotation/windows-local-account-rotation-schemas.ts@@ -0,0 +1,101 @@+import { z } from "zod";++import { SecretRotation } from "@app/ee/services/secret-rotation-v2/secret-rotation-v2-enums";+import {+ BaseCreateSecretRotationSchema,+ BaseSecretRotationSchema,+ BaseUpdateSecretRotationSchema+} from "@app/ee/services/secret-rotation-v2/secret-rotation-v2-schemas";+import { PasswordRequirementsSchema } from "@app/ee/services/secret-rotation-v2/shared/general";+import { SecretRotations } from "@app/lib/api-docs";+import { CharacterType, characterValidator } from "@app/lib/validator/validate-string";+import { SecretNameSchema } from "@app/server/lib/schemas";+import { AppConnection } from "@app/services/app-connection/app-connection-enums";++export enum WindowsLocalAccountRotationMethod {+ LoginAsTarget = "login-as-target",+ LoginAsRoot = "login-as-root"+}++export const WindowsLocalAccountRotationGeneratedCredentialsSchema = z+ .object({+ username: z.string(),+ password: z.string()+ })+ .array()+ .min(1)+ .max(2);++const WindowsLocalAccountRotationParametersSchema = z.object({+ username: z+ .string()+ .trim()+ .min(1, "Username required")+ .refine(+ (val) => characterValidator([CharacterType.AlphaNumeric, CharacterType.Hyphen, CharacterType.Underscore])(val),+ "Name can only contain alphanumeric characters, dashes, underscores, and spaces"+ )+ .describe(SecretRotations.PARAMETERS.WINDOWS_LOCAL_ACCOUNT.username),+ passwordRequirements: PasswordRequirementsSchema.optional(),+ rotationMethod: z+ .nativeEnum(WindowsLocalAccountRotationMethod)+ .optional()+ .describe(SecretRotations.PARAMETERS.WINDOWS_LOCAL_ACCOUNT.rotationMethod)+});++const WindowsLocalAccountRotationSecretsMappingSchema = z.object({+ username: SecretNameSchema.describe(SecretRotations.SECRETS_MAPPING.WINDOWS_LOCAL_ACCOUNT.username),+ password: SecretNameSchema.describe(SecretRotations.SECRETS_MAPPING.WINDOWS_LOCAL_ACCOUNT.password)+});++export const WindowsLocalAccountRotationTemplateSchema = z.object({+ secretsMapping: z.object({+ username: z.string(),+ password: z.string()+ })+});++export const WindowsLocalAccountRotationSchema = BaseSecretRotationSchema(SecretRotation.WindowsLocalAccount).extend({+ type: z.literal(SecretRotation.WindowsLocalAccount),+ parameters: WindowsLocalAccountRotationParametersSchema,+ secretsMapping: WindowsLocalAccountRotationSecretsMappingSchema+});++export const CreateWindowsLocalAccountRotationSchema = BaseCreateSecretRotationSchema(+ SecretRotation.WindowsLocalAccount+)+ .extend({+ parameters: WindowsLocalAccountRotationParametersSchema,+ secretsMapping: WindowsLocalAccountRotationSecretsMappingSchema,+ temporaryParameters: z+ .object({+ password: z.string().optional().describe(SecretRotations.PARAMETERS.WINDOWS_LOCAL_ACCOUNT.password)+ })+ .optional()+ })+ .superRefine((val, ctx) => {+ if (+ val.parameters.rotationMethod === WindowsLocalAccountRotationMethod.LoginAsTarget &&+ !val.temporaryParameters?.password+ ) {+ ctx.addIssue({+ code: z.ZodIssueCode.custom,+ message: "Current password is required for initial rotation setup in login as target method",+ path: ["temporaryParameters", "password"]+ });+ }+ });++export const UpdateWindowsLocalAccountRotationSchema = BaseUpdateSecretRotationSchema(+ SecretRotation.WindowsLocalAccount+).extend({+ parameters: WindowsLocalAccountRotationParametersSchema.optional(),+ secretsMapping: WindowsLocalAccountRotationSecretsMappingSchema.optional()+});++export const WindowsLocalAccountRotationListItemSchema = z.object({+ name: z.literal("Windows Local Account"),+ connection: z.literal(AppConnection.SSH),+ type: z.literal(SecretRotation.WindowsLocalAccount),+ template: WindowsLocalAccountRotationTemplateSchema+});diff --git a/backend/src/ee/services/secret-rotation-v2/windows-local-account-rotation/windows-local-account-rotation-types.ts b/backend/src/ee/services/secret-rotation-v2/windows-local-account-rotation/windows-local-account-rotation-types.tsnew file mode 100644index 0000000000..c1ff93e629--- /dev/null+++ b/backend/src/ee/services/secret-rotation-v2/windows-local-account-rotation/windows-local-account-rotation-types.ts@@ -0,0 +1,24 @@+import { z } from "zod";++import { TSshConnection } from "@app/services/app-connection/ssh";++import {+ CreateWindowsLocalAccountRotationSchema,+ WindowsLocalAccountRotationGeneratedCredentialsSchema,+ WindowsLocalAccountRotationListItemSchema,+ WindowsLocalAccountRotationSchema+} from "./windows-local-account-rotation-schemas";++export type TWindowsLocalAccountRotation = z.infer<typeof WindowsLocalAccountRotationSchema>;++export type TWindowsLocalAccountRotationInput = z.infer<typeof CreateWindowsLocalAccountRotationSchema>;++export type TWindowsLocalAccountRotationListItem = z.infer<typeof WindowsLocalAccountRotationListItemSchema>;++export type TWindowsLocalAccountRotationWithConnection = TWindowsLocalAccountRotation & {+ connection: TSshConnection;+};++export type TWindowsLocalAccountRotationGeneratedCredentials = z.infer<+ typeof WindowsLocalAccountRotationGeneratedCredentialsSchema+>;diff --git a/backend/src/lib/api-docs/constants.ts b/backend/src/lib/api-docs/constants.tsindex d4b5d0b076..9037474543 100644--- a/backend/src/lib/api-docs/constants.ts+++ b/backend/src/lib/api-docs/constants.ts@@ -2913,8 +2913,16 @@ export const SecretRotations = {UNIX_LINUX_LOCAL_ACCOUNT: {username: "The username of the Unix/Linux user account to rotate the password for.",rotationMethod:- 'Whether the rotation should be performed using "self" (the target user\'s own credentials) or "managed" (the SSH connection\'s admin credentials). Defaults to "managed".',- password: 'The current password of the target user if "parameters.rotationMethod" is set to "managed".'+ 'Whether the rotation should be performed using "login-as-target" (the target user\'s own credentials) or "login-as-root" (the SSH connection\'s admin credentials). Defaults to "login-as-root".',+ password:+ 'The current password of the target user. Required if "parameters.rotationMethod" is set to "login-as-target".'+ },+ WINDOWS_LOCAL_ACCOUNT: {+ username: "The username of the Windows user account to rotate the password for.",+ rotationMethod:+ 'Whether the rotation should be performed using "login-as-target" (the target user\'s own credentials) or "login-as-root" (the SSH connection\'s admin credentials). Defaults to "login-as-root".',+ password:+ 'The current password of the target user. Required if "parameters.rotationMethod" is set to "login-as-target".'},GENERAL: {PASSWORD_REQUIREMENTS: {@@ -2981,6 +2989,10 @@ export const SecretRotations = {username: "The name of the secret that the username will be mapped to.",password: "The name of the secret that the rotated password will be mapped to."},+ WINDOWS_LOCAL_ACCOUNT: {+ username: "The name of the secret that the username will be mapped to.",+ password: "The name of the secret that the rotated password will be mapped to."+ },AWS_IAM_USER_SECRET: {accessKeyId: "The name of the secret that the access key ID will be mapped to.",secretAccessKey: "The name of the secret that the rotated secret access key will be mapped to."diff --git a/docs/documentation/platform/secret-rotation/windows-local-account.mdx b/docs/documentation/platform/secret-rotation/windows-local-account.mdxnew file mode 100644index 0000000000..3cbb9cf2d2--- /dev/null+++ b/docs/documentation/platform/secret-rotation/windows-local-account.mdx@@ -0,0 +1,244 @@+---+title: "Windows Local Account Rotation"+description: "Learn how to automatically rotate Windows local account passwords using OpenSSH."+---++<Note>+ Due to how Windows local account passwords are rotated, retired credentials will not be able to+ authenticate with the SSH provider during their [inactive period](./overview#how-rotation-works).++ This is a limitation of the SSH provider and cannot be+ rectified by Infisical.+</Note>++## Prerequisites++- **OpenSSH Server installed and enabled** on your Windows Server (Windows Server 2019+ includes OpenSSH by default)+- Create an [SSH Connection](/integrations/app-connections/ssh) with the **Secret Rotation** requirements+- Ensure your network security policies allow incoming requests from Infisical to this rotation provider, if network restrictions apply.++### Enable OpenSSH on Windows++For Windows Server 2019 and later (and Windows 10/11), OpenSSH Server is included as an optional feature. To enable it, run these PowerShell commands as Administrator:++```powershell+# Install OpenSSH Server (if not already installed)+$ssh = Get-WindowsCapability -Online | Where-Object Name -like 'OpenSSH.Server*'+if ($ssh.State -ne "Installed") {+ Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0+}++# Start and enable the service+Start-Service sshd+Set-Service -Name sshd -StartupType Automatic+```++### Firewall Configuration (Optional)++If you need to allow SSH connections through Windows Firewall, you can use:++```powershell+New-NetFirewallRule -Name "OpenSSH-Server-In-TCP" -DisplayName "OpenSSH Server" `+ -Enabled True -Direction Inbound -Protocol TCP -Action Allow -LocalPort 22+```++**Note**: Consult your security team if you have existing firewall policies, use Group Policy, or have third-party firewall software.++### For Older Windows Versions++For Windows Server versions prior to 2019, download and install OpenSSH from the [official repository](https://github.com/PowerShell/Win32-OpenSSH).++## Create a Windows Local Account Rotation in Infisical++<Tabs>+ <Tab title="Infisical UI">+ 1. Navigate to your Secret Manager Project's Dashboard and select **Add Secret Rotation** from the actions dropdown.+ ++ 2. Select the **Windows Local Account** option.+ ++ 3. Select the **SSH Connection** to use and configure the rotation behavior. Then click **Next**.+ ++ - **SSH Connection** - the connection that will perform the rotation of the configured user's password.+ - **Rotation Interval** - the interval, in days, that once elapsed will trigger a rotation.+ - **Rotate At** - the local time of day when rotation should occur once the interval has elapsed.+ - **Auto-Rotation Enabled** - whether secrets should automatically be rotated once the rotation interval has elapsed. Disable this option to manually rotate secrets or pause secret rotation.+ <Note>+ Due to Windows Local Account Rotations rotating a single credential set, auto-rotation may result in service interruptions. If you need to ensure service continuity, we recommend disabling this option.+ </Note>+++ 4. Configure the required Parameters for your rotation. Then click **Next**.+ ++ - **Rotation Method** - The method to use when rotating the target user's password.+ - **Login as Target** - Infisical will use the provided SSH username and password to log in and rotate its own password.+ - **Login as Root** - Infisical will use the SSH Connection's credentials to log in and rotate the provided user's password.+ - **Username** - The target Windows username whose password will be rotated.+ - **Current Password** - The current password of the target user (required when **Rotation Method** is set to **Login as Target**).+ - **Password Requirements** - The constraints to apply when generating new passwords.++ 5. Specify the secret names that the Windows credentials should be mapped to. Then click **Next**.+ ++ - **Username** - the name of the secret that the Windows username will be stored in.+ - **Password** - the name of the secret that the rotated password will be stored in.++ 6. Give your rotation a name and description (optional). Then click **Next**.+ ++ - **Name** - the name of the secret rotation configuration. Must be slug-friendly.+ - **Description** (optional) - a description of this rotation configuration.++ 7. Review your configuration, then click **Create Secret Rotation**.+ ++ 8. Your **Windows Local Account** credentials are now available for use via the mapped secrets.+ ++ ### Reconcile Windows Local Account++ If you suspect the credentials are out of sync (for example, after a manual password change on the server), you can regain access by using **Reconcile**. This will use the configured SSH App Connection's administrator account to reset the target user's password and sync it with Infisical.++ + + </Tab>+ <Tab title="API">+ To create a Windows Local Account Rotation, make an API request to the [Create Windows+ Local Account Rotation](/api-reference/endpoints/secret-rotations/windows-local-account/create) API endpoint.++ ### Sample request++ ```bash Request+ curl --request POST \+ --url https://us.infisical.com/api/v2/secret-rotations/windows-local-account \+ --header 'Content-Type: application/json' \+ --data '{+ "name": "my-windows-rotation",+ "projectId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",+ "description": "my windows local account rotation",+ "connectionId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",+ "environment": "dev",+ "secretPath": "/",+ "isAutoRotationEnabled": false,+ "rotationInterval": 30,+ "rotateAtUtc": {+ "hours": 0,+ "minutes": 0+ },+ "parameters": {+ "rotationMethod": "login-as-root",+ "username": "appuser",+ "passwordRequirements": {+ "length": 48,+ "required": {+ "digits": 2,+ "lowercase": 2,+ "uppercase": 2,+ "symbols": 2+ },+ "allowedSymbols": "-_.~!*"+ }+ },+ "secretsMapping": {+ "username": "WINDOWS_USERNAME",+ "password": "WINDOWS_PASSWORD"+ }+ }'+ ```++ <Note>+ Due to Windows Local Account Rotations rotating a single credential set, auto-rotation may result in service interruptions. If you need to ensure service continuity, we recommend disabling this option.+ </Note>++ ### Sample response++ ```bash Response+ {+ "secretRotation": {+ "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",+ "name": "my-windows-rotation",+ "description": "my windows local account rotation",+ "secretsMapping": {+ "username": "WINDOWS_USERNAME",+ "password": "WINDOWS_PASSWORD"+ },+ "isAutoRotationEnabled": false,+ "activeIndex": 0,+ "folderId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",+ "connectionId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",+ "createdAt": "2023-11-07T05:31:56Z",+ "updatedAt": "2023-11-07T05:31:56Z",+ "rotationInterval": 30,+ "rotationStatus": "success",+ "lastRotationAttemptedAt": "2023-11-07T05:31:56Z",+ "lastRotatedAt": "2023-11-07T05:31:56Z",+ "lastRotationJobId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",+ "nextRotationAt": "2023-11-07T05:31:56Z",+ "connection": {+ "app": "ssh",+ "name": "my-ssh-connection",+ "description": "Windows SSH connection",+ "credentials": {}+ },+ "folder": {+ "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",+ "name": "dev",+ "path": "/"+ },+ "environment": {+ "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",+ "name": "Development",+ "slug": "dev"+ },+ "parameters": {+ "username": "appuser",+ "rotationMethod": "login-as-root",+ "passwordRequirements": {+ "length": 48,+ "required": {+ "digits": 2,+ "lowercase": 2,+ "uppercase": 2,+ "symbols": 2+ },+ "allowedSymbols": "-_.~!*"+ }+ },+ "projectId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",+ "rotateAtUtc": {+ "hours": 0,+ "minutes": 0+ },+ "secrets": [],+ "type": "windows-local-account"+ }+ }+ ```+ </Tab>+</Tabs>++## Troubleshooting++### Common Issues++**OpenSSH service not starting**+- Verify the service is installed: `Get-Service sshd`+- Check Windows Event Viewer for SSH-related errors+- Ensure port 22 is not already in use by another service++**Connection refused**+- Verify the firewall allows SSH connections on port 22+- Check that the OpenSSH service is running: `Get-Service sshd`+- Test SSH connectivity locally: `ssh localhost`++**Permission denied errors**+- Ensure the SSH connection credentials have administrator privileges+- For "Login as Root" method, the SSH connection user must have rights to change other users' passwords+- Verify the target user account exists and is not locked++**Password policy violations**+- Adjust the Password Requirements in Infisical to meet your Windows Server password policy+- Check Windows Server password policy using: `net accounts`diff --git a/frontend/src/components/secret-rotations-v2/ReconcileUnixLinuxLocalAccountRotationModal.tsx b/frontend/src/components/secret-rotations-v2/ReconcileLocalAccountRotationModal.tsxsimilarity index 53%rename from frontend/src/components/secret-rotations-v2/ReconcileUnixLinuxLocalAccountRotationModal.tsxrename to frontend/src/components/secret-rotations-v2/ReconcileLocalAccountRotationModal.tsxindex 2e51ebac34..aa03fdbe82 100644--- a/frontend/src/components/secret-rotations-v2/ReconcileUnixLinuxLocalAccountRotationModal.tsx+++ b/frontend/src/components/secret-rotations-v2/ReconcileLocalAccountRotationModal.tsx@@ -1,8 +1,9 @@import { createNotification } from "@app/components/notifications";import { Button, Modal, ModalClose, ModalContent } from "@app/components/v2";import { SecretRotation, TSecretRotationV2 } from "@app/hooks/api/secretRotationsV2";-import { useReconcileUnixLinuxLocalAccountRotation } from "@app/hooks/api/secretRotationsV2/mutations";+import { useReconcileLocalAccountRotation } from "@app/hooks/api/secretRotationsV2/mutations";import { TUnixLinuxLocalAccountRotation } from "@app/hooks/api/secretRotationsV2/types/unix-linux-local-account-rotation";+import { TWindowsLocalAccountRotation } from "@app/hooks/api/secretRotationsV2/types/windows-local-account-rotation";type Props = {secretRotation?: TSecretRotationV2;@@ -11,26 +12,34 @@ type Props = {};type ContentProps = {- secretRotation: TUnixLinuxLocalAccountRotation;+ secretRotation: TUnixLinuxLocalAccountRotation | TWindowsLocalAccountRotation;onComplete: () => void;};+const getRotationTypeName = (type: SecretRotation): string => {+ return type === SecretRotation.UnixLinuxLocalAccount+ ? "Unix/Linux Local Account"+ : "Windows Local Account";+};+const Content = ({ secretRotation, onComplete }: ContentProps) => {- const reconcileUnixLinuxLocalAccount = useReconcileUnixLinuxLocalAccountRotation();+ const reconcileLocalAccount = useReconcileLocalAccountRotation();- const { id: rotationId, projectId, folder } = secretRotation;+ const { id: rotationId, projectId, folder, type } = secretRotation;+ const rotationTypeName = getRotationTypeName(type);const handleReconcile = async () => {- const result = await reconcileUnixLinuxLocalAccount.mutateAsync({+ const result = await reconcileLocalAccount.mutateAsync({rotationId,+ type: type as SecretRotation.UnixLinuxLocalAccount | SecretRotation.WindowsLocalAccount,projectId,secretPath: folder.path});createNotification({text: result.reconciled- ? "Successfully reconciled Unix/Linux Local Account rotation"- : "Unix/Linux Local Account rotation is already in sync",+ ? `Successfully reconciled ${rotationTypeName} rotation`+ : `${rotationTypeName} rotation is already in sync`,type: "success"});@@ -55,8 +64,8 @@ const Content = ({ secretRotation, onComplete }: ContentProps) => {</ModalClose><ButtononClick={handleReconcile}- isDisabled={reconcileUnixLinuxLocalAccount.isPending}- isLoading={reconcileUnixLinuxLocalAccount.isPending}+ isDisabled={reconcileLocalAccount.isPending}+ isLoading={reconcileLocalAccount.isPending}colorSchema="secondary">Reconcile@@ -66,21 +75,30 @@ const Content = ({ secretRotation, onComplete }: ContentProps) => {);};-export const ReconcileUnixLinuxLocalAccountRotationModal = ({+export const ReconcileLocalAccountRotationModal = ({isOpen,onOpenChange,secretRotation}: Props) => {- if (!secretRotation || secretRotation.type !== SecretRotation.UnixLinuxLocalAccount) return null;+ if (+ !secretRotation ||+ (secretRotation.type !== SecretRotation.UnixLinuxLocalAccount &&+ secretRotation.type !== SecretRotation.WindowsLocalAccount)+ )+ return null;++ const rotationTypeName = getRotationTypeName(secretRotation.type);return (<Modal isOpen={isOpen} onOpenChange={onOpenChange}><ModalContent- title="Reconcile Unix/Linux Local Account"- subTitle="Sync the Unix/Linux Local Account password between Infisical and the server."+ title={`Reconcile ${rotationTypeName}`}+ subTitle={`Sync the ${rotationTypeName} password between Infisical and the server.`}><Content- secretRotation={secretRotation as TUnixLinuxLocalAccountRotation}+ secretRotation={+ secretRotation as TUnixLinuxLocalAccountRotation | TWindowsLocalAccountRotation+ }onComplete={() => onOpenChange(false)}/></ModalContent>diff --git a/frontend/src/components/secret-rotations-v2/ViewSecretRotationV2GeneratedCredentials/ViewSecretRotationV2GeneratedCredentials.tsx b/frontend/src/components/secret-rotations-v2/ViewSecretRotationV2GeneratedCredentials/ViewSecretRotationV2GeneratedCredentials.tsxindex ec71f1d436..50658bc8d1 100644--- a/frontend/src/components/secret-rotations-v2/ViewSecretRotationV2GeneratedCredentials/ViewSecretRotationV2GeneratedCredentials.tsx+++ b/frontend/src/components/secret-rotations-v2/ViewSecretRotationV2GeneratedCredentials/ViewSecretRotationV2GeneratedCredentials.tsx@@ -26,6 +26,7 @@ import { ViewAwsIamUserSecretRotationGeneratedCredentials } from "./ViewAwsIamUsimport { ViewOktaClientSecretRotationGeneratedCredentials } from "./ViewOktaClientSecretRotationGeneratedCredentials";import { ViewRedisCredentialsRotationGeneratedCredentials } from "./ViewRedisCredentialsRotationGeneratedCredentials";import { ViewUnixLinuxLocalAccountRotationGeneratedCredentials } from "./ViewUnixLinuxLocalAccountRotationGeneratedCredentials";+import { ViewWindowsLocalAccountRotationGeneratedCredentials } from "./ViewWindowsLocalAccountRotationGeneratedCredentials";type Props = {secretRotation?: TSecretRotationV2;@@ -132,6 +133,13 @@ const Content = ({ secretRotation }: ContentProps) => {/>);break;+ case SecretRotation.WindowsLocalAccount:+ Component = (+ <ViewWindowsLocalAccountRotationGeneratedCredentials+ generatedCredentialsResponse={generatedCredentialsResponse}+ />+ );+ break;default:throw new Error("Unhandled View Generated Credential Rotation Type");}diff --git a/frontend/src/components/secret-rotations-v2/ViewSecretRotationV2GeneratedCredentials/ViewWindowsLocalAccountRotationGeneratedCredentials.tsx b/frontend/src/components/secret-rotations-v2/ViewSecretRotationV2GeneratedCredentials/ViewWindowsLocalAccountRotationGeneratedCredentials.tsxnew file mode 100644index 0000000000..94d3895eb2--- /dev/null+++ b/frontend/src/components/secret-rotations-v2/ViewSecretRotationV2GeneratedCredentials/ViewWindowsLocalAccountRotationGeneratedCredentials.tsx@@ -0,0 +1,37 @@+import { TWindowsLocalAccountRotationGeneratedCredentialsResponse } from "@app/hooks/api/secretRotationsV2/types/windows-local-account-rotation";++import { CredentialDisplay, ViewRotationGeneratedCredentialsDisplay } from "./shared";++type Props = {+ generatedCredentialsResponse: TWindowsLocalAccountRotationGeneratedCredentialsResponse;+};++export const ViewWindowsLocalAccountRotationGeneratedCredentials = ({+ generatedCredentialsResponse: { generatedCredentials, activeIndex }+}: Props) => {+ const inactiveIndex = activeIndex === 0 ? 1 : 0;++ const activeCredentials = generatedCredentials[activeIndex];+ const inactiveCredentials = generatedCredentials[inactiveIndex];++ return (+ <ViewRotationGeneratedCredentialsDisplay+ activeCredentials={+ <>+ <CredentialDisplay label="Username">{activeCredentials?.username}</CredentialDisplay>+ <CredentialDisplay isSensitive label="Password">+ {activeCredentials?.password}+ </CredentialDisplay>+ </>+ }+ inactiveCredentials={+ <>+ <CredentialDisplay label="Username">{inactiveCredentials?.username}</CredentialDisplay>+ <CredentialDisplay isSensitive label="Password">+ {inactiveCredentials?.password}+ </CredentialDisplay>+ </>+ }+ />+ );+};diff --git a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/SecretRotationV2ParametersFields.tsx b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/SecretRotationV2ParametersFields.tsxindex 70654f2fe7..26c837cb1a 100644--- a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/SecretRotationV2ParametersFields.tsx+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/SecretRotationV2ParametersFields.tsx@@ -13,6 +13,7 @@ import { OktaClientSecretRotationParametersFields } from "./OktaClientSecretRotaimport { RedisCredentialsRotationParametersFields } from "./RedisCredentialsRotationParametersFields";import { SqlCredentialsRotationParametersFields } from "./shared";import { UnixLinuxLocalAccountRotationParametersFields } from "./UnixLinuxLocalAccountRotationParametersFields";+import { WindowsLocalAccountRotationParametersFields } from "./WindowsLocalAccountRotationParametersFields";const COMPONENT_MAP: Record<SecretRotation, React.FC> = {[SecretRotation.PostgresCredentials]: SqlCredentialsRotationParametersFields,@@ -28,7 +29,8 @@ const COMPONENT_MAP: Record<SecretRotation, React.FC> = {[SecretRotation.MongoDBCredentials]: MongoRotationParametersFields,[SecretRotation.DatabricksServicePrincipalSecret]:DatabricksServicePrincipalSecretRotationParametersFields,- [SecretRotation.UnixLinuxLocalAccount]: UnixLinuxLocalAccountRotationParametersFields+ [SecretRotation.UnixLinuxLocalAccount]: UnixLinuxLocalAccountRotationParametersFields,+ [SecretRotation.WindowsLocalAccount]: WindowsLocalAccountRotationParametersFields};export const SecretRotationV2ParametersFields = () => {diff --git a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/WindowsLocalAccountRotationParametersFields.tsx b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/WindowsLocalAccountRotationParametersFields.tsxnew file mode 100644index 0000000000..26b26b1b06--- /dev/null+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/WindowsLocalAccountRotationParametersFields.tsx@@ -0,0 +1,265 @@+import { Controller, useFormContext } from "react-hook-form";++import { TSecretRotationV2Form } from "@app/components/secret-rotations-v2/forms/schemas";+import { DEFAULT_PASSWORD_REQUIREMENTS } from "@app/components/secret-rotations-v2/forms/schemas/shared";+import { FormControl, Input, Select, SelectItem } from "@app/components/v2";+import { SecretRotation } from "@app/hooks/api/secretRotationsV2";+import { WindowsLocalAccountRotationMethod } from "@app/hooks/api/secretRotationsV2/types/windows-local-account-rotation";++export const WindowsLocalAccountRotationParametersFields = () => {+ const { control, watch, setValue } = useFormContext<+ TSecretRotationV2Form & {+ type: SecretRotation.WindowsLocalAccount;+ }+ >();++ const id = watch("id");+ const rotationMethod = watch(+ "parameters.rotationMethod",+ WindowsLocalAccountRotationMethod.LoginAsTarget+ );+ const isUpdate = Boolean(id);++ return (+ <>+ <Controller+ name="parameters.rotationMethod"+ control={control}+ defaultValue={WindowsLocalAccountRotationMethod.LoginAsTarget}+ render={({ field: { value, onChange }, fieldState: { error } }) => (+ <FormControl+ tooltipText={+ <>+ <span>Determines how the rotation will be performed:</span>+ <ul className="mt-2 ml-4 flex list-disc flex-col gap-2">+ <li>+ <span className="font-medium">Login as Root</span> - The SSH connection+ credentials of the app connection linked will be used to change the target+ user's password.+ </li>+ <li>+ <span className="font-medium">Login as Target</span> - The target user will+ authenticate with their own credentials and change their own password.+ </li>+ </ul>+ </>+ }+ tooltipClassName="max-w-sm"+ errorText={error?.message}+ isError={Boolean(error?.message)}+ label="Rotation Method"+ helperText={+ // eslint-disable-next-line no-nested-ternary+ isUpdate+ ? "Cannot be updated."+ : value === WindowsLocalAccountRotationMethod.LoginAsRoot+ ? "The SSH connection credentials will change the target user's password"+ : "The target user will change their own password"+ }+ >+ <Select+ isDisabled={isUpdate}+ value={value}+ onValueChange={(val) => {+ setValue("temporaryParameters", {+ password: ""+ });+ onChange(val);+ }}+ className="w-full border border-mineshaft-500 capitalize"+ position="popper"+ dropdownContainerClassName="max-w-none"+ >+ {Object.values(WindowsLocalAccountRotationMethod).map((method) => {+ return (+ <SelectItem value={method} className="capitalize" key={method}>+ {method.replace(/-/g, " ")}+ </SelectItem>+ );+ })}+ </Select>+ </FormControl>+ )}+ />+ <div className="flex gap-3">+ <Controller+ name="parameters.username"+ control={control}+ render={({ field: { value, onChange }, fieldState: { error } }) => (+ <FormControl+ className="flex-1"+ isError={Boolean(error)}+ errorText={error?.message}+ label="Target Username"+ tooltipText="The Windows username of the account to rotate the password for."+ tooltipClassName="max-w-sm"+ helperText={isUpdate ? "Cannot be updated." : undefined}+ >+ <Input+ isDisabled={isUpdate}+ value={value}+ onChange={onChange}+ placeholder="appuser"+ />+ </FormControl>+ )}+ />+ {!isUpdate && rotationMethod === WindowsLocalAccountRotationMethod.LoginAsTarget && (+ <Controller+ name="temporaryParameters.password"+ control={control}+ render={({ field: { value, onChange }, fieldState: { error } }) => (+ <FormControl+ className="flex-1"+ isError={Boolean(error)}+ errorText={error?.message}+ label="Current Password"+ tooltipText="The current password of the target user. Required for initial rotation setup."+ >+ <Input+ value={value}+ onChange={onChange}+ type="password"+ placeholder="****************"+ />+ </FormControl>+ )}+ />+ )}+ </div>+ <div className="flex flex-col gap-3">+ <div className="w-full border-b border-mineshaft-600">+ <span className="text-sm text-mineshaft-300">Password Requirements</span>+ </div>+ <div className="grid grid-cols-2 gap-x-3 gap-y-1 rounded-sm border border-mineshaft-600 bg-mineshaft-700 px-3 pt-3">+ <Controller+ control={control}+ name="parameters.passwordRequirements.length"+ defaultValue={DEFAULT_PASSWORD_REQUIREMENTS.length}+ render={({ field, fieldState: { error } }) => (+ <FormControl+ label="Password Length"+ isError={Boolean(error)}+ errorText={error?.message}+ tooltipText="The length of the password to generate"+ >+ <Input+ type="number"+ min={1}+ max={250}+ size="sm"+ {...field}+ onChange={(e) => field.onChange(Number(e.target.value))}+ />+ </FormControl>+ )}+ />+ <Controller+ control={control}+ name="parameters.passwordRequirements.required.digits"+ defaultValue={DEFAULT_PASSWORD_REQUIREMENTS.required.digits}+ render={({ field, fieldState: { error } }) => (+ <FormControl+ label="Digit Count"+ isError={Boolean(error)}+ errorText={error?.message}+ tooltipText="Minimum number of digits"+ >+ <Input+ type="number"+ min={0}+ size="sm"+ {...field}+ onChange={(e) => field.onChange(Number(e.target.value))}+ />+ </FormControl>+ )}+ />+ <Controller+ control={control}+ name="parameters.passwordRequirements.required.lowercase"+ defaultValue={DEFAULT_PASSWORD_REQUIREMENTS.required.lowercase}+ render={({ field, fieldState: { error } }) => (+ <FormControl+ label="Lowercase Character Count"+ isError={Boolean(error)}+ errorText={error?.message}+ tooltipText="Minimum number of lowercase characters"+ >+ <Input+ type="number"+ min={0}+ size="sm"+ {...field}+ onChange={(e) => field.onChange(Number(e.target.value))}+ />+ </FormControl>+ )}+ />+ <Controller+ control={control}+ name="parameters.passwordRequirements.required.uppercase"+ defaultValue={DEFAULT_PASSWORD_REQUIREMENTS.required.uppercase}+ render={({ field, fieldState: { error } }) => (+ <FormControl+ label="Uppercase Character Count"+ isError={Boolean(error)}+ errorText={error?.message}+ tooltipText="Minimum number of uppercase characters"+ >+ <Input+ type="number"+ min={0}+ size="sm"+ {...field}+ onChange={(e) => field.onChange(Number(e.target.value))}+ />+ </FormControl>+ )}+ />+ <Controller+ control={control}+ name="parameters.passwordRequirements.required.symbols"+ defaultValue={DEFAULT_PASSWORD_REQUIREMENTS.required.symbols}+ render={({ field, fieldState: { error } }) => (+ <FormControl+ label="Symbol Count"+ isError={Boolean(error)}+ errorText={error?.message}+ tooltipText="Minimum number of symbols"+ >+ <Input+ type="number"+ min={0}+ size="sm"+ {...field}+ onChange={(e) => field.onChange(Number(e.target.value))}+ />+ </FormControl>+ )}+ />+ <Controller+ control={control}+ name="parameters.passwordRequirements.allowedSymbols"+ defaultValue={DEFAULT_PASSWORD_REQUIREMENTS.allowedSymbols}+ render={({ field, fieldState: { error } }) => (+ <FormControl+ label="Allowed Symbols"+ isError={Boolean(error)}+ errorText={error?.message}+ tooltipText="Symbols to use in generated password"+ >+ <Input+ placeholder="-_.~!*"+ size="sm"+ {...field}+ onChange={(e) => field.onChange(e.target.value)}+ />+ </FormControl>+ )}+ />+ </div>+ </div>+ </>+ );+};diff --git a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/SecretRotationReviewFields.tsx b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/SecretRotationReviewFields.tsxindex e361156b13..0beb6a13b2 100644--- a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/SecretRotationReviewFields.tsx+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/SecretRotationReviewFields.tsx@@ -15,6 +15,7 @@ import { OktaClientSecretRotationReviewFields } from "./OktaClientSecretRotationimport { RedisCredentialsRotationReviewFields } from "./RedisCredentialsRotationReviewFields";import { SqlCredentialsRotationReviewFields } from "./shared";import { UnixLinuxLocalAccountRotationReviewFields } from "./UnixLinuxLocalAccountRotationReviewFields";+import { WindowsLocalAccountRotationReviewFields } from "./WindowsLocalAccountRotationReviewFields";const COMPONENT_MAP: Record<SecretRotation, React.FC> = {[SecretRotation.PostgresCredentials]: SqlCredentialsRotationReviewFields,@@ -30,7 +31,8 @@ const COMPONENT_MAP: Record<SecretRotation, React.FC> = {[SecretRotation.MongoDBCredentials]: SqlCredentialsRotationReviewFields,[SecretRotation.DatabricksServicePrincipalSecret]:DatabricksServicePrincipalSecretRotationReviewFields,- [SecretRotation.UnixLinuxLocalAccount]: UnixLinuxLocalAccountRotationReviewFields+ [SecretRotation.UnixLinuxLocalAccount]: UnixLinuxLocalAccountRotationReviewFields,+ [SecretRotation.WindowsLocalAccount]: WindowsLocalAccountRotationReviewFields};export const SecretRotationV2ReviewFields = () => {diff --git a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/WindowsLocalAccountRotationReviewFields.tsx b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/WindowsLocalAccountRotationReviewFields.tsxnew file mode 100644index 0000000000..f9fad05b4e--- /dev/null+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/WindowsLocalAccountRotationReviewFields.tsx@@ -0,0 +1,51 @@+import { useFormContext } from "react-hook-form";++import { TSecretRotationV2Form } from "@app/components/secret-rotations-v2/forms/schemas";+import { GenericFieldLabel } from "@app/components/v2";+import { SecretRotation } from "@app/hooks/api/secretRotationsV2";++import { SecretRotationReviewSection } from "./shared";++export const WindowsLocalAccountRotationReviewFields = () => {+ const { watch } = useFormContext<+ TSecretRotationV2Form & {+ type: SecretRotation.WindowsLocalAccount;+ }+ >();++ const [parameters, { username, password }] = watch(["parameters", "secretsMapping"]);++ const { passwordRequirements } = parameters;++ return (+ <>+ <SecretRotationReviewSection label="Parameters">+ <GenericFieldLabel label="Username">{parameters.username}</GenericFieldLabel>+ </SecretRotationReviewSection>+ {passwordRequirements && (+ <SecretRotationReviewSection label="Password Requirements">+ <GenericFieldLabel label="Length">{passwordRequirements.length}</GenericFieldLabel>+ <GenericFieldLabel label="Minimum Digits">+ {passwordRequirements.required.digits}+ </GenericFieldLabel>+ <GenericFieldLabel label="Minimum Lowercase Characters">+ {passwordRequirements.required.lowercase}+ </GenericFieldLabel>+ <GenericFieldLabel label="Minimum Uppercase Characters">+ {passwordRequirements.required.uppercase}+ </GenericFieldLabel>+ <GenericFieldLabel label="Minimum Symbols">+ {passwordRequirements.required.symbols}+ </GenericFieldLabel>+ <GenericFieldLabel label="Allowed Symbols">+ {passwordRequirements.allowedSymbols}+ </GenericFieldLabel>+ </SecretRotationReviewSection>+ )}+ <SecretRotationReviewSection label="Secrets Mapping">+ <GenericFieldLabel label="Username">{username}</GenericFieldLabel>+ <GenericFieldLabel label="Password">{password}</GenericFieldLabel>+ </SecretRotationReviewSection>+ </>+ );+};diff --git a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/SecretRotationV2SecretsMappingFields.tsx b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/SecretRotationV2SecretsMappingFields.tsxindex 1f8506a4af..7c37edb6f5 100644--- a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/SecretRotationV2SecretsMappingFields.tsx+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/SecretRotationV2SecretsMappingFields.tsx@@ -12,6 +12,7 @@ import { OktaClientSecretRotationSecretsMappingFields } from "./OktaClientSecretimport { RedisCredentialsRotationSecretsMappingFields } from "./RedisCredentialsRotationSecretsMappingFields";import { SqlCredentialsRotationSecretsMappingFields } from "./shared";import { UnixLinuxLocalAccountRotationSecretsMappingFields } from "./UnixLinuxLocalAccountRotationSecretsMappingFields";+import { WindowsLocalAccountRotationSecretsMappingFields } from "./WindowsLocalAccountRotationSecretsMappingFields";const COMPONENT_MAP: Record<SecretRotation, React.FC> = {[SecretRotation.PostgresCredentials]: SqlCredentialsRotationSecretsMappingFields,@@ -27,7 +28,8 @@ const COMPONENT_MAP: Record<SecretRotation, React.FC> = {[SecretRotation.MongoDBCredentials]: SqlCredentialsRotationSecretsMappingFields,[SecretRotation.DatabricksServicePrincipalSecret]:DatabricksServicePrincipalSecretRotationSecretsMappingFields,- [SecretRotation.UnixLinuxLocalAccount]: UnixLinuxLocalAccountRotationSecretsMappingFields+ [SecretRotation.UnixLinuxLocalAccount]: UnixLinuxLocalAccountRotationSecretsMappingFields,+ [SecretRotation.WindowsLocalAccount]: WindowsLocalAccountRotationSecretsMappingFields};export const SecretRotationV2SecretsMappingFields = () => {diff --git a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/WindowsLocalAccountRotationSecretsMappingFields.tsx b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/WindowsLocalAccountRotationSecretsMappingFields.tsxnew file mode 100644index 0000000000..5f287cec7e--- /dev/null+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/WindowsLocalAccountRotationSecretsMappingFields.tsx@@ -0,0 +1,58 @@+import { Controller, useFormContext } from "react-hook-form";++import { TSecretRotationV2Form } from "@app/components/secret-rotations-v2/forms/schemas";+import { FormControl, Input } from "@app/components/v2";+import { SecretRotation, useSecretRotationV2Option } from "@app/hooks/api/secretRotationsV2";++import { SecretsMappingTable } from "./shared";++export const WindowsLocalAccountRotationSecretsMappingFields = () => {+ const { control } = useFormContext<+ TSecretRotationV2Form & {+ type: SecretRotation.WindowsLocalAccount;+ }+ >();++ const { rotationOption } = useSecretRotationV2Option(SecretRotation.WindowsLocalAccount);++ const items = [+ {+ name: "Username",+ input: (+ <Controller+ render={({ field: { value, onChange }, fieldState: { error } }) => (+ <FormControl isError={Boolean(error)} errorText={error?.message}>+ <Input+ value={value}+ onChange={onChange}+ placeholder={rotationOption?.template.secretsMapping.username}+ />+ </FormControl>+ )}+ control={control}+ name="secretsMapping.username"+ />+ )+ },+ {+ name: "Password",+ input: (+ <Controller+ render={({ field: { value, onChange }, fieldState: { error } }) => (+ <FormControl isError={Boolean(error)} errorText={error?.message}>+ <Input+ value={value}+ onChange={onChange}+ placeholder={rotationOption?.template.secretsMapping.password}+ />+ </FormControl>+ )}+ control={control}+ name="secretsMapping.password"+ />+ )+ }+ ];++ return <SecretsMappingTable items={items} />;+};diff --git a/frontend/src/components/secret-rotations-v2/forms/schemas/windows-local-account-rotation-schema.ts b/frontend/src/components/secret-rotations-v2/forms/schemas/windows-local-account-rotation-schema.tsnew file mode 100644index 0000000000..fdafe5060a--- /dev/null+++ b/frontend/src/components/secret-rotations-v2/forms/schemas/windows-local-account-rotation-schema.ts@@ -0,0 +1,26 @@+import { z } from "zod";++import { BaseSecretRotationSchema } from "@app/components/secret-rotations-v2/forms/schemas/base-secret-rotation-v2-schema";+import { PasswordRequirementsSchema } from "@app/components/secret-rotations-v2/forms/schemas/shared";+import { SecretRotation } from "@app/hooks/api/secretRotationsV2";+import { WindowsLocalAccountRotationMethod } from "@app/hooks/api/secretRotationsV2/types/windows-local-account-rotation";++export const WindowsLocalAccountRotationSchema = z+ .object({+ type: z.literal(SecretRotation.WindowsLocalAccount),+ parameters: z.object({+ username: z.string().trim().min(1, "Username required"),+ passwordRequirements: PasswordRequirementsSchema.optional(),+ rotationMethod: z.nativeEnum(WindowsLocalAccountRotationMethod).optional()+ }),+ secretsMapping: z.object({+ username: z.string().trim().min(1, "Username required"),+ password: z.string().trim().min(1, "Password required")+ }),+ temporaryParameters: z+ .object({+ password: z.string().optional()+ })+ .optional()+ })+ .merge(BaseSecretRotationSchema);diff --git a/frontend/src/helpers/secretRotationsV2.ts b/frontend/src/helpers/secretRotationsV2.tsindex 5b298b7596..e3def5c3e4 100644--- a/frontend/src/helpers/secretRotationsV2.ts+++ b/frontend/src/helpers/secretRotationsV2.ts@@ -69,6 +69,11 @@ export const SECRET_ROTATION_MAP: Record<name: "Unix/Linux Local Account",image: "SSH.png",size: 50+ },+ [SecretRotation.WindowsLocalAccount]: {+ name: "Windows Local Account",+ image: "Windows.png",+ size: 50}};@@ -85,7 +90,8 @@ export const SECRET_ROTATION_CONNECTION_MAP: Record<SecretRotation, AppConnectio[SecretRotation.RedisCredentials]: AppConnection.Redis,[SecretRotation.MongoDBCredentials]: AppConnection.MongoDB,[SecretRotation.DatabricksServicePrincipalSecret]: AppConnection.Databricks,- [SecretRotation.UnixLinuxLocalAccount]: AppConnection.SSH+ [SecretRotation.UnixLinuxLocalAccount]: AppConnection.SSH,+ [SecretRotation.WindowsLocalAccount]: AppConnection.SSH};// if a rotation can potentially have downtime due to rotating a single credential set this to false@@ -102,7 +108,8 @@ export const IS_ROTATION_DUAL_CREDENTIALS: Record<SecretRotation, boolean> = {[SecretRotation.RedisCredentials]: true,[SecretRotation.MongoDBCredentials]: true,[SecretRotation.DatabricksServicePrincipalSecret]: true,- [SecretRotation.UnixLinuxLocalAccount]: false+ [SecretRotation.UnixLinuxLocalAccount]: false,+ [SecretRotation.WindowsLocalAccount]: false};export const getRotateAtLocal = ({ hours, minutes }: TSecretRotationV2["rotateAtUtc"]) => {diff --git a/frontend/src/hooks/api/secretRotationsV2/enums.ts b/frontend/src/hooks/api/secretRotationsV2/enums.tsindex df26b40992..4cafbb1b3c 100644--- a/frontend/src/hooks/api/secretRotationsV2/enums.ts+++ b/frontend/src/hooks/api/secretRotationsV2/enums.ts@@ -11,7 +11,8 @@ export enum SecretRotation {RedisCredentials = "redis-credentials",MongoDBCredentials = "mongodb-credentials",DatabricksServicePrincipalSecret = "databricks-service-principal-secret",- UnixLinuxLocalAccount = "unix-linux-local-account"+ UnixLinuxLocalAccount = "unix-linux-local-account",+ WindowsLocalAccount = "windows-local-account"}export enum SecretRotationStatus {diff --git a/frontend/src/hooks/api/secretRotationsV2/mutations.tsx b/frontend/src/hooks/api/secretRotationsV2/mutations.tsxindex c02574b975..25ca4f2664 100644--- a/frontend/src/hooks/api/secretRotationsV2/mutations.tsx+++ b/frontend/src/hooks/api/secretRotationsV2/mutations.tsx@@ -2,12 +2,11 @@ import { useMutation, useQueryClient } from "@tanstack/react-query";import { apiRequest } from "@app/config/request";import { dashboardKeys } from "@app/hooks/api/dashboard/queries";-import { SecretRotation } from "@app/hooks/api/secretRotationsV2/enums";import {TCreateSecretRotationV2DTO,TDeleteSecretRotationV2DTO,- TReconcileUnixLinuxLocalAccountRotationDTO,- TReconcileUnixLinuxLocalAccountRotationResponse,+ TReconcileLocalAccountRotationDTO,+ TReconcileLocalAccountRotationResponse,TRotateSecretRotationV2DTO,TSecretRotationV2Response,TUpdateSecretRotationV2DTO@@ -93,12 +92,12 @@ export const useDeleteSecretRotationV2 = () => {});};-export const useReconcileUnixLinuxLocalAccountRotation = () => {+export const useReconcileLocalAccountRotation = () => {const queryClient = useQueryClient();return useMutation({- mutationFn: async ({ rotationId }: TReconcileUnixLinuxLocalAccountRotationDTO) => {- const { data } = await apiRequest.post<TReconcileUnixLinuxLocalAccountRotationResponse>(- `/api/v2/secret-rotations/${SecretRotation.UnixLinuxLocalAccount}/${rotationId}/reconcile`+ mutationFn: async ({ rotationId, type }: TReconcileLocalAccountRotationDTO) => {+ const { data } = await apiRequest.post<TReconcileLocalAccountRotationResponse>(+ `/api/v2/secret-rotations/${type}/${rotationId}/reconcile`);return data;diff --git a/frontend/src/hooks/api/secretRotationsV2/types/index.ts b/frontend/src/hooks/api/secretRotationsV2/types/index.tsindex 4b91324551..f51e282428 100644--- a/frontend/src/hooks/api/secretRotationsV2/types/index.ts+++ b/frontend/src/hooks/api/secretRotationsV2/types/index.ts@@ -64,6 +64,11 @@ import {TUnixLinuxLocalAccountRotationGeneratedCredentialsResponse,TUnixLinuxLocalAccountRotationOption} from "./unix-linux-local-account-rotation";+import {+ TWindowsLocalAccountRotation,+ TWindowsLocalAccountRotationGeneratedCredentialsResponse,+ TWindowsLocalAccountRotationOption+} from "./windows-local-account-rotation";export type TSecretRotationV2 = (| TPostgresCredentialsRotation@@ -79,6 +84,7 @@ export type TSecretRotationV2 = (| TMongoDBCredentialsRotation| TDatabricksServicePrincipalSecretRotation| TUnixLinuxLocalAccountRotation+ | TWindowsLocalAccountRotation) & {secrets: (SecretV3RawSanitized | null)[];};@@ -93,7 +99,8 @@ export type TSecretRotationV2Option =| TRedisCredentialsRotationOption| TMongoDBCredentialsRotationOption| TDatabricksServicePrincipalSecretRotationOption- | TUnixLinuxLocalAccountRotationOption;+ | TUnixLinuxLocalAccountRotationOption+ | TWindowsLocalAccountRotationOption;export type TListSecretRotationV2Options = { secretRotationOptions: TSecretRotationV2Option[] };@@ -112,7 +119,8 @@ export type TViewSecretRotationGeneratedCredentialsResponse =| TRedisCredentialsRotationGeneratedCredentialsResponse| TMongoDBCredentialsRotationGeneratedCredentialsResponse| TDatabricksServicePrincipalSecretRotationGeneratedCredentialsResponse- | TUnixLinuxLocalAccountRotationGeneratedCredentialsResponse;+ | TUnixLinuxLocalAccountRotationGeneratedCredentialsResponse+ | TWindowsLocalAccountRotationGeneratedCredentialsResponse;export type TCreateSecretRotationV2DTO = DiscriminativePick<TSecretRotationV2,@@ -169,6 +177,7 @@ export type TSecretRotationOptionMap = {[SecretRotation.MongoDBCredentials]: TMongoDBCredentialsRotationOption;[SecretRotation.DatabricksServicePrincipalSecret]: TDatabricksServicePrincipalSecretRotationOption;[SecretRotation.UnixLinuxLocalAccount]: TUnixLinuxLocalAccountRotationOption;+ [SecretRotation.WindowsLocalAccount]: TWindowsLocalAccountRotationOption;};export type TSecretRotationGeneratedCredentialsResponseMap = {@@ -185,17 +194,20 @@ export type TSecretRotationGeneratedCredentialsResponseMap = {[SecretRotation.MongoDBCredentials]: TMongoDBCredentialsRotationGeneratedCredentialsResponse;[SecretRotation.DatabricksServicePrincipalSecret]: TDatabricksServicePrincipalSecretRotationGeneratedCredentialsResponse;[SecretRotation.UnixLinuxLocalAccount]: TUnixLinuxLocalAccountRotationGeneratedCredentialsResponse;+ [SecretRotation.WindowsLocalAccount]: TWindowsLocalAccountRotationGeneratedCredentialsResponse;};-export type TReconcileUnixLinuxLocalAccountRotationDTO = {+// Unified type for local account reconciliation (Unix/Linux and Windows)+export type TReconcileLocalAccountRotationDTO = {rotationId: string;+ type: SecretRotation.UnixLinuxLocalAccount | SecretRotation.WindowsLocalAccount;// required for query invalidationsecretPath: string;projectId: string;};-export type TReconcileUnixLinuxLocalAccountRotationResponse = {+export type TReconcileLocalAccountRotationResponse = {message: string;reconciled: boolean;- secretRotation: TUnixLinuxLocalAccountRotation;+ secretRotation: TUnixLinuxLocalAccountRotation | TWindowsLocalAccountRotation;};diff --git a/frontend/src/hooks/api/secretRotationsV2/types/windows-local-account-rotation.ts b/frontend/src/hooks/api/secretRotationsV2/types/windows-local-account-rotation.tsnew file mode 100644index 0000000000..dabf2d8143--- /dev/null+++ b/frontend/src/hooks/api/secretRotationsV2/types/windows-local-account-rotation.ts@@ -0,0 +1,45 @@+import { TPasswordRequirements } from "@app/components/secret-rotations-v2/forms/schemas/shared";+import { AppConnection } from "@app/hooks/api/appConnections/enums";+import { SecretRotation } from "@app/hooks/api/secretRotationsV2";+import {+ TSecretRotationV2Base,+ TSecretRotationV2GeneratedCredentialsResponseBase+} from "@app/hooks/api/secretRotationsV2/types/shared";++export enum WindowsLocalAccountRotationMethod {+ LoginAsTarget = "login-as-target",+ LoginAsRoot = "login-as-root"+}++export type TWindowsLocalAccountRotation = TSecretRotationV2Base & {+ type: SecretRotation.WindowsLocalAccount;+ parameters: {+ username: string;+ rotationMethod?: WindowsLocalAccountRotationMethod;+ passwordRequirements?: TPasswordRequirements;+ };+ secretsMapping: {+ username: string;+ password: string;+ };+};++export type TWindowsLocalAccountRotationGeneratedCredentials = {+ username: string;+ password: string;+};++export type TWindowsLocalAccountRotationGeneratedCredentialsResponse =+ TSecretRotationV2GeneratedCredentialsResponseBase<+ SecretRotation.WindowsLocalAccount,+ TWindowsLocalAccountRotationGeneratedCredentials+ >;++export type TWindowsLocalAccountRotationOption = {+ name: string;+ type: SecretRotation.WindowsLocalAccount;+ connection: AppConnection.SSH;+ template: {+ secretsMapping: TWindowsLocalAccountRotation["secretsMapping"];+ };+};diff --git a/frontend/src/pages/secret-manager/OverviewPage/OverviewPage.tsx b/frontend/src/pages/secret-manager/OverviewPage/OverviewPage.tsxindex ed48611870..be28e754d3 100644--- a/frontend/src/pages/secret-manager/OverviewPage/OverviewPage.tsx+++ b/frontend/src/pages/secret-manager/OverviewPage/OverviewPage.tsx@@ -31,7 +31,7 @@ import { ProjectPermissionCan } from "@app/components/permissions";import { CreateSecretRotationV2Modal } from "@app/components/secret-rotations-v2";import { DeleteSecretRotationV2Modal } from "@app/components/secret-rotations-v2/DeleteSecretRotationV2Modal";import { EditSecretRotationV2Modal } from "@app/components/secret-rotations-v2/EditSecretRotationV2Modal";-import { ReconcileUnixLinuxLocalAccountRotationModal } from "@app/components/secret-rotations-v2/ReconcileUnixLinuxLocalAccountRotationModal";+import { ReconcileLocalAccountRotationModal } from "@app/components/secret-rotations-v2/ReconcileLocalAccountRotationModal";import { RotateSecretRotationV2Modal } from "@app/components/secret-rotations-v2/RotateSecretRotationV2Modal";import { ViewSecretRotationV2GeneratedCredentialsModal } from "@app/components/secret-rotations-v2/ViewSecretRotationV2GeneratedCredentials";import {@@ -1727,11 +1727,13 @@ export const OverviewPage = () => {secretRotation={popUp.rotateSecretRotation.data as TSecretRotationV2}onOpenChange={(isOpen) => handlePopUpToggle("rotateSecretRotation", isOpen)}/>- <ReconcileUnixLinuxLocalAccountRotationModal+ <ReconcileLocalAccountRotationModalisOpen={popUp.reconcileSecretRotation.isOpen &&- (popUp.reconcileSecretRotation.data as TSecretRotationV2)?.type ===- SecretRotationV2.UnixLinuxLocalAccount+ ((popUp.reconcileSecretRotation.data as TSecretRotationV2)?.type ===+ SecretRotationV2.UnixLinuxLocalAccount ||+ (popUp.reconcileSecretRotation.data as TSecretRotationV2)?.type ===+ SecretRotationV2.WindowsLocalAccount)}secretRotation={popUp.reconcileSecretRotation.data as TSecretRotationV2}onOpenChange={(isOpen) => handlePopUpToggle("reconcileSecretRotation", isOpen)}diff --git a/frontend/src/pages/secret-manager/SecretDashboardPage/components/SecretRotationListView/SecretRotationListView.tsx b/frontend/src/pages/secret-manager/SecretDashboardPage/components/SecretRotationListView/SecretRotationListView.tsxindex 3d05365efd..a4c2e26d0d 100644--- a/frontend/src/pages/secret-manager/SecretDashboardPage/components/SecretRotationListView/SecretRotationListView.tsx+++ b/frontend/src/pages/secret-manager/SecretDashboardPage/components/SecretRotationListView/SecretRotationListView.tsx@@ -1,6 +1,6 @@import { DeleteSecretRotationV2Modal } from "@app/components/secret-rotations-v2/DeleteSecretRotationV2Modal";import { EditSecretRotationV2Modal } from "@app/components/secret-rotations-v2/EditSecretRotationV2Modal";-import { ReconcileUnixLinuxLocalAccountRotationModal } from "@app/components/secret-rotations-v2/ReconcileUnixLinuxLocalAccountRotationModal";+import { ReconcileLocalAccountRotationModal } from "@app/components/secret-rotations-v2/ReconcileLocalAccountRotationModal";import { RotateSecretRotationV2Modal } from "@app/components/secret-rotations-v2/RotateSecretRotationV2Modal";import { ViewSecretRotationV2GeneratedCredentialsModal } from "@app/components/secret-rotations-v2/ViewSecretRotationV2GeneratedCredentials";import { usePopUp } from "@app/hooks";@@ -83,11 +83,11 @@ export const SecretRotationListView = ({secretRotation={popUp.rotateSecretRotation.data as TSecretRotationV2}onOpenChange={(isOpen) => handlePopUpToggle("rotateSecretRotation", isOpen)}/>- <ReconcileUnixLinuxLocalAccountRotationModal+ <ReconcileLocalAccountRotationModalisOpen={popUp.reconcileSecretRotation.isOpen &&- (popUp.reconcileSecretRotation.data as TSecretRotationV2)?.type ===- SecretRotation.UnixLinuxLocalAccount+ (popUp.reconcileSecretRotation.data?.type === SecretRotation.UnixLinuxLocalAccount ||+ popUp.reconcileSecretRotation.data?.type === SecretRotation.WindowsLocalAccount)}secretRotation={popUp.reconcileSecretRotation.data as TSecretRotationV2}onOpenChange={(isOpen) => handlePopUpToggle("reconcileSecretRotation", isOpen)}