Just shipped a new Posh-IBWAPI release, version 3.1.0. There is now an
-OverrideTransferHost switch in
Receive-IBFile. But to understand what it does requires a bit of explanation on how file transfers work under the hood with the Infoblox WAPI. Any given file transfer (up or down) is a 3-step process that can be generalized as follows.
- Inform WAPI that you want to do a file transfer and it returns a token and a URL to actually transfer against.
- Upload or download the file using the URL it gave you.
- Use the token to inform WAPI the transfer is complete.
With most file transfers, the WAPI host and the URL it wants you to transfer the file against are the same. However, for some reason the URL returned always has the host’s IP even if you originally connected via the hostname or FQDN. For example,
# WAPI URL base 'https://gridmaster.example.com/' # Transfer URL base 'https://192.168.1.2/'
This can be a problem if you’re using a trusted SSL\TLS certificate on your host because they usually don’t validate properly for IP addresses. So while the WAPI calls will succeed, the transfer call will fail due to certificate validation. In the previous version, I tried working around this by just always skipping certificate validation on the transfer call. But it turns out that can cause some undesireable behavior in dependent scripts.
So what the
-OverrideTransferHost actually does is check if the transfer URL’s host matches the WAPI URL’s host and if it doesn’t, tweaks the transfer URL to match. Whatever value is being used for
-SkipCertificateCheck is also configured for the transfer call.
In addition to the new switch, there are a few other enhancements and fixes in this release. In particular,
Send-IBFile will now open the file to be uploaded with a lock that no longer prevents other readers from reading the file simultaneously.
Receive-IBFilewhich tweaks the WAPI supplied transfer URL so that the hostname matches the WAPIHost value originally passed to the function. It also copies the state of the
SkipCertificateswitch to the transfer call.
Send-IBFilewill no longer lock the file being uploaded so other readers can’t read it.
- Fixed file encoding in
Send-IBFilewhen uploading non-ascii files.
Receive-IBFileon PowerShell Core by working around an upstream bug (#43)
ReturnAllFieldsparameter when not querying the latest WAPI version