Skip to content

wrong symlink in CentOS8 Powershell 7.1.3 package #15029

Closed
PowerShell/PowerShell-Snap
#76

Description

@c-0815

Environment:

CentOS 8 Powershell 7.1.3
powershell installed by Microsoft repo

Scenario

  • ldd for libmi.so shows:

ldd /opt/microsoft/powershell/7/libmi.so
ldd: warning: you do not have execution permission for `/opt/microsoft/powershell/7/libmi.so'
linux-vdso.so.1 (0x00007ffc3ea41000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x00007ff105ed7000)
libdl.so.2 => /lib64/libdl.so.2 (0x00007ff105cd3000)
libpam.so.0 => /lib64/libpam.so.0 (0x00007ff105ac3000)
libssl.so.1.0.0 => /opt/microsoft/powershell/7/libssl.so.1.0.0 (0x00007ff10582f000)

libcrypto.so.1.0.0 => not found

libc.so.6 => /lib64/libc.so.6 (0x00007ff10546c000)
/lib64/ld-linux-x86-64.so.2 (0x00007ff1060f7000)
libaudit.so.1 => /lib64/libaudit.so.1 (0x00007ff105242000)
libcrypto.so.1.1 => /lib64/libcrypto.so.1.1 (0x00007ff104d5c000)
libz.so.1 => /lib64/libz.so.1 (0x00007ff104b45000)
libcap-ng.so.0 => /lib64/libcap-ng.so.0 (0x00007ff10493f000)

  • following the missing reference
    ls -l libcrypto.so.1.0.0
    lrwxrwxrwx 1 root root 25 Mar 10 02:14 libcrypto.so.1.0.0 -> /lib64/libcrypto.so.1.1.1

but /lib64/libcrypto.so.1.1.1 is not found on a CentOS 8 system

Resolution
cd /lib64
ln -s libcrypto.so.1.1 libcrypto.so.1.1.1

Solution
The link must reference to /lib64/libcrypto.so.1.1

Please fix this in the rpm Package.

regards

Ralph

Activity

  1. changed the title [-]Wrong symlink in CentOS8 Powershell 7.1.3[/-] [+]wrong symlink in CentOS8 Powershell 7.1.3 package[/+] on Mar 15, 2021
  2. jborean93 commented on Mar 15, 2021

    @jborean93
    Collaborator

    You cannot just change the link for OpenSSL 1.0.x to point to the 1.1.x libraries. While it will get libmi to load you will be unable to use any TLS features due to the API and ABI difference on OpenSSL 1.0.x and the 1.1.x versions. This is the reason why the symlink is pointing to 1.0.x still.

  3. added
    WG-Maintainers-Build
    Needs-Triage
    on Mar 16, 2021
  4. c-0815 commented on Mar 16, 2021

    @c-0815
    Author

    Hi Jordan,

    please look at the output of the ls command. In the current 7.1.3 package libcrypto.1.0.0 is already linked to libcrypto.so.1.1.1. But version 1.1.1 is not found in /lib64 directory.
    In /lib64 you find:

    • libcrypto.so.1.1 - that links to libcrypto.so.1.1.1g
    • libcrypto.so.1.1.1g - the original library

    uncorrected I get following error:

    #>$session = New-PSSession -ComputerName server-05 -Credential $cred -Authentication Negotiate
    
    New-PSSession: This parameter set requires WSMan, and no supported WSMan client library was found. WSMan is either not installed or unavailable for this system.
    

    After I corrected the link the WSMAN communication works fine.

    best regards

    Ralph

  5. jborean93 commented on Mar 16, 2021

    @jborean93
    Collaborator

    So the symlink is pointing to an invalid location and adjusting it to the OpenSSL 1.1.x location gets the library to load. But the issue here is that libmi is compiled against OpenSSL 1.0.x not 1.1.x. These versions are not API and ABI compatible so even if you point the link to the a valid location on your host you will run across issues when it first tries to use something in that library. In your example it’s running over HTTP which doesn’t use OpenSSL, as soon as you target a https endpoint it will fail, maybe even segfault the entire process.

    In reality the symlinks shouldn’t be pointing to OpenSSL 1.1.x in this package but rather where the OpenSSL 1.0.x ones. This is complicated by the fact that this OpenSSL version may not be available on more modern distros so you have to compile it yourself.

  6. c-0815 commented on Mar 16, 2021

    @c-0815
    Author

    I understand. But why libmi isn't compiled against OpenSSL 1.1.x in the CentOS8 rpm package?

  7. c-0815 commented on Mar 16, 2021

    @c-0815
    Author

    I've seen PSWSMan 2.1.0 Package in the Powershell Gallery. Is the OpenSSL Bug fixed, if I install this nuget Package, an exchange the libs. I checked the libmi.so and it is correctly linked against OpenSSL 1.1

  8. jborean93 commented on Mar 16, 2021

    @jborean93
    Collaborator

    But why libmi isn't compiled against OpenSSL 1.1.x in the CentOS8 rpm package?

    Another team in Microsoft maintain the package and they no longer support PowerShell's use case so PowerShell is stuck with what was given to them at the time. Technically they could build it themselves and include it in the distribution but so far they haven’t gone that route.

    I've seen PSWSMan 2.1.0 Package in the Powershell Gallery

    Thats a fork of the libmi package that has been recompiled against OpenSSL 1.1.x on more modern systems. I’m actually the maintainer of that but there is no connection between myself and Microsoft so it isn’t supported here. I do recommend you use it because it fixes more problems than just OpenSSL, you can find more about it here https://github.com/jborean93/omi.

    GitHub
    Open Management Infrastructure. Contribute to jborean93/omi development by creating an account on GitHub.
  9. joeyaiello commented on Mar 16, 2021

    @joeyaiello
    Contributor

    Thanks for providing all that context, Jordan Borean (@jborean93), and for your work on maintaining that fork of OMI. It's still not something we're feel comfortable taking into our package (largely due to lack of time on our side to review all of your changes), but I'm really glad it's out there for the folks that need it.

    Given the symlink to an appropriately installed OpenSSL 1.0.x package, I'm going to close this one.

  10. added
    Issue-Question
    Resolution-Answered
    and removed
    Needs-Triage
    on Mar 16, 2021
  11. jborean93 commented on Mar 16, 2021

    @jborean93
    Collaborator

    It's still not something we're feel comfortable taking into our package

    Totally understandable, I had trouble myself trying to understand the existing codebase due to how complex it all is :) Looking forward to the pluggable transports slated for 7.2 which will hopefully make this even easier to distribute and install.

  12. jborean93 commented on Mar 16, 2021

    @jborean93
    Collaborator

    Joey Aiello (@joeyaiello) i think there is still an issue with the package here. The symlinks are pointing to the 1.1.x locations and even one of them does not exist. In reality they should either:

    • Point to the expected 1.0.x locations
    • Point to the correct 1.1.x locations

    The first is what strictly should happen but it means OpenSSL 1.0.x must be installed for libmi to load at all. The latter will work for the http situation but will fail if a https endpoint is used, I.e. Exchange Online.

  13. joeyaiello commented on Mar 17, 2021

    @joeyaiello
    Contributor

    Thanks for the clarification. I was reading it as "we're linking to 1.0 and I have 1.1, and so 1.0 doesn't exist", but it looks like we're in a strange mixed state.

    I think we should do the first of the two options you're presenting as HTTP endpoints probably shouldn't be used (and I think in the HTTPS we're very ungraceful in our error).

  14. added
    Issue-Bug
    and removed
    Issue-Question
    Resolution-Answered
    on Mar 17, 2021
  15. jborean93 commented on Mar 17, 2021

    @jborean93
  16. c-0815 commented on Mar 17, 2021

    @c-0815
    Author

    Is this CentOS8?
    because in sourcecode of packaging.pm1 in case of CentOS 8 it is linked to 1.1

    if ($Environment.IsRedHatFamily) {
        switch -regex ($Distribution)
        {
            # add two symbolic links to system shared libraries that libmi.so is dependent on to handle
            # platform specific changes. This is the only set of platforms needed for this currently
            # as Ubuntu has these specific library files in the platform and macOS builds for itself
            # against the correct versions.
            'centos\.8' {
                New-Item -Force -ItemType SymbolicLink -Target "/lib64/libssl.so.1.1" -Path "$Staging/libssl.so.1.0.0" > $null
                New-Item -Force -ItemType SymbolicLink -Target "/lib64/libcrypto.so.1.1.1" -Path "$Staging/libcrypto.so.1.0.0" > $null
            }
            default {
                New-Item -Force -ItemType SymbolicLink -Target "/lib64/libssl.so.10" -Path "$Staging/libssl.so.1.0.0" > $null
                New-Item -Force -ItemType SymbolicLink -Target "/lib64/libcrypto.so.10" -Path "$Staging/libcrypto.so.1.0.0" > $null
            }
    
  17. jborean93 commented on Mar 17, 2021

    @jborean93
    Collaborator

    Oh I'm really sorry I must have added the repo for rhel/7 so it was installing the EL7 rpm hence why the links were still pointing to 1.0. Please ignore that post and my comments in #15029 (comment) still stand.

    Just as an FYI when the libssl and libcrypto links are pointing to OpenSSL 1.1.x here is the error you get when trying to connect to a HTTPS endpoint

    pwsh: symbol lookup error: /opt/microsoft/powershell/7/libmi.so: undefined symbol: SSL_library_init

    This faults the entire process and kicks you out of PowerShell which is definitely not ideal. Adds more weight to the argument that it should still be pointed to the OpenSSL 1.0.x libs and we continue to document that compat-openssl10 is required here.

  18. c-0815 commented on Mar 18, 2021

    @c-0815
    Author

    But than the powershell devs should change die linking behavior I showed at my last post for CentOS8

  19. jborean93 commented on Mar 18, 2021

    @jborean93
    Collaborator

    Yep so that’s the 2nd option I mentioned. I don’t think it’s the right move though as it brings the whole PowerShell process down as soon as you target HTTPS endpoints. The symlinks should still be pointing to the OpenSSL 1.0.x libraries like it does on CentOS 7 and the docs updated to indicate compat-openssl10 is required for WSMan.

  20. mmcnutt commented on May 21, 2021

    @mmcnutt

    https://bugzilla.redhat.com/show_bug.cgi?id=1879707

    Fedora is not packaging compat-openssl10 in Fedora 34. At the moment installing to Fedora 34 leaves WSMan broken

  21. megamorf commented on Jun 6, 2021

    @megamorf
    Contributor

    https://bugzilla.redhat.com/show_bug.cgi?id=1879707

    Fedora is not packaging compat-openssl10 in Fedora 34. At the moment installing to Fedora 34 leaves WSMan broken

    1879707 – FTBFS: Remove compat-openssl10 requirement

    I'm also affected by this issue - pwsh as snap on Fedora 34:

    ➜  pwsh                       
    PowerShell 7.1.3
    Copyright (c) Microsoft Corporation.
    
    https://aka.ms/powershell
    Type 'help' to get help.
    
    No usable version of libssl was found
    [1]    14902 IOT instruction (core dumped)  pwsh
    

    snap info

    ➜  snap list powershell 
    Name        Version  Rev  Tracking       Publisher              Notes
    powershell  7.1.3    160  latest/stable  microsoft-powershell✓  classic
    ➜  snap info powershell 
    name:      powershell
    summary:   PowerShell for every system!
    publisher: Microsoft PowerShell✓
    store-url: https://snapcraft.io/powershell
    contact:   https://github.com/powershell/powershell
    license:   unset
    description: |
      PowerShell is an automation and configuration management platform.
      It consists of a cross-platform (Windows, Linux, and macOS)
      command-line shell and associated scripting language.
      
      See https://docs.microsoft.com/powershell/scripting/powershell-support-lifecycle for support
      details.
    commands:
      - powershell
    snap-id:      JSNnoJl3EqkMuWoy5Dgq8PMqZ0uNcpie
    tracking:     latest/stable
    refresh-date: 2021-04-04
    channels:
      latest/stable:    7.1.3 2021-03-12 (160) 68MB classic
      latest/candidate: 7.1.3 2021-03-12 (160) 68MB classic
      latest/beta:      7.1.3 2021-03-12 (160) 68MB classic
      latest/edge:      7.1.3 2021-03-12 (160) 68MB classic
      lts/stable:       7.0.6 2021-03-12 (161) 60MB classic
      lts/candidate:    7.0.6 2021-03-12 (161) 60MB classic
      lts/beta:         7.0.6 2021-03-12 (161) 60MB classic
      lts/edge:         7.0.6 2021-03-12 (161) 60MB classic
    installed:          7.1.3            (160) 68MB classic
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue-BugResolution-FixedWG-Maintainers-Build

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions