Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ADEssentials.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
Description = 'Helper module for Active Directory with lots of useful functions that simplify supporting Active Directory.'
FunctionsToExport = @('Add-ADACL', 'Compare-PingCastleReport', 'Compare-WinADGlobalCatalogObjects', 'Convert-ADSecurityDescriptor', 'Copy-ADOUSecurity', 'Disable-ADACLInheritance', 'Enable-ADACLInheritance', 'Export-ADACLObject', 'Find-WinADObjectDifference', 'Get-ADACL', 'Get-ADACLOwner', 'Get-DNSServerIP', 'Get-PingCastleReport', 'Get-WinADACLConfiguration', 'Get-WinADACLForest', 'Get-WinADBitlockerLapsSummary', 'Get-WinADBrokenProtectedFromDeletion', 'Get-WinADComputerACLLAPS', 'Get-WinADComputers', 'Get-WinADDelegatedAccounts', 'Get-WinADDFSHealth', 'Get-WinADDFSTopology', 'Get-WinADDHCP', 'Get-WinADDHCPHealthCheck', 'Get-WinADDHCPSummary', 'Get-WinADDiagnostics', 'Get-WinADDnsInformation', 'Get-WinADDnsIPAddresses', 'Get-WinADDnsRecords', 'Get-WinADDnsServerForwarder', 'Get-WinADDnsServerScavenging', 'Get-ADWinDnsServerZones', 'Get-WinADDNSZones', 'Get-WinADDomain', 'Get-WinADDomainControllerGenerationId', 'Get-WinADDomainControllerNetLogonSettings', 'Get-WinADDomainControllerNTDSSettings', 'Get-WinADDomainControllerOption', 'Get-WinADDuplicateObject', 'Get-WinADDuplicateSPN', 'Get-WinADForest', 'Get-WinADForestControllerInformation', 'Get-WinADForestOptionalFeatures', 'Get-WinADForestReplication', 'Get-WinADForestReplicationSummary', 'Get-WinADForestRoles', 'Get-WinADForestSchemaDetails', 'Get-WinADForestSchemaProperties', 'Get-WinADForestSites', 'Get-WinADForestSubnet', 'Get-WinADGroupMember', 'Get-WinADGroupMemberOf', 'Get-WinADGroups', 'Get-WinADKerberosAccount', 'Get-WinADLastBackup', 'Get-WinADLDAPBindingsSummary', 'Get-WinADLDAPSummary', 'Get-WinADLMSettings', 'Get-WinADObject', 'Get-WinADOrganization', 'Get-WinADPasswordPolicy', 'Get-WinADPrivilegedObjects', 'Get-WinADProtocol', 'Get-WinADProxyAddresses', 'Get-WinADServiceAccount', 'Get-WinADSharePermission', 'Get-WinADSIDHistory', 'Get-WinADSiteConnections', 'Get-WinADSiteCoverage', 'Get-WinADSiteLinks', 'Get-WinADSiteOptions', 'Get-WinADTombstoneLifetime', 'Get-WinADTrust', 'Get-WinADTrustLegacy', 'Get-WinADUserPrincipalName', 'Get-WinADUsers', 'Get-WinADUsersForeignSecurityPrincipalList', 'Get-WinADWellKnownFolders', 'Invoke-ADEssentials', 'Invoke-PingCastle', 'Invoke-WinADDHCPHealthCheck', 'New-ADACLObject', 'New-ADSite', 'Remove-ADACL', 'Remove-WinADDFSTopology', 'Remove-WinADDuplicateObject', 'Remove-WinADSharePermission', 'Rename-WinADUserPrincipalName', 'Repair-WinADACLConfigurationOwner', 'Repair-WinADBrokenProtectedFromDeletion', 'Repair-WinADEmailAddress', 'Repair-WinADForestControllerInformation', 'Request-ChangePasswordAtLogon', 'Request-DisableOnAccountExpiration', 'Restore-ADACLDefault', 'Set-ADACL', 'Set-ADACLInheritance', 'Set-ADACLOwner', 'Set-DnsServerIP', 'Set-WinADDiagnostics', 'Set-WinADDomainControllerNetLogonSettings', 'Set-WinADDomainControllerOption', 'Set-WinADForestACLOwner', 'Set-WinADReplication', 'Set-WinADReplicationConnections', 'Set-WinADShare', 'Set-WinADTombstoneLifetime', 'Show-WinADDHCPSummary', 'Show-WinADDNSRecords', 'Show-WinADForestReplicationSummary', 'Show-WinADGroupCritical', 'Show-WinADGroupMember', 'Show-WinADGroupMemberOf', 'Show-WinADKerberosAccount', 'Show-WinADLdapSummary', 'Show-WinADObjectDifference', 'Show-WinADOrganization', 'Show-WinADSIDHistory', 'Show-WinADSites', 'Show-WinADSitesCoverage', 'Show-WinADTrust', 'Show-WinADUserSecurity', 'Sync-WinADDomainController', 'Test-ADDomainController', 'Test-ADRolesAvailability', 'Test-ADSiteLinks', 'Test-DNSNameServers', 'Test-FSMORolesAvailability', 'Test-LDAP', 'Test-WinADDNSResolving', 'Test-WinADObjectReplicationStatus', 'Test-WinADVulnerableSchemaClass', 'Update-LastLogonTimestamp')
GUID = '9fc9fd61-7f11-4f4b-a527-084086f1905f'
ModuleVersion = '1.0.2'
ModuleVersion = '1.0.3'
PowerShellVersion = '5.1'
PrivateData = @{
PSData = @{
Expand Down
341 changes: 121 additions & 220 deletions Build/Build-Module.ps1

Large diffs are not rendered by default.

10 changes: 8 additions & 2 deletions Private/Configuration.ServiceAccounts.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,17 @@

New-HTMLTab -Name $Domain {
New-HTMLTable -DataTable $Script:Reporting['ServiceAccounts']['Data'][$Domain] -Filtering {

New-HTMLTableCondition -Name 'UsesDESEncryption' -ComparisonType bool -Operator eq -Value $true -BackgroundColor Red
New-HTMLTableCondition -Name 'UsesRC4Encryption' -ComparisonType bool -Operator eq -Value $true -BackgroundColor Salmon
New-HTMLTableCondition -Name 'UsesDomainEncryptionDefaults' -ComparisonType bool -Operator eq -Value $true -BackgroundColor LightYellow
New-HTMLTableConditionGroup -Conditions {
New-HTMLTableCondition -Name 'UsesAESKeys' -ComparisonType bool -Operator eq -Value $false
New-HTMLTableCondition -Name 'UsesDomainEncryptionDefaults' -ComparisonType bool -Operator eq -Value $false
} -BackgroundColor LightPink -HighlightHeaders SupportedEncryptionTypes, UsesAESKeys
}
}
}
}
}
}
}
}
9 changes: 8 additions & 1 deletion Private/Configuration.WinADComputer.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -188,10 +188,17 @@
New-HTMLTableCondition -Name 'Enabled' -ComparisonType string -Operator eq -Value $True
New-HTMLTableCondition -Name 'PasswordNotRequired' -ComparisonType string -Operator eq -Value $True
} -BackgroundColor Red -HighlightHeaders Name, SamAccountName, Enabled, PasswordNotRequired
New-HTMLTableCondition -Name 'UsesDESEncryption' -ComparisonType bool -Operator eq -Value $true -BackgroundColor Red
New-HTMLTableCondition -Name 'UsesRC4Encryption' -ComparisonType bool -Operator eq -Value $true -BackgroundColor Salmon
New-HTMLTableCondition -Name 'UsesDomainEncryptionDefaults' -ComparisonType bool -Operator eq -Value $true -BackgroundColor LightYellow
New-HTMLTableConditionGroup -Conditions {
New-HTMLTableCondition -Name 'UsesAESKeys' -ComparisonType bool -Operator eq -Value $false
New-HTMLTableCondition -Name 'UsesDomainEncryptionDefaults' -ComparisonType bool -Operator eq -Value $false
} -BackgroundColor LightPink -HighlightHeaders SupportedEncryptionTypes, UsesAESKeys
} -ScrollX
}
}
}
}
}
}
}
9 changes: 8 additions & 1 deletion Private/Configuration.WinADUser.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -164,10 +164,17 @@
New-HTMLTableCondition -Name 'Enabled' -ComparisonType string -Operator eq -Value $True
New-HTMLTableCondition -Name 'PasswordNotRequired' -ComparisonType string -Operator eq -Value $True
} -BackgroundColor Red -HighlightHeaders Name, SamAccountName, Enabled, PasswordNotRequired
New-HTMLTableCondition -Name 'UsesDESEncryption' -ComparisonType bool -Operator eq -Value $true -BackgroundColor Red
New-HTMLTableCondition -Name 'UsesRC4Encryption' -ComparisonType bool -Operator eq -Value $true -BackgroundColor Salmon
New-HTMLTableCondition -Name 'UsesDomainEncryptionDefaults' -ComparisonType bool -Operator eq -Value $true -BackgroundColor LightYellow
New-HTMLTableConditionGroup -Conditions {
New-HTMLTableCondition -Name 'UsesAESKeys' -ComparisonType bool -Operator eq -Value $false
New-HTMLTableCondition -Name 'UsesDomainEncryptionDefaults' -ComparisonType bool -Operator eq -Value $false
} -BackgroundColor LightPink -HighlightHeaders SupportedEncryptionTypes, UsesAESKeys
} -ScrollX
}
}
}
}
}
}
}
85 changes: 85 additions & 0 deletions Private/ConvertTo-WinADSupportedEncryptionTypes.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
function ConvertTo-WinADSupportedEncryptionTypes {
[cmdletBinding()]
param(
[AllowNull()][object] $Value
)

if ($null -ne $Value -and $Value -is [System.Collections.IEnumerable] -and $Value -isnot [string]) {
$Value = @($Value) | Select-Object -First 1
}

if ($null -eq $Value -or ($Value -is [string] -and $Value -eq '')) {
return [PSCustomObject] @{
RawValue = $null
ValueState = 'Not configured'
Types = [string[]] @()
TypesText = 'Not configured (uses KDC/domain defaults)'
UsesDomainDefaults = $true
UsesAESKeys = $false
UsesRC4Encryption = $false
UsesDESEncryption = $false
EnforcesAESSessionKeys = $false
}
}

try {
[int32] $RawValue = $Value
} catch {
return [PSCustomObject] @{
RawValue = $Value
ValueState = 'Invalid'
Types = [string[]] @()
TypesText = "Invalid value: $Value"
UsesDomainDefaults = $false
UsesAESKeys = $false
UsesRC4Encryption = $false
UsesDESEncryption = $false
EnforcesAESSessionKeys = $false
}
}

if ($RawValue -eq 0) {
return [PSCustomObject] @{
RawValue = 0
ValueState = 'Configured as 0'
Types = [string[]] @()
TypesText = 'Configured as 0 (uses KDC/domain defaults)'
UsesDomainDefaults = $true
UsesAESKeys = $false
UsesRC4Encryption = $false
UsesDESEncryption = $false
EnforcesAESSessionKeys = $false
}
}

$EncryptionTypeMap = [ordered] @{
'1' = 'DES-CBC-CRC'
'2' = 'DES-CBC-MD5'
'4' = 'RC4-HMAC'
'8' = 'AES128-CTS-HMAC-SHA1-96'
'16' = 'AES256-CTS-HMAC-SHA1-96'
'32' = 'FAST-supported'
'64' = 'Compound-identity-supported'
'128' = 'Claims-supported'
'256' = 'AES256-CTS-HMAC-SHA1-96-SK'
'512' = 'Resource-SID-compression-disabled'
}

[string[]] $Types = foreach ($Bit in $EncryptionTypeMap.Keys) {
if ($RawValue -band [int32] $Bit) {
$EncryptionTypeMap[$Bit]
}
}

[PSCustomObject] @{
RawValue = $RawValue
ValueState = 'Configured'
Types = $Types
TypesText = if ($Types.Count -gt 0) { $Types -join ', ' } else { 'None' }
UsesDomainDefaults = $false
UsesAESKeys = $Types -contains 'AES128-CTS-HMAC-SHA1-96' -or $Types -contains 'AES256-CTS-HMAC-SHA1-96'
UsesRC4Encryption = $Types -contains 'RC4-HMAC'
UsesDESEncryption = $Types -contains 'DES-CBC-CRC' -or $Types -contains 'DES-CBC-MD5'
EnforcesAESSessionKeys = $Types -contains 'AES256-CTS-HMAC-SHA1-96-SK'
}
}
5 changes: 3 additions & 2 deletions Private/Get-WinADTrustObject.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@
} else {
$ObjectSID = $null
}
$SupportedEncryption = ConvertTo-WinADSupportedEncryptionTypes -Value $Trust.properties.'msds-supportedencryptiontypes'

