Open Closed

Problem with LDAP login in Docker after upgrade ABP to 6.0.1 #4062


User avatar
0
tomasz.lewandowski@neuca.pl created

If you're creating a bug/problem report, please include the followings:

  • ABP Framework version: v6.0.1
  • UI type: Angular
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Separated (Angular): no
  • Exception message and stack trace: System.DllNotFoundException at LdapForNet.Native.NativeMethodsLinux.ldap_initialize Unable to load shared library 'ldap.so.2' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: libldap.so.2: cannot open shared object file: No such file or directory
  • Steps to reproduce the issue:" After upgraded version from 5.2.2 to 6.0.1 we have a problem with LDAP login. We are getting exception: System.DllNotFoundException at LdapForNet.Native.NativeMethodsLinux.ldap_initialize Unable to load shared library 'ldap.so.2' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: libldap.so.2: cannot open shared object file: No such file or directory

Our docker file: FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base WORKDIR /app EXPOSE 80 EXPOSE 443

RUN apt-get update && apt-get install -y --no-install-recommends libldap-2.4-2 && apt-get install -y --no-install-recommends libldap-common && apt-get install -y --no-install-recommends gss-ntlmssp && rm -rf /var/lib/apt/lists/*

FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build WORKDIR /src

COPY ./*.sln ./NuGet.Config ./

COPY core//.csproj ./ RUN for file in $(ls .csproj); do mkdir -p core/${file%.}/ && mv $file core/${file%.*}/; done

COPY src//.csproj ./ RUN for file in $(ls .csproj); do mkdir -p src/${file%.}/ && mv $file src/${file%.*}/; done

COPY test//.csproj ./ RUN for file in $(ls .csproj); do mkdir -p test/${file%.}/ && mv $file test/${file%.*}/; done

COPY tools//.csproj ./ RUN for file in $(ls .csproj); do mkdir -p tools/${file%.}/ && mv $file tools/${file%.*}/; done

RUN dotnet restore "Neuca.OrderManagementSystem.sln" --configfile "NuGet.Config" COPY . .

RUN dotnet build -c Release -nowarn:msb3202,msb3277,nu1503 -o /app/build --no-restore

FROM build AS test LABEL test=oms_test RUN dotnet test -c Release -nowarn:msb3202,msb3277,nu1503 --no-restore --results-directory /testresults --logger:trx;LogFileName=test-results.trx

FROM build AS publish WORKDIR "/src/src/Neuca.OrderManagementSystem.HttpApi.Host" RUN dotnet publish "Neuca.OrderManagementSystem.HttpApi.Host.csproj" -c Release -o /app/publish -nowarn:msb3202,msb3277,nu1503 --no-restore

FROM base AS final WORKDIR /app COPY --from=publish /app/publish . ENTRYPOINT ["dotnet", "Neuca.OrderManagementSystem.HttpApi.Host.dll"]

Is anything changed? Should we install any additional lib in our docker file. I've been looking for a solution to this problem, but without success. Do you have any tips? With ABP 5.2.2 this Docker file has worked well.


4 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    https://github.com/flamencist/ldap4net/blob/master/linux.md

  • User Avatar
    0
    tomasz.lewandowski@neuca.pl created

    I have changed my docker file like this:

    FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base WORKDIR /app EXPOSE 80 EXPOSE 443

    RUN apt-get update && apt-get install -y --no-install-recommends libldap-2.4-2 && apt-get install -y --no-install-recommends libldap-common && apt-get install -y --no-install-recommends gss-ntlmssp && rm -rf /var/lib/apt/lists/* RUN ln -s /usr/lib/libldap-2.4.so.2.11.7 /usr/lib/libldap.so.2 && ln -s /usr/lib/libldap.so.2 /usr/lib/libldap.so && ln -s /usr/lib/liblber-2.4.so.2.11.7 /usr/lib/liblber.so.2 && ln -s /usr/lib/liblber.so.2 /usr/lib/liblber.so RUN ls -l /usr/lib/libldap.so.2 && ls -l /usr/lib/libldap.so && ls -l /usr/lib/liblber.so.2 && ls -l /usr/lib/liblber.so

    FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build WORKDIR /src

    COPY ./*.sln ./NuGet.Config ./

    COPY core//.csproj ./ RUN for file in $(ls .csproj); do mkdir -p core/${file%.}/ && mv $file core/${file%.*}/; done

    COPY src//.csproj ./ RUN for file in $(ls .csproj); do mkdir -p src/${file%.}/ && mv $file src/${file%.*}/; done

    COPY test//.csproj ./ RUN for file in $(ls .csproj); do mkdir -p test/${file%.}/ && mv $file test/${file%.*}/; done

    COPY tools//.csproj ./ RUN for file in $(ls .csproj); do mkdir -p tools/${file%.}/ && mv $file tools/${file%.*}/; done

    RUN dotnet restore "Neuca.OrderManagementSystem.sln" --configfile "NuGet.Config" COPY . .

    RUN dotnet build -c Release -nowarn:msb3202,msb3277,nu1503 -o /app/build --no-restore

    FROM build AS test LABEL test=oms_test RUN dotnet test -c Release -nowarn:msb3202,msb3277,nu1503 --no-restore --results-directory /testresults --logger:trx;LogFileName=test-results.trx

    FROM build AS publish WORKDIR "/src/src/Neuca.OrderManagementSystem.HttpApi.Host" RUN dotnet publish "Neuca.OrderManagementSystem.HttpApi.Host.csproj" -c Release -o /app/publish -nowarn:msb3202,msb3277,nu1503 --no-restore

    FROM base AS final WORKDIR /app COPY --from=publish /app/publish . ENTRYPOINT ["dotnet", "Neuca.OrderManagementSystem.HttpApi.Host.dll"]

    But the problem still exists, because there is no library other than those that should have been linked.

    Unable to load shared library 'ldap.so.2' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: libldap.so.2: cannot open shared object file: No such file or directory

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    How about this?

    https://github.com/flamencist/ldap4net/discussions/168#discussioncomment-3565708

  • User Avatar
    0
    tomasz.lewandowski@neuca.pl created

    hi

    How about this?

    https://github.com/flamencist/ldap4net/discussions/168#discussioncomment-3565708

    That works. Thanks for your help!

Made with ❤️ on ABP v9.1.0-preview. Updated on December 12, 2024, 07:15