jborean93 / omi

Open Management Infrastructure
Other
108 stars 13 forks source link

Cannot install anymore on Powershell 7.3 (MacOS Ventura) #59

Closed RFdeGroot closed 1 year ago

RFdeGroot commented 1 year ago
SUMMARY

Install-WSMan does not work anymore in PowerShell 7.3. For some reason it does not find openssl 1.1 anymore.

MODULE VERSION
ModuleType Version    PreRelease Name                                ExportedCommands
---------- -------    ---------- ----                                ----------------
Script     2.3.0                 PSWSMan                             {Disable-WSManCertVerification, Enable-WSManCertVerification, Get-WSManVersion, Install-WSMan…}
OS / ENVIRONMENT

MacOS 13.0.1 Powershell 7.3 Architecture Apple Sillicon (M1)

Installed openssl with brew. get-WSManVersion Get-WSManVersion: libmi could not be loaded, make sure it and its dependencies are available Get-WSManVersion: libpsrpclient could not be loaded, make sure it and its dependencies are available

KibosJ commented 1 year ago

Importing the PSWSMan Module then running the Get-OpenSSLInfo function produces this:

WARNING: /usr/local/bin/pwsh is loading libcrypto in an unsafe way

Not sure if that helps in any way

james-maclean commented 1 year ago

I can confirm facing the same issue:

OS / ENVIRONMENT

MacOS 12.6.1 Powershell 7.3.0 Architecture Intel Core i9

gxpd-jjh commented 1 year ago

Me 3.

sudo pwsh -Command 'Install-WSMan'

/usr/local/opt/openssl@3
jborean93 commented 1 year ago

I've not looked into this as I'm trying to move away from omi itself and replace it with PSWSMan which is a pure C# library. If it's a simple fix I might be able to push through one more release but I do not want to spend much more time on a codebase I am trying to replace.

A brief look online tells me that this error might be coming from PSWSMan trying to load libcrypto.dylib without any major versions in the filename. You can run Install-WSMan -Verbose to try and get some more information about the install process. It might give some information as to why it's failing.

RFdeGroot commented 1 year ago

Thank you for your reply, would be great if you are able to push through one more release if it's relatively easy for you to fix. The -Verbose option doest not give me any information.

sudo pwsh -Command 'Install-WSMan -Verbose' /opt/homebrew/opt/openssl@3

lucahost commented 1 year ago

Debugging this leads to a problem which, I think, might come from PowerShell 7.3 theInstall-WSMan cmdlet terminates after calling exec in Get-MacOSOpenSSL (line 166)

See experimental features https://learn.microsoft.com/en-us/powershell/scripting/whats-new/what-s-new-in-powershell-73?view=powershell-7.3

Replacing your internal exec in PSWSMan.psm1with psws_exec or something else resolves the issue and the script runs again.

see my (small) PR with that fix.

cc @jborean93, @RFdeGroot

jborean93 commented 1 year ago

Thanks for the fix, will look at pushing it out sometime today.

RFdeGroot commented 1 year ago

Didn't have the chance to say thank you until now, but thank you so much for fixing it! Much appreciated! I use this almost every day for Azure / Exchange online management so I'm really glad it's working again!