feat: add SSO workspace, named shares and Debian release tooling
This commit is contained in:
1 parent
833d908884
commit
87bc33e675
106 files changed
+4160
-5637
No files matched your search
+7
-47
@@ -1,49 +1,9 @@
|
||||
<p align="center">
|
||||
<img src="../branding/banner.png" width="550"/>
|
||||
</p>
|
||||
# Документация File Browser SSO
|
||||
|
||||
> [!WARNING]
|
||||
>
|
||||
> **File Browser is archived on 2026-09-01.** There will be no further releases and no security fixes. Existing releases and Docker images stay online. For the known unaddressed security issues and hardening guidance, read the [README](../README.md#security).
|
||||
- [Установка на Debian, первоначальная настройка, SSO и systemd](deployment.md)
|
||||
- [Авторизация и сессии](authentication.md)
|
||||
- [Проверки безопасности и ограничения](SECURITY-REVIEW.md)
|
||||
- [Настройка внешнего вида](customization.md)
|
||||
- [CLI](cli/filebrowser.md)
|
||||
|
||||
File Browser provides a file managing interface within a specified directory and it can be used to upload, delete, preview and edit your files. It is a **create-your-own-cloud**-kind of software where you can just install it on your server, direct it to a path and access your files through a nice web interface.
|
||||
|
||||

|
||||
|
||||
## Contents
|
||||
|
||||
- [Installation](installation.md)
|
||||
- [Customization](customization.md)
|
||||
- [Authentication](authentication.md)
|
||||
- [Command Execution](command-execution.md)
|
||||
- [Deployment](deployment.md)
|
||||
- [Troubleshooting](troubleshooting.md)
|
||||
- [Command Line Usage](cli/filebrowser.md)
|
||||
|
||||
Project-level documents live in the repository root: [README](../README.md), [Building File Browser](../CONTRIBUTING.md), [Security Policy](../SECURITY.md), [Code of Conduct](../CODE-OF-CONDUCT.md), [Changelog](../CHANGELOG.md) and [License](../LICENSE).
|
||||
|
||||
## Features
|
||||
|
||||
- **Easy Login System**
|
||||
|
||||

|
||||
|
||||
- **Sleek Interface**
|
||||
|
||||

|
||||
|
||||
- **User Management**
|
||||
|
||||

|
||||
|
||||
- **File Editing**
|
||||
|
||||

|
||||
|
||||
- **Custom Commands**
|
||||
|
||||

|
||||
|
||||
- **Customization**
|
||||
|
||||

|
||||
Актуальная точка входа — `filebrowser init`. Руководства исходного архивированного File Browser по локальным паролям, proxy-auth, hook-auth и выполнению команд к этому форку не применяются.
|
||||
@@ -0,0 +1,36 @@
|
||||
# Проверки безопасности и ограничения
|
||||
|
||||
Проверено 21 октября 2026 года. Это результат проверок конкретного состояния исходников, а не гарантия отсутствия всех возможных уязвимостей.
|
||||
|
||||
## Сделано
|
||||
|
||||
- Удалены JSON/password, no-auth, proxy и hook способы входа, регистрация, выпуск и продление JWT File Browser. Локальные пароли в существующей базе при миграции заменяются заблокированным значением.
|
||||
- OIDC Authorization Code с PKCE S256, state, nonce, RS256, issuer/audience/expiry и at_hash. Идентичность привязана к issuer и sub; совпадение имени с локальным пользователем не повышает права.
|
||||
- Административная роль берётся только из подтверждённого SSO-входа: Master Admin / FS Admin. Флаг admin в локальном профиле не даёт административный доступ.
|
||||
- Сессии в памяти сервера: случайные 256-битные идентификаторы, SHA256 на сервере, Secure/HttpOnly/SameSite=Lax cookie на HTTPS, 8 часов максимум и 30 минут бездействия. Logout немедленно инвалидирует локальную сессию.
|
||||
- Проверка Origin и специального заголовка для меняющих состояние запросов, запрет cross-site запросов. CSP с nonce для HTML bootstrap, запрет скриптов при выдаче пользовательских файлов, nosniff.
|
||||
- Выполнение команд и файловые хуки принудительно выключены; /api/command не зарегистрирован. Внешние симлинки запрещены. Старый вспомогательный CLI-код локальных аккаунтов не подключён к корневой команде; часть legacy-кода оставлена отключённой.
|
||||
- Короткие ссылки: валидация имени, атомарная вставка в BoltDB, отказ 409 при занятом имени; случайные ключи увеличены с 48 до 128 бит.
|
||||
- Исправлено удаление соседних просроченных ссылок: прежний цикл менял срез во время range и мог пропускать записи или выходить за границы.
|
||||
- Исправлен откат слишком большого TUS-чанка на Windows: используется запись с явным смещением, позволяющая Truncate; проверены последовательные чанки и повторное использование HTTP-соединения.
|
||||
- Ошибка чтения настроек больше не завершает процесс сервера через log.Fatalf.
|
||||
- Обновлены frontend-зависимости и x/net, x/crypto, x/image. Удалена цепочка линтера с неисправленной advisory braces; вместо неё используется flat config typescript-eslint. Режимы и темы Ace включены в бинарник, загрузка с CDN больше не нужна.
|
||||
|
||||
## Результаты
|
||||
|
||||
- go test ./... — успешно на Windows, включая OIDC, роли, logout, expiry/idle, CSRF, callback replay, короткие ссылки и конкурентную вставку.
|
||||
- go vet ./... — успешно.
|
||||
- Frontend: TypeScript, production build, 29 тестов и ESLint без ошибок — успешно. У старых неизменённых файлов при полном lint остаются предупреждения Prettier из-за CRLF-выгрузки Windows.
|
||||
- pnpm audit — 0 известных уязвимостей в установленном дереве.
|
||||
- govulncheck для linux/amd64 — 0 уязвимостей в вызываемом коде и импортируемых пакетах. Одна advisory остаётся на уровне требуемого модуля: GO-2026-5932 (неиспользуемый пакет golang.org/x/crypto/openpgp). Приложение openpgp не импортирует и не вызывает; исправленной версии для этого устаревшего пакета нет.
|
||||
- В браузере: тестовый локальный OIDC-провайдер, список файлов, создание именованной ссылки и маршрут /s/{key}. Настоящие Client ID/secret не использовались и в репозиторий не добавлялись.
|
||||
|
||||
## Ограничения эксплуатации
|
||||
|
||||
Согласно выбранной схеме VTNL Panel, изменение роли или блокировка в SSO не отзывает уже созданную сессию File Browser до нового входа/истечения срока. Сам SSO не менялся. Для немедленного завершения всех локальных сессий перезапустите приложение.
|
||||
|
||||
Сессии хранятся в памяти одного процесса; после перезапуска нужен новый вход. Несколько экземпляров требуют sticky sessions. Долгая операция, начатая до истечения сессии, не обрывается посередине; новая операция потребует действующую сессию.
|
||||
|
||||
Debian-бинарник собирается из Windows для linux/amd64 с отключённым CGO и GOAMD64=v1. Нативный запуск и тесты на Debian в этой среде не выполнялись. POSIX-тест с именами, содержащими обратные слеши, не применим к файловой системе Windows и пропускается там.
|
||||
|
||||
Конфигурация содержит Client secret и должна принадлежать только пользователю службы (0600). Рекомендуемый systemd-файл отделяет исполняемые файлы от изменяемых данных. Обновляйте зависимости и повторяйте аудит перед публикацией новых версий.
|
||||
+10
-160
@@ -1,167 +1,17 @@
|
||||
# Authentication
|
||||
# Вход через SSO
|
||||
|
||||
There are three possible authentication methods. Each one of them has its own capabilities and specification. Adding another authentication method is described in [Building File Browser](../CONTRIBUTING.md#authentication-provider).
|
||||
Поддерживается OpenID Connect Authorization Code Flow с PKCE S256. Настройка выполняется через `filebrowser init`, который создаёт `.filebrowser.json` и печатает callback URL. Подробности — [установка](deployment.md).
|
||||
|
||||
## JSON Auth (default)
|
||||
Проверяются state, nonce, RSA-подпись, issuer, audience, срок действия ID token и привязка access token через at_hash. Идентичность привязана к issuer и стабильному sub. Логин или почта, совпавшие с прежним локальным аккаунтом, не дают доступ к нему.
|
||||
|
||||
We call it JSON Authentication but it is just the default authentication method and the one that is provided by default if you don't make any changes. It is set by default, but if you've made changes before you can revert to using JSON auth:
|
||||
Роли из подписанного claim roles:
|
||||
|
||||
```sh
|
||||
filebrowser config set --auth.method=json
|
||||
```
|
||||
- Master Admin — администратор File Browser;
|
||||
- FS Admin — администратор File Browser;
|
||||
- остальные — пользователь с назначенными файловыми разрешениями.
|
||||
|
||||
This method can also be extended with **reCAPTCHA** verification during login:
|
||||
Пароли и регистрация пользователей File Browser, JWT, proxy-auth и hook-auth удалены. Пароли публичных ссылок сохранены. Старые локальные пароли удаляются из базы при миграции; перед обновлением сохраните резервную копию базы.
|
||||
|
||||
```sh
|
||||
filebrowser config set --auth.method=json \
|
||||
--recaptcha.key site-key \
|
||||
--recaptcha.secret private-key
|
||||
```
|
||||
После входа действует локальная сессия в памяти сервера: максимум 8 часов и 30 минут бездействия. Случайный идентификатор хранится в HttpOnly-cookie, в памяти сервера — его SHA256. Роли фиксируются при входе. SSO не опрашивается при работе с файлами. Изменения роли/блокировки SSO применяются при следующем входе; для завершения всех текущих сессий перезапустите File Browser.
|
||||
|
||||
By default, we use [Google's reCAPTCHA](https://developers.google.com/recaptcha/docs/display) service. If you live in China, or want to use other provider, you can change the host with the following command:
|
||||
|
||||
```sh
|
||||
filebrowser config set --recaptcha.host https://recaptcha.net
|
||||
```
|
||||
|
||||
Where `https://recaptcha.net` is any provider you want.
|
||||
|
||||
## Proxy Header
|
||||
|
||||
If you have a reverse proxy you want to use to login your users, you do it via our `proxy` authentication method. To configure this method, your proxy must send an HTTP header containing the username of the logged in user:
|
||||
|
||||
```sh
|
||||
filebrowser config set --auth.method=proxy --auth.header=X-My-Header
|
||||
```
|
||||
|
||||
Where `X-My-Header` is the HTTP header provided by your proxy with the username.
|
||||
|
||||
> [!WARNING]
|
||||
>
|
||||
> File Browser will blindly trust the provided header. If the proxy can be bypassed, an attacker could simply attach the header and get admin access. Please ensure that File Browser is not accessible from untrusted networks, and that the proxy is correctly configured to strip/overwrite the header from client requests.
|
||||
|
||||
## Hook Authentication
|
||||
|
||||
The Hook Authentication method in FileBrowser allows developers to delegate user authentication to an external script or program. Instead of validating credentials internally, FileBrowser sends the username and password to a custom command defined by the administrator. This command receives the credentials through environment variables and returns key‑value pairs indicating whether the user should be authenticated, blocked, or passed through.
|
||||
|
||||
The hook’s output controls user permissions, scope, locale, and other attributes, making it a powerful and extensible authentication mechanism.
|
||||
|
||||
> [!WARNING]
|
||||
>
|
||||
> The submitted username and password are attacker-controlled and are handed to your hook command as the `USERNAME` and `PASSWORD` environment variables. File Browser runs the command directly, without a shell, so the values themselves are inert. However, your script must treat them as untrusted: always quote them (`"$USERNAME"`, `"$PASSWORD"`) and never pass them unquoted to a shell, `eval`, `bash -c`, command substitution, or backticks. A hook script that shell-evaluates these values turns any login request into remote code execution.
|
||||
|
||||
For example, the following code delegates filebrowser authentication to a PowerShell script on Windows. You can configure any command (for example, a script in Python, Node.js, etc.).
|
||||
|
||||
```sh
|
||||
filebrowser config set --auth.method=hook --auth.command="powershell.exe -File C:\route\to\your\script\auth.ps1"
|
||||
```
|
||||
|
||||
This is the code for the auth.ps1 script
|
||||
|
||||
```sh
|
||||
param()
|
||||
|
||||
# Get FileBrowser credentials from environment variables
|
||||
$username = $env:USERNAME
|
||||
$password = $env:PASSWORD
|
||||
|
||||
# Users dictionary (for testing purposes only)
|
||||
$users = @{
|
||||
"admin" = "kideW48v7-SdE*"
|
||||
"test" = "2sDd3-etrytñK"
|
||||
}
|
||||
|
||||
# Check if the user exists in the dictionary and verify the password
|
||||
if ($users.ContainsKey($username) -and $users[$username] -eq $password) {
|
||||
|
||||
# Successful authentication
|
||||
Write-Output "hook.action=auth" # Hook action (in this case, "auth", is required for successful authentication)
|
||||
|
||||
Write-Output "user.perm.admin=true" # Set admin role (all permissions)
|
||||
#You can also define specific permissions like this:
|
||||
Write-Output "user.perm.execute=true"
|
||||
Write-Output "user.perm.create=true"
|
||||
Write-Output "user.perm.rename=true"
|
||||
Write-Output "user.perm.modify=true"
|
||||
Write-Output "user.perm.delete=true"
|
||||
Write-Output "user.perm.share=true"
|
||||
Write-Output "user.perm.download=true"
|
||||
|
||||
Write-Output "user.locale=es" # Set language
|
||||
Write-Output "user.viewMode=list" # Set view mode
|
||||
Write-Output "user.scope=/" # Set FileBrowser scope
|
||||
Write-Output "user.singleClick=true" # Set single click user configuration
|
||||
Write-Output "user.hideDotfiles=false" # Set hide dot files user configuration
|
||||
|
||||
#Set other configuration
|
||||
} else {
|
||||
# Block authentication
|
||||
Write-Output "hook.action=block"
|
||||
}
|
||||
```
|
||||
|
||||
### Hook Output Format
|
||||
|
||||
A hook authentication script must output a series of key–value pairs, one per line, using the format:
|
||||
|
||||
```
|
||||
key=value
|
||||
```
|
||||
|
||||
FileBrowser reads these lines and applies the corresponding authentication action and user configuration.
|
||||
|
||||
#### Required Fields
|
||||
|
||||
The hook must output one of the following actions:
|
||||
|
||||
| Key | Description |
|
||||
|--------|------------ |
|
||||
| hook.action=auth | Authenticates the user. FileBrowser will create or update the user if needed. |
|
||||
| hook.action=block | Rejects authentication. The login attempt fails. |
|
||||
| hook.action=pass | Delegates authentication to FileBrowser’s internal password validation. |
|
||||
|
||||
For most custom authentication flows, auth or block are used.
|
||||
|
||||
Example of a successful authentication:
|
||||
|
||||
```sh
|
||||
hook.action=auth
|
||||
```
|
||||
|
||||
#### Optional User Fields
|
||||
|
||||
When `hook.action=auth` is returned, the hook may also define additional user attributes. These fields override FileBrowser defaults and allow full customization of the authenticated user.
|
||||
|
||||
1. Permissions
|
||||
```
|
||||
user.perm.admin=true
|
||||
user.perm.execute=true
|
||||
user.perm.create=true
|
||||
user.perm.rename=true
|
||||
user.perm.modify=true
|
||||
user.perm.delete=true
|
||||
user.perm.share=true
|
||||
user.perm.download=true
|
||||
```
|
||||
> Setting user.perm.admin=true automatically enables all permissions.
|
||||
|
||||
2. User Interface and Behavior
|
||||
```
|
||||
user.locale=es
|
||||
user.viewMode=list
|
||||
user.singleClick=true
|
||||
user.hideDotfiles=false
|
||||
```
|
||||
|
||||
3. User Scope
|
||||
```
|
||||
user.scope=/
|
||||
```
|
||||
|
||||
## No Authentication
|
||||
|
||||
We also provide a no authentication mechanism for users that want to use File Browser privately such in a home network. By setting this authentication method, the user with **id 1** will be used as the default users. Creating more users won't have any effect.
|
||||
|
||||
```sh
|
||||
filebrowser config set --auth.method=noauth
|
||||
```
|
||||
Выход немедленно удаляет сессию File Browser; сессия самого SSO остаётся активной. Перезапуск приложения завершает все локальные сессии. Для нескольких экземпляров нужна sticky session-маршрутизация.
|
||||
@@ -19,10 +19,6 @@ filebrowser config init [flags]
|
||||
```
|
||||
--aceEditorTheme string ace editor's syntax highlighting theme for users
|
||||
-a, --address string address to listen on (default "127.0.0.1")
|
||||
--auth.command string command for auth.method=hook
|
||||
--auth.header string HTTP header for auth.method=proxy
|
||||
--auth.logoutPage string url of custom logout page
|
||||
--auth.method string authentication type (default "json")
|
||||
-b, --baseURL string base url
|
||||
--branding.color string set the theme color
|
||||
--branding.disableExternal disable external links such as GitHub links
|
||||
@@ -59,13 +55,9 @@ filebrowser config init [flags]
|
||||
--perm.rename rename perm for users (default true)
|
||||
--perm.share share perm for users (default true)
|
||||
-p, --port string port to listen on (default "8080")
|
||||
--recaptcha.host string use another host for ReCAPTCHA. recaptcha.net might be useful in China (default "https://www.google.com")
|
||||
--recaptcha.key string ReCaptcha site key
|
||||
--recaptcha.secret string ReCaptcha secret
|
||||
--redirectAfterCopyMove redirect to destination after copy/move
|
||||
-r, --root string root to prepend to relative paths (default ".")
|
||||
--scope string scope for users (default ".")
|
||||
--shell string shell command to which other commands should be appended
|
||||
-s, --signup allow users to signup
|
||||
--singleClick use single clicks only
|
||||
--socket string socket to listen to (cannot be used with address, port, cert nor key flags)
|
||||
|
||||
@@ -16,10 +16,6 @@ filebrowser config set [flags]
|
||||
```
|
||||
--aceEditorTheme string ace editor's syntax highlighting theme for users
|
||||
-a, --address string address to listen on (default "127.0.0.1")
|
||||
--auth.command string command for auth.method=hook
|
||||
--auth.header string HTTP header for auth.method=proxy
|
||||
--auth.logoutPage string url of custom logout page
|
||||
--auth.method string authentication type (default "json")
|
||||
-b, --baseURL string base url
|
||||
--branding.color string set the theme color
|
||||
--branding.disableExternal disable external links such as GitHub links
|
||||
@@ -56,13 +52,9 @@ filebrowser config set [flags]
|
||||
--perm.rename rename perm for users (default true)
|
||||
--perm.share share perm for users (default true)
|
||||
-p, --port string port to listen on (default "8080")
|
||||
--recaptcha.host string use another host for ReCAPTCHA. recaptcha.net might be useful in China (default "https://www.google.com")
|
||||
--recaptcha.key string ReCaptcha site key
|
||||
--recaptcha.secret string ReCaptcha secret
|
||||
--redirectAfterCopyMove redirect to destination after copy/move
|
||||
-r, --root string root to prepend to relative paths (default ".")
|
||||
--scope string scope for users (default ".")
|
||||
--shell string shell command to which other commands should be appended
|
||||
-s, --signup allow users to signup
|
||||
--singleClick use single clicks only
|
||||
--socket string socket to listen to (cannot be used with address, port, cert nor key flags)
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
# filebrowser init
|
||||
|
||||
Initial setup: SSO, file directory and database
|
||||
|
||||
```
|
||||
filebrowser init [flags]
|
||||
```
|
||||
|
||||
## Options
|
||||
|
||||
```
|
||||
-h, --help help for init
|
||||
--output string configuration file to create; existing files are never overwritten (default ".filebrowser.json")
|
||||
```
|
||||
|
||||
## Options inherited from parent commands
|
||||
|
||||
```
|
||||
-c, --config string config file path
|
||||
-d, --database string database path (default "./filebrowser.db")
|
||||
```
|
||||
|
||||
## See Also
|
||||
|
||||
* [filebrowser](filebrowser.md) - A stylish web-based file browser
|
||||
|
||||
+2
-38
@@ -8,40 +8,7 @@ File Browser CLI lets you create the database to use with File Browser,
|
||||
manage your users and all the configurations without accessing the
|
||||
web interface.
|
||||
|
||||
If you've never run File Browser, you'll need to have a database for
|
||||
it. Don't worry: you don't need to setup a separate database server.
|
||||
We're using Bolt DB which is a single file database and all managed
|
||||
by ourselves.
|
||||
|
||||
For this command, all flags are available as environmental variables,
|
||||
except for "--config", which specifies the configuration file to use.
|
||||
The environment variables are prefixed by "FB_" followed by the flag name in
|
||||
UPPER_SNAKE_CASE. For example, the flag "--disablePreviewResize" is available
|
||||
as FB_DISABLE_PREVIEW_RESIZE.
|
||||
|
||||
If "--config" is not specified, File Browser will look for a configuration
|
||||
file named .filebrowser.{json, toml, yaml, yml} in the following directories:
|
||||
|
||||
- ./
|
||||
- $HOME/
|
||||
- /etc/filebrowser/
|
||||
|
||||
**Note:** Only the options listed below can be set via the config file or
|
||||
environment variables. Other configuration options live exclusively in the
|
||||
database and so they must be set by the "config set" or "config
|
||||
import" commands.
|
||||
|
||||
The precedence of the configuration values are as follows:
|
||||
|
||||
- Flags
|
||||
- Environment variables
|
||||
- Configuration file
|
||||
- Database values
|
||||
- Defaults
|
||||
|
||||
Also, if the database path doesn't exist, File Browser will enter into
|
||||
the quick setup mode and a new database will be bootstrapped and a new
|
||||
user created with the credentials from options "username" and "password".
|
||||
Run filebrowser init for initial setup. It creates the configuration file, prepares the database and prints the SSO callback URL. Local password accounts and command execution are not supported. Runtime options can still be overridden using flags or FB_ environment variables.
|
||||
|
||||
```
|
||||
filebrowser [flags]
|
||||
@@ -66,15 +33,12 @@ filebrowser [flags]
|
||||
--imageProcessors int image processors count (default 4)
|
||||
-k, --key string tls key
|
||||
-l, --log string log output (default "stdout")
|
||||
--noauth use the noauth auther when using quick setup
|
||||
--password string hashed password for the first user when using quick setup
|
||||
-p, --port string port to listen on (default "8080")
|
||||
--redisCacheUrl string redis cache URL (for multi-instance deployments), e.g. redis://user:pass@host:port
|
||||
-r, --root string root to prepend to relative paths (default ".")
|
||||
--socket string socket to listen to (cannot be used with address, port, cert nor key flags)
|
||||
--socketPerm uint32 unix socket file permissions (default 438)
|
||||
--tokenExpirationTime string user session timeout (default "2h")
|
||||
--username string username for the first user when using quick setup (default "admin")
|
||||
```
|
||||
|
||||
## See Also
|
||||
@@ -83,7 +47,7 @@ filebrowser [flags]
|
||||
* [filebrowser completion](filebrowser-completion.md) - Generate the autocompletion script for the specified shell
|
||||
* [filebrowser config](filebrowser-config.md) - Configuration management utility
|
||||
* [filebrowser hash](filebrowser-hash.md) - Hashes a password
|
||||
* [filebrowser init](filebrowser-init.md) - Initial setup: SSO, file directory and database
|
||||
* [filebrowser rules](filebrowser-rules.md) - Rules management utility
|
||||
* [filebrowser users](filebrowser-users.md) - Users management utility
|
||||
* [filebrowser version](filebrowser-version.md) - Print the version number
|
||||
|
||||
@@ -1,54 +1,5 @@
|
||||
# Command Execution
|
||||
# Выполнение команд
|
||||
|
||||
> [!CAUTION]
|
||||
>
|
||||
> The **hook runner** and **interactive shell** functionalities have been disabled for all existent and new installations by default from version v2.33.8 and onwards, due to continuous and known security vulnerabilities. You should only use this feature if you are aware of all of the security risks involved. For more up to date information, consult issue [#5199](https://github.com/filebrowser/filebrowser/issues/5199).
|
||||
В этом форке выполнение команд, shell API и файловые хуки отключены без возможности включения через пользовательские настройки. Веб-маршрут `/api/command` отсутствует.
|
||||
|
||||
## Hook Runner
|
||||
|
||||
The hook runner is a feature that enables you to execute any shell command you want before or after a certain event. Right now, these are the events:
|
||||
|
||||
* Copy
|
||||
* Rename
|
||||
* Upload
|
||||
* Delete
|
||||
* Save
|
||||
|
||||
Also, during the execution of the commands set for those hooks, there will be some environment variables available to help you perform your commands:
|
||||
|
||||
* `FILE` with the full absolute path to the changed file.
|
||||
* `SCOPE` with the path to user's scope.
|
||||
* `TRIGGER` with the name of the event.
|
||||
* `USERNAME` with the user's username.
|
||||
* `DESTINATION` with the absolute path to the destination. Only used for **copy** and **rename.**
|
||||
|
||||
At this moment, you can edit the commands via the command line interface, using the following commands \(please check the flag `--help` to know more about them\):
|
||||
|
||||
```bash
|
||||
filebrowser cmds add before_copy "echo $FILE"
|
||||
filebrowser cmds rm before_copy 0
|
||||
filebrowser cmds ls
|
||||
```
|
||||
|
||||
Or you can use the web interface to manage them via **Settings** → **Global Settings**.
|
||||
|
||||
## Interactive Shell
|
||||
|
||||
Within File Browser you can toggle the shell (`< >` icon at the top right) and this will open a shell command window at the bottom of the screen. This functionality can be turned on using the environment variable `FB_DISABLE_EXEC=false` or the flag `--disable-exec=false`.
|
||||
|
||||
By default no commands are available as the command list is empty. To enable commands these need to either be done on a per-user basis (including for the Admin user).
|
||||
|
||||
You can do this by adding them in Settings > User Management > (edit user) > Commands or to *apply to all new users created from that point forward* they can be set in Settings > Global Settings
|
||||
|
||||
> [!NOTE]
|
||||
>
|
||||
> If using a proxy manager then remember to enable websockets support for the File Browser proxy
|
||||
|
||||
> [!NOTE]
|
||||
>
|
||||
> If using Docker and you want to add a new command that is not in the base image then you will need to build a custom Docker image using `filebrowser/filebrowser` as a base image. For example to add 7z:
|
||||
>
|
||||
> ```docker
|
||||
> FROM filebrowser/filebrowser
|
||||
> RUN sudo apt install p7zip-full
|
||||
> ```
|
||||
Если нужна автоматическая обработка файлов, запускайте её отдельной службой ОС с самостоятельными разрешениями.
|
||||
+107
-36
@@ -1,46 +1,117 @@
|
||||
## Self-Registration (Signup)
|
||||
# File Browser SSO — Debian amd64
|
||||
|
||||
File Browser allows you to enable user self-registration (signup). This can be enabled via **Settings → Global Settings**, or with `filebrowser config set --signup`. Self-registered users inherit the configured **user defaults**, including the scope.
|
||||
Сборка для `linux/amd64`, базовый набор инструкций `GOAMD64=v1`, `CGO_ENABLED=0`.
|
||||
Node.js и Go на сервере не нужны: интерфейс встроен в исполняемый файл.
|
||||
|
||||
> [!WARNING]
|
||||
>
|
||||
> By default, the user scope is the server's root, so a self-registered user could read,
|
||||
> modify, and delete every file File Browser serves. To prevent this, either:
|
||||
>
|
||||
> a. Enable `createUserDir` so each user gets their own directory; or
|
||||
> b. If users are meant to share files, set the default scope to something other than the root.
|
||||
## Первоначальная настройка
|
||||
|
||||
## Fail2ban
|
||||
Распакуйте архив в `/opt/filebrowser`. Пример отдельного системного пользователя:
|
||||
|
||||
File Browser does not natively support protection against brute force attacks. Therefore, we suggest using something like [fail2ban](https://github.com/fail2ban/fail2ban), which takes care of that by tracking the logs of your File Browser instance. For more information on how fail2ban works, please refer to their [wiki](https://github.com/fail2ban/fail2ban/wiki).
|
||||
|
||||
### Filter Configuration
|
||||
|
||||
An example filter configuration targeted at matching File Browser's logs.
|
||||
|
||||
```ini
|
||||
[INCLUDES]
|
||||
before = common.conf
|
||||
|
||||
[Definition]
|
||||
datepattern = `^%%Y\/%%m\/%%d %%H:%%M:%%S`
|
||||
failregex = `\/api\/login: 403 <HOST> *`
|
||||
```sh
|
||||
sudo useradd --system --home /opt/filebrowser --shell /usr/sbin/nologin filebrowser
|
||||
sudo install -d -m 0750 -o filebrowser -g filebrowser /var/lib/filebrowser /srv/filebrowser
|
||||
sudo chmod 0755 /opt/filebrowser/filebrowser
|
||||
cd /var/lib/filebrowser
|
||||
sudo -u filebrowser /opt/filebrowser/filebrowser init
|
||||
```
|
||||
|
||||
### Jail Configuration
|
||||
Мастер запросит issuer SSO, Client ID, Client secret (без эха в терминале),
|
||||
публичный URL File Browser, папку файлов, путь базы, адрес и порт прослушивания.
|
||||
Для приведённого systemd-файла используйте `/srv/filebrowser` как папку файлов,
|
||||
`/var/lib/filebrowser/filebrowser.db` как базу и `127.0.0.1:8080` как адрес сервера.
|
||||
Публичный URL — внешний HTTPS-адрес, например `https://files.anidev.ru`.
|
||||
|
||||
An example jail configuration. You should fill it with the path of the logs of File Browser, as well as the port where it is running at.
|
||||
Конфигурация сохраняется в `.filebrowser.json` с правами `0600`. Настройка через
|
||||
`.env` не нужна. Мастер не перезаписывает существующую конфигурацию; для другого
|
||||
файла используйте `./filebrowser init --output /полный/путь/settings.json`.
|
||||
Запуск с нестандартной конфигурацией: `./filebrowser --config /полный/путь/settings.json`.
|
||||
|
||||
```ini
|
||||
[filebrowser]
|
||||
В вашем SSO зарегистрируйте приложение с PKCE S256 и callback, напечатанным мастером:
|
||||
|
||||
enabled = true
|
||||
port = [your_port]
|
||||
filter = filebrowser
|
||||
logpath = [your_log_path]
|
||||
maxretry = 10
|
||||
bantime = 10m
|
||||
findtime = 10m
|
||||
banaction = iptables-allports
|
||||
banaction_allports = iptables-allports
|
||||
```text
|
||||
https://files.anidev.ru/auth/callback
|
||||
```
|
||||
|
||||
Если приложение размещено в подпапке, например `https://example.com/files`,
|
||||
мастер сохранит `baseURL=/files`, а callback будет `/files/auth/callback`.
|
||||
|
||||
Нужны scopes `openid profile email`. Claim `roles` — массив строк;
|
||||
точные имена `Master Admin` и `FS Admin` дают права администратора.
|
||||
Остальные пользователи получают локальные файловые разрешения по умолчанию.
|
||||
Создавать пароли и пользователей File Browser не нужно: профиль создаётся при
|
||||
первом входе. Идентичность привязана к issuer и `sub`, а не к логину или почте.
|
||||
|
||||
## Сессии
|
||||
|
||||
После проверенного OIDC-входа действует локальная серверная сессия: максимум
|
||||
8 часов и 30 минут бездействия, как в VTNL Panel. Access token не хранится
|
||||
в браузере и не определяет продолжительность локальной сессии. Роли фиксируются
|
||||
при входе. Изменение роли или блокировка в SSO потребует нового входа; немедленный
|
||||
централизованный отзыв сессий в этой версии не реализован. Для массового завершения
|
||||
локальных сессий перезапустите File Browser; сессии хранятся только в памяти.
|
||||
Несколько экземпляров должны использовать sticky sessions; общая база сессий не предусмотрена.
|
||||
|
||||
Кнопка выхода немедленно удаляет сессию File Browser. Общая сессия самого SSO остаётся
|
||||
активной, поэтому новый вход может не потребовать пароль. Локальные пароли, регистрация,
|
||||
JWT File Browser, proxy-auth и hook-auth удалены. Пароли **публичных ссылок** сохранены.
|
||||
|
||||
## Запуск через systemd
|
||||
|
||||
```sh
|
||||
sudo install -m 0644 filebrowser.service /etc/systemd/system/filebrowser.service
|
||||
sudo systemctl daemon-reload
|
||||
sudo systemctl enable --now filebrowser
|
||||
sudo journalctl -u filebrowser -f
|
||||
```
|
||||
|
||||
Перед приложением нужен reverse proxy с HTTPS. Пример nginx:
|
||||
|
||||
```nginx
|
||||
server {
|
||||
listen 443 ssl;
|
||||
server_name files.anidev.ru;
|
||||
# Укажите свои ssl_certificate и ssl_certificate_key.
|
||||
client_max_body_size 0;
|
||||
location / {
|
||||
proxy_pass http://127.0.0.1:8080;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
proxy_request_buffering off;
|
||||
proxy_read_timeout 3600s;
|
||||
proxy_send_timeout 3600s;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Исполняемые команды и хуки всегда выключены, внешние симлинки запрещены.
|
||||
Файлы, которые разрешено отдавать пользователям, держите в отдельном каталоге.
|
||||
При изменении пути файлов поправьте `ReadWritePaths` и `ProtectHome` в systemd-файле.
|
||||
|
||||
Публичные ссылки создаются как `/s/{key}`. Можно задать имя длиной 2–64 символа
|
||||
из латинских букв, цифр, `_` и `-`. Имена чувствительны к регистру. Занятое имя
|
||||
возвращает 409 и никогда не перезаписывает существующую ссылку. Без имени генерируется
|
||||
случайный ключ из 128 бит. Старые `/share/{key}` остаются доступными.
|
||||
|
||||
Понятные имена легче угадать; для приватных материалов используйте пароль ссылки и срок действия.
|
||||
|
||||
## Обновление и резервное копирование
|
||||
|
||||
Остановите службу, сохраните `.filebrowser.json`, базу и пользовательские файлы,
|
||||
замените бинарник и запустите службу. Перед миграцией старой установки особенно
|
||||
важно сохранить базу: при запуске удаляются пригодные для входа локальные пароли.
|
||||
Старые локальные пользователи автоматически не связываются с SSO по имени — это
|
||||
предотвращает захват аккаунта совпадающим логином. Их файловые области при необходимости
|
||||
назначьте новым SSO-профилям через настройки администратора.
|
||||
|
||||
## Сборка из исходников
|
||||
|
||||
Нужны Go 1.26+, Node.js 24+ и pnpm 10.33.4. Сборка использует системные шрифты,
|
||||
переводы и тяжёлые экраны загружаются по требованию. Для старых ПК используйте
|
||||
поддерживаемый браузер с JavaScript Proxy (Vue 3); Internet Explorer не поддерживается.
|
||||
|
||||
```sh
|
||||
sh scripts/build-release.sh
|
||||
```
|
||||
|
||||
На Windows: `./scripts/build-release.ps1`. Архив и SHA256 появятся в `build/`.
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 21 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 21 KiB |
Reference in new issue
Block a user