PowerShell / PowerShell

PowerShell for every system!
https://microsoft.com/PowerShell
MIT License
44.67k stars 7.23k forks source link

PSRemoting Support for Apple M1 Silicon #14760

Closed fatherofinvention closed 3 years ago

fatherofinvention commented 3 years ago

Steps to reproduce

Enter-PSSession -ComputerName Server01 -Port 90 -Credential Domain01\User01


Expected behavior

Enter-PSSession: This parameter set requires WSMan, and no supported WSMan client library was found. WSMan is either not installed or unavailable for this system.

ErrorCode                   : 0
TransportMessage            : 
ErrorRecord                 : This parameter set requires WSMan, and no supported WSMan client library was found. WSMan is either not installed or unavailable for this system.
WasThrownFromThrowStatement : False
TargetSite                  : Void .ctor()
StackTrace                  :    at System.Management.Automation.Remoting.Client.WSManClientSessionTransportManager.WSManAPIDataCommon..ctor()
                                 at System.Management.Automation.Remoting.Client.WSManClientSessionTransportManager..ctor(Guid runspacePoolInstanceId, WSManConnectionInfo 
                              connectionInfo, PSRemotingCryptoHelper cryptoHelper, String sessionName)
                                 at System.Management.Automation.Runspaces.WSManConnectionInfo.CreateClientSessionTransportManager(Guid instanceId, String sessionName, 
                              PSRemotingCryptoHelper cryptoHelper)
                                 at System.Management.Automation.Remoting.ClientRemoteSessionDSHandlerImpl..ctor(ClientRemoteSession session, PSRemotingCryptoHelper 
                              cryptoHelper, RunspaceConnectionInfo connectionInfo, URIDirectionReported uriRedirectionHandler)
                                 at System.Management.Automation.Remoting.ClientRemoteSessionImpl..ctor(RemoteRunspacePoolInternal rsPool, URIDirectionReported 
                              uriRedirectionHandler)
                                 at System.Management.Automation.Internal.ClientRunspacePoolDataStructureHandler.CreateClientRemoteSession(RemoteRunspacePoolInternal 
                              rsPoolInternal)
                                 at System.Management.Automation.Internal.ClientRunspacePoolDataStructureHandler..ctor(RemoteRunspacePoolInternal clientRunspacePool, TypeTable 
                              typeTable)
                                 at System.Management.Automation.Runspaces.Internal.RemoteRunspacePoolInternal.CreateDSHandler(TypeTable typeTable)
                                 at System.Management.Automation.Runspaces.Internal.RemoteRunspacePoolInternal..ctor(Int32 minRunspaces, Int32 maxRunspaces, TypeTable 
                              typeTable, PSHost host, PSPrimitiveDictionary applicationArguments, RunspaceConnectionInfo connectionInfo, String name)
                                 at System.Management.Automation.Runspaces.RunspacePool..ctor(Int32 minRunspaces, Int32 maxRunspaces, TypeTable typeTable, PSHost host, 
                              PSPrimitiveDictionary applicationArguments, RunspaceConnectionInfo connectionInfo, String name)
                                 at System.Management.Automation.RemoteRunspace..ctor(TypeTable typeTable, RunspaceConnectionInfo connectionInfo, PSHost host, 
                              PSPrimitiveDictionary applicationArguments, String name, Int32 id)
                                 at Microsoft.PowerShell.Commands.EnterPSSessionCommand.CreateTemporaryRemoteRunspace(PSHost host, WSManConnectionInfo connectionInfo)
                                 at Microsoft.PowerShell.Commands.EnterPSSessionCommand.CreateRunspaceWhenComputerNameParameterSpecified()
Message                     : This parameter set requires WSMan, and no supported WSMan client library was found. WSMan is either not installed or unavailable for this system.
Data                        : {}
InnerException              : System.DllNotFoundException: Unable to load shared library 'libpsrpclient' or one of its dependencies. In order to help diagnose loading problems, 
                              consider setting the DYLD_PRINT_LIBRARIES environment variable: dlopen(liblibpsrpclient, 1): image not found
                                 at System.Management.Automation.Remoting.Client.WSManNativeApi.WSManInitialize(Int32 flags, IntPtr& wsManAPIHandle)
                                 at System.Management.Automation.Remoting.Client.WSManClientSessionTransportManager.WSManAPIDataCommon..ctor()
HelpLink                    : 
Source                      : System.Management.Automation
HResult                     : -2146233087

Environment data

Name                           Value

PSVersion                      7.1.1
PSEdition                      Core
GitCommitId                    7.1.1
OS                             Darwin 20.2.0 Darwin Kernel Version 20.2.0: Wed Dec  2 20:40:21 PST 2020; root:xnu-7195.60.75~1/RELEASE_ARM64_T8101
Platform                       Unix
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Questions

Thanks!

jborean93 commented 3 years ago

Is this a PowerShell problem or an OpenSSL problem?

Somewhat PowerShell but also other teams in Microsoft unrelated to PowerShell. The current problem is that the libmi.dylib library shipped by PowerShell is hardcoded to link against OpenSSL 1.0.x. You would need to compile another version that is linked against OpenSSL 1.1.x and then use that library. I'll touch on this more.

Since OpenSSL1.1.1i is compatible with Big Sur on M1 silicon, is there a workaround to this right now?

The only workaround would be to compile the mi library again yourself that is linked to OpenSSL 1.1.x. You can adjust the link paths of the existing libmi.dylib to link to OpenSSL 1.1.x but when you go to use it there will be failures because 1.0.x and 1.1.x are not fully ABI/API compatible.

I don't think this is going to be possible for it to be done using the provided library that is included with PowerShell as the team that is involved with maintaining libmi aren't interested in macOS anymore:

thanks for PR! but omi has dropped powershell and mac support on 2018, and it is only used by SCOM and OMS/LAD now.

The chances of you getting them to create a build for macOS for their MI architecture is probably just as high as getting them to create an OpenSSL 1.1.x one :)

Once you sort that out then you need to have an updated version of libpsrpclient built for the M1 architecture but that has stayed largely static because libmi has not changed at all.

What you could try is PSWSMan which is my own personal fork of both libmi and libpsrpclient that fixes a few of the problems of the official Microsoft version:

# Needs to be run as sudo or an account that can modify the pwsh install dir
Install-Module -Name PSWSMan
Install-WSMan

# Restart pwsh for it to use the new libraries that have just been installed

As well as fixing the dep on OpenSSL that is a problem on the original there are numerous other fixes that are included to make WSMan on Linux hopefully a better experience.

While this fork works for macOS on Intel I'm unsure whether it will work for M1. I've got no hardware to test this and it doesn't look like M1 is provided with any CI providers so I cannot build or test any copies for that architecture. It's especially complex as with Rossetta 2 it may just work but I have no idea whether the whole stack needs to be the same architecture or not.

If the forked copy in PSWSMan does not work you can compile your own version:

git clone https://github.com/jborean93/omi
cd omi

# See the steps that the build script will run
./build.py macOS --output-script

# Actually build it
./build.py macOS

I honestly have no idea if this will work or not but if you are willing to try it out I'm more than happy for you to post any relevant info to my fork for anybody else wanting to try it.

fatherofinvention commented 3 years ago

@jborean93 Great reply and thank you for taking the time. I will try out your PSWSMan module and let you know how it goes.

fatherofinvention commented 3 years ago

Hey @jborean93. I gave it a shot but no joy. The module install went just fine, as did running the commandInstall-WSMan but when I try to open a remote session or run Get-WSManVersion I get the error below. Happy to try any other suggestions you may have or get additional detail if that's helpful.

CommandType     Name                                               Version    Source

Function        Disable-WSManCertVerification                      2.1.0      PSWSMan
Function        Enable-WSManCertVerification                       2.1.0      PSWSMan
Function        Get-WSManVersion                                   2.1.0      PSWSMan
Function        Install-WSMan                                      2.1.0      PSWSMan
Function        Register-TrustedCertificate                        2.1.0      PSWSMan

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

MI PSRP
-- ----

Thank you.

jborean93 commented 3 years ago

Did you install OpenSSL 1.1.x using brew? You can use otool to display the linked libraries

PWSHDIR="$( dirname "$( readlink "$( which pwsh )" )" )"
otool -L "${PWSHDIR}/libpsrpclient.dylib"
otool -L "${PWSHDIR}/libmi.dylib"

The libmi one should show you the path for the configured libssl and libcrypto which must exist. Apart from that it does indicate the libraries distributed with PSWSMan won't work for M1 macOS but that's mostly expected.

fatherofinvention commented 3 years ago

Hey @jborean93. I installed OpenSSL via MacPorts:

CleanShot 2021-02-11 at 19 39 43@2x

And this is what I see when I run the otool commands:

CleanShot 2021-02-11 at 19 42 01@2x

Based on this I created a link so that libssl and libcrypto were accessible in their expected locations:

sudo ln -s /opt/local/lib /usr/local/opt/openssl@1.1/lib

CleanShot 2021-02-11 at 19 54 43@2x

But unfortunately I am getting the same error, which has me thinking either I've followed your instructions wrong or this just won't work.

CleanShot 2021-02-11 at 19 53 11@2x

Thank you.

jborean93 commented 3 years ago

Yea unfortunately at this point there's bound to be some other problem that is brought up by M1. That honestly could be anything and without something to test in front of my hands I'm not sure I can really do much. At this stage the next thing I would try is to enable some of the dylib env vars that log some of the loading details. For example

# This will fail but it gets PowerShell to load the libraries, otherwise you can try Get-WSManVersion
$ DYLD_PRINT_APIS=1 pwsh -Command Enter-PSSession -ComputerName localhost

This will print out all the libraries that are dynamically loaded, the WSMan specific ones are right at the end.

dlopen_internal(/usr/local/microsoft/powershell/7/libpsrpclient.dylib, 0x00000001)
dyld_image_path_containing_address(0x10cb10000)
_dyld_is_memory_immutable(0x10cb10000, 28)
dyld_image_path_containing_address(0x10f121000)
_dyld_is_memory_immutable(0x10f121000, 28)
dyld_image_path_containing_address(0x10cb6c000)
_dyld_is_memory_immutable(0x10cb6c000, 28)
dyld_image_path_containing_address(0x10f215000)
_dyld_is_memory_immutable(0x10f215000, 28)
  dlopen_internal(/usr/local/microsoft/powershell/7/libpsrpclient.dylib) ==> 0x7f95c9f4c400
dlsym_internal(0x7f95c9f4c400, WSManInitialize)
  dlsym_internal(0x7f95c9f4c400, WSManInitialize) ==> 0x10cb15590
dlsym_internal(0x7f95c9f4c400, WSManCreateSession)
  dlsym_internal(0x7f95c9f4c400, WSManCreateSession) ==> 0x10cb157d0
dlsym_internal(0x7f95c9f4c400, WSManGetSessionOptionAsDword)
  dlsym_internal(0x7f95c9f4c400, WSManGetSessionOptionAsDword) ==> 0x10cb164b0
dlsym_internal(0x7f95c9f4c400, WSManSetSessionOption)
  dlsym_internal(0x7f95c9f4c400, WSManSetSessionOption) ==> 0x10cb15eb0
dlsym_internal(0x7f95c9f30a50, SystemNative_InitializeConsoleBeforeRead)
  dlsym_internal(0x7f95c9f30a50, SystemNative_InitializeConsoleBeforeRead) ==> 0x10caa53c0
dlsym_internal(0x7f95c9f30a50, SystemNative_Write)
  dlsym_internal(0x7f95c9f30a50, SystemNative_Write) ==> 0x10ca9f4c0
dlsym_internal(0x7f95c9f30a50, SystemNative_ReadStdin)
  dlsym_internal(0x7f95c9f30a50, SystemNative_ReadStdin) ==> 0x10caa59b0
dlsym_internal(0x7f95c9f30a50, SystemNative_UninitializeConsoleAfterRead)
  dlsym_internal(0x7f95c9f30a50, SystemNative_UninitializeConsoleAfterRead) ==> 0x10caa5500
dlsym_internal(0x7f95c9f30a50, SystemNative_GetWindowSize)
  dlsym_internal(0x7f95c9f30a50, SystemNative_GetWindowSize) ==> 0x10caa5220
dlsym_internal(0x7f95c9f4c400, WSManCreateShellEx)
  dlsym_internal(0x7f95c9f4c400, WSManCreateShellEx) ==> 0x10cb16d40
_dyld_is_memory_immutable(0x7fff204543c5, 39)
dlsym_internal(0x7f95c9f4c400, WSManGetErrorMessage)
  dlsym_internal(0x7f95c9f4c400, WSManGetErrorMessage) ==> 0x10cb156b0
dlsym_internal(0x7f95c9f4c400, WSManCloseShell)
  dlsym_internal(0x7f95c9f4c400, WSManCloseShell) ==> 0x10cb1a230
dlsym_internal(0x7f95c9f4c400, WSManCloseSession)
  dlsym_internal(0x7f95c9f4c400, WSManCloseSession) ==> 0x10cb15e50
dlsym_internal(0x7f95c9f4c400, WSManDeinitialize)
  dlsym_internal(0x7f95c9f4c400, WSManDeinitialize) ==> 0x10cb15640
dladdr(0x10f13da00, 0x70000d6e3a50)
Enter-PSSession: Connecting to remote server localhost failed with the following error message : MI_RESULT_FAILED For more information, see the about_Remote_Troubleshooting Help topic.

You can see that it loaded libmi, libpsrpclient, libssl, and libcrypto which are typically the main offenders here. The error message is expected and proves it actually tried to connect to localhost.

Compare that to the default setup without my fork you can see the failures near the end

dlopen_internal(/usr/local/microsoft/powershell/7/libpsrpclient.dylib, 0x00000001)
dlclose(), found unused image 0x7fa794f45eb0 libpsrpclient.dylib
dlclose(), found unused image 0x7fa794f46100 libmi.dylib
dlclose(), deleting 0x7fa794f45eb0 libpsrpclient.dylib
dlclose(), deleting 0x7fa794f46100 libmi.dylib
  dlopen_internal() failed, error: 'dlopen(/usr/local/microsoft/powershell/7/libpsrpclient.dylib, 1): Library not loaded: /usr/local/opt/openssl/lib/libssl.1.0.0.dylib
  Referenced from: /usr/local/microsoft/powershell/7/libmi.dylib
  Reason: image not found'
dlerror()
dlopen_internal(/usr/local/microsoft/powershell/7/libpsrpclient.dylib, 0x00000001)
dlclose(), found unused image 0x7fa794f46970 libpsrpclient.dylib
dlclose(), found unused image 0x7fa794f46100 libmi.dylib
dlclose(), deleting 0x7fa794f46970 libpsrpclient.dylib
dlclose(), deleting 0x7fa794f46100 libmi.dylib
  dlopen_internal() failed, error: 'dlopen(/usr/local/microsoft/powershell/7/libpsrpclient.dylib, 1): Library not loaded: /usr/local/opt/openssl/lib/libssl.1.0.0.dylib
  Referenced from: /usr/local/microsoft/powershell/7/libmi.dylib
  Reason: image not found'
dlerror()
dlopen_internal(libpsrpclient.dylib, 0x00000001)
dlclose(), found unused image 0x7fa794f46970 libpsrpclient.dylib
dlclose(), found unused image 0x7fa794f46100 libmi.dylib
dlclose(), deleting 0x7fa794f46970 libpsrpclient.dylib
dlclose(), deleting 0x7fa794f46100 libmi.dylib
  dlopen_internal() failed, error: 'dlopen(libpsrpclient.dylib, 1): Library not loaded: /usr/local/opt/openssl/lib/libssl.1.0.0.dylib
  Referenced from: /usr/local/microsoft/powershell/7/libmi.dylib
  Reason: image not found'
dlerror()

The error here is pretty clear in that I don't have the libssl.1.0.0.dylib library at that path (which is expected here as this is the copy distributed by PowerShell). So potentially you can use DYLD_PRINT_APIS to figure out why dlopen is failing to load the library which could help take you on the next step.

fatherofinvention commented 3 years ago

@jborean93 Totally understand, thanks again for all of your input so far. I am pasting the results of your last suggestion so you can see what libraries loaded and which couldn't be. Based on some of these errors (some libraries not found, others incompatible with the architecture) I am assuming we've reached the end of the line on this one. What I am curious to know though is, does this mean that PSRemoting will never work on new Apple computers or just that we need more time for support to be added?

CleanShot 2021-02-12 at 11 17 42@2x

CleanShot 2021-02-12 at 11 18 45@2x

user@Macbook-Air ~ % DYLD_PRINT_APIS=1 pwsh -Command Enter-PSSession -ComputerName localhost
_dyld_register_func_for_add_image(0x7fff20360506)
_dyld_register_for_bulk_image_loads(0x7fff20092cf3)
_dyld_is_memory_immutable(0x7fff200dcd3b, 36)
_NSGetExecutablePath(...)
_NSGetExecutablePath(...)
dlopen_internal(/usr/local/microsoft/powershell/7/libhostfxr.dylib, 0x00000001)
  dlopen_internal(/usr/local/microsoft/powershell/7/libhostfxr.dylib) ==> 0x7fb8acc05b60
dlsym_internal(0x7fb8acc05b60, hostfxr_main_startupinfo)
  dlsym_internal(0x7fb8acc05b60, hostfxr_main_startupinfo) ==> 0x108ac83f0
dlsym_internal(0x7fb8acc05b60, hostfxr_set_error_writer)
  dlsym_internal(0x7fb8acc05b60, hostfxr_set_error_writer) ==> 0x108ac9170
dlopen_internal(/usr/local/microsoft/powershell/7/libhostpolicy.dylib, 0x00000001)
  dlopen_internal(/usr/local/microsoft/powershell/7/libhostpolicy.dylib) ==> 0x7fb8acd050e0
dlsym_internal(0x7fb8acd050e0, corehost_main)
  dlsym_internal(0x7fb8acd050e0, corehost_main) ==> 0x108bbdb40
dlsym_internal(0x7fb8acd050e0, corehost_load)
  dlsym_internal(0x7fb8acd050e0, corehost_load) ==> 0x108bbce10
dlsym_internal(0x7fb8acd050e0, corehost_unload)
  dlsym_internal(0x7fb8acd050e0, corehost_unload) ==> 0x108bbf010
dlsym_internal(0x7fb8acd050e0, corehost_main_with_output_buffer)
  dlsym_internal(0x7fb8acd050e0, corehost_main_with_output_buffer) ==> 0x108bbe1c0
dlsym_internal(0x7fb8acd050e0, corehost_set_error_writer)
  dlsym_internal(0x7fb8acd050e0, corehost_set_error_writer) ==> 0x108bbf9a0
dlsym_internal(0x7fb8acd050e0, corehost_initialize)
  dlsym_internal(0x7fb8acd050e0, corehost_initialize) ==> 0x108bbe490
dlopen_internal(/usr/local/microsoft/powershell/7/libcoreclr.dylib, 0x00000001)
_dyld_is_memory_immutable(0x7fff203cc19b, 50)
_dyld_is_memory_immutable(0x7fff203cc1cd, 55)
_dyld_is_memory_immutable(0x7fff203cc204, 56)
_dyld_is_memory_immutable(0x7fff203cc23c, 58)
_dyld_get_prog_image_header()
dyld_image_path_containing_address(0x10079c000)
_NSGetExecutablePath(...)
_dyld_register_func_for_add_image(0x7fff200c894e)
dyld_image_path_containing_address(0x10079c000)
_dyld_is_memory_immutable(0x10079c000, 28)
dyld_image_path_containing_address(0x108ab7000)
_dyld_is_memory_immutable(0x108ab7000, 28)
dyld_image_path_containing_address(0x108baa000)
_dyld_is_memory_immutable(0x108baa000, 28)
dyld_image_path_containing_address(0x108c91000)
_dyld_is_memory_immutable(0x108c91000, 28)
_dyld_register_func_for_remove_image(0x7fff200d5e13)
_dyld_is_memory_immutable(0x7fff200dca5f, 38)
_NSGetExecutablePath(...)
  dlopen_internal(/usr/local/microsoft/powershell/7/libcoreclr.dylib) ==> 0x7fb8ace04930
dlsym_internal(0x7fb8ace04930, coreclr_initialize)
  dlsym_internal(0x7fb8ace04930, coreclr_initialize) ==> 0x108cdb800
dlsym_internal(0x7fb8ace04930, coreclr_shutdown_2)
  dlsym_internal(0x7fb8ace04930, coreclr_shutdown_2) ==> 0x108cdbdb0
dlsym_internal(0x7fb8ace04930, coreclr_execute_assembly)
  dlsym_internal(0x7fb8ace04930, coreclr_execute_assembly) ==> 0x108cdbf40
dlsym_internal(0x7fb8ace04930, coreclr_create_delegate)
  dlsym_internal(0x7fb8ace04930, coreclr_create_delegate) ==> 0x108cdbe30
dlopen_internal(NULL, 0x00000001)
dlsym_internal(0xfffffffffffffffe, DllMain)
  dlsym_internal(RTLD_DEFAULT, DllMain) ==> 0x108cdb050
_NSGetExecutablePath(...)
_NSGetExecutablePath(...)
dladdr(0x108cae4c0, 0x30529af50)
dladdr(0x108ca95e0, 0x30529b128)
dlopen_internal(/usr/local/microsoft/powershell/7/libcoreclr.dylib, 0x00000001)
  dlopen_internal(/usr/local/microsoft/powershell/7/libcoreclr.dylib) ==> 0x7fb8ace04930
dlsym_internal(0x7fb8ace04930, DllMain)
  dlsym_internal(0x7fb8ace04930, DllMain) ==> 0x108cdb050
dlsym_internal(0x7fb8ace04930, PAL_RegisterModule)
  dlsym_internal(0x7fb8ace04930, PAL_RegisterModule) ==> NULL
dladdr(0x10902d5e0, 0x30529b0b0)
dlopen_internal(/usr/local/microsoft/powershell/7/libclrjit.dylib, 0x00000001)
dyld_image_path_containing_address(0x10a1a2000)
_dyld_is_memory_immutable(0x10a1a2000, 28)
  dlopen_internal(/usr/local/microsoft/powershell/7/libclrjit.dylib) ==> 0x7fb8acc06100
dlsym_internal(0x7fb8acc06100, DllMain)
  dlsym_internal(0x7fb8acc06100, DllMain) ==> NULL
dlsym_internal(0x7fb8acc06100, jitStartup)
  dlsym_internal(0x7fb8acc06100, jitStartup) ==> 0x10a1cb700
dlopen_internal(NULL, 0x00000001)
dlsym_internal(0xfffffffffffffffe, DllMain)
  dlsym_internal(RTLD_DEFAULT, DllMain) ==> 0x108cdb050
dlsym_internal(0x7fb8acc06100, getJit)
  dlsym_internal(0x7fb8acc06100, getJit) ==> 0x10a1cb800
dlopen_internal(/usr/local/microsoft/powershell/7/libc.dylib, 0x00000001)
  dlopen_internal() failed, error: 'dlopen(/usr/local/microsoft/powershell/7/libc.dylib, 1): image not found'
dlerror()
dlopen_internal(/usr/local/microsoft/powershell/7/libc.dylib, 0x00000001)
  dlopen_internal() failed, error: 'dlopen(/usr/local/microsoft/powershell/7/libc.dylib, 1): image not found'
dlerror()
dlopen_internal(libc.dylib, 0x00000001)
  dlopen_internal(libc.dylib) ==> 0x200a94320
dlsym_internal(0x200a94320, sysctl)
  dlsym_internal(0x200a94320, sysctl) ==> 0x7fff20257e10
dlsym_internal(0x200a94320, getpid)
  dlsym_internal(0x200a94320, getpid) ==> 0x7fff20325368
dlopen_internal(/usr/local/microsoft/powershell/7/libSystem.Native.dylib, 0x00000001)
dyld_image_path_containing_address(0x10a896000)
_dyld_is_memory_immutable(0x10a896000, 28)
  dlopen_internal(/usr/local/microsoft/powershell/7/libSystem.Native.dylib) ==> 0x7fb8ace1fb50
dlsym_internal(0x7fb8ace1fb50, SystemNative_GetTimestamp)
  dlsym_internal(0x7fb8ace1fb50, SystemNative_GetTimestamp) ==> 0x10a89ed30
dlopen_internal(/usr/lib/libicucore.dylib, 0x00000001)
  dlopen_internal(/usr/lib/libicucore.dylib) ==> 0x7fb8ace04e10
dlsym_internal(0x7fb8ace04e10, u_charsToUChars)
  dlsym_internal(0x7fb8ace04e10, u_charsToUChars) ==> 0x7fff2250fb0b
dlsym_internal(0x7fb8ace04e10, u_getVersion)
  dlsym_internal(0x7fb8ace04e10, u_getVersion) ==> 0x7fff224bdbc8
dlsym_internal(0x7fb8ace04e10, u_strlen)
  dlsym_internal(0x7fb8ace04e10, u_strlen) ==> 0x7fff22540178
dlsym_internal(0x7fb8ace04e10, u_strncpy)
  dlsym_internal(0x7fb8ace04e10, u_strncpy) ==> 0x7fff22540d94
dlsym_internal(0x7fb8ace04e10, u_tolower)
  dlsym_internal(0x7fb8ace04e10, u_tolower) ==> 0x7fff224df0de
dlsym_internal(0x7fb8ace04e10, u_toupper)
  dlsym_internal(0x7fb8ace04e10, u_toupper) ==> 0x7fff224df0e8
dlsym_internal(0x7fb8ace04e10, ucal_add)
  dlsym_internal(0x7fb8ace04e10, ucal_add) ==> 0x7fff2265b472
dlsym_internal(0x7fb8ace04e10, ucal_close)
  dlsym_internal(0x7fb8ace04e10, ucal_close) ==> 0x7fff2265ae52
dlsym_internal(0x7fb8ace04e10, ucal_get)
  dlsym_internal(0x7fb8ace04e10, ucal_get) ==> 0x7fff2265b49c
dlsym_internal(0x7fb8ace04e10, ucal_getAttribute)
  dlsym_internal(0x7fb8ace04e10, ucal_getAttribute) ==> 0x7fff2265b34d
dlsym_internal(0x7fb8ace04e10, ucal_getKeywordValuesForLocale)
  dlsym_internal(0x7fb8ace04e10, ucal_getKeywordValuesForLocale) ==> 0x7fff2265b752
dlsym_internal(0x7fb8ace04e10, ucal_getLimit)
  dlsym_internal(0x7fb8ace04e10, ucal_getLimit) ==> 0x7fff2265b4da
dlsym_internal(0x7fb8ace04e10, ucal_getTimeZoneDisplayName)
  dlsym_internal(0x7fb8ace04e10, ucal_getTimeZoneDisplayName) ==> 0x7fff2265b09c
dlsym_internal(0x7fb8ace04e10, ucal_open)
  dlsym_internal(0x7fb8ace04e10, ucal_open) ==> 0x7fff2265acf1
dlsym_internal(0x7fb8ace04e10, ucal_set)
  dlsym_internal(0x7fb8ace04e10, ucal_set) ==> 0x7fff2265b4b2
dlsym_internal(0x7fb8ace04e10, ucol_close)
  dlsym_internal(0x7fb8ace04e10, ucol_close) ==> 0x7fff2265c4cb
dlsym_internal(0x7fb8ace04e10, ucol_closeElements)
  dlsym_internal(0x7fb8ace04e10, ucol_closeElements) ==> 0x7fff2265f5ee
dlsym_internal(0x7fb8ace04e10, ucol_getOffset)
  dlsym_internal(0x7fb8ace04e10, ucol_getOffset) ==> 0x7fff2265fb62
dlsym_internal(0x7fb8ace04e10, ucol_getRules)
  dlsym_internal(0x7fb8ace04e10, ucol_getRules) ==> 0x7fff2265c9fd
dlsym_internal(0x7fb8ace04e10, ucol_getSortKey)
  dlsym_internal(0x7fb8ace04e10, ucol_getSortKey) ==> 0x7fff2265c62d
dlsym_internal(0x7fb8ace04e10, ucol_getStrength)
  dlsym_internal(0x7fb8ace04e10, ucol_getStrength) ==> 0x7fff2265c84e
dlsym_internal(0x7fb8ace04e10, ucol_getVersion)
  dlsym_internal(0x7fb8ace04e10, ucol_getVersion) ==> 0x7fff2265c8bd
dlsym_internal(0x7fb8ace04e10, ucol_next)
  dlsym_internal(0x7fb8ace04e10, ucol_next) ==> 0x7fff2265f61a
dlsym_internal(0x7fb8ace04e10, ucol_previous)
  dlsym_internal(0x7fb8ace04e10, ucol_previous) ==> 0x7fff2265f7c9
dlsym_internal(0x7fb8ace04e10, ucol_open)
  dlsym_internal(0x7fb8ace04e10, ucol_open) ==> 0x7fff2265de9d
dlsym_internal(0x7fb8ace04e10, ucol_openElements)
  dlsym_internal(0x7fb8ace04e10, ucol_openElements) ==> 0x7fff2265f4fa
dlsym_internal(0x7fb8ace04e10, ucol_openRules)
  dlsym_internal(0x7fb8ace04e10, ucol_openRules) ==> 0x7fff2256640c
dlsym_internal(0x7fb8ace04e10, ucol_safeClone)
  dlsym_internal(0x7fb8ace04e10, ucol_safeClone) ==> 0x7fff2265c477
dlsym_internal(0x7fb8ace04e10, ucol_setAttribute)
  dlsym_internal(0x7fb8ace04e10, ucol_setAttribute) ==> 0x7fff2265c7e1
dlsym_internal(0x7fb8ace04e10, ucol_strcoll)
  dlsym_internal(0x7fb8ace04e10, ucol_strcoll) ==> 0x7fff2265c8ff
dlsym_internal(0x7fb8ace04e10, udat_close)
  dlsym_internal(0x7fb8ace04e10, udat_close) ==> 0x7fff22660065
dlsym_internal(0x7fb8ace04e10, udat_countSymbols)
  dlsym_internal(0x7fb8ace04e10, udat_countSymbols) ==> 0x7fff2266129b
dlsym_internal(0x7fb8ace04e10, udat_getSymbols)
  dlsym_internal(0x7fb8ace04e10, udat_getSymbols) ==> 0x7fff22660c28
dlsym_internal(0x7fb8ace04e10, udat_open)
  dlsym_internal(0x7fb8ace04e10, udat_open) ==> 0x7fff2265fde6
dlsym_internal(0x7fb8ace04e10, udat_setCalendar)
  dlsym_internal(0x7fb8ace04e10, udat_setCalendar) ==> 0x7fff2266080f
dlsym_internal(0x7fb8ace04e10, udat_toPattern)
  dlsym_internal(0x7fb8ace04e10, udat_toPattern) ==> 0x7fff226609e6
dlsym_internal(0x7fb8ace04e10, udatpg_close)
  dlsym_internal(0x7fb8ace04e10, udatpg_close) ==> 0x7fff226621ee
dlsym_internal(0x7fb8ace04e10, udatpg_getBestPattern)
  dlsym_internal(0x7fb8ace04e10, udatpg_getBestPattern) ==> 0x7fff22662213
dlsym_internal(0x7fb8ace04e10, udatpg_open)
  dlsym_internal(0x7fb8ace04e10, udatpg_open) ==> 0x7fff22662148
dlsym_internal(0x7fb8ace04e10, uenum_close)
  dlsym_internal(0x7fb8ace04e10, uenum_close) ==> 0x7fff2250db09
dlsym_internal(0x7fb8ace04e10, uenum_count)
  dlsym_internal(0x7fb8ace04e10, uenum_count) ==> 0x7fff2250db51
dlsym_internal(0x7fb8ace04e10, uenum_next)
  dlsym_internal(0x7fb8ace04e10, uenum_next) ==> 0x7fff2250dced
dlsym_internal(0x7fb8ace04e10, uidna_close)
  dlsym_internal(0x7fb8ace04e10, uidna_close) ==> 0x7fff2254faac
dlsym_internal(0x7fb8ace04e10, uidna_nameToASCII)
  dlsym_internal(0x7fb8ace04e10, uidna_nameToASCII) ==> 0x7fff2254fdc4
dlsym_internal(0x7fb8ace04e10, uidna_nameToUnicode)
  dlsym_internal(0x7fb8ace04e10, uidna_nameToUnicode) ==> 0x7fff2254ff14
dlsym_internal(0x7fb8ace04e10, uidna_openUTS46)
  dlsym_internal(0x7fb8ace04e10, uidna_openUTS46) ==> 0x7fff2254faa2
dlsym_internal(0x7fb8ace04e10, uloc_canonicalize)
  dlsym_internal(0x7fb8ace04e10, uloc_canonicalize) ==> 0x7fff22513b2c
dlsym_internal(0x7fb8ace04e10, uloc_countAvailable)
  dlsym_internal(0x7fb8ace04e10, uloc_countAvailable) ==> 0x7fff224a2cc4
dlsym_internal(0x7fb8ace04e10, uloc_getAvailable)
  dlsym_internal(0x7fb8ace04e10, uloc_getAvailable) ==> 0x7fff224a2d4c
dlsym_internal(0x7fb8ace04e10, uloc_getBaseName)
  dlsym_internal(0x7fb8ace04e10, uloc_getBaseName) ==> 0x7fff22513b1a
dlsym_internal(0x7fb8ace04e10, uloc_getCharacterOrientation)
  dlsym_internal(0x7fb8ace04e10, uloc_getCharacterOrientation) ==> 0x7fff224adefc
dlsym_internal(0x7fb8ace04e10, uloc_getCountry)
  dlsym_internal(0x7fb8ace04e10, uloc_getCountry) ==> 0x7fff2251319f
dlsym_internal(0x7fb8ace04e10, uloc_getDefault)
  dlsym_internal(0x7fb8ace04e10, uloc_getDefault) ==> 0x7fff22513011
dlsym_internal(0x7fb8ace04e10, uloc_getDisplayCountry)
  dlsym_internal(0x7fb8ace04e10, uloc_getDisplayCountry) ==> 0x7fff224a3a37
dlsym_internal(0x7fb8ace04e10, uloc_getDisplayLanguage)
  dlsym_internal(0x7fb8ace04e10, uloc_getDisplayLanguage) ==> 0x7fff224a34f9
dlsym_internal(0x7fb8ace04e10, uloc_getDisplayName)
  dlsym_internal(0x7fb8ace04e10, uloc_getDisplayName) ==> 0x7fff224a3e9f
dlsym_internal(0x7fb8ace04e10, uloc_getISO3Country)
  dlsym_internal(0x7fb8ace04e10, uloc_getISO3Country) ==> 0x7fff22513bd0
dlsym_internal(0x7fb8ace04e10, uloc_getISO3Language)
  dlsym_internal(0x7fb8ace04e10, uloc_getISO3Language) ==> 0x7fff22513b3e
dlsym_internal(0x7fb8ace04e10, uloc_getKeywordValue)
  dlsym_internal(0x7fb8ace04e10, uloc_getKeywordValue) ==> 0x7fff22511ecf
dlsym_internal(0x7fb8ace04e10, uloc_getLanguage)
  dlsym_internal(0x7fb8ace04e10, uloc_getLanguage) ==> 0x7fff225130b5
dlsym_internal(0x7fb8ace04e10, uloc_getLCID)
  dlsym_internal(0x7fb8ace04e10, uloc_getLCID) ==> 0x7fff22513c62
dlsym_internal(0x7fb8ace04e10, uloc_getName)
  dlsym_internal(0x7fb8ace04e10, uloc_getName) ==> 0x7fff22513488
dlsym_internal(0x7fb8ace04e10, uloc_getParent)
  dlsym_internal(0x7fb8ace04e10, uloc_getParent) ==> 0x7fff2251301b
dlsym_internal(0x7fb8ace04e10, uloc_setKeywordValue)
  dlsym_internal(0x7fb8ace04e10, uloc_setKeywordValue) ==> 0x7fff225122c1
dlsym_internal(0x7fb8ace04e10, ulocdata_getCLDRVersion)
  dlsym_internal(0x7fb8ace04e10, ulocdata_getCLDRVersion) ==> 0x7fff22519dcc
dlsym_internal(0x7fb8ace04e10, ulocdata_getMeasurementSystem)
  dlsym_internal(0x7fb8ace04e10, ulocdata_getMeasurementSystem) ==> 0x7fff22519c15
dlsym_internal(0x7fb8ace04e10, unorm2_getNFCInstance)
  dlsym_internal(0x7fb8ace04e10, unorm2_getNFCInstance) ==> 0x7fff224b201f
dlsym_internal(0x7fb8ace04e10, unorm2_getNFDInstance)
  dlsym_internal(0x7fb8ace04e10, unorm2_getNFDInstance) ==> 0x7fff224b2035
dlsym_internal(0x7fb8ace04e10, unorm2_getNFKCInstance)
  dlsym_internal(0x7fb8ace04e10, unorm2_getNFKCInstance) ==> 0x7fff2249f537
dlsym_internal(0x7fb8ace04e10, unorm2_getNFKDInstance)
  dlsym_internal(0x7fb8ace04e10, unorm2_getNFKDInstance) ==> 0x7fff2249f575
dlsym_internal(0x7fb8ace04e10, unorm2_isNormalized)
  dlsym_internal(0x7fb8ace04e10, unorm2_isNormalized) ==> 0x7fff224b2738
dlsym_internal(0x7fb8ace04e10, unorm2_normalize)
  dlsym_internal(0x7fb8ace04e10, unorm2_normalize) ==> 0x7fff224b205d
dlsym_internal(0x7fb8ace04e10, unum_close)
  dlsym_internal(0x7fb8ace04e10, unum_close) ==> 0x7fff22666d14
dlsym_internal(0x7fb8ace04e10, unum_getAttribute)
  dlsym_internal(0x7fb8ace04e10, unum_getAttribute) ==> 0x7fff22667acb
dlsym_internal(0x7fb8ace04e10, unum_getSymbol)
  dlsym_internal(0x7fb8ace04e10, unum_getSymbol) ==> 0x7fff22668345
dlsym_internal(0x7fb8ace04e10, unum_open)
  dlsym_internal(0x7fb8ace04e10, unum_open) ==> 0x7fff22666944
dlsym_internal(0x7fb8ace04e10, unum_toPattern)
  dlsym_internal(0x7fb8ace04e10, unum_toPattern) ==> 0x7fff226681ec
dlsym_internal(0x7fb8ace04e10, ures_close)
  dlsym_internal(0x7fb8ace04e10, ures_close) ==> 0x7fff22530adb
dlsym_internal(0x7fb8ace04e10, ures_getByKey)
  dlsym_internal(0x7fb8ace04e10, ures_getByKey) ==> 0x7fff22532a8e
dlsym_internal(0x7fb8ace04e10, ures_getSize)
  dlsym_internal(0x7fb8ace04e10, ures_getSize) ==> 0x7fff22531010
dlsym_internal(0x7fb8ace04e10, ures_getStringByIndex)
  dlsym_internal(0x7fb8ace04e10, ures_getStringByIndex) ==> 0x7fff22531cdd
dlsym_internal(0x7fb8ace04e10, ures_open)
  dlsym_internal(0x7fb8ace04e10, ures_open) ==> 0x7fff22531f6a
dlsym_internal(0x7fb8ace04e10, usearch_close)
  dlsym_internal(0x7fb8ace04e10, usearch_close) ==> 0x7fff2266b4f4
dlsym_internal(0x7fb8ace04e10, usearch_first)
  dlsym_internal(0x7fb8ace04e10, usearch_first) ==> 0x7fff2266c0b9
dlsym_internal(0x7fb8ace04e10, usearch_getMatchedLength)
  dlsym_internal(0x7fb8ace04e10, usearch_getMatchedLength) ==> 0x7fff2266bd73
dlsym_internal(0x7fb8ace04e10, usearch_last)
  dlsym_internal(0x7fb8ace04e10, usearch_last) ==> 0x7fff2266c31e
dlsym_internal(0x7fb8ace04e10, usearch_openFromCollator)
  dlsym_internal(0x7fb8ace04e10, usearch_openFromCollator) ==> 0x7fff2266b220
dlsym_internal(0x7fb8ace04e10, ucol_setMaxVariable)
  dlsym_internal(0x7fb8ace04e10, ucol_setMaxVariable) ==> 0x7fff2265c760
dlsym_internal(0x7fb8ace04e10, ucurr_forLocale)
  dlsym_internal(0x7fb8ace04e10, ucurr_forLocale) ==> 0x7fff22508422
dlsym_internal(0x7fb8ace04e10, ucurr_getName)
  dlsym_internal(0x7fb8ace04e10, ucurr_getName) ==> 0x7fff225086d0
dlsym_internal(0x7fb8ace04e10, uldn_close)
  dlsym_internal(0x7fb8ace04e10, uldn_close) ==> 0x7fff224a7ba8
dlsym_internal(0x7fb8ace04e10, uldn_keyValueDisplayName)
  dlsym_internal(0x7fb8ace04e10, uldn_keyValueDisplayName) ==> 0x7fff224a816e
dlsym_internal(0x7fb8ace04e10, uldn_open)
  dlsym_internal(0x7fb8ace04e10, uldn_open) ==> 0x7fff224a7a90
dlsym_internal(0x7fb8ace1fb50, SystemNative_ConvertErrorPlatformToPal)
  dlsym_internal(0x7fb8ace1fb50, SystemNative_ConvertErrorPlatformToPal) ==> 0x10a897240
dlsym_internal(0x7fb8ace1fb50, SystemNative_Stat)
  dlsym_internal(0x7fb8ace1fb50, SystemNative_Stat) ==> 0x10a898250
dlsym_internal(0x7fb8ace1fb50, SystemNative_LStat)
  dlsym_internal(0x7fb8ace1fb50, SystemNative_LStat) ==> 0x10a8983f0
dlopen_internal(/usr/local/microsoft/powershell/7/libpsl-native.dylib, 0x00000001)
dyld_image_path_containing_address(0x10c70c000)
_dyld_is_memory_immutable(0x10c70c000, 28)
  dlopen_internal(/usr/local/microsoft/powershell/7/libpsl-native.dylib) ==> 0x7fb8acd31fb0
dlsym_internal(0x7fb8acd31fb0, Native_OpenLog)
  dlsym_internal(0x7fb8acd31fb0, Native_OpenLog) ==> 0x10c70ec10
dlsym_internal(0x7fb8ace1fb50, SystemNative_Stat)
  dlsym_internal(0x7fb8ace1fb50, SystemNative_Stat) ==> 0x10a898250
dlsym_internal(0x7fb8ace1fb50, SystemNative_ConvertErrorPlatformToPal)
  dlsym_internal(0x7fb8ace1fb50, SystemNative_ConvertErrorPlatformToPal) ==> 0x10a897240
dlsym_internal(0x7fb8ace1fb50, SystemNative_Open)
  dlsym_internal(0x7fb8ace1fb50, SystemNative_Open) ==> 0x10a898490
dlsym_internal(0x7fb8ace1fb50, SystemNative_FStat)
  dlsym_internal(0x7fb8ace1fb50, SystemNative_FStat) ==> 0x10a898320
dlsym_internal(0x7fb8ace1fb50, SystemNative_FLock)
  dlsym_internal(0x7fb8ace1fb50, SystemNative_FLock) ==> 0x10a898b90
dlsym_internal(0x7fb8ace1fb50, SystemNative_LSeek)
  dlsym_internal(0x7fb8ace1fb50, SystemNative_LSeek) ==> 0x10a898c10
dlsym_internal(0x7fb8ace1fb50, SystemNative_Read)
  dlsym_internal(0x7fb8ace1fb50, SystemNative_Read) ==> 0x10a8993b0
dlsym_internal(0x7fb8ace1fb50, SystemNative_FStat)
  dlsym_internal(0x7fb8ace1fb50, SystemNative_FStat) ==> 0x10a898320
dlsym_internal(0x7fb8ace1fb50, SystemNative_SysConf)
  dlsym_internal(0x7fb8ace1fb50, SystemNative_SysConf) ==> 0x10a898dc0
dlsym_internal(0x7fb8ace1fb50, SystemNative_MMap)
  dlsym_internal(0x7fb8ace1fb50, SystemNative_MMap) ==> 0x10a898ce0
dlsym_internal(0x7fb8ace1fb50, SystemNative_MAdvise)
  dlsym_internal(0x7fb8ace1fb50, SystemNative_MAdvise) ==> 0x10a898d50
dlsym_internal(0x7fb8ace1fb50, SystemNative_FLock)
  dlsym_internal(0x7fb8ace1fb50, SystemNative_FLock) ==> 0x10a898b90
dlsym_internal(0x7fb8ace1fb50, SystemNative_Close)
  dlsym_internal(0x7fb8ace1fb50, SystemNative_Close) ==> 0x10a898530
dlsym_internal(0x7fb8ace1fb50, SystemNative_MSync)
  dlsym_internal(0x7fb8ace1fb50, SystemNative_MSync) ==> 0x10a898d80
dlsym_internal(0x7fb8ace1fb50, SystemNative_MUnmap)
  dlsym_internal(0x7fb8ace1fb50, SystemNative_MUnmap) ==> 0x10a898d40
dlsym_internal(0x7fb8ace1fb50, SystemNative_GetNonCryptographicallySecureRandomBytes)
  dlsym_internal(0x7fb8ace1fb50, SystemNative_GetNonCryptographicallySecureRandomBytes) ==> 0x10a89e2a0
