Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VMware.vSphere.SsoAdmin: Get-IdentitySource: An error occurred while enumerating through a collection: ASN1 corrupted data #590

Open
mbertolina opened this issue Sep 2, 2022 · 0 comments
Assignees
Labels

Comments

@mbertolina
Copy link

Describe the bug

I am getting the following error when retrieving Identity Sources from vCenter, it retrieves a couple of them but it seems to me that this error occurs when the library tries to parse VMware.vSphere.SsoAdminClient.DataTypes.ActiveDirectoryIdentitySource datatype.
This only occurs in Linux environments (not Windows).

PS /infra/infrastructure/ansible/roles/vca/vca-config-ldap/library> Get-IdentitySource -Server $con -Debug -Verbose

Name
----
localos
vsphere.local

PS /infra/infrastructure/ansible/roles/vca/vca-config-ldap/library> Set-PSDebug -Trace 2
PS /infra/infrastructure/ansible/roles/vca/vca-config-ldap/library> Get-IdentitySource -Server $con -Debug -Verbose
DEBUG:    1+  >>>> Get-IdentitySource -Server $con -Debug -Verbose
DEBUG:     ! CALL function '<ScriptBlock>'
DEBUG:  688+ function Get-IdentitySource  >>>> {

DEBUG:     ! CALL function 'Get-IdentitySource'  (defined in file '/root/.local/share/powershell/Modules/VMware.vSphere.SsoAdmin/1.3.8/IdentitySource.ps1')
DEBUG:  765+      >>>> $serversToProcess = $global:DefaultSsoAdminServers.ToArray()

DEBUG:     ! SET $serversToProcess = 'host1.eng.net'.
DEBUG:  766+     if ( >>>> $Server -ne $null) {

DEBUG:  767+          >>>> $serversToProcess = $Server

DEBUG:     ! SET $serversToProcess = 'host1.eng.net'.
DEBUG:  769+     foreach ($connection in  >>>> $serversToProcess) {

DEBUG:     ! SET $foreach = 'IEnumerator'.
DEBUG:  769+     foreach ( >>>> $connection in $serversToProcess) {

DEBUG:     ! SET $connection = 'host1.eng.net'.
DEBUG:  770+         if ( >>>> -not $connection.IsConnected) {

DEBUG:  775+          >>>> $resultIdentitySources = @()

DEBUG:     ! SET $resultIdentitySources = ''.
DEBUG:  776+          >>>> $allIdentitySources = $connection.Client.GetDomains()

DEBUG:     ! SET $allIdentitySources = 'IEnumerator'.
DEBUG:  778+         if ( >>>> -not $Localos -and -not $System -and -not $External) {

DEBUG:  779+              >>>> $resultIdentitySources = $allIdentitySources

DEBUG:     ! SET $resultIdentitySources = 'IEnumerator'.
DEBUG:  782+         if ( >>>> $Localos) {

DEBUG:  786+         if ( >>>> $System) {

DEBUG:  790+         if ( >>>> $External) {

DEBUG:  794+         if ( >>>> $Default) {

DEBUG:  801+          >>>> $resultIdentitySources


DEBUG:    5+                                     function Get-ConciseViewPositionMessage  >>>> {

DEBUG:     ! CALL function 'Get-ConciseViewPositionMessage'
DEBUG:    7+                                          >>>> $resetColor = ''

DEBUG:     ! SET $resetColor = ''.
DEBUG:    8+                                         if ( >>>> $Host.UI.SupportsVirtualTerminal -and ([string]::IsNullOrEmpty($env:__SuppressAnsiEscapeSequences))) {

DEBUG:    9+                                              >>>> $resetColor = [System.Management.Automation.VTUtility]::GetEscapeSequence(

DEBUG:     ! SET $resetColor = ''.
DEBUG:   46+                                          >>>> $errorColor = ''

DEBUG:     ! SET $errorColor = ''.
DEBUG:   47+                                          >>>> $accentColor = ''

DEBUG:     ! SET $accentColor = ''.
DEBUG:   49+                                         if ( >>>> $null -ne $Host.PrivateData) {

DEBUG:   50+                                              >>>> $errorColor = Get-VT100Color $Host.PrivateData.ErrorForegroundColor

DEBUG:   14+                                         function Get-VT100Color([ConsoleColor] $color)  >>>> {

DEBUG:     ! CALL function 'Get-VT100Color'
DEBUG:   15+                                             if ( >>>> !$Host.UI.SupportsVirtualTerminal -or !([string]::IsNullOrEmpty($env:__SuppressAnsiEscapeSequences))) {

DEBUG:   19+                                             return  >>>> [System.Management.Automation.VTUtility]::GetEscapeSequence($color)

DEBUG:   20+                                          >>>> }

DEBUG:     ! SET $errorColor = ''.
DEBUG:   51+                                              >>>> $accentColor = Get-VT100Color ($Host.PrivateData.ErrorAccentColor ?? $errorColor)

DEBUG:   14+                                         function Get-VT100Color([ConsoleColor] $color)  >>>> {

DEBUG:     ! CALL function 'Get-VT100Color'
DEBUG:   15+                                             if ( >>>> !$Host.UI.SupportsVirtualTerminal -or !([string]::IsNullOrEmpty($env:__SuppressAnsiEscapeSequences))) {

DEBUG:   19+                                             return  >>>> [System.Management.Automation.VTUtility]::GetEscapeSequence($color)

DEBUG:   20+                                          >>>> }

DEBUG:     ! SET $accentColor = ''.
DEBUG:   54+                                          >>>> $posmsg = ''

DEBUG:     ! SET $posmsg = ''.
DEBUG:   55+                                          >>>> $headerWhitespace = ''

DEBUG:     ! SET $headerWhitespace = ''.
DEBUG:   56+                                          >>>> $offsetWhitespace = ''

DEBUG:     ! SET $offsetWhitespace = ''.
DEBUG:   57+                                          >>>> $message = ''

DEBUG:     ! SET $message = ''.
DEBUG:   58+                                          >>>> $prefix = ''

DEBUG:     ! SET $prefix = ''.
DEBUG:   61+                                         if ( >>>> ($myinv -and $myinv.ScriptName -or $myinv.ScriptLineNumber -gt 1 -or $err.CategoryInfo.Category -eq 'ParserError') -and !($myinv.ScriptName.EndsWith('.psm1', [System.StringComparison]::OrdinalIgnoreCase))) {

DEBUG:   62+                                              >>>> $useTargetObject = $false

DEBUG:     ! SET $useTargetObject = 'False'.
DEBUG:   65+                                             if ( >>>> $_.TargetObject.Line -and $_.TargetObject.LineText) {

DEBUG:  769+     foreach ( >>>> $connection in $serversToProcess) {

DEBUG:     ! SET $foreach = ''.
DEBUG:  803+  >>>> }

Name
----
localos
vsphere.local

PS /infra/infrastructure/ansible/roles/vca/vca-config-ldap/library> $ErrorActionPreference = "Stop"
DEBUG:    1+  >>>> $ErrorActionPreference = "Stop"
DEBUG:     ! CALL function '<ScriptBlock>'
DEBUG:     ! SET $ErrorActionPreference = 'Stop'.
PS /infra/infrastructure/ansible/roles/vca/vca-config-ldap/library> Get-IdentitySource -Server $con -Debug -Verbose
DEBUG:    1+  >>>> Get-IdentitySource -Server $con -Debug -Verbose
DEBUG:     ! CALL function '<ScriptBlock>'
DEBUG:  688+ function Get-IdentitySource  >>>> {

DEBUG:     ! CALL function 'Get-IdentitySource'  (defined in file '/root/.local/share/powershell/Modules/VMware.vSphere.SsoAdmin/1.3.8/IdentitySource.ps1')
DEBUG:  765+      >>>> $serversToProcess = $global:DefaultSsoAdminServers.ToArray()

DEBUG:     ! SET $serversToProcess = 'host1.eng.net'.
DEBUG:  766+     if ( >>>> $Server -ne $null) {

DEBUG:  767+          >>>> $serversToProcess = $Server

DEBUG:     ! SET $serversToProcess = 'host1.eng.net'.
DEBUG:  769+     foreach ($connection in  >>>> $serversToProcess) {

DEBUG:     ! SET $foreach = 'IEnumerator'.
DEBUG:  769+     foreach ( >>>> $connection in $serversToProcess) {

DEBUG:     ! SET $connection = 'host1.eng.net'.
DEBUG:  770+         if ( >>>> -not $connection.IsConnected) {

DEBUG:  775+          >>>> $resultIdentitySources = @()

DEBUG:     ! SET $resultIdentitySources = ''.
DEBUG:  776+          >>>> $allIdentitySources = $connection.Client.GetDomains()

DEBUG:     ! SET $allIdentitySources = 'IEnumerator'.
DEBUG:  778+         if ( >>>> -not $Localos -and -not $System -and -not $External) {

DEBUG:  779+              >>>> $resultIdentitySources = $allIdentitySources

DEBUG:     ! SET $resultIdentitySources = 'IEnumerator'.
DEBUG:  782+         if ( >>>> $Localos) {

DEBUG:  786+         if ( >>>> $System) {

DEBUG:  790+         if ( >>>> $External) {

DEBUG:  794+         if ( >>>> $Default) {

DEBUG:  801+          >>>> $resultIdentitySources


DEBUG:     ! SET $foreach = ''.
Get-IdentitySource: An error occurred while enumerating through a collection: ASN1 corrupted data..
PS /infra/infrastructure/ansible/roles/vca/vca-config-ldap/library> 

Reproduction steps

1. Connect to SSO using `Connect-SsoAdminServer `
2. Retrieve Identity Sources using `Get-IdentitySource`

Expected behavior

This is the expected behavior and output from Windows box:

PS C:\Users\martin> Get-IdentitySource -Server $con

Name
----
localos
vsphere.local
services.eng.com

PS C:\Users\martin> $(Get-IdentitySource -Server $con)[2] | Get-Member

   TypeName: VMware.vSphere.SsoAdminClient.DataTypes.ActiveDirectoryIdentitySource

Name                   MemberType Definition
----                   ---------- ----------
Equals                 Method     bool Equals(System.Object obj)
GetHashCode            Method     int GetHashCode()
GetType                Method     type GetType()
ToString               Method     string ToString()
Alias                  Property   string Alias {get;set;}
AuthenticationType     Property   string AuthenticationType {get;set;}
AuthenticationUsername Property   string AuthenticationUsername {get;set;}
Certificates           Property   System.Security.Cryptography.X509Certificates.X509Certificate2[] Certificates {get;set;}
FailoverUrl            Property   string FailoverUrl {get;set;}
FriendlyName           Property   string FriendlyName {get;set;}
GroupBaseDN            Property   string GroupBaseDN {get;set;}
Name                   Property   string Name {get;set;}
PrimaryUrl             Property   string PrimaryUrl {get;set;}
Type                   Property   string Type {get;set;}
UserBaseDN             Property   string UserBaseDN {get;set;}

PS C:\Users\martin>

Additional context

No response

@mbertolina mbertolina added the bug label Sep 2, 2022
@mbertolina mbertolina changed the title Get-IdentitySource: An error occurred while enumerating through a collection: ASN1 corrupted data VMware.vSphere.SsoAdmin: Get-IdentitySource: An error occurred while enumerating through a collection: ASN1 corrupted data Sep 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants