Giter VIP home page Giter VIP logo

Comments (4)

momala454 avatar momala454 commented on May 18, 2024

also, what's the proper way to replace a library for libcurl in linux using /usr/local/lib ?

It looks like renaming to /usr/local/lib/libcurl.so.4 doesn't work, even after running ldconfig, it looks like it know it is "libcurl-impersonate" and not "libcurl".

Libcurl impersonate only works in conjonction of LD_LIBRARY_PATH or LD_PRELOAD, but that's not great. Do you know a better way using ldconfig ?

Directly replacing /usr/lib/x86_64-linux-gnu/libcurl.so.4 only works until a package is updated on the system

from curl-impersonate.

momala454 avatar momala454 commented on May 18, 2024

Actually, LD_PRELOAD doesn't work due to SONAME

LD_PRELOAD=/home/libcurl-impersonate.so php script.php

script.php content :
print_r(curl_version());

will show
[ssl_version] => OpenSSL/1.1.1n

if I replace /usr/lib/x86_64-linux-gnu/libcurl.so.4 with libcurl-impersonate.so (after renaming), it works
[ssl_version] => BoringSSL

instead of replacing /usr/lib/x86_64-linux-gnu/libcurl.so.4, i can do this :
LD_PRELOAD will only work if I do this before
patchelf --set-soname libcurl.so.4 /home/libcurl-impersonate.so

from curl-impersonate.

lwthiker avatar lwthiker commented on May 18, 2024

When using libcurl-impersonate.so (not sure which one to use, there is .so, .so.4, .so.4.7.0) compiled and replaced, curl will show an error with version not available

libcurl-impersonate is intentionally built without the version information. If I remember correctly, when I built it with version information it wouldn't work since the symbol version information contains the TLS library used. Then you get a mismatch (i.e OpenSSL vs. BoringSSL). I think it is better to leave libcurl-impersonate without versioning info, and I believe you can safely ignore this error.

Libcurl impersonate only works in conjonction of LD_LIBRARY_PATH or LD_PRELOAD, but that's not great. Do you know a better way using ldconfig ?

I think these methods should be preferred. I would consider them less hacky than replacing the system's libcurl, which is not really a good way to do this as you mentioned. LD_PRELOAD exists for exactly these kind of situations :)

Actually, LD_PRELOAD doesn't work due to SONAME

LD_PRELOAD definitely works even without changing the SONAME. Try doing LD_PRELOAD=/path/to/libcurl-impersonate-chrome.so curl --version and it will output:

curl 7.68.0 (x86_64-pc-linux-gnu) libcurl/7.81.0 BoringSSL zlib/1.2.11 brotli/1.0.9 nghttp2/1.46.0

If I had to guess, what you are seeing is some PHP-specific quirk. My guess would be that PHP loads libcurl dynamically at runtime and somehow uses its symbols instead of libcurl-impersonate

from curl-impersonate.

momala454 avatar momala454 commented on May 18, 2024

Is it possible to use the libcurl soname so it will work for every situation without requiring to tweak with patchelf ?

from curl-impersonate.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.