Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
414a08ece6 | ||
|
|
80baae1b54 |
No files matched your search
+10
-5
@@ -68,15 +68,20 @@ that same password directly to ADSI `SetPassword`. This is an idempotent UPSERT
|
|||||||
performed on every successful sign-in, so the next sign-in after an institutional
|
performed on every successful sign-in, so the next sign-in after an institutional
|
||||||
password change updates AD before Windows validates the interactive logon. If
|
password change updates AD before Windows validates the interactive logon. If
|
||||||
SGU explicitly rejects the credential, the provider stops without trying AD.
|
SGU explicitly rejects the credential, the provider stops without trying AD.
|
||||||
If SGO accepts it but AD synchronization fails, the provider reports that
|
If SGU accepts it but AD synchronization fails, the provider reports that
|
||||||
failure without trying a stale AD verifier. Only a genuine broker/SGO outage
|
failure without trying a stale AD verifier. Only a genuine broker/SGU outage
|
||||||
uses the documented Windows cached-domain-credential fallback, for an existing
|
uses the documented Windows cached-domain-credential fallback, for an existing
|
||||||
account. A matching username pattern alone never provisions an account.
|
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 SGO
|
role security groups. It allows the broker to record the exact password SGU
|
||||||
accepted, even when the normal domain complexity policy would reject it. It
|
accepted even when the normal domain complexity policy would reject it, while
|
||||||
does not relax password requirements for other domain accounts.
|
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
|
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
|
||||||
|
|||||||
@@ -1,19 +1,19 @@
|
|||||||
# v0.6.19 — SGO password authority
|
# v0.6.19 — SGU password authority
|
||||||
|
|
||||||
- Add a fine-grained Active Directory password policy scoped to the three
|
- Add a fine-grained Active Directory password policy scoped to the three
|
||||||
`SGU-*` role groups. A password accepted by SGO is stored unchanged in AD,
|
`SGU-*` role groups. A password accepted by SGU is stored unchanged in AD,
|
||||||
including short passwords that the default domain complexity policy rejects.
|
including short passwords that the default domain complexity policy rejects.
|
||||||
Other domain accounts keep their existing policy.
|
Other domain accounts keep their existing policy.
|
||||||
- Apply and verify this policy during server bootstrap. Existing SGU accounts
|
- Apply and verify this policy during server bootstrap. Existing SGU accounts
|
||||||
receive it through their role-group membership.
|
receive it through their role-group membership.
|
||||||
- Stop institutional login immediately when SGO explicitly rejects a password.
|
- Stop institutional login immediately when SGU explicitly rejects a password.
|
||||||
When SGO accepts it but AD synchronization fails, show a distinct error
|
When SGU accepts it but AD synchronization fails, show a distinct error
|
||||||
instead of trying an older AD password.
|
instead of trying an older AD password.
|
||||||
- Preserve the documented cached-domain fallback only while the broker or SGO
|
- Preserve the documented cached-domain fallback only while the broker or SGU
|
||||||
is genuinely unavailable.
|
is genuinely unavailable.
|
||||||
|
|
||||||
Operational validation: on the domain controller, disposable users in each of
|
Operational validation: on the domain controller, disposable users in each of
|
||||||
`SGU-Alumnos`, `SGU-Administrativos`, and `SGU-Docentes` accepted a three-character
|
`SGU-Alumnos`, `SGU-Administrativos`, and `SGU-Docentes` accepted a three-character
|
||||||
password and were removed after the test. The three originally reported
|
password and were removed after the test. The three originally reported
|
||||||
accounts still require a real SGO sign-in to finish AD provisioning; no student
|
accounts still require a real SGU sign-in to finish AD provisioning; no student
|
||||||
password was requested or stored for testing.
|
password was requested or stored for testing.
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
# v0.6.20 — SGU-scoped reversible password storage
|
||||||
|
|
||||||
|
- Enable reversible password storage only for members of the three SGU role
|
||||||
|
groups (`SGU-Alumnos`, `SGU-Administrativos`, and `SGU-Docentes`). The
|
||||||
|
domain-wide default password policy remains unchanged.
|
||||||
|
- Before synchronizing a valid Acceso SGU login, the broker enables the
|
||||||
|
per-account AD flag and then writes the exact SGU-accepted password. Existing
|
||||||
|
role-group members are repaired by server bootstrap and the password-policy
|
||||||
|
deployment script.
|
||||||
|
- Add structured broker event 1306 when the per-account setting is enabled.
|
||||||
|
- Document that reversible storage allows a privileged directory-data reader to
|
||||||
|
recover the original password, and that existing passwords are rewritten only
|
||||||
|
after their next successful SGU password synchronization.
|
||||||
|
- Correct references that called the institutional system “SGO”; the product is
|
||||||
|
SGU.
|
||||||
|
|
||||||
|
The setting is intentionally limited to the SGU-managed role groups. Do not
|
||||||
|
apply it to unrelated domain users. Existing SGU accounts need a successful
|
||||||
|
Acceso SGU sign-in (or another authorized password reset) before their currently
|
||||||
|
stored password is rewritten using reversible encryption.
|
||||||
@@ -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.
|
||||||
+14
-9
@@ -22,10 +22,15 @@ the same source list. RDP uses a separate allowlist. See
|
|||||||
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 and permits passwords from one
|
history, and password age requirements and permits passwords from one
|
||||||
character onward so a password accepted by SGO is never altered or rejected
|
character onward so passwords accepted by SGU can be recorded unchanged by AD.
|
||||||
by AD. The default domain password policy remains unchanged. The group is
|
Reversible storage is disabled in this fine-grained policy and in each SGU
|
||||||
assigned before `SetPassword` for newly created users. Bootstrap reapplies
|
account. The default domain password policy remains unchanged for non-SGU
|
||||||
the policy via `Set-SguInstitutionalPasswordPolicy.ps1`.
|
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`
|
- 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.
|
||||||
@@ -98,21 +103,21 @@ Use an enterprise CA with revocation checking in production.
|
|||||||
The provider distinguishes an SGU rejection from unavailable infrastructure:
|
The provider distinguishes an SGU rejection from unavailable infrastructure:
|
||||||
|
|
||||||
- `400`/`401`: do not create or update the account and do not submit a Windows
|
- `400`/`401`: do not create or update the account and do not submit a Windows
|
||||||
credential. An explicit SGO rejection is authoritative, including when an
|
credential. An explicit SGU rejection is authoritative, including when an
|
||||||
older AD password still exists.
|
older AD password still exists.
|
||||||
- `DIRECTORY_SYNCHRONIZATION_FAILED`: SGO accepted the password but AD did not
|
- `DIRECTORY_SYNCHRONIZATION_FAILED`: SGU accepted the password but AD did not
|
||||||
record it. Show a specific error and do not attempt Windows logon against a
|
record it. Show a specific error and do not attempt Windows logon against a
|
||||||
potentially stale AD verifier.
|
potentially stale AD verifier.
|
||||||
- timeout, TLS/connectivity error, `429`, or `5xx`: submit the unchanged
|
- timeout, TLS/connectivity error, `429`, or `5xx`: submit the unchanged
|
||||||
credential to Windows only for a genuine broker/SGO outage. Windows must still
|
credential to Windows only for a genuine broker/SGU outage. Windows must still
|
||||||
validate it against AD or its cached domain verifier, so this does not grant
|
validate it against AD or its cached domain verifier, so this does not grant
|
||||||
access without a domain credential. This continuity path can accept a
|
access without a domain credential. This continuity path can accept a
|
||||||
last-known AD password while SGO is unreachable; decide explicitly whether
|
last-known AD password while SGU is unreachable; decide explicitly whether
|
||||||
that availability trade-off is appropriate for each deployment.
|
that availability trade-off is appropriate for each deployment.
|
||||||
- usernames that do not match the institutional key format go directly to
|
- usernames that do not match the institutional key format go directly to
|
||||||
Windows and are never sent to SGU or provisioned by the broker.
|
Windows and are never sent to SGU or provisioned by the broker.
|
||||||
|
|
||||||
Allowing an SGO-accepted three-character password also allows that short
|
Allowing an SGU-accepted three-character password also allows that short
|
||||||
password at the native AD logon surface. Broker rate limiting does not protect
|
password at the native AD logon surface. Broker rate limiting does not protect
|
||||||
direct AD authentication; domain network exposure and monitoring therefore
|
direct AD authentication; domain network exposure and monitoring therefore
|
||||||
remain essential. The policy cannot make a weak upstream password strong.
|
remain essential. The policy cannot make a weak upstream password strong.
|
||||||
|
|||||||
@@ -202,15 +202,33 @@ if ($RemoteDesktopGroupDn) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$managedUsersPasswordChangeCorrected = 0
|
$managedUsersPasswordChangeCorrected = 0
|
||||||
|
$managedUsersReversibleEncryptionDisabled = 0
|
||||||
|
$sguRoleGroupDns = @($ProfessorGroupDn, $StudentGroupDn, $AdministrativeGroupDn)
|
||||||
|
$sguRoleUserDns = [Collections.Generic.HashSet[string]]::new([StringComparer]::OrdinalIgnoreCase)
|
||||||
|
foreach ($roleGroupDn in $sguRoleGroupDns) {
|
||||||
|
foreach ($member in Get-ADGroupMember -Identity $roleGroupDn -Recursive `
|
||||||
|
-Server $LdapHost -ErrorAction Stop) {
|
||||||
|
if ($member.objectClass -eq 'user') {
|
||||||
|
[void]$sguRoleUserDns.Add($member.DistinguishedName)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
if ($PSCmdlet.ShouldProcess($usersOuDn, 'Deny direct password changes for every managed SGU user')) {
|
if ($PSCmdlet.ShouldProcess($usersOuDn, 'Deny direct password changes for every managed SGU user')) {
|
||||||
$managedUsers = @(Get-ADUser -Filter * -SearchBase $usersOuDn -SearchScope Subtree `
|
$managedUsers = @(Get-ADUser -Filter * -SearchBase $usersOuDn -SearchScope Subtree `
|
||||||
-Properties CannotChangePassword -Server $LdapHost -ErrorAction Stop)
|
-Properties CannotChangePassword,AllowReversiblePasswordEncryption `
|
||||||
|
-Server $LdapHost -ErrorAction Stop)
|
||||||
foreach ($managedUser in $managedUsers) {
|
foreach ($managedUser in $managedUsers) {
|
||||||
if (-not $managedUser.CannotChangePassword) {
|
if (-not $managedUser.CannotChangePassword) {
|
||||||
Set-ADAccountControl -Identity $managedUser.DistinguishedName `
|
Set-ADAccountControl -Identity $managedUser.DistinguishedName `
|
||||||
-CannotChangePassword $true -Server $LdapHost -Confirm:$false
|
-CannotChangePassword $true -Server $LdapHost -Confirm:$false
|
||||||
$managedUsersPasswordChangeCorrected++
|
$managedUsersPasswordChangeCorrected++
|
||||||
}
|
}
|
||||||
|
if ($sguRoleUserDns.Contains($managedUser.DistinguishedName) -and
|
||||||
|
$managedUser.AllowReversiblePasswordEncryption) {
|
||||||
|
Set-ADAccountControl -Identity $managedUser.DistinguishedName `
|
||||||
|
-AllowReversiblePasswordEncryption $false -Server $LdapHost -Confirm:$false
|
||||||
|
$managedUsersReversibleEncryptionDisabled++
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -370,4 +388,5 @@ 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 = 'ExistingSguRoleUsersReversibleEncryptionDisabled'; Expression = { $managedUsersReversibleEncryptionDisabled } }
|
||||||
@@ -37,6 +37,8 @@ $eventNames = @{
|
|||||||
1303 = 'DirectoryRoleGroupMembershipAdded'
|
1303 = 'DirectoryRoleGroupMembershipAdded'
|
||||||
1304 = 'DirectoryPasswordChangeDenied'
|
1304 = 'DirectoryPasswordChangeDenied'
|
||||||
1305 = 'DirectoryPhotoFailure'
|
1305 = 'DirectoryPhotoFailure'
|
||||||
|
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.19',
|
[string]$Version = '0.6.21',
|
||||||
|
|
||||||
[ValidatePattern('^https://')]
|
[ValidatePattern('^https://')]
|
||||||
[string]$ClientPackageUri = 'https://gitea.lci.ulsa.mx/alexrg/SGU-CredentialProvider/releases/download/v0.6.19/sgu-windows-client-bootstrap-0.6.19.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 = 'C1FA9C92BA941003FE54E9074973CF6630E30456B186C099E731EC5F54182F24',
|
[string]$ClientPackageSha256 = '59E2ECCB16A951D5A55D005325B734501868BFB2CFCFEF507A0FE8A1F829C21E',
|
||||||
|
|
||||||
[string]$GpoName = 'SGU - Credential Provider update',
|
[string]$GpoName = 'SGU - Credential Provider update',
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ if ($domain.DomainMode -lt 'Windows2012Domain') {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# AD's default password policy must remain intact for non-SGU accounts.
|
# AD's default password policy must remain intact for non-SGU accounts.
|
||||||
# The broker validates the exact password with SGO before resetting the AD
|
# The broker validates the exact password with SGU before resetting the AD
|
||||||
# verifier. These global security groups are assigned before SetPassword.
|
# verifier. These global security groups are assigned before SetPassword.
|
||||||
$groups = @(
|
$groups = @(
|
||||||
"CN=SGU-Alumnos,OU=Alumnos,OU=Usuarios-SGU,$BaseDn",
|
"CN=SGU-Alumnos,OU=Alumnos,OU=Usuarios-SGU,$BaseDn",
|
||||||
@@ -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 'SGO validates the exact institutional password; 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,6 +80,34 @@ foreach ($groupDn in $groups) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# 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) {
|
||||||
|
foreach ($member in Get-ADGroupMember -Identity $groupDn -Recursive `
|
||||||
|
-Server $DomainController -ErrorAction Stop) {
|
||||||
|
if ($member.objectClass -eq 'user') {
|
||||||
|
[void]$managedUserDns.Add($member.DistinguishedName)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
foreach ($userDn in $managedUserDns) {
|
||||||
|
$user = Get-ADUser -Identity $userDn -Properties AllowReversiblePasswordEncryption `
|
||||||
|
-Server $DomainController -ErrorAction Stop
|
||||||
|
if (-not $user.DistinguishedName.EndsWith(",$usersOuDn", [StringComparison]::OrdinalIgnoreCase)) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if ($user.AllowReversiblePasswordEncryption -and
|
||||||
|
$PSCmdlet.ShouldProcess($user.SamAccountName, 'Disable reversible password storage for SGU account')) {
|
||||||
|
Set-ADAccountControl -Identity $user.DistinguishedName `
|
||||||
|
-AllowReversiblePasswordEncryption $false -Server $DomainController -Confirm:$false
|
||||||
|
$reversibleAccountsDisabled++
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$policy = Get-ADFineGrainedPasswordPolicy -Identity $PolicyName -Properties AppliesTo `
|
$policy = Get-ADFineGrainedPasswordPolicy -Identity $PolicyName -Properties AppliesTo `
|
||||||
-Server $DomainController -ErrorAction Stop
|
-Server $DomainController -ErrorAction Stop
|
||||||
if (-not $WhatIfPreference) {
|
if (-not $WhatIfPreference) {
|
||||||
@@ -99,8 +127,10 @@ if (-not $WhatIfPreference) {
|
|||||||
Name = $policy.Name
|
Name = $policy.Name
|
||||||
Precedence = $policy.Precedence
|
Precedence = $policy.Precedence
|
||||||
ComplexityEnabled = $policy.ComplexityEnabled
|
ComplexityEnabled = $policy.ComplexityEnabled
|
||||||
|
ReversibleEncryptionEnabled = $policy.ReversibleEncryptionEnabled
|
||||||
MinPasswordLength = $policy.MinPasswordLength
|
MinPasswordLength = $policy.MinPasswordLength
|
||||||
PasswordHistoryCount = $policy.PasswordHistoryCount
|
PasswordHistoryCount = $policy.PasswordHistoryCount
|
||||||
MaxPasswordAge = $policy.MaxPasswordAge
|
MaxPasswordAge = $policy.MaxPasswordAge
|
||||||
|
ExistingAccountFlagsDisabled = $reversibleAccountsDisabled
|
||||||
Subjects = @($policy.AppliesTo)
|
Subjects = @($policy.AppliesTo)
|
||||||
}
|
}
|
||||||
@@ -26,4 +26,6 @@ internal static class BrokerEventIds
|
|||||||
internal static readonly EventId DirectoryRoleGroupMembershipAdded = new(1303, nameof(DirectoryRoleGroupMembershipAdded));
|
internal static readonly EventId DirectoryRoleGroupMembershipAdded = new(1303, nameof(DirectoryRoleGroupMembershipAdded));
|
||||||
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 DirectoryReversiblePasswordEncryptionDisabled = new(1307, nameof(DirectoryReversiblePasswordEncryptionDisabled));
|
||||||
}
|
}
|
||||||
@@ -17,6 +17,7 @@ public sealed class ActiveDirectorySynchronizer(
|
|||||||
private const int InfoAttributeMaximumLength = 1024;
|
private const int InfoAttributeMaximumLength = 1024;
|
||||||
private const int AccountDisabled = 0x0002;
|
private const int AccountDisabled = 0x0002;
|
||||||
private const int NormalAccount = 0x0200;
|
private const int NormalAccount = 0x0200;
|
||||||
|
private const int ReversiblePasswordEncryptionAllowed = 0x0080;
|
||||||
private static readonly Guid ChangePasswordExtendedRight =
|
private static readonly Guid ChangePasswordExtendedRight =
|
||||||
new("AB721A53-1E2F-11D0-9819-00AA0040529B");
|
new("AB721A53-1E2F-11D0-9819-00AA0040529B");
|
||||||
private static readonly SecurityIdentifier EveryoneSid =
|
private static readonly SecurityIdentifier EveryoneSid =
|
||||||
@@ -131,6 +132,10 @@ 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);
|
||||||
|
|
||||||
|
// 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.
|
// 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.
|
||||||
user.Invoke("SetPassword", [password]);
|
user.Invoke("SetPassword", [password]);
|
||||||
@@ -175,6 +180,23 @@ public sealed class ActiveDirectorySynchronizer(
|
|||||||
institutionalUser);
|
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)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
user.Properties["userAccountControl"].Value = flags & ~ReversiblePasswordEncryptionAllowed;
|
||||||
|
user.CommitChanges();
|
||||||
|
logger.LogInformation(
|
||||||
|
BrokerEventIds.DirectoryReversiblePasswordEncryptionDisabled,
|
||||||
|
"Disabled reversible password storage for SGU-managed Active Directory user {InstitutionalUser}.",
|
||||||
|
institutionalUser);
|
||||||
|
}
|
||||||
|
|
||||||
internal static bool EnsureCannotChangePassword(ActiveDirectorySecurity security)
|
internal static bool EnsureCannotChangePassword(ActiveDirectorySecurity security)
|
||||||
{
|
{
|
||||||
bool changed = false;
|
bool changed = false;
|
||||||
|
|||||||
@@ -80,21 +80,21 @@ internal sealed class SguCredentialTile : CredentialTile3
|
|||||||
return DomainCredential(decision.Domain!, decision.UserName!, securePassword);
|
return DomainCredential(decision.Domain!, decision.UserName!, securePassword);
|
||||||
}
|
}
|
||||||
|
|
||||||
// An explicit SGO rejection is authoritative even when an older AD
|
// An explicit SGU rejection is authoritative even when an older AD
|
||||||
// verifier for the same institutional key still exists.
|
// verifier for the same institutional key still exists.
|
||||||
if (decision.Kind == BrokerDecisionKind.InvalidCredentials)
|
if (decision.Kind == BrokerDecisionKind.InvalidCredentials)
|
||||||
{
|
{
|
||||||
return Failure("Usuario o contraseña incorrectos.");
|
return Failure("Usuario o contraseña incorrectos.");
|
||||||
}
|
}
|
||||||
|
|
||||||
// SGO accepted this password but AD could not record it. Windows
|
// SGU accepted this password but AD could not record it. Windows
|
||||||
// must not attempt a logon against a stale AD password.
|
// must not attempt a logon against a stale AD password.
|
||||||
if (decision.ErrorCode == "DIRECTORY_SYNCHRONIZATION_FAILED")
|
if (decision.ErrorCode == "DIRECTORY_SYNCHRONIZATION_FAILED")
|
||||||
{
|
{
|
||||||
return Failure("La contraseña institucional fue aceptada, pero no se pudo preparar la cuenta en Active Directory. Intenta nuevamente o contacta a soporte.");
|
return Failure("La contraseña institucional fue aceptada, pero no se pudo preparar la cuenta en Active Directory. Intenta nuevamente o contacta a soporte.");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Only a genuine broker/SGO outage permits the documented cached
|
// Only a genuine broker/SGU outage permits the documented cached
|
||||||
// domain-credential path for an existing account.
|
// domain-credential path for an existing account.
|
||||||
return DomainCredential(
|
return DomainCredential(
|
||||||
domain,
|
domain,
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ Describe 'SGU Auth Broker password authority' {
|
|||||||
$userPolicy | Should Match '(?s)-ValueName \$disableChangePasswordValueName.*-Type DWord.*-Value 1'
|
$userPolicy | Should Match '(?s)-ValueName \$disableChangePasswordValueName.*-Type DWord.*-Value 1'
|
||||||
}
|
}
|
||||||
|
|
||||||
It 'scopes exact SGO passwords to all three SGU role groups without changing the domain default' {
|
It 'scopes exact SGU passwords to all three SGU role groups without changing the domain default' {
|
||||||
foreach ($role in @('Alumnos', 'Administrativos', 'Docentes')) {
|
foreach ($role in @('Alumnos', 'Administrativos', 'Docentes')) {
|
||||||
$passwordPolicy | Should Match "CN=SGU-$role,OU=$role,OU=Usuarios-SGU"
|
$passwordPolicy | Should Match "CN=SGU-$role,OU=$role,OU=Usuarios-SGU"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ public sealed class BrokerClientTests
|
|||||||
|
|
||||||
BrokerDecision decision = await client.AuthenticateAsync(
|
BrokerDecision decision = await client.AuthenticateAsync(
|
||||||
"AL250792",
|
"AL250792",
|
||||||
"SGOAccepted",
|
"SGUAccepted",
|
||||||
TestContext.Current.CancellationToken);
|
TestContext.Current.CancellationToken);
|
||||||
|
|
||||||
Assert.Equal(BrokerDecisionKind.Unavailable, decision.Kind);
|
Assert.Equal(BrokerDecisionKind.Unavailable, decision.Kind);
|
||||||
|
|||||||
Reference in new issue
Block a user