Disable reversible password storage for SGU accounts
This commit is contained in:
1 parent
80baae1b54
commit
414a08ece6
9 files changed
+61
-46
No files matched your search
@@ -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)
|
||||
}
|
||||
Reference in new issue
Block a user