Filebrowser: Must create user 1 when importing a "noauth" config

Created on 22 Mar 2019  路  3Comments  路  Source: filebrowser/filebrowser

Description
If you start from an empty database, and you import a configuration that uses the noauth authentication method (e.g. as part of a larger Kubernetes deployment that authenticates users through the ingress controller), attempting to access File Browser yields a 500 error.

Expected behaviour

  1. File browser would automatically create the first user account OR log an error message so that an admin knows he needs to create the first user.
  2. File browser would be accessible immediately after startup.

What is happening instead?

  • The loading animation never disappears.
  • The browser indicates:
auth.js:34 POST /files/api/login 500
(anonymous) @ auth.js:34
w @ runtime.js:62
(anonymous) @ runtime.js:288
e.(anonymous function) @ runtime.js:114
s @ asyncToGenerator.js:5
a @ asyncToGenerator.js:27
(anonymous) @ asyncToGenerator.js:34
t @ _export.js:36
(anonymous) @ asyncToGenerator.js:23
le @ auth.js:34
oe @ auth.js:34
(anonymous) @ main.js:12
w @ runtime.js:62
(anonymous) @ runtime.js:288
e.(anonymous function) @ runtime.js:114
s @ asyncToGenerator.js:5
a @ asyncToGenerator.js:27
(anonymous) @ asyncToGenerator.js:34
t @ _export.js:36
(anonymous) @ asyncToGenerator.js:23
ho @ main.js:12
po @ main.js:12
56d7 @ main.js:10
i @ bootstrap:78
0 @ bootstrap:151
i @ bootstrap:78
s @ bootstrap:45
(anonymous) @ bootstrap:149
(anonymous) @ bootstrap:149
auth.js:34 Uncaught (in promise) Error: 500 Internal Server Error

    at auth.js:34
    at w (runtime.js:62)
    at Generator._invoke (runtime.js:288)
    at Generator.e.(/files/anonymous function) [as next] (/files/static/js/chunk-vendors.8da789cf.js:36:47656)
    at s (asyncToGenerator.js:5)
    at a (asyncToGenerator.js:27)
  • The console indicates:
2019/03/22 21:42:26 Using config file: /etc/filebrowser/.filebrowser.json
2019/03/22 21:42:26 Listening on [::]:8080
2019/03/22 21:42:29 /api/login: 500 172.17.0.1:40034 the resource does not exist

How to reproduce?

  1. Use a Dockerfile like this:
FROM alpine:3.6

COPY --from="filebrowser/filebrowser:v2.0.3" filebrowser /bin/filebrowser

RUN set -ex; \
    mkdir /home/filebrowser; \
    mkdir /var/lib/filebrowser

COPY initial.json /etc/filebrowser/.filebrowser.json
COPY runtime.json /etc/filebrowser/runtime.json

RUN set -ex; \
    filebrowser config import /etc/filebrowser/runtime.json

EXPOSE 8080

ENTRYPOINT [ "/bin/filebrowser" ]
  1. With an initial.json config like this:
{
  "port": 8080,
  "baseURL": "",
  "address": "",
  "log": "stdout",
  "database": "/var/lib/filebrowser/database.db",
  "root": "/home/filebrowser"
}
  1. With a runtime.json like this:
{
  "settings": {
    "signup": false,
    "defaults": {
      "scope": ".",
      "locale": "en",
      "viewMode": "mosaic",
      "sorting": {
        "by": "",
        "asc": false
      },
      "perm": {
        "admin": false,
        "execute": false,
        "create": true,
        "rename": true,
        "modify": true,
        "delete": true,
        "share": false,
        "download": true
      },
      "commands": []
    },
    "authMethod": "noauth",
    "branding": {
      "name": "",
      "disableExternal": true,
      "files": ""
    },
    "commands": {
      "after_copy": [],
      "after_delete": [],
      "after_rename": [],
      "after_save": [],
      "after_upload": [],
      "before_copy": [],
      "before_delete": [],
      "before_rename": [],
      "before_save": [],
      "before_upload": []
    },
    "shell": [],
    "rules": []
  },
  "server": {
    "root": "/home/filebrowser",
    "baseURL": "",
    "tlsKey": "",
    "tlsCert": "",
    "port": "8080",
    "address": "",
    "log": "stdout"
  },
  "auther": {}
}

Workaround
Ensure that the Dockerfile adds the first user account after importing the config.

For example, we changed our config import line to read:

RUN set -ex; \
    filebrowser config import /etc/filebrowser/runtime.json; \
    \
    RANDOM_PASSWORD=$(tr -cd '[:alnum:]' < /dev/urandom | fold -w30 | head -n1); \
    \
    filebrowser users add \
      "default-user" \
      "${RANDOM_PASSWORD}"
bug 馃悶

Most helpful comment

This issue still exist. Requesting to reopen the issue

All 3 comments

Thanks for reporting this @GuyPaddock!

Probably I won't fix it as soon as I'd like to _but_ thanks a lot for the big report. It'll help other users!

If you'd like to contribute, I'd love a PR 馃槂

I'm closing this since this repository will be archived. Please read the information on the README for more information. Thanks for all your contributions!

This issue still exist. Requesting to reopen the issue

Was this page helpful?
0 / 5 - 0 ratings

Related issues

zxysilent picture zxysilent  路  5Comments

eine picture eine  路  4Comments

eternaltyro picture eternaltyro  路  5Comments

ghost picture ghost  路  6Comments

princemaple picture princemaple  路  6Comments