Limit reversible password storage to SGU accounts
This commit is contained in:
1 parent
843a1956d6
commit
80baae1b54
13 files changed
+139
-34
No files matched your search
@@ -202,15 +202,33 @@ if ($RemoteDesktopGroupDn) {
|
||||
}
|
||||
|
||||
$managedUsersPasswordChangeCorrected = 0
|
||||
$managedUsersReversibleEncryptionCorrected = 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')) {
|
||||
$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) {
|
||||
if (-not $managedUser.CannotChangePassword) {
|
||||
Set-ADAccountControl -Identity $managedUser.DistinguishedName `
|
||||
-CannotChangePassword $true -Server $LdapHost -Confirm:$false
|
||||
$managedUsersPasswordChangeCorrected++
|
||||
}
|
||||
if ($sguRoleUserDns.Contains($managedUser.DistinguishedName) -and
|
||||
-not $managedUser.AllowReversiblePasswordEncryption) {
|
||||
Set-ADAccountControl -Identity $managedUser.DistinguishedName `
|
||||
-AllowReversiblePasswordEncryption $true -Server $LdapHost -Confirm:$false
|
||||
$managedUsersReversibleEncryptionCorrected++
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -370,4 +388,5 @@ 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 = 'ExistingUsersPasswordChangeDenied'; Expression = { $managedUsersPasswordChangeCorrected } },
|
||||
@{ Name = 'ExistingSguRoleUsersReversibleEncryptionEnabled'; Expression = { $managedUsersReversibleEncryptionCorrected } }
|
||||
Reference in new issue
Block a user