dlopen_internal(/usr/local/microsoft/powershell/7//usr/lib/libobjc.dylib, 0x00000001)
  dlopen_internal() failed, error: 'dlopen(/usr/local/microsoft/powershell/7//usr/lib/libobjc.dylib, 1): image not found'
dlerror()
dlopen_internal(/usr/lib/libobjc.dylib, 0x00000001)
  dlopen_internal(/usr/lib/libobjc.dylib) ==> 0x200a96b80
dlsym_internal(0x200a96b80, objc_getClass)
  dlsym_internal(0x200a96b80, objc_getClass) ==> 0x7fff201f98b4
dlsym_internal(0x200a96b80, sel_getUid)
  dlsym_internal(0x200a96b80, sel_getUid) ==> 0x7fff20201561
dlsym_internal(0x200a96b80, objc_msgSend)
  dlsym_internal(0x200a96b80, objc_msgSend) ==> 0x7fff201f5bc0
dlsym_internal(0x200a96b80, objc_msgSend_stret)
  dlsym_internal(0x200a96b80, objc_msgSend_stret) ==> 0x7fff201f6380
dlopen_internal(NULL, 0x00000110)
_dyld_image_count()
_dyld_get_image_header(0)
dlopen_internal(/usr/lib/system/libsystem_sandbox.dylib, 0x00000100)
  dlopen_internal(/usr/lib/system/libsystem_sandbox.dylib) ==> 0x200a96291
dlsym_internal(0x200a96291, sandbox_requests_integrity_protection_for_preference_domain)
  dlsym_internal(0x200a96291, sandbox_requests_integrity_protection_for_preference_domain) ==> 0x7fff29247d50
_dyld_is_memory_immutable(0x7fff2082e473, 50)
_dyld_is_memory_immutable(0x7fff208404a1, 26)
_dyld_is_memory_immutable(0x7fff20840aa7, 25)
_dyld_is_memory_immutable(0x7fff200dca47, 24)
dlsym_internal(0x7fb8ace1fb50, SystemNative_GetOSArchitecture)
  dlsym_internal(0x7fb8ace1fb50, SystemNative_GetOSArchitecture) ==> 0x10a89e510
dlsym_internal(0x7fb8ace1fb50, SystemNative_GetProcessArchitecture)
  dlsym_internal(0x7fb8ace1fb50, SystemNative_GetProcessArchitecture) ==> 0x10a89e520
dlsym_internal(0x7fb8ace1fb50, SystemNative_GetUnixVersion)
  dlsym_internal(0x7fb8ace1fb50, SystemNative_GetUnixVersion) ==> 0x10a89e450
dlsym_internal(0x7fb8acd31fb0, Native_SysLog)
  dlsym_internal(0x7fb8acd31fb0, Native_SysLog) ==> 0x10c70ea70
dlsym_internal(0x7fb8ace1fb50, SystemNative_IsATty)
  dlsym_internal(0x7fb8ace1fb50, SystemNative_IsATty) ==> 0x10a89f250
dlsym_internal(0x7fb8ace1fb50, SystemNative_Dup)
  dlsym_internal(0x7fb8ace1fb50, SystemNative_Dup) ==> 0x10a898540
dlsym_internal(0x7fb8ace1fb50, SystemNative_ConvertErrorPlatformToPal)
  dlsym_internal(0x7fb8ace1fb50, SystemNative_ConvertErrorPlatformToPal) ==> 0x10a897240
dlsym_internal(0x7fb8ace1fb50, SystemNative_InitializeTerminalAndSignalHandling)
  dlsym_internal(0x7fb8ace1fb50, SystemNative_InitializeTerminalAndSignalHandling) ==> 0x10a89fc80
dladdr(0x10a89f2e0, 0x30529a630)
dlsym_internal(0x7fb8ace1fb50, SystemNative_SetTerminalInvalidationHandler)
  dlsym_internal(0x7fb8ace1fb50, SystemNative_SetTerminalInvalidationHandler) ==> 0x10a89e660
dlsym_internal(0x7fb8ace1fb50, SystemNative_Open)
  dlsym_internal(0x7fb8ace1fb50, SystemNative_Open) ==> 0x10a898490
dlsym_internal(0x7fb8ace1fb50, SystemNative_LSeek)
  dlsym_internal(0x7fb8ace1fb50, SystemNative_LSeek) ==> 0x10a898c10
dlsym_internal(0x7fb8ace1fb50, SystemNative_Read)
  dlsym_internal(0x7fb8ace1fb50, SystemNative_Read) ==> 0x10a8993b0
dlsym_internal(0x7fb8ace1fb50, SystemNative_SetKeypadXmit)
  dlsym_internal(0x7fb8ace1fb50, SystemNative_SetKeypadXmit) ==> 0x10a89f260
dlsym_internal(0x7fb8ace1fb50, SystemNative_GetControlCharacters)
  dlsym_internal(0x7fb8ace1fb50, SystemNative_GetControlCharacters) ==> 0x10a89f870
dlsym_internal(0x7fb8ace1fb50, SystemNative_RegisterForCtrl)
  dlsym_internal(0x7fb8ace1fb50, SystemNative_RegisterForCtrl) ==> 0x10a89e5e0
dlsym_internal(0x7fb8ace1fb50, SystemNative_GetDomainName)
  dlsym_internal(0x7fb8ace1fb50, SystemNative_GetDomainName) ==> 0x10a89a1a0
dlsym_internal(0x7fb8ace1fb50, SystemNative_GetHostName)
  dlsym_internal(0x7fb8ace1fb50, SystemNative_GetHostName) ==> 0x10a89a1b0
dlsym_internal(0x7fb8ace1fb50, SystemNative_GetPid)
  dlsym_internal(0x7fb8ace1fb50, SystemNative_GetPid) ==> 0x10a89e0c0
dlopen_internal(/usr/local/microsoft/powershell/7//usr/lib/libproc.dylib, 0x00000001)
  dlopen_internal() failed, error: 'dlopen(/usr/local/microsoft/powershell/7//usr/lib/libproc.dylib, 1): image not found'
dlerror()
dlopen_internal(/usr/lib/libproc.dylib, 0x00000001)
  dlopen_internal(/usr/lib/libproc.dylib) ==> 0x200a94320
dlsym_internal(0x200a94320, proc_pidinfo)
  dlsym_internal(0x200a94320, proc_pidinfo) ==> 0x7fff20325ed0
dlsym_internal(0x7fb8ace1fb50, SystemNative_Stat)
  dlsym_internal(0x7fb8ace1fb50, SystemNative_Stat) ==> 0x10a898250
dlsym_internal(0x7fb8ace1fb50, SystemNative_ReadLink)
  dlsym_internal(0x7fb8ace1fb50, SystemNative_ReadLink) ==> 0x10a899410
dlsym_internal(0x7fb8ace1fb50, SystemNative_GetReadDirRBufferSize)
  dlsym_internal(0x7fb8ace1fb50, SystemNative_GetReadDirRBufferSize) ==> 0x10a8985f0
dlsym_internal(0x7fb8ace1fb50, SystemNative_OpenDir)
  dlsym_internal(0x7fb8ace1fb50, SystemNative_OpenDir) ==> 0x10a8986a0
dlsym_internal(0x7fb8ace1fb50, SystemNative_ReadDirR)
  dlsym_internal(0x7fb8ace1fb50, SystemNative_ReadDirR) ==> 0x10a898600
dlsym_internal(0x7fb8ace1fb50, SystemNative_CloseDir)
  dlsym_internal(0x7fb8ace1fb50, SystemNative_CloseDir) ==> 0x10a8986b0
_dyld_is_memory_immutable(0x7fff202af3a0, 26)
dlsym_internal(0x7fb8ace1fb50, SystemNative_GetSid)
  dlsym_internal(0x7fb8ace1fb50, SystemNative_GetSid) ==> 0x10a89e0d0
dlsym_internal(0x200a94320, proc_pidinfo)
  dlsym_internal(0x200a94320, proc_pidinfo) ==> 0x7fff20325ed0
dlsym_internal(0x200a94320, proc_pidinfo)
  dlsym_internal(0x200a94320, proc_pidinfo) ==> 0x7fff20325ed0
dlsym_internal(0x7fb8ace1fb50, SystemNative_Unlink)
  dlsym_internal(0x7fb8ace1fb50, SystemNative_Unlink) ==> 0x10a898580
dlsym_internal(0x7fb8ace1fb50, SystemNative_Socket)
  dlsym_internal(0x7fb8ace1fb50, SystemNative_Socket) ==> 0x10a89bee0
dlsym_internal(0x7fb8ace1fb50, SystemNative_CreateSocketEventPort)
  dlsym_internal(0x7fb8ace1fb50, SystemNative_CreateSocketEventPort) ==> 0x10a89c2e0
dlsym_internal(0x7fb8ace1fb50, SystemNative_CreateSocketEventBuffer)
  dlsym_internal(0x7fb8ace1fb50, SystemNative_CreateSocketEventBuffer) ==> 0x10a89c350
dlsym_internal(0x7fb8ace1fb50, SystemNative_WaitForSocketEvents)
  dlsym_internal(0x7fb8ace1fb50, SystemNative_WaitForSocketEvents) ==> 0x10a89c4f0
dlsym_internal(0x7fb8ace1fb50, SystemNative_GetDomainSocketSizes)
  dlsym_internal(0x7fb8ace1fb50, SystemNative_GetDomainSocketSizes) ==> 0x10a89c700
dlsym_internal(0x7fb8ace1fb50, SystemNative_Socket)
  dlsym_internal(0x7fb8ace1fb50, SystemNative_Socket) ==> 0x10a89bee0
dlsym_internal(0x7fb8ace1fb50, SystemNative_SetAddressFamily)
  dlsym_internal(0x7fb8ace1fb50, SystemNative_SetAddressFamily) ==> 0x10a89a2d0
dlsym_internal(0x7fb8ace1fb50, SystemNative_GetAddressFamily)
  dlsym_internal(0x7fb8ace1fb50, SystemNative_GetAddressFamily) ==> 0x10a89a1f0
dlsym_internal(0x7fb8ace1fb50, SystemNative_SetAddressFamily)
  dlsym_internal(0x7fb8ace1fb50, SystemNative_SetAddressFamily) ==> 0x10a89a2d0
dlsym_internal(0x7fb8ace1fb50, SystemNative_Bind)
  dlsym_internal(0x7fb8ace1fb50, SystemNative_Bind) ==> 0x10a89b090
dlsym_internal(0x7fb8ace1fb50, SystemNative_Listen)
  dlsym_internal(0x7fb8ace1fb50, SystemNative_Listen) ==> 0x10a89b230
dlsym_internal(0x7fb8ace1fb50, SystemNative_FcntlSetIsNonBlocking)
  dlsym_internal(0x7fb8ace1fb50, SystemNative_FcntlSetIsNonBlocking) ==> 0x10a8989d0
dlsym_internal(0x7fb8ace1fb50, SystemNative_Accept)
  dlsym_internal(0x7fb8ace1fb50, SystemNative_Accept) ==> 0x10a89af90
dlsym_internal(0x7fb8ace1fb50, SystemNative_TryChangeSocketEventRegistration)
  dlsym_internal(0x7fb8ace1fb50, SystemNative_TryChangeSocketEventRegistration) ==> 0x10a89c3b0
dlsym_internal(0x7fb8ace1fb50, SystemNative_Access)
  dlsym_internal(0x7fb8ace1fb50, SystemNative_Access) ==> 0x10a898c00
dlsym_internal(0x7fb8ace1fb50, SystemNative_GetHostName)
  dlsym_internal(0x7fb8ace1fb50, SystemNative_GetHostName) ==> 0x10a89a1b0
dlsym_internal(0x7fb8ace1fb50, SystemNative_GetEUid)
  dlsym_internal(0x7fb8ace1fb50, SystemNative_GetEUid) ==> 0x10a89f090
dlsym_internal(0x7fb8ace1fb50, SystemNative_GetPwUidR)
  dlsym_internal(0x7fb8ace1fb50, SystemNative_GetPwUidR) ==> 0x10a89ee90
dlsym_internal(0x7fb8ace1fb50, SystemNative_GetAllMountPoints)
  dlsym_internal(0x7fb8ace1fb50, SystemNative_GetAllMountPoints) ==> 0x10a899940
dlsym_internal(0x7fb8ace1fb50, SystemNative_ConvertErrorPlatformToPal)
  dlsym_internal(0x7fb8ace1fb50, SystemNative_ConvertErrorPlatformToPal) ==> 0x10a897240
dlsym_internal(0x7fb8ace1fb50, SystemNative_GetFormatInfoForMountPoint)
  dlsym_internal(0x7fb8ace1fb50, SystemNative_GetFormatInfoForMountPoint) ==> 0x10a899a60
dlsym_internal(0x7fb8ace1fb50, SystemNative_ConvertErrorPalToPlatform)
  dlsym_internal(0x7fb8ace1fb50, SystemNative_ConvertErrorPalToPlatform) ==> 0x10a897260
dlsym_internal(0x7fb8ace1fb50, SystemNative_GetCwd)
  dlsym_internal(0x7fb8ace1fb50, SystemNative_GetCwd) ==> 0x10a89e270
dlsym_internal(0x7fb8ace1fb50, SystemNative_OpenDir)
  dlsym_internal(0x7fb8ace1fb50, SystemNative_OpenDir) ==> 0x10a8986a0
dlsym_internal(0x7fb8ace1fb50, SystemNative_GetReadDirRBufferSize)
  dlsym_internal(0x7fb8ace1fb50, SystemNative_GetReadDirRBufferSize) ==> 0x10a8985f0
dlsym_internal(0x7fb8ace1fb50, SystemNative_ReadDirR)
  dlsym_internal(0x7fb8ace1fb50, SystemNative_ReadDirR) ==> 0x10a898600
dlsym_internal(0x7fb8ace1fb50, SystemNative_Unlink)
  dlsym_internal(0x7fb8ace1fb50, SystemNative_Unlink) ==> 0x10a898580
dlsym_internal(0x7fb8ace1fb50, SystemNative_CloseDir)
  dlsym_internal(0x7fb8ace1fb50, SystemNative_CloseDir) ==> 0x10a8986b0
dlsym_internal(0x7fb8ace1fb50, SystemNative_GetEUid)
  dlsym_internal(0x7fb8ace1fb50, SystemNative_GetEUid) ==> 0x10a89f090
dlsym_internal(0x7fb8ace1fb50, SystemNative_GetEGid)
  dlsym_internal(0x7fb8ace1fb50, SystemNative_GetEGid) ==> 0x10a89f0a0
dlsym_internal(0x7fb8ace1fb50, SystemNative_GetTimestampResolution)
  dlsym_internal(0x7fb8ace1fb50, SystemNative_GetTimestampResolution) ==> 0x10a89ecf0
dlopen_internal(/usr/local/microsoft/powershell/7/libpsrpclient.dylib, 0x00000001)
dlclose(), found unused image 0x7fb8ace3aba0 libpsrpclient.dylib
dlclose(), found unused image 0x7fb8acd71930 libmi.dylib
dlclose(), deleting 0x7fb8ace3aba0 libpsrpclient.dylib
dlclose(), deleting 0x7fb8acd71930 libmi.dylib
  dlopen_internal() failed, error: 'dlopen(/usr/local/microsoft/powershell/7/libpsrpclient.dylib, 1): Library not loaded: /usr/local/opt/openssl@1.1/lib/libssl.1.1.dylib
  Referenced from: /usr/local/microsoft/powershell/7/libmi.dylib
  Reason: no suitable image found.  Did find:
    /usr/local/opt/openssl@1.1/lib/libssl.1.1.dylib: mach-o, but wrong architecture
    /opt/local/lib/libssl.1.1.dylib: mach-o, but wrong architecture'
dlerror()
dlopen_internal(/usr/local/microsoft/powershell/7/libpsrpclient.dylib, 0x00000001)
dlclose(), found unused image 0x7fb8acd71c40 libpsrpclient.dylib
dlclose(), found unused image 0x7fb8acd71930 libmi.dylib
dlclose(), deleting 0x7fb8acd71c40 libpsrpclient.dylib
dlclose(), deleting 0x7fb8acd71930 libmi.dylib
  dlopen_internal() failed, error: 'dlopen(/usr/local/microsoft/powershell/7/libpsrpclient.dylib, 1): Library not loaded: /usr/local/opt/openssl@1.1/lib/libssl.1.1.dylib
  Referenced from: /usr/local/microsoft/powershell/7/libmi.dylib
  Reason: no suitable image found.  Did find:
    /usr/local/opt/openssl@1.1/lib/libssl.1.1.dylib: mach-o, but wrong architecture
    /opt/local/lib/libssl.1.1.dylib: mach-o, but wrong architecture'
dlerror()
dlopen_internal(libpsrpclient.dylib, 0x00000001)
  dlopen_internal() failed, error: 'dlopen(libpsrpclient.dylib, 1): image not found'
dlerror()
dlopen_internal(/usr/local/microsoft/powershell/7/liblibpsrpclient.dylib, 0x00000001)
  dlopen_internal() failed, error: 'dlopen(/usr/local/microsoft/powershell/7/liblibpsrpclient.dylib, 1): image not found'
dlerror()
dlopen_internal(/usr/local/microsoft/powershell/7/liblibpsrpclient.dylib, 0x00000001)
  dlopen_internal() failed, error: 'dlopen(/usr/local/microsoft/powershell/7/liblibpsrpclient.dylib, 1): image not found'
dlerror()
dlopen_internal(liblibpsrpclient.dylib, 0x00000001)
  dlopen_internal() failed, error: 'dlopen(liblibpsrpclient.dylib, 1): image not found'
dlerror()
dlopen_internal(/usr/local/microsoft/powershell/7/libpsrpclient, 0x00000001)
  dlopen_internal() failed, error: 'dlopen(/usr/local/microsoft/powershell/7/libpsrpclient, 1): image not found'
dlerror()
dlopen_internal(/usr/local/microsoft/powershell/7/libpsrpclient, 0x00000001)
  dlopen_internal() failed, error: 'dlopen(/usr/local/microsoft/powershell/7/libpsrpclient, 1): image not found'
dlerror()
dlopen_internal(libpsrpclient, 0x00000001)
  dlopen_internal() failed, error: 'dlopen(libpsrpclient, 1): image not found'
dlerror()
dlopen_internal(/usr/local/microsoft/powershell/7/liblibpsrpclient, 0x00000001)
  dlopen_internal() failed, error: 'dlopen(/usr/local/microsoft/powershell/7/liblibpsrpclient, 1): image not found'
dlerror()
dlopen_internal(/usr/local/microsoft/powershell/7/liblibpsrpclient, 0x00000001)
  dlopen_internal() failed, error: 'dlopen(/usr/local/microsoft/powershell/7/liblibpsrpclient, 1): image not found'
dlerror()
dlopen_internal(liblibpsrpclient, 0x00000001)
  dlopen_internal() failed, error: 'dlopen(liblibpsrpclient, 1): image not found'
dlerror()
dlopen_internal(/usr/local/microsoft/powershell/7/osx-x64/libpsrpclient.dylib, 0x00000001)
  dlopen_internal() failed, error: 'dlopen(/usr/local/microsoft/powershell/7/osx-x64/libpsrpclient.dylib, 1): image not found'
dlerror()
dlopen_internal(Microsoft.DiaSymReader.Native.amd64.dll, 0x00000001)
  dlopen_internal() failed, error: 'dlopen(Microsoft.DiaSymReader.Native.amd64.dll, 1): image not found'
dlopen_internal(/usr/local/microsoft/powershell/7/Microsoft.DiaSymReader.Native.amd64.dll, 0x00000001)
  dlopen_internal() failed, error: 'dlopen(/usr/local/microsoft/powershell/7/Microsoft.DiaSymReader.Native.amd64.dll, 1): image not found'
dlsym_internal(0x7fb8ace1fb50, SystemNative_GetWindowSize)
  dlsym_internal(0x7fb8ace1fb50, SystemNative_GetWindowSize) ==> 0x10a89f220
dlsym_internal(0x7fb8ace1fb50, SystemNative_Write)
  dlsym_internal(0x7fb8ace1fb50, SystemNative_Write) ==> 0x10a8994c0
Enter-PSSession: This parameter set requires WSMan, and no supported WSMan client library was found. WSMan is either not installed or unavailable for this system.
dlsym_internal(0x7fb8ace1fb50, SystemNative_SetLingerOption)
  dlsym_internal(0x7fb8ace1fb50, SystemNative_SetLingerOption) ==> 0x10a89a940
dlsym_internal(0x7fb8ace1fb50, SystemNative_ConvertErrorPlatformToPal)
  dlsym_internal(0x7fb8ace1fb50, SystemNative_ConvertErrorPlatformToPal) ==> 0x10a897240
dlsym_internal(0x7fb8ace1fb50, SystemNative_Close)
  dlsym_internal(0x7fb8ace1fb50, SystemNative_Close) ==> 0x10a898530
dlsym_internal(0x7fb8ace1fb50, SystemNative_ConvertErrorPalToPlatform)
  dlsym_internal(0x7fb8ace1fb50, SystemNative_ConvertErrorPalToPlatform) ==> 0x10a897260
dlsym_internal(0x7fb8ace1fb50, SystemNative_StrErrorR)
  dlsym_internal(0x7fb8ace1fb50, SystemNative_StrErrorR) ==> 0x10a8976b0
dlclose(0x7fb8acc05b60)
jborean93 commented 3 years ago

Unfortunately the next step is to look into compiling the components yourself. The repo for my fork shows you how to do that for libpsrpclient and libmi but your error would also indicate this is an issue with the openssl build that’s present as well.

kai-h commented 3 years ago

From what I understand of Rosetta 2, the entire stack has to be either x86_64 or arm64. You can't, for example, launch the pwsh binary as arm64 and have it call the OpenSSL libraries as x86_64. On my M1 Mac, I was able to get MacPorts installed with no problems, and then when I installed the dependencies for PowerShell, the libraries were, by default, installed as arm64: e.g.:

kai@hobbes-M1 lib % file /usr/local/opt/openssl/lib/libssl.1.0.0.dylib
/usr/local/opt/openssl/lib/libssl.1.0.0.dylib: Mach-O 64-bit dynamically linked shared library arm64

or

kai@hobbes-M1 ~ % sudo port -v installed openssl 
Password:
The following ports are currently installed:
  openssl @1.1.1i_0 (active) platform='darwin 20' archs='arm64' date='2020-12-15T09:15:25+1100'

The precompiled package releases of PowerShell however are x86_64:

kai@hobbes-M1 lib % file /usr/local/bin/pwsh
/usr/local/bin/pwsh: Mach-O 64-bit executable x86_64

So, Terminal.app can launch x86_64 binaries on arm64 without needing Terminal to run entirely in Rosetta, but then from what I understand, every single shared library that pwsh needs to use, must also be x86_64, or pwsh needs to be recompiled as arm64, along with every shared library.

kai-h commented 3 years ago

To install a port for an alternative CPU architecture on an M1 Mac, you can use the following:

sudo port install openssl10 +universal

This will then install universal binary versions (at the time of writing, that means arm64 and x86_64, not i386 nor any ppc variant)

jborean93 commented 3 years ago

Thanks for the great info there, it would indicate you need the x86_64 OpenSSL libs in /usr/local/opt/openssl@1.1/lib/*. I'm honestly never used MacPorts but it does sound like that would work. For brew you may want to try arch -x86_64 brew install openssl to install the x86_64 library that PowerShell would require. The libmi and libpsrpclient libraries provided by my fork should be pure x86_64 as I haven't built them for arm64/universal yet.

It does sound like I need to look into compiling a universal library in the future as once PowerShell releases an arm64 build this would be required but the OpenSSL requirement will be tricky to achieve as the location is no longer expected to be /usr/local/opt/openssl/lib/*.

kai-h commented 3 years ago

Yeah, it's very frustrating that some of the libraries used by PowerShell have these hard-coded library paths inside them. While the PowerShell team at Microsoft seem to be quite open to ensuring PowerShell works on non-Windows platforms, it seems that the teams developing these supporting libraries aren't really embracing the concept of cross-platform support.

re: MacPorts / Homebrew - I use MacPorts myself, but I'm of the understanding that Homebrew can have some problems installing older versions of OpenSSL, whereas this is fairly straightforward with MacPorts. The downside to using MacPorts is that you still need to symlink the libraries to where they're expected to be from a Homebrew installation

sudo mkdir -p /usr/local/opt/openssl
sudo ln -s /opt/local/lib/openssl-1.0 /usr/local/opt/openssl/lib

Now that I have it working at a level such that I can administer Microsoft 365 from my Apple Silicon Mac, the next step for me is to explore what can be done to get remoting working with Modern Authentication...

jborean93 commented 3 years ago

Yeah, it's very frustrating that some of the libraries used by PowerShell have these hard-coded library paths inside them.

I mentioned before why the path is hardcoded and why I also continued the practice for my forked copy in https://github.com/PowerShell/PowerShell/issues/5561#issuecomment-747779842. TLDR: without LD_LIBRARY_PATH being set to your OpenSSL lib path (not done by default) then you cannot use a dynamic PATH.

This is because brew (and I assume MacPorts) will install the OpenSSL lib into a path that isn't automatically looked so so the default install will fail for the majority of users and expecting them to set an env var like LD_LIBRARY_PATH is IMO bad user experience (the alternative isn't that great as well). Luckily if you wish to make it relative you can use install_name_tool to change the path.

but I'm of the understanding that Homebrew can have some problems installing older versions of OpenSSL,

Yea they only offer OpenSSL 1.1.x and no longer provider 1.0.x without using a custom formula. This is problematic for the builtin version of mi as it has been compiled against 1.0.x. This doesn't affect me because my fork was compiled against 1.1.x allowing it to work with what is installed with brew (and actually not ancient :)).

the next step for me is to explore what can be done to get remoting working with Modern Authentication...

I can't speak for the one builtin to PowerShell but this should work for my fork, I've had some explicit tests for this. I remember the builtin mi library had a hardcoded password limt of 1KiB characters and when testing EXO modern auth, the JWT tokens were exceeding that. The fork increases that limit to 8KiB which is about the max size for HTTP headers allowing me to use modern auth.

kai-h commented 3 years ago

Thanks for that, Jordan. I will have to give your fork a go now that I have the rest of the x86_64 architecture working under Rosetta. I found the whole hardcoded library path thing frustrating because at the time I initially looked into this, back in 2017/2018, Apple were still installing the OpenSSL 1.0 libraries as a part of the default install for macOS. At that point, it would have been good if PowerShell was able to use the libraries supplied by Apple, instating of needing another dependency. Having said that, your reason does make sense, particularly as LD_LIBRARY_PATH isn't set by default on current versions of macOS.

jborean93 commented 3 years ago

Apple were still installing the OpenSSL 1.0 libraries as a part of the default install for macOS

They did provide OpenSSL but it was even older at 0.9.8 which is even more fun. With macOS 10.11 (2015) they adopted LibreSSL 2.8.3 instead of OpenSSL which modernized things a bit but even then the library has stayed static (still on that version). I believe there are limitations with this library but I've honestly never really tried it out. There are indications that using these libraries are deprecated by Apple and they state you should be using their own framework Secure Transport.

What I'm hoping to do with my fork is to change the Install-WSMan command to dynamically set the OpenSSL lib path based on

This means that if you've installed OpenSSL with either brew or ports then Install-WSMan should just work. The only caveat is that you need the correct arch to be installed. Right now PowerShell is x86_64 so you need the x86_64 OpenSSL libs to be present.

jborean93 commented 3 years ago

@fatherofinvention so I was finally able to get my hands on an M1 Mac Mini to try this all out. I was able to get it all working thanks to the information @kai-h has provided. Basically PowerShell is compiled against x86_64 as well as the libmi.dylib and libpsrpclient.dylib that is included with PowerShell (and my fork). The only missing link here is libssl and libcrypto which I was able to get working by using the x86_64 brew to install OpenSSL:

# Enter x86_64 bash (Rosetta 2)
arch -x86_64 bash

# Install brew for this architecture (seems to run side by side with the arm64 one)
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

# Use that brew to install the x86_64 openssl
brew install openssl

Note: for others reading this works with my fork, you will have to find another way (port) to install OpenSSL 1.0.0 for the builtin PowerShell version.

There might be another way to get the arm64 brew to install the x86_64 libs but I'm unsure. For now I have both versions installed and luckily they use different directories so they don't impact each other too much. Once the x86_64 libs were installed and present in /usr/local/opt/openssl@1.1/lib/* then PowerShell was able to load the libraries.

PS /Users/jborean> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      7.1.2
PSEdition                      Core
GitCommitId                    7.1.2
OS                             Darwin 20.3.0 Darwin Kernel Version 20.3.0: Thu Jan 21 00:06:51 PST 2021; root:xnu-7195.81.3~1/RELEASE_ARM64_T8101
Platform                       Unix
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

PS /Users/jborean> Get-WSManVersion

MI        PSRP
--        ----
2.1.0.590 2.1.0.590
fatherofinvention commented 3 years ago

@jborean93 and @kai-h - thank you both. A ton of great info here.

@jborean93 - Were you able to actually get into a remote session? I got as far as you did but once I tried to use Enter-PSSession I got the following error on my M1 MacBook Air but opening a PSSession to the same PC from my Windows laptop on PowerShell 5.1 worked.

Enter-PSSession: Connecting to remote server PC01 failed with the following error message : MI_RESULT_FAILED For more information, see the about_Remote_Troubleshooting Help topic.

jborean93 commented 3 years ago

No I didn't actually test it out as I didn't have a Windows host on that same network to check against. macOS is a bit more difficult than the other distro's as it does not support NTLM authentication. You effectively have to make sure that Kerberos is set up and your are dealing with FQDN when connecting to your Windows host. The username format also needs to be in the UPN form username@REALM.COM as the Netlogon form won't work. This isn't anything unique to M1 but rather how the macOS NTLM implementation is mostly broken and OMI can't use it without some large restructuring.

kai-h commented 3 years ago

Using these details, I was able to successfully establish a remote session to MS365 from an M1 MacBook Pro. I installed the x86_64 package of PowerShell, installed the native version of MacPorts, and then installed a universal version of OpenSSH 1.0. I created the symlink as detailed above and then could successfully connect to MS365 / Exchange Online (but not using MFA, only legacy auth)

fatherofinvention commented 3 years ago

@jborean93 - Man... I was just about to thank you and close this out by saying I think we are outside the scope of the original issue and then I tried changing the username in my PSCredential object to the UPN form (username@domain.com) based on your last suggestion and IT WORKED! I got connected to a Windows 10 machine running Windows PowerShell 5.1 on my MacBook Air M1 running PowerShell 7.1.2. I am really grateful for the time you took to walk me through this. Here is the command with arguments I used:

Enter-PSSession -ComputerName PC01 -Credential username@domain.com

CleanShot 2021-02-17 at 21 56 04@2x

@jborean93 and @kai-h You guys are awesome. Thanks for all of the help!

jborean93 commented 3 years ago

You're welcome, glad you got it working in the end. I know I probably spruik this too much but if you use my OMI fork you can rely on implicit credentials like on Windows. Make sure you've gotten your Kerberos ticket with kinit username@REALM.COM and then you can just do Enter-PSSession -ComputerName MyHost like you do on Windows.