Skip to content

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

refactor: update Windows local account rotation logic to omit domain for local accounts and enhance documentation on rotation methods and requirements

Victor Santosdf87c1f38800
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.ts
index ed0da87fc4..f431e82bde 100644
--- 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.ts
@@ -30,9 +30,10 @@ export const windowsLocalAccountRotationFactory: TRotationFactory<
const { username, passwordRequirements, rotationMethod = WindowsLocalAccountRotationMethod.LoginAsRoot } = parameters;
// Helper to verify Windows credentials work via SMB
+ // Note: We don't pass the domain when verifying the rotated account because it's a local account,
+ // not a domain account. The domain is only used for the app connection (admin) credentials.
const $verifyCredentials = async (targetUsername: string, targetPassword: string): Promise<void> => {
const { credentials } = connection;
- const credentialsDomain: string | undefined = credentials.domain;
const verifyConfig: TSmbConnectionConfig = {
method: SmbConnectionMethod.Credentials,
@@ -42,14 +43,15 @@ export const windowsLocalAccountRotationFactory: TRotationFactory<
credentials: {
host: credentials.host,
port: credentials.port,
- domain: credentialsDomain,
+ domain: undefined,
username: targetUsername,
password: targetPassword
}
};
await executeSmbWithPotentialGateway(verifyConfig, gatewayV2Service, async (targetHost, targetPort) => {
- await verifyWindowsCredentials(targetHost, targetPort, targetUsername, targetPassword, credentialsDomain);
+ // Verify without domain - local accounts don't belong to a domain
+ await verifyWindowsCredentials(targetHost, targetPort, targetUsername, targetPassword, undefined);
});
};
@@ -75,6 +77,8 @@ export const windowsLocalAccountRotationFactory: TRotationFactory<
if (isSelfRotation && currentPassword) {
smbConfig.adminUser = username;
smbConfig.adminPassword = currentPassword;
+ // Clear domain for self-rotation - local accounts don't belong to a domain
+ smbConfig.domain = undefined;
}
// Determine which credentials to use for the SMB connection
@@ -95,7 +99,10 @@ export const windowsLocalAccountRotationFactory: TRotationFactory<
if (isSelfRotation && currentPassword) {
connectConfig.credentials.username = username;
connectConfig.credentials.password = currentPassword;
+ // Clear domain for self-rotation - local accounts don't belong to a domain
+ connectConfig.credentials.domain = undefined;
}
+
await executeSmbWithPotentialGateway(connectConfig, gatewayV2Service, async (targetHost, targetPort) => {
const configWithProxiedHost: SmbRpcConfig = {
...smbConfig,
diff --git a/docs/documentation/platform/secret-rotation/windows-local-account.mdx b/docs/documentation/platform/secret-rotation/windows-local-account.mdx
index 87f8142244..997346ced6 100644
--- a/docs/documentation/platform/secret-rotation/windows-local-account.mdx
+++ b/docs/documentation/platform/secret-rotation/windows-local-account.mdx
@@ -62,8 +62,8 @@ description: "Learn how to automatically rotate Windows local account passwords
![Rotation Parameters](/images/secret-rotations-v2/windows-local-account/windows-local-account-parameters.png)
- **Rotation Method** - The method to use when rotating the target user's password.
- - **Login as Target** - Infisical will use the target user's current credentials to authenticate and rotate its own password. The target user must have administrator privileges on the Windows machine to be able to rotate its own password.
- - **Login as Root** - Infisical will use the administrator credentials provided in the SMB Connection to rotate the target user's password.
+ - **Login as Target** - Infisical will use the target user's current credentials to authenticate and rotate its own password. See the [Login as Target Requirements](#login-as-target-requirements) section below for important configuration details.
+ - **Login as Root** - Infisical will use the administrator credentials provided in the SMB Connection to rotate the target user's password. This is the recommended method for most use cases.
- **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.
@@ -86,6 +86,32 @@ description: "Learn how to automatically rotate Windows local account passwords
8. Your **Windows Local Account** credentials are now available for use via the mapped secrets.
![Rotation Created](/images/secret-rotations-v2/windows-local-account/windows-local-account-created.png)
+ ### Login as Target Requirements
+
+ The **Login as Target** method allows a user to rotate their own password without requiring separate administrator credentials in the SMB Connection. However, this method has specific requirements due to Windows security restrictions:
+
+ 1. **Local Administrator Privileges** - The target user must be a member of the local `Administrators` group on the Windows machine.
+
+ 2. **Disable Remote UAC Token Filtering** - By default, Windows filters administrative tokens for remote connections, even for local administrators. You must disable this by setting the following registry key on the target Windows server:
+
+ ```powershell
+ Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" -Name "LocalAccountTokenFilterPolicy" -Value 1 -Type DWord
+ ```
+
+ After setting this, restart the server or the LanmanServer service:
+
+ ```powershell
+ Restart-Service LanmanServer
+ ```
+
+ <Warning>
+ Disabling Remote UAC token filtering reduces security by allowing remote connections with full administrative privileges. Only enable this setting if you understand the security implications and have other compensating controls in place (e.g., network segmentation, firewall rules).
+ </Warning>
+
+ <Note>
+ If you cannot or prefer not to disable Remote UAC token filtering, use the **Login as Root** method instead, which uses domain administrator or built-in Administrator credentials from the SMB Connection.
+ </Note>
+
### 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 Windows App Connection's administrator account to reset the target user's password and sync it with Infisical.