LoginSignup
0
0

More than 1 year has passed since last update.

jpsonic - dSub for subsonicでアクセスできない

Last updated at Posted at 2021-09-18

なんでやん。

2021/09/19 追記

以下の方法でタイトル通りの問題は解決しますが、play:Subなどの以前使えていたアプリが使えなくなりました。 他のアプリを使っている方は注意してね。

環境

Linux : Ubuntu20.04
Dockerによる仮想環境
traefikによるリバースプロキシ
OpenLDAPによるユーザー認証

使えるアプリ
iOS : Play:Sub
Android : subsonic for Android

使えなかったアプリ
dSub for subsonic をはじめ、いろんなアプリがダメだった。

調べたら以下が有力。

https://github.com/airsonic/airsonic/issues/260
https://bleepcoder.com/ja/airsonic/240477191/allow-ldap-auth-via-rest-api

ただ、対策がNginXだったので、traefikでsub_filterみたいな事ができんか探してたら、プラグインでできそう。

問題を要約

DSubのリクエスト

GET /airsonic/rest/ping.view?u=pogo&s=xxxxxxxxxxx&t=xxxxxxxxxxx&v=1.2.0&c=DSub HTTP/1.1

お返事

<?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>

公式のSubsonicのアプリ

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

お返事

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

どうも上のリクエストだとAirsonic系列のjpsonicはちゃんと返事できないらしい。subsonicのリクエストだと返事する。

原因

LDAP認証だとはじかれるらしい。(jpsonicのデータベースに入ってるユーザーはログインできる)

対策

traefikにプラグイン導入

https://pilot.traefik.io/plugins/606d8063a316dece52c30c1c/subfilter

フィルターをインストールする。
リンク先のInstall Pluginをクリックして、手順通りにやればとりあえずできる。

  • traefik Pilotのトークンを発行する。
  • プラグインをtraefik.ymlに呼び出すようにする。
  • middlewaresに設定。
provider.yml
http:
  middlewares:
    jpsonic-dsub:
      plugin:
        subfilter:
          filters:
            - regex: subsonic
              replacement: madsonic
          lastModified: true

middlewaresの設定は別の記事に書きました。

madsonicは、jpsonicairsonicにかえたらダメだったので、madsonicである必要があるみたい。

チラ裏

traefikに移行したのはいいが(昔はNginXだった)、エラーはくんだよな~

Mixed Content: The page at 'https://おうちのドメイン/index' was loaded over HTTPS, but requested an insecure frame 'http://おうちのドメイン/home.view'. This request has been blocked; the content must be served over HTTPS.

これどうにかしたい。ウェブで再生できぬ……

あと、subsonicのアプリはいいのが多いが、どうも英語ばっかりでわからんかったりする……専門用語多かったりするしな。
アプリ作りたい欲が出てくるが、未知の世界だからすごいためらう。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0