$TrustObject = [PSCustomObject] @{
#Name = [string] $Trust.properties.name # {ad.evotec.xyz}
Expand All @@ -101,7 +102,7 @@
ShowInAdvancedViewOnly = [bool]::Parse($Trust.properties.showinadvancedviewonly) # {True}
TrustPosixOffset = [string] $Trust.properties.trustposixoffset # {-2147483648}
msDSTrustForestTrustInfo = $msDSTrustForestTrustInfo
msDSSupportedEncryptionTypes = if ($Trust.properties.'msds-supportedencryptiontypes') { Get-ADEncryptionTypes -Value ([int] $Trust.properties.'msds-supportedencryptiontypes'[0]) } else { $null }
msDSSupportedEncryptionTypes = $SupportedEncryption.Types
#SecurityIdentifier = [string] $Trust.properties.securityidentifier # {1 4 0 0 0 0 0 5 21 0 0 0 113 37 225 50 27 133 23 171 67 175 144 188}
#InstanceType = $Trust.properties.instancetype # {4}
#AdsPath = [string] $Trust.properties.adspath # {LDAP://CN=ad.evotec.xyz,CN=System,DC=ad,DC=evotec,DC=pl}
Expand All @@ -119,4 +120,4 @@
if ($AsHashTable) {
$Summary
}
}
}
23 changes: 21 additions & 2 deletions Public/Get-WinADComputers.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
$Properties = @(
'DistinguishedName', 'LastLogonDate', 'PasswordLastSet', 'Enabled', 'DnsHostName', 'PasswordNeverExpires', 'PasswordNotRequired',
'PasswordExpired', 'ManagedBy', 'OperatingSystemVersion', 'OperatingSystem' , 'TrustedForDelegation', 'WhenCreated', 'WhenChanged', 'PrimaryGroupID'
'nTSecurityDescriptor'
'nTSecurityDescriptor', 'msDS-SupportedEncryptionTypes'
)
$AllComputers[$Domain] = Get-ADComputer -Filter "*" -Server $QueryServer -Properties $Properties
}
Expand Down Expand Up @@ -120,6 +120,7 @@
} else {
$PasswordLastChangedDays = $null
}
$SupportedEncryption = ConvertTo-WinADSupportedEncryptionTypes -Value $Computer.'msDS-SupportedEncryptionTypes'

if ($AddOwner) {
$Owner = Get-ADACLOwner -ADObject $Computer -Verbose -Resolve
Expand Down Expand Up @@ -154,6 +155,15 @@
ManagerDN = $Computer.ManagedBy
Description = $Computer.Description
TrustedForDelegation = $Computer.TrustedForDelegation
'msDS-SupportedEncryptionTypes' = $SupportedEncryption.RawValue
SupportedEncryptionTypesState = $SupportedEncryption.ValueState
SupportedEncryptionTypes = $SupportedEncryption.TypesText
UsesDomainEncryptionDefaults = $SupportedEncryption.UsesDomainDefaults
UsesAESKeys = $SupportedEncryption.UsesAESKeys
UsesRC4Encryption = $SupportedEncryption.UsesRC4Encryption
UsesDESEncryption = $SupportedEncryption.UsesDESEncryption
EnforcesAESSessionKeys = $SupportedEncryption.EnforcesAESSessionKeys
msDSSupportedEncryptionTypes = $SupportedEncryption.Types
}
} else {
$Owner = $null
Expand Down Expand Up @@ -185,6 +195,15 @@
ManagerDN = $Computer.ManagedBy
Description = $Computer.Description
TrustedForDelegation = $Computer.TrustedForDelegation
'msDS-SupportedEncryptionTypes' = $SupportedEncryption.RawValue
SupportedEncryptionTypesState = $SupportedEncryption.ValueState
SupportedEncryptionTypes = $SupportedEncryption.TypesText
UsesDomainEncryptionDefaults = $SupportedEncryption.UsesDomainDefaults
UsesAESKeys = $SupportedEncryption.UsesAESKeys
UsesRC4Encryption = $SupportedEncryption.UsesRC4Encryption
UsesDESEncryption = $SupportedEncryption.UsesDESEncryption
EnforcesAESSessionKeys = $SupportedEncryption.EnforcesAESSessionKeys
msDSSupportedEncryptionTypes = $SupportedEncryption.Types
}
}
}
Expand All @@ -196,4 +215,4 @@
$Output[$O]
}
}
}
}
16 changes: 12 additions & 4 deletions Public/Get-WinADServiceAccount.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,9 @@
} else {
$PasswordLastChangedDays = $null
}
$SupportedEncryption = ConvertTo-WinADSupportedEncryptionTypes -Value $Account.'msDS-SupportedEncryptionTypes'

