Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
414a08ece6 |
No files matched your search
@@ -75,11 +75,13 @@ account. A matching username pattern alone never provisions an account.
|
||||
|
||||
The domain bootstrap creates a fine-grained password policy for the three SGU
|
||||
role security groups. It allows the broker to record the exact password SGU
|
||||
accepted, including reversible storage, even when the normal domain complexity
|
||||
policy would reject it. The domain default remains unchanged; per-user reversible
|
||||
storage is enabled only for members of those three groups. AD rewrites an existing
|
||||
password in reversible form only when the broker sets it after a successful SGU
|
||||
sign-in. Do not apply the setting to unrelated domain accounts.
|
||||
accepted even when the normal domain complexity policy would reject it, while
|
||||
keeping reversible password storage disabled. The domain default remains
|
||||
unchanged. Bootstrap clears the per-user reversible-storage flag for members of
|
||||
the three SGU groups, and the broker clears it before every password
|
||||
synchronization. Existing reversibly stored passwords remain so until the next
|
||||
password reset; successful Acceso SGU sign-in synchronizes the password using
|
||||
the disabled setting.
|
||||
|
||||
Before an account becomes usable, the broker applies explicit deny ACEs for the
|
||||
Active Directory `Change Password` extended right to SELF and Everyone. Users
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
# v0.6.21 — Disable reversible password storage for SGU accounts
|
||||
|
||||
- Set `ReversibleEncryptionEnabled` to false in the fine-grained policy scoped
|
||||
to `SGU-Alumnos`, `SGU-Administrativos`, and `SGU-Docentes`.
|
||||
- Clear the per-account reversible-encryption flag for existing members of those
|
||||
role groups, and make bootstrap keep the flag disabled.
|
||||
- Update the Auth Broker to clear the flag before synchronizing any password
|
||||
accepted by SGU, so future and existing managed accounts stay on one-way
|
||||
password storage.
|
||||
- Add broker event 1307 for an account whose reversible-storage flag is cleared.
|
||||
|
||||
The default domain policy remains unchanged and disabled. Password values that
|
||||
were already stored reversibly are not transformed by changing these settings;
|
||||
they are replaced using one-way storage when SGU next resets the password. A
|
||||
successful Acceso SGU sign-in performs that synchronization.
|
||||
+10
-13
@@ -21,19 +21,16 @@ the same source list. RDP uses a separate allowlist. See
|
||||
- The `SGU - Institutional password authority` fine-grained AD password policy
|
||||
applies only to the global security groups `SGU-Alumnos`,
|
||||
`SGU-Administrativos`, and `SGU-Docentes`. It disables AD complexity,
|
||||
history, and password age requirements, permits passwords from one character
|
||||
onward, and enables reversible password storage so passwords accepted by SGU
|
||||
can be recorded unchanged by AD. The default domain password policy remains
|
||||
unchanged for non-SGU accounts. The broker sets the per-user reversible-storage
|
||||
flag before each `SetPassword`; bootstrap repairs existing role-group members
|
||||
and reapplies the policy via `Set-SguInstitutionalPasswordPolicy.ps1`.
|
||||
- Reversible password storage is a significant security reduction: a domain
|
||||
controller stores a decryptable password representation. A privileged attacker
|
||||
or administrator who obtains the relevant directory data can recover the
|
||||
original password. This is limited to accounts in the three SGU role groups;
|
||||
existing password values are converted only when SGU next resets them (normally
|
||||
on a successful Acceso SGU sign-in). Do not enable this for unrelated domain
|
||||
accounts.
|
||||
history, and password age requirements and permits passwords from one
|
||||
character onward so passwords accepted by SGU can be recorded unchanged by AD.
|
||||
Reversible storage is disabled in this fine-grained policy and in each SGU
|
||||
account. The default domain password policy remains unchanged for non-SGU
|
||||
accounts. Bootstrap repairs existing role-group members, and the broker clears
|
||||
the per-user reversible-storage flag before every `SetPassword`.
|
||||
- Disabling reversible storage does not rewrite password data already stored in
|
||||
reversible form. Those existing values remain until each password is reset;
|
||||
the broker synchronizes the current SGU password on the next successful
|
||||
Acceso SGU sign-in, at which point AD stores it without reversible encryption.
|
||||
- Managed `Usuarios-SGU` accounts deny the SELF and Everyone `Change Password`
|
||||
extended right. Only an administrator or the broker through the separate
|
||||
`Reset Password` right can replace the AD password.
|
||||
|
||||
@@ -202,7 +202,7 @@ if ($RemoteDesktopGroupDn) {
|
||||
}
|
||||
|
||||
$managedUsersPasswordChangeCorrected = 0
|
||||
$managedUsersReversibleEncryptionCorrected = 0
|
||||
$managedUsersReversibleEncryptionDisabled = 0
|
||||
$sguRoleGroupDns = @($ProfessorGroupDn, $StudentGroupDn, $AdministrativeGroupDn)
|
||||
$sguRoleUserDns = [Collections.Generic.HashSet[string]]::new([StringComparer]::OrdinalIgnoreCase)
|
||||
foreach ($roleGroupDn in $sguRoleGroupDns) {
|
||||
@@ -224,10 +224,10 @@ if ($PSCmdlet.ShouldProcess($usersOuDn, 'Deny direct password changes for every
|
||||
$managedUsersPasswordChangeCorrected++
|
||||
}
|
||||
if ($sguRoleUserDns.Contains($managedUser.DistinguishedName) -and
|
||||
-not $managedUser.AllowReversiblePasswordEncryption) {
|
||||
$managedUser.AllowReversiblePasswordEncryption) {
|
||||
Set-ADAccountControl -Identity $managedUser.DistinguishedName `
|
||||
-AllowReversiblePasswordEncryption $true -Server $LdapHost -Confirm:$false
|
||||
$managedUsersReversibleEncryptionCorrected++
|
||||
-AllowReversiblePasswordEncryption $false -Server $LdapHost -Confirm:$false
|
||||
$managedUsersReversibleEncryptionDisabled++
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -389,4 +389,4 @@ if ($PSCmdlet.ShouldProcess($installPath, 'Install the SGU Authentication Broker
|
||||
Get-Service -Name $serviceName | Select-Object Name, Status, StartType,
|
||||
@{ Name = 'EventLog'; Expression = { $brokerEventLogName } },
|
||||
@{ Name = 'ExistingUsersPasswordChangeDenied'; Expression = { $managedUsersPasswordChangeCorrected } },
|
||||
@{ Name = 'ExistingSguRoleUsersReversibleEncryptionEnabled'; Expression = { $managedUsersReversibleEncryptionCorrected } }
|
||||
@{ Name = 'ExistingSguRoleUsersReversibleEncryptionDisabled'; Expression = { $managedUsersReversibleEncryptionDisabled } }
|
||||
@@ -38,6 +38,7 @@ $eventNames = @{
|
||||
1304 = 'DirectoryPasswordChangeDenied'
|
||||
1305 = 'DirectoryPhotoFailure'
|
||||
1306 = 'DirectoryReversiblePasswordEncryptionEnabled'
|
||||
1307 = 'DirectoryReversiblePasswordEncryptionDisabled'
|
||||
}
|
||||
|
||||
# Keep these reads unfiltered. Besides making archived and current logs behave
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
[CmdletBinding(SupportsShouldProcess)]
|
||||
param(
|
||||
[string]$Version = '0.6.20',
|
||||
[string]$Version = '0.6.21',
|
||||
|
||||
[ValidatePattern('^https://')]
|
||||
[string]$ClientPackageUri = 'https://gitea.lci.ulsa.mx/alexrg/SGU-CredentialProvider/releases/download/v0.6.20/sgu-windows-client-bootstrap-0.6.20.zip',
|
||||
[string]$ClientPackageUri = 'https://gitea.lci.ulsa.mx/alexrg/SGU-CredentialProvider/releases/download/v0.6.21/sgu-windows-client-bootstrap-0.6.21.zip',
|
||||
|
||||
[ValidatePattern('^[0-9A-Fa-f]{64}$')]
|
||||
[string]$ClientPackageSha256 = '6F5FE0467446C695218BEDD02E7BE9E08E1437CE7287C09DE0FC4BE7C596FB60',
|
||||
[string]$ClientPackageSha256 = '59E2ECCB16A951D5A55D005325B734501868BFB2CFCFEF507A0FE8A1F829C21E',
|
||||
|
||||
[string]$GpoName = 'SGU - Credential Provider update',
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ foreach ($groupDn in $groups) {
|
||||
$desired = @{
|
||||
Precedence = $Precedence
|
||||
ComplexityEnabled = $false
|
||||
ReversibleEncryptionEnabled = $true
|
||||
ReversibleEncryptionEnabled = $false
|
||||
MinPasswordLength = 1
|
||||
PasswordHistoryCount = 0
|
||||
MinPasswordAge = [TimeSpan]::Zero
|
||||
@@ -51,7 +51,7 @@ $policy = Get-ADFineGrainedPasswordPolicy -Filter * -Server $DomainController |
|
||||
if (-not $policy) {
|
||||
if ($PSCmdlet.ShouldProcess($PolicyName, 'Create password policy limited to SGU role groups')) {
|
||||
New-ADFineGrainedPasswordPolicy -Name $PolicyName @desired -Server $DomainController `
|
||||
-Description 'SGU validates the exact institutional password; reversible storage is enabled only for SGU role groups, and AD must not reject its complexity, length, history, or age.' `
|
||||
-Description 'SGU validates the exact institutional password; reversible storage remains disabled and AD must not reject its complexity, length, history, or age.' `
|
||||
-ProtectedFromAccidentalDeletion $true | Out-Null
|
||||
}
|
||||
}
|
||||
@@ -80,10 +80,10 @@ foreach ($groupDn in $groups) {
|
||||
}
|
||||
}
|
||||
|
||||
# Existing SGU group members also need the per-account UAC bit before the next
|
||||
# broker SetPassword call. The default domain policy stays unchanged, and users
|
||||
# outside these three SGU groups are deliberately excluded.
|
||||
$reversibleAccountsEnabled = 0
|
||||
# Existing SGU group members must have the per-account UAC bit cleared as well.
|
||||
# The default domain policy stays unchanged, and users outside these three SGU
|
||||
# groups are deliberately excluded.
|
||||
$reversibleAccountsDisabled = 0
|
||||
$usersOuDn = "OU=Usuarios-SGU,$BaseDn"
|
||||
$managedUserDns = [Collections.Generic.HashSet[string]]::new([StringComparer]::OrdinalIgnoreCase)
|
||||
foreach ($groupDn in $groups) {
|
||||
@@ -100,11 +100,11 @@ foreach ($userDn in $managedUserDns) {
|
||||
if (-not $user.DistinguishedName.EndsWith(",$usersOuDn", [StringComparison]::OrdinalIgnoreCase)) {
|
||||
continue
|
||||
}
|
||||
if (-not $user.AllowReversiblePasswordEncryption -and
|
||||
$PSCmdlet.ShouldProcess($user.SamAccountName, 'Allow reversible password storage for SGU account')) {
|
||||
if ($user.AllowReversiblePasswordEncryption -and
|
||||
$PSCmdlet.ShouldProcess($user.SamAccountName, 'Disable reversible password storage for SGU account')) {
|
||||
Set-ADAccountControl -Identity $user.DistinguishedName `
|
||||
-AllowReversiblePasswordEncryption $true -Server $DomainController -Confirm:$false
|
||||
$reversibleAccountsEnabled++
|
||||
-AllowReversiblePasswordEncryption $false -Server $DomainController -Confirm:$false
|
||||
$reversibleAccountsDisabled++
|
||||
}
|
||||
}
|
||||
|
||||
@@ -131,6 +131,6 @@ if (-not $WhatIfPreference) {
|
||||
MinPasswordLength = $policy.MinPasswordLength
|
||||
PasswordHistoryCount = $policy.PasswordHistoryCount
|
||||
MaxPasswordAge = $policy.MaxPasswordAge
|
||||
ExistingAccountFlagsEnabled = $reversibleAccountsEnabled
|
||||
ExistingAccountFlagsDisabled = $reversibleAccountsDisabled
|
||||
Subjects = @($policy.AppliesTo)
|
||||
}
|
||||
@@ -27,4 +27,5 @@ internal static class BrokerEventIds
|
||||
internal static readonly EventId DirectoryPasswordChangeDenied = new(1304, nameof(DirectoryPasswordChangeDenied));
|
||||
internal static readonly EventId DirectoryPhotoFailure = new(1305, nameof(DirectoryPhotoFailure));
|
||||
internal static readonly EventId DirectoryReversiblePasswordEncryptionEnabled = new(1306, nameof(DirectoryReversiblePasswordEncryptionEnabled));
|
||||
internal static readonly EventId DirectoryReversiblePasswordEncryptionDisabled = new(1307, nameof(DirectoryReversiblePasswordEncryptionDisabled));
|
||||
}
|
||||
@@ -132,10 +132,9 @@ public sealed class ActiveDirectorySynchronizer(
|
||||
// which ADSI SetPassword uses for each successful authentication.
|
||||
EnsureCannotChangePassword(user, identity.UserName);
|
||||
|
||||
// Scope reversible storage to users provisioned through SGU. The
|
||||
// group password policy requires it, and this account flag must be
|
||||
// set before the password is written.
|
||||
EnsureReversiblePasswordEncryption(user, identity.UserName);
|
||||
// Keep reversible storage disabled for SGU users. Clear the account
|
||||
// flag before writing the password so this reset uses one-way storage.
|
||||
EnsureReversiblePasswordEncryptionDisabled(user, identity.UserName);
|
||||
|
||||
// The exact institutional password received by the broker is passed to AD.
|
||||
// It is not derived, transformed, written to disk, or included in logs.
|
||||
@@ -181,20 +180,20 @@ public sealed class ActiveDirectorySynchronizer(
|
||||
institutionalUser);
|
||||
}
|
||||
|
||||
private void EnsureReversiblePasswordEncryption(DirectoryEntry user, string institutionalUser)
|
||||
private void EnsureReversiblePasswordEncryptionDisabled(DirectoryEntry user, string institutionalUser)
|
||||
{
|
||||
object? rawFlags = user.Properties["userAccountControl"].Value;
|
||||
int flags = rawFlags is null ? NormalAccount : Convert.ToInt32(rawFlags);
|
||||
if ((flags & ReversiblePasswordEncryptionAllowed) != 0)
|
||||
if ((flags & ReversiblePasswordEncryptionAllowed) == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
user.Properties["userAccountControl"].Value = flags | ReversiblePasswordEncryptionAllowed;
|
||||
user.Properties["userAccountControl"].Value = flags & ~ReversiblePasswordEncryptionAllowed;
|
||||
user.CommitChanges();
|
||||
logger.LogInformation(
|
||||
BrokerEventIds.DirectoryReversiblePasswordEncryptionEnabled,
|
||||
"Enabled reversible password storage for SGU-managed Active Directory user {InstitutionalUser}.",
|
||||
BrokerEventIds.DirectoryReversiblePasswordEncryptionDisabled,
|
||||
"Disabled reversible password storage for SGU-managed Active Directory user {InstitutionalUser}.",
|
||||
institutionalUser);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user