lwthiker / curl-impersonate

curl-impersonate: A special build of curl that can impersonate Chrome & Firefox
MIT License
3.45k stars 229 forks source link

Ubuntu 22:04 libcurl-impersonate-chrome.so cannot be preloaded #207

Closed nklido closed 7 months ago

nklido commented 7 months ago

I'm using ubuntu with docker and I would like to use curl-impersonate from php scripts.

FROM ubuntu:22.04
...

COPY libcurl-impersonate-chrome.so /usr/lib/libcurl-impersonate-chrome.so
RUN apt-get update -y && apt-get install patchelf && \
    patchelf --set-soname libcurl.so.4 /usr/lib/libcurl-impersonate-chrome.so
ENV LD_PRELOAD=/usr/lib/libcurl-impersonate-chrome.so
ENV CURL_IMPERSONATE=chrome101

Image builds but when get a shell to the container, i get the following error.

ERROR: ld.so: object '/usr/lib/libcurl-impersonate-chrome.so' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored.

For libcurl-impersonate-chrome.so I'm using this libcurl-impersonate-v0.6.0-alpha.1.x86_64-linux-gnu.tar.gz

Any Ideas on what might be wrong ?

Edit: I managed to get past this error by specifying platform: linux/x86_64 on my container. My host system is a Macbook pro with M2 so i guess that was an issue. Now it seems that i have the same issue with #147.

Ghxst commented 7 months ago

Can you log the contents of the dir after building? Just to make sure the .so is where you expect it to be

nklido commented 7 months ago

@Ghxst

Can you log the contents of the dir after building? Just to make sure the .so is where you expect it to be


sail@57f355727f1b:/var/www/html$ ls /usr/lib | grep libcurl
ERROR: ld.so: object '/usr/lib/libcurl-impersonate-chrome.so' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored.
ERROR: ld.so: object '/usr/lib/libcurl-impersonate-chrome.so' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored.
libcurl-impersonate-chrome.so
nklido commented 7 months ago

Now it seems that i have the same issue with #147

curl --version
curl 7.81.0 (x86_64-pc-linux-gnu) libcurl/8.1.1 BoringSSL zlib/1.2.11 brotli/1.0.9 nghttp2/1.56.0
Release-Date: 2022-01-05
Protocols: dict file ftp ftps gopher gophers http https imap imaps mqtt pop3 pop3s rtsp smb smbs smtp smtps telnet tftp 
Features: alt-svc AsynchDNS brotli HSTS HTTP2 HTTPS-proxy IPv6 Largefile libz NTLM NTLM_WB SSL UnixSockets
WARNING: curl and libcurl versions do not match. Functionality may be affected.
sail@e8897ba87baf:/var/www/html$ php -r 'print_r(curl_version());'
Array
(
    [version_number] => 479488
    [age] => 9
    [features] => 364890013
    [ssl_version_number] => 0
    [version] => 7.81.0
    [host] => x86_64-pc-linux-gnu
    [ssl_version] => OpenSSL/3.0.2
    [libz_version] => 1.2.11
    [protocols] => Array
        (
            [0] => dict
            [1] => file
            [2] => ftp
            [3] => ftps
            [4] => gopher
            [5] => gophers
            [6] => http
            [7] => https
            [8] => imap
            [9] => imaps
            [10] => ldap
            [11] => ldaps
            [12] => mqtt
            [13] => pop3
            [14] => pop3s
            [15] => rtmp
            [16] => rtsp
            [17] => scp
            [18] => sftp
            [19] => smb
            [20] => smbs
            [21] => smtp
            [22] => smtps
            [23] => telnet
            [24] => tftp
        )

    [ares] => 
    [ares_num] => 0
    [libidn] => 2.3.2
    [iconv_ver_num] => 0
    [libssh_version] => libssh/0.9.6/openssl/zlib
    [brotli_ver_num] => 16777225
    [brotli_version] => 1.0.9
)