epoupon / lms

Lightweight Music Server. Access your self-hosted music using a web interface.
http://lms-demo.poupon.dev
GNU General Public License v3.0
1.09k stars 61 forks source link

[Question] Airsonic-Refix compatibility? #476

Closed GioF71 closed 2 months ago

GioF71 commented 4 months ago

Hello, I am trying to run Airsonic-refix on LMS, but I get an error saying "Could not log in. (Failed to fetch)". Authentication isn't actually the problem, but something fails after that. I already have opened an issue here. Do you have an idea of what could be happening? I already enabled debug logging but no new information appeared (at least, that I could notice!). Thank you for any help!

epoupon commented 4 months ago

Hello Well if LMS does not log any further operation, I guess the ping response is somewhat badly parsed or not accepted by airsonic-refix. Maybe there is a field or a version in the response that triggers this error?

GioF71 commented 4 months ago

Hello, I just checked lms vs navidrome for the authentication request, and they are very similar. I noticed that the app sends "1.15.0" as the "v" field, but both navidrome and lms respond with their subsonic api version. So right now I have no idea of what is going on...

{
    "subsonic-response": {
        "openSubsonic": true,
        "serverVersion": "6",
        "status": "ok",
        "type": "lms",
        "version": "1.16.0"
    }
}
{
    "subsonic-response": {
        "status": "ok",
        "version": "1.16.1",
        "type": "navidrome",
        "serverVersion": "0.52.5 (c5560888)",
        "openSubsonic": true
    }
}
GioF71 commented 4 months ago

Hello, from further tests it seems that the password is sent as-is and not in the enc:xxxx form.

image

GioF71 commented 4 months ago

I believe lms does not support clear-text passwords without hex encoding, am I right? Otherwise the login attempt should go through...

epoupon commented 4 months ago

I can't test right now but according to the code it should be supported. Do you have details on lms side when enabling debug logs? You should see auth failure/success

GioF71 commented 4 months ago

I will try again and report... do I need to enable debug for this? Thank you

GioF71 commented 4 months ago

Doesn't seem to fail after the first attempt where the logs says "'Token authentication not supported for LDAP users." The next attempt is done with clear-text password, and it seems to me a http code 200 is returned, am I wrong? Thank you for any help!

lms-lightweight-music-server | [2024-May-28 17:34:46.895] 1 - [error] - 139672461351736 [API_SUBSONIC] Error while processing request '/ping', params = [{c=app}, {f=json}, {s=1FBaJKCanyyUv9Gv}, {t=676aca97826db6556a1eb1e4cb95d4f7}, {u=giovanni}, {v=1.15.0}, ], code = 41, msg = 'Token authentication not supported for LDAP users.'
lms-lightweight-music-server | [2024-May-28 17:34:46.895] 1 - [info] "wthttp: 192.168.1.14   GET /rest/ping?u=giovanni&s=1FBaJKCanyyUv9Gv&t=676aca97826db6556a1eb1e4cb95d4f7&v=1.15.0&c=app&f=json HTTP/1.1 200 196"
lms-lightweight-music-server | [2024-May-28 17:34:46.895] 1 - [info] "WebRequest: took 1.791 ms"
lms-lightweight-music-server | [2024-May-28 17:34:46.924] 1 - [info] "wthttp: 192.168.1.14   GET /rest/ping?u=giovanni&p=HEn%25CWgnRdfz5iAt2%24495zcE&v=1.15.0&c=app&f=json HTTP/1.1 200 109"
lms-lightweight-music-server | [2024-May-28 17:34:46.924] 1 - [info] "WebRequest: took 17.312 ms"
lms-lightweight-music-server | [2024-May-28 17:34:51.444] 1 - [info] "wthttp: 192.168.16.2   POST /?wtd=CD3xjfrj7gzo2QeD HTTP/1.1 200 0"
lms-lightweight-music-server | [2024-May-28 17:34:51.445] 1 - [info] "WebRequest: took 96000.3 ms"
lms-lightweight-music-server | [2024-May-28 17:34:51.445] 1 - [info] "wthttp: 192.168.16.2   POST /?wtd=CD3xjfrj7gzo2QeD HTTP/1.1 200 47"
lms-lightweight-music-server | [2024-May-28 17:34:51.445] 1 - [info] "WebRequest: took 1.197 ms"
epoupon commented 4 months ago

Are you sure you enabled the debug level for the logs?

GioF71 commented 4 months ago

I tried before without -debug in log-config in lms.conf and found no additional information as far as I understand. Anyway I tried again just now, here is the log without -debug:

lms-lightweight-music-server | [2024-May-28 18:16:57.358] 1 - [error] - 140269690940216 [API_SUBSONIC] Error while processing request '/ping', params = [{c=app}, {f=json}, {s=byuG0ygilzWI7FFg}, {t=e2b05f0ca739c96fdeaaa12bf5347865}, {u=giovanni}, {v=1.15.0}, ], code = 41, msg = 'Token authentication not supported for LDAP users.'
lms-lightweight-music-server | [2024-May-28 18:16:57.358] 1 - [info] "wthttp: 192.168.1.14   GET /rest/ping?u=giovanni&s=byuG0ygilzWI7FFg&t=e2b05f0ca739c96fdeaaa12bf5347865&v=1.15.0&c=app&f=json HTTP/1.1 200 196"
lms-lightweight-music-server | [2024-May-28 18:16:57.358] 1 - [info] "WebRequest: took 0.552 ms"
lms-lightweight-music-server | [2024-May-28 18:16:57.380] 1 - [info] "wthttp: 192.168.1.14   GET /rest/ping?u=giovanni&p=HEn%25CWgnRdfz5iAt2%24495zcE&v=1.15.0&c=app&f=json HTTP/1.1 200 109"
lms-lightweight-music-server | [2024-May-28 18:16:57.380] 1 - [info] "WebRequest: took 17.934 ms"
epoupon commented 4 months ago

Actually I changed the log config a while ago, you just have to put the min severity you want, see: https://github.com/epoupon/lms/blob/a7f4672d65bc48e2e7c943446b46e45e9a1782dc/conf/lms.conf#L14

You need to put log-min-severity = "debug";

GioF71 commented 4 months ago

Ok! So this is the output with the new log settings:

lms-lightweight-music-server | [2024-May-28 20:29:42.740] 1 - [debug] - 140214709127992 [API_SUBSONIC] Handling request 2 '/ping', continuation = false, params = {c=app}, {f=json}, {s=zlgccoGbEQIPpVl5}, {t=42fb0250bf5c1e44a2de0bd97c6a153f}, {u=giovanni}, {v=1.15.0},
lms-lightweight-music-server | [2024-May-28 20:29:42.740] 1 - [error] - 140214709127992 [API_SUBSONIC] Error while processing request '/ping', params = [{c=app}, {f=json}, {s=zlgccoGbEQIPpVl5}, {t=42fb0250bf5c1e44a2de0bd97c6a153f}, {u=giovanni}, {v=1.15.0}, ], code = 41, msg = 'Token authentication not supported for LDAP users.'
lms-lightweight-music-server | [2024-May-28 20:29:42.740] 1 - [info] "wthttp: 192.168.1.14   GET /rest/ping?u=giovanni&s=zlgccoGbEQIPpVl5&t=42fb0250bf5c1e44a2de0bd97c6a153f&v=1.15.0&c=app&f=json HTTP/1.1 200 196"
lms-lightweight-music-server | [2024-May-28 20:29:42.740] 1 - [info] "WebRequest: took 0.755 ms"
lms-lightweight-music-server | [2024-May-28 20:29:42.747] 1 - [debug] - 140214715374392 [API_SUBSONIC] Handling request 3 '/ping', continuation = false, params = {c=app}, {f=json}, {p=*REDACTED*}, {u=giovanni}, {v=1.15.0},
lms-lightweight-music-server | [2024-May-28 20:29:42.747] 1 - [debug] - 140214715374392 [AUTH] Checking password for user 'giovanni'
lms-lightweight-music-server | [2024-May-28 20:29:42.747] 1 - [debug] - 140214715374392 [AUTH] Checking internal password for user 'giovanni'
lms-lightweight-music-server | [2024-May-28 20:29:42.767] 1 - [debug] - 140214715374392 [API_SUBSONIC] Request 3 '/ping' handled!
lms-lightweight-music-server | [2024-May-28 20:29:42.767] 1 - [info] "wthttp: 192.168.1.14   GET /rest/ping?u=giovanni&p=HEn%25CWgnRdfz5iAt2%24495zcE&v=1.15.0&c=app&f=json HTTP/1.1 200 109"
lms-lightweight-music-server | [2024-May-28 20:29:42.767] 1 - [info] "WebRequest: took 20.535 ms"
epoupon commented 4 months ago

Hello, I just checked lms vs navidrome for the authentication request, and they are very similar. I noticed that the app sends "1.15.0" as the "v" field, but both navidrome and lms respond with their subsonic api version. So right now I have no idea of what is going on...

{
    "subsonic-response": {
        "openSubsonic": true,
        "serverVersion": "6",
        "status": "ok",
        "type": "lms",
        "version": "1.16.0"
    }
}
{
    "subsonic-response": {
        "status": "ok",
        "version": "1.16.1",
        "type": "navidrome",
        "serverVersion": "0.52.5 (c5560888)",
        "openSubsonic": true
    }
}

Well if LMS returns this message, even for clear text passwords, I really think the problem is on the client side.

GioF71 commented 4 months ago

Hello, actually I could not make a request with clear-text password, because I had to escape some characters. But I will try!

GioF71 commented 4 months ago

I just tried with cleartext password using postman... and it works. Let's see if there is some feedback from the airsonic-refix side. Thank you for your support!

GioF71 commented 2 months ago

Hello, I tried again today. I configured a reverse proxy for Airsonic-Refix, while I already had traefik set for lms. So now it seems to me it's a CORS issue. Are there settings available on lms, or is this something I should probably change on the client side? Thank you!

epoupon commented 2 months ago

Hello! The internal web server (wt-httpd, used by lms) states that cross-origin requests are always disallowed. Maybe you can hack with the proxy and add the relevant Access-Control-Allow-Origin headers, but I have not tried myself

GioF71 commented 2 months ago

Thank you. I cannot seems to be able to configure traefik correctly. The think that puzzles me is that upmpcli with its pysonic library connects without any issue, even using the reverse proxy on top of lms. Instead with airsonic-refix I keep getting the same issue mentioned here.

GioF71 commented 2 months ago

I sorted it out, I was applying the traefik configuration to airsonic-refix instead of to lms. Silly!

epoupon commented 2 months ago

If it works now, then it is a good news!