[PSCUstomObject] @{
[PSCustomObject] @{
Name = $Account.Name
Enabled = $Account.Enabled # : True # : WO_SVC_Delete$
ObjectClass = $Account.ObjectClass # : msDS-ManagedServiceAccount
Expand Down Expand Up @@ -100,8 +101,15 @@
AccountExpirationDate = $Account.AccountExpirationDate
#AllowReversiblePasswordEncryption = $Account.AllowReversiblePasswordEncryption # : False
#CannotChangePassword = $Account.CannotChangePassword # : False
#'msDS-SupportedEncryptionTypes' = $Account.'msDS-SupportedEncryptionTypes' # : 28
msDSSupportedEncryptionTypes = Get-ADEncryptionTypes -Value $Account.'msds-supportedencryptiontypes'
'msDS-SupportedEncryptionTypes' = $SupportedEncryption.RawValue
SupportedEncryptionTypesState = $SupportedEncryption.ValueState
SupportedEncryptionTypes = $SupportedEncryption.TypesText
UsesDomainEncryptionDefaults = $SupportedEncryption.UsesDomainDefaults
UsesAESKeys = $SupportedEncryption.UsesAESKeys
UsesRC4Encryption = $SupportedEncryption.UsesRC4Encryption
UsesDESEncryption = $SupportedEncryption.UsesDESEncryption
EnforcesAESSessionKeys = $SupportedEncryption.EnforcesAESSessionKeys
msDSSupportedEncryptionTypes = $SupportedEncryption.Types
# 'msDS-User-Account-Control-Computed' = $Account.'msDS-User-Account-Control-Computed' # : 0
#ObjectGUID = $Account.ObjectGUID # : 573ff95e-c1f8-45e2-9b64-662fb9cb0615
PasswordNeverExpires = $Account.PasswordNeverExpires # : False
Expand All @@ -127,4 +135,4 @@
} else {
$Output.Values
}
}
}
Loading
Loading