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