diff --git a/README.md b/README.md index 3f98fc8..50940f9 100644 --- a/README.md +++ b/README.md @@ -509,8 +509,8 @@ Payload: | `POST` | `/api/hosts` | User | Create host. | | `GET` | `/api/hosts/import/vcenter/status` | User | Return legacy effective vCenter status plus visible saved VMware connection records. | | `GET` | `/api/hosts/import/vcenter/connections` | User | List visible saved VMware connections. | -| `POST` | `/api/hosts/import/vcenter/connections` | User | Create an encrypted VMware connection record. Use `targetType: "vcenter"` for vCenter inventory or `targetType: "host"` for standalone ESXi Web Services inventory. | -| `PUT` | `/api/hosts/import/vcenter/connections/:connectionId` | User | Update a visible VMware connection; omit password to keep the existing secret. | +| `POST` | `/api/hosts/import/vcenter/connections` | User | Create a VMware connection record using a Credential Vault `credentialId`. Use `targetType: "vcenter"` for vCenter inventory or `targetType: "host"` for standalone ESXi Web Services inventory. | +| `PUT` | `/api/hosts/import/vcenter/connections/:connectionId` | User | Update a visible VMware connection and its selected vault credential. | | `DELETE` | `/api/hosts/import/vcenter/connections/:connectionId` | User | Delete a visible VMware connection. | | `POST` | `/api/hosts/import/vcenter/connections/:connectionId/test` | User | Verify a VMware connection. vCenter records authenticate and list VM summaries; standalone ESXi records authenticate to `/sdk` and query VM inventory through the vSphere Web Services API. | | `POST` | `/api/hosts/import/vcenter/preview` | User | Authenticate to vCenter, search VM inventory, and return import candidates. | @@ -612,8 +612,7 @@ Create/update a saved vCenter inventory system: "name": "Production vCenter", "targetType": "vcenter", "baseUrl": "https://vcenter.contoso.local", - "username": "administrator@vsphere.local", - "password": "stored-encrypted-on-save", + "credentialId": "cred_vmware_api", "apiMode": "auto", "requestTimeoutMs": 20000, "allowUntrustedTls": false, @@ -630,8 +629,7 @@ Create/update a saved standalone ESXi host connection: "name": "Standalone ESXi 01", "targetType": "host", "baseUrl": "https://esxi01.contoso.local", - "username": "root", - "password": "stored-encrypted-on-save", + "credentialId": "cred_esxi_api", "apiMode": "web-services", "requestTimeoutMs": 20000, "allowUntrustedTls": true, @@ -641,13 +639,21 @@ Create/update a saved standalone ESXi host connection: } ``` -Saved VMware passwords are encrypted with the same credential-store key used -by the Credential Vault. `targetType: "vcenter"` records use the vSphere +VMware connection records reference a Credential Vault username/password entry +through `credentialId`; operators create and rotate the actual VMware API +username/password in Credential Vault, then select it in Config / VMware. +Existing legacy connection records with an embedded encrypted VMware password +continue to resolve for compatibility, but new records should use the vault. +`targetType: "vcenter"` records use the vSphere Automation API or legacy REST API for inventory and VM power-state checks. `targetType: "host"` records are standalone host connections that use the vSphere Web Services SOAP endpoint at `/sdk`; they validate direct ESXi connectivity and enumerate VM inventory directly from the selected ESXi host in -the VMware import wizard. Existing +the VMware import wizard. The saved URL can be the host root +(`https://esxi01.contoso.local`), `/sdk`, or `/sdk/vimService.wsdl`; POSHManager +normalizes those forms, probes `/sdk/vimService.wsdl` for diagnostics, and +retries SOAP POSTs across `/sdk`, `/sdk/`, and `/sdk/vimService` when ESXi or a +reverse proxy maps one path differently. Existing `vcenter_*` settings and `VCENTER_*` environment variables remain supported as the `Configured default` import connection for single-vCenter deployments or Docker-provided configuration. @@ -658,10 +664,12 @@ When the import wizard selects a standalone ESXi connection (`targetType: "host"`), preview uses the vSphere Web Services API sequence `RetrieveServiceContent`, `Login`, `CreateContainerView`, and `RetrievePropertiesEx` against `/sdk` to enumerate `VirtualMachine` managed -objects. Filter fields work the same as vCenter imports. Imported hosts store -the selected ESXi connection plus the VM managed-object reference in -`sourceRef`, so script tests and RunPlans can run a direct ESXi power-state -check before spawning PowerShell. +objects. The API trace includes the WSDL probe, endpoint attempt count, redacted +SOAP session cookies, and low-level network/TLS causes when Node reports a +generic `fetch failed`. Filter fields work the same as vCenter imports. +Imported hosts store the selected ESXi connection plus the VM managed-object +reference in `sourceRef`, so script tests and RunPlans can run a direct ESXi +power-state check before spawning PowerShell. For exact VM-name searches (`field: "name"`, `operator: "equals"`), POSHManager uses the documented server-side name filters: `names=` for `/api/vcenter/vm` and `filter.names=` for `/rest/vcenter/vm`. Contains/starts-with/ends-with searches are filtered locally because vCenter VM list filters do not provide wildcard contains semantics. The combined `hostname` field searches both the VM inventory name and the VMware Tools guest `host_name`/FQDN after enrichment. VM display-name matches are checked first, then the rest of the inventory is still enriched for guest-only hostname matches. Networking/IP enrichment is only requested for candidates that match the filter. FQDN and IP discovery depends on VMware Tools data; when guest data is unavailable, the import falls back to the VM name as the host address and records the limitation in host notes. diff --git a/client/src/App.vue b/client/src/App.vue index 1c9df06..e47798f 100644 --- a/client/src/App.vue +++ b/client/src/App.vue @@ -621,6 +621,7 @@ { return { name: connection?.name || 'Selected VMware connection', typeLabel: connection?.targetType === 'host' ? 'ESXi host' : 'vCenter', - configured: Boolean(connection?.baseUrl && connection?.username), + configured: Boolean(connection?.baseUrl && (connection?.credentialId || connection?.username)), baseUrl: connection?.baseUrl || '' }; } diff --git a/client/src/components/settings/VCenterConnectionsConfig.vue b/client/src/components/settings/VCenterConnectionsConfig.vue index 128ab22..d81bff4 100644 --- a/client/src/components/settings/VCenterConnectionsConfig.vue +++ b/client/src/components/settings/VCenterConnectionsConfig.vue @@ -14,7 +14,7 @@
Inventory sources -

vCenter entries import VM inventory and power-state checks. Standalone host entries validate direct ESXi connections through the vSphere Web Services API.

+

vCenter and standalone ESXi entries use Credential Vault entries for VMware API authentication, inventory import, and power-state checks.

{{ connections.length }}systems {{ enabledCount }}enabled @@ -28,7 +28,7 @@ VMware systems
{{ connection.name }} - {{ connection.baseUrl }} - {{ connectionTypeLabel(connection) }} - {{ connection.apiMode }} - {{ connection.lastTestStatus || 'untested' }} + {{ connection.baseUrl }} - {{ connectionTypeLabel(connection) }} - {{ connection.credentialName || connection.username || 'No vault credential' }} - {{ connection.lastTestStatus || 'untested' }}