Skip to content
This repository has been archived by the owner on Sep 8, 2021. It is now read-only.

Allow ldap auth via rest api #260

Open
issuemover631 opened this issue Feb 25, 2017 · 22 comments
Open

Allow ldap auth via rest api #260

issuemover631 opened this issue Feb 25, 2017 · 22 comments
Labels
in: external cooperation Issues in the external Services (Lastfm, lyrics, LDAP, etc). stale This label will be removed soon status: waiting-for-feedback The replication have not been confirmed yet. Or no implementer or no PRs or tips to solve yet. type: bug A general bug, or suspect a bug.Gray phenomena are bugs. However, there are not always enough clues.

Comments

@issuemover631
Copy link

Issue by muff1nman
Saturday Feb 25, 2017 at 23:47 GMT
Originally opened as https://github.com/Libresonic/libresonic/issues/258


When I was fixing up the ldap auth a week or so back I noticed that the REST api stuff uses a different authentication mechanism which makes it so that ldap authentication does not work via the REST api and by extension android apps. We should really change the auth mechanism on the REST endpoints to use the same auth as the rest of the app. This might be work that should be done along with #69.

@issuemover631
Copy link
Author

Comment by EugeneKay
Tuesday Feb 28, 2017 at 23:41 GMT


I'm confused; I am using LDAP authentication just fine?

@issuemover631
Copy link
Author

Comment by muff1nman
Wednesday Mar 01, 2017 at 01:07 GMT


Via an Android app? That would be surprising.

@issuemover631 issuemover631 added this to the Future milestone Jul 4, 2017
@jooola jooola removed this from the Future milestone Jul 26, 2017
@muff1nman muff1nman added bug and removed refactor labels Sep 19, 2017
@muff1nman
Copy link
Contributor

muff1nman commented Sep 19, 2017

Verified this is an issue today with the dsub app

@thallian
Copy link

thallian commented Jan 5, 2018

For some reason the DSub Variant from F-Droid works for me with LDAP auth. None of the other apps though.

@stale
Copy link

stale bot commented Jul 29, 2018

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale This label will be removed soon label Jul 29, 2018
@kykc
Copy link

kykc commented Aug 29, 2018

Strangely, I can confirm @thallian statement: D-Sub from F-Droid works fine with airsonic 10.1.2 and LDAP, but D-Sub from play market doesn't

@stale stale bot removed the stale This label will be removed soon label Aug 29, 2018
@jooola
Copy link
Contributor

jooola commented Aug 29, 2018

Dsub from fdroid is stalled at version 5.0.3. Current version is 5.4.2 on his github releases page and should be the same on the play store.

@kykc
Copy link

kykc commented Aug 30, 2018

Yep, that's the reason. I've compiled 5.4.2 floss version from sources and it's not working. If I will have enough spare time I'll try to pinpoint exact version of D-Sub when this stopped working and peek and the diff involved, maybe I'll get some insights regarding the issue.

@hjone72
Copy link

hjone72 commented Nov 15, 2018

I've narrowed the cause down to a change between v5.2.2 and v5.3 of DSub. Hope that helps...
daneren2005/Subsonic@5.2.2...5.3

@muff1nman
Copy link
Contributor

cc @daneren2005

@stale
Copy link

stale bot commented Mar 3, 2019

This issue has been automatically marked as stale because it has not had recent activity. Thank you for your contributions.

@stale stale bot added the stale This label will be removed soon label Mar 3, 2019
@jooola jooola added issue and removed bug labels Apr 5, 2019
@stale stale bot removed the stale This label will be removed soon label Apr 5, 2019
@PoGo606
Copy link

PoGo606 commented Jul 17, 2019

Same problem here, can't connect with Dsub from Play Store and LDAP auth configured...

Just sent a mail to @daneren2005 about this. Hope it will be patched soon !

@hjone72
Copy link

hjone72 commented Jul 18, 2019

@PoGo606 The problem can be found here: popeen/Booksonic-App#68 (comment)

I'm not sure how to fix it however I used nginx subfilter to change the response and got it working.

        sub_filter_types text/xml application/json;
        sub_filter_once off;
        sub_filter 'subsonic' 'madsonic';

@PoGo606
Copy link

PoGo606 commented Jul 18, 2019

Thank you @hjone72 for your answer.

Actually, I think I have a different issue here.
Local and LDAP accounts are KO with Dsub but OK when using Subsonic official app.
Looking at HTTP requests/response it seems the issue is from the API auth mecanism used by Dsub.

Here is the request made by DSUB App:
GET /airsonic/rest/ping.view?u=pogo&s=xxxxxxxxxxx&t=xxxxxxxxxxx&v=1.2.0&c=DSub HTTP/1.1

Response:
<?xml version="1.0" encoding="UTF-8"?> <subsonic-response xmlns="http://subsonic.org/restapi" status="failed" version="1.15.0"> <error code="40" message="Wrong username or password."/> </subsonic-response>

Same with official Subsonic app:
POST /airsonic/rest/ping.view?u=pogo&p=enc:xxxxxxxxxxxxxxxxxx&v=1.2.0&c=android HTTP/1.1

Response:
<?xml version="1.0" encoding="UTF-8"?> <subsonic-response xmlns="http://subsonic.org/restapi" status="ok" version="1.15.0"/>

Both App are working well with official Subsonic server.
So it seems Airsonic doesn't handle well the first auth mecanism (GET + Encrypted + Salted ?)

@hjone72
Copy link

hjone72 commented Jul 18, 2019

There is GET request that the app does to find out what capabilities the server has. If the server returns 'subsonic' the app thinks the server supports (GET + Encrypted + Salted). When the server responds with 'madsonic' it uses the old method.

It was a while ago that I found these bits and pieces so I'm just working from memory here. I believe it could be fixed either at the app end or the server end. I didn't have time to figure it out so just put a dirty hack in place. :)

@eharris eharris added the in: rest Issues in the REST API. label Oct 9, 2019
@dvdkon
Copy link

dvdkon commented Dec 9, 2019

The challenge-response mechanism of sending md5(password + nonce) requires knowing the plain-text password on the server. However, Airsonic's LDAP auth works by getting the plain-text password from the user and trying to authenticate ("bind") to the LDAP server with it, so this challenge-response scheme can't work with it, or any reasonable external auth mechanism.

This isn't so tragic. Sending plain-text passwords over HTTPS is arguably much more secure than storing them in a database, and everyone should be using HTTPS by now, so I'd recommend deprecating this authentication mechanism. Hopefully it will make at least some clients switch to the other, ironically more modern, method.

EDIT: By the way, the MD5-based auth isn't even a passable challenge-response scheme. The main purpose of such a scheme is to make it harder to get the password by packet sniffing. You may, however, notice that there's no "challenge" phase in Subsonic's auth mechanism. Since the nonce is chosen by the client, there's nothing preventing a replay attack by simply sending both s and t as captured. This of course doesn't matter if HTTPS is used.

@loki666
Copy link

loki666 commented Dec 9, 2019

what are you suggesting to deprecate ? LDAP auth or md5(password + nonce) ?

@dvdkon
Copy link

dvdkon commented Dec 9, 2019

Sorry I wasn't clear, the md5(password + nonce) one.

@jmccoy555
Copy link

@PoGo606 The problem can be found here: popeen/Popeens-DSub#68 (comment)

I'm not sure how to fix it however I used nginx subfilter to change the response and got it working.

        sub_filter_types text/xml application/json;
        sub_filter_once off;
        sub_filter 'subsonic' 'madsonic';

Does the trick, just add --with-http_sub_module \ if you build Nginx

@stale
Copy link

stale bot commented Mar 23, 2020

This issue has been automatically marked as stale because it has not had recent activity. Thank you for your contributions.

@stale stale bot added the stale This label will be removed soon label Mar 23, 2020
@tesshucom tesshucom removed the security label May 8, 2020
@stale stale bot removed the stale This label will be removed soon label May 8, 2020
@tesshucom tesshucom added in: external cooperation Issues in the external Services (Lastfm, lyrics, LDAP, etc). type: request There is no implementer. Or there is no support from the maintainer. Please implement it and appeal. type: bug A general bug, or suspect a bug.Gray phenomena are bugs. However, there are not always enough clues. status: waiting-for-feedback The replication have not been confirmed yet. Or no implementer or no PRs or tips to solve yet. and removed in: rest Issues in the REST API. type: request There is no implementer. Or there is no support from the maintainer. Please implement it and appeal. labels May 8, 2020
@stale
Copy link

stale bot commented Sep 17, 2020

This issue has been automatically marked as stale because it has not had recent activity. Thank you for your contributions.

@stale stale bot added the stale This label will be removed soon label Sep 17, 2020
@frdbonif
Copy link

@PoGo606 The problem can be found here: popeen/Popeens-DSub#68 (comment)
I'm not sure how to fix it however I used nginx subfilter to change the response and got it working.

        sub_filter_types text/xml application/json;
        sub_filter_once off;
        sub_filter 'subsonic' 'madsonic';

Does the trick, just add --with-http_sub_module \ if you build Nginx

An old issue, I know. I've just got everything up and running with LDAPS authentication but can't get DSub authenticating. Can you or anyone else clarify where I put this into the Nginx configuration?

I guess that in reality this is an issue that needs looking at within the DSub code itself?

massyas added a commit to massyas/airsonic_ynh-1 that referenced this issue Aug 10, 2021
DSub v. 5.5.2 has been recently pushed to F-Droid instead of v 5.0.3 with a lot of change but it's now not able to connect to Airsonic server when LDAP is used as set here in yunohost package.
See airsonic/airsonic#260 for details.
The changes use sub_filter directive to make the server think it's madsonic and use old auth method.
SSOWAT user panel has been disable since it contains also a sub_filter_once directive
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
in: external cooperation Issues in the external Services (Lastfm, lyrics, LDAP, etc). stale This label will be removed soon status: waiting-for-feedback The replication have not been confirmed yet. Or no implementer or no PRs or tips to solve yet. type: bug A general bug, or suspect a bug.Gray phenomena are bugs. However, there are not always enough clues.
Projects
None yet
Development

No branches or pull requests