Project

General

Profile

[Abandoned] Issue with auth.backend config with lighttpd1.4.64/ 1.4.65 on arm aarch64 (7.1.2 Android-api 25)

Added by sanathkumar almost 2 years ago

Hi

I want to use lighttpd version 1.4.65 on arm aarch64 (ANDROID version - 7.1.2 ANDROID_API_25) architecture. I have cross-compiled lighttpd-1.4.65 version successfully Currently, I am facing the following issue while running the cross compiled binary on my device.

I am using the following command to run the lighttpd server

lighttpd -f <conf_path>/lighttpd.conf -m <library_path>/lighttpd/ -D

Below are the relevant parts of the config file that I am using

# listen to ipv4
server.bind = "0.0.0.0" 
server.port = 80

# listen to ipv6
$SERVER["socket"] == "[::]:80" {  }

server.upload-dirs=( "<upload_dir>" )

server.modules = (
    "mod_auth",
    "mod_authn_file",
    "mod_alias",
    "mod_cgi",
    "mod_fastcgi",
    "mod_proxy" 
)

#auth.debug = 2
#auth.backend = "plain" 
#auth.backend.plain.userfile = "<path>/.lighttpdpassword" 

index-file.names = ("index.sh", "index.php", "index.html")

fastcgi.server = (
  ".php" =>
        (( "host" => "127.0.0.1",
           "port" => 9001,
        ))
)

cgi.assign = (
  ".sh" => "/system/bin/sh" 
)

proxy.server = (
  "/onvif" =>
        (( "host" => "127.0.0.1",
        "port" => 8080,
    ))
)

# protect /test/ with user + password
$HTTP["url"] =~ "^/test/(?!test-status\.sh)" {
    auth.backend = "htdigest" 
    auth.backend.htdigest.userfile = "<path>/lighttpd-digest.user" 
    auth.require = ( "" =>
    (
        "method" => "digest",
        "realm" => "testa",
        "require" => "valid-user" 
    )
    )
    auth.cache = ("max-age" => "10")
}

The issue is that the server seems to shutdown and it throws the follwing error logs.

(server.c.1568) server started (lighttpd/1.4.64-devel-lighttpd-1.4.64)
(mod_auth.c.627) auth.backend not supported: htdigest.
(server.c.1572) Configuration of plugins failed. Going down.

The above configuration works fine with the lighttpd-1.4.59. The lighttpd server(1.4.59) starts and works as expected. I am facing the issue with lighttpd version 1.4.64 and 1.4.65

What am I missing here? Do I need to add any other libraries in the config file ?


Replies (3)

RE: Issue with auth.backend config with lighttpd1.4.64/ 1.4.65 on arm aarch64 (7.1.2 Android-api 25) - Added by gstrauss almost 2 years ago

Something might be different between how you built lighttpd-1.4.59 and lighttpd-1.4.64.
("lighttpd/1.4.64-devel-lighttpd-1.4.64" is not lighttpd-1.4.65, so you might consider upgrading your source tree, too)

Try running lighttpd -f /etc/lighttpd/lighttpd.conf -t, and then try running lighttpd -f /etc/lighttpd/lighttpd.conf -tt (with -tt)

I see that you have both mod_auth and mod_authn_file (which provides "htdigest") in server.modules, and you have already said that this configuration works with lighttpd-1.4.59, so I must conclude for the moment that something is amiss with your custom build or installation of lighttpd-1.4.64. Did you build lighttpd as a static executable? If you can, strace lighttpd to see which files it loads before "Configuration of plugins failed. Going down."

RE: Issue with auth.backend config with lighttpd1.4.64/ 1.4.65 on arm aarch64 (7.1.2 Android-api 25) - Added by sanathkumar almost 2 years ago

Hi,

I have used the following link to download the latest version lighttpd version 1.4.65,

https://download.lighttpd.net/lighttpd/releases-1.4.x/lighttpd-1.4.65.tar.gz

cross-compilation flags :

./configure \
    --prefix=<path>/out \
    --with-openssl=<openssl_path>/out/ \
    --with-pcre=<pcre-8.43_path>/out \
    PCRECONFIG=<pcre-8.43_path>/out/bin/pcre-config \
    --with-zlib=<zlib-1.2.11_path>/out \
    --without-bzip2 \
    --without-lua \
    --host=aarch64-linux-android host_alias=aarch64-linux-android \
    CC=<toolchain_path>/android-toolchain/bin/aarch64-linux-android-gcc \
    CFLAGS='-fPIE -pie' LDFLAGS=-L'<pcre-8.43_path>/out/lib -fPIE -pie' \
    --no-create \
    --no-recursion

Output :


# lighttpd -v                                                                                                                                                                                    

lighttpd/1.4.65 (ssl) - a light and fast webserver

# /system/bin/lighttpd -f ./system/etc/lighttpd/lighttpd.conf -m ./system/lib/modules/lighttpd/ -t

Syntax OK

# /system/bin/lighttpd -f ./system/etc/lighttpd/lighttpd.conf -m ./system/lib/modules/lighttpd/ -tt 

2022-07-15 05:47:02: (plugin.c.202) dlopen() failed for: ./system/lib/modules/lighttpd/mod_authn_file.so dlopen failed: cannot locate symbol "http_auth_digest_len" referenced by "/system/lib/modules/lighttpd/mod_authn_file.so"...
2022-07-15 05:47:02: (server.c.1285) loading plugins finally failed

The lighttpd binary is linked dynamically, strace program is currently not available in our device.

The config I used is the same as the one used above. Am I missing any library/dependency?

Thanks

RE: Issue with auth.backend config with lighttpd1.4.64/ 1.4.65 on arm aarch64 (7.1.2 Android-api 25) - Added by gstrauss almost 2 years ago

This must be a build issue. http_auth_digest_len is in mod_auth_api.c and it should be part of mod_auth.so on most systems.

The file in which the symbol http_auth_digest_len is defined and how that file is included in the build has changed in lighttpd 1.4.60.
https://git.lighttpd.net/lighttpd/lighttpd1.4/commit/1a8ac120b49132f8983400f1817a6b8bd1f31188

I had to make adjustments to the build for MacOS
https://git.lighttpd.net/lighttpd/lighttpd1.4/commit/0507c822047f7f0af9b03b33a577d83ff0918de1
so it stands to reason that another adjustment might be necessary for your environment.

I do not have an Android build environment, so I hope that the above is helpful to you in figuring out the next steps. If you find something that works, please share a patch and I might include it in lighttpd.

As a workaround, you could modify src/Makefile.am to put mod_auth_api.o into the main executable instead of in mod_auth.so

    (1-3/3)