sftpgo-mirror/README.md

200 lines
12 KiB
Markdown
Raw Normal View History

2019-07-20 10:26:52 +00:00
# SFTPGo
2020-03-04 22:10:58 +00:00
2020-06-28 19:01:03 +00:00
![CI Status](https://github.com/drakkan/sftpgo/workflows/CI/badge.svg?branch=master&event=push)
[![Code Coverage](https://codecov.io/gh/drakkan/sftpgo/branch/master/graph/badge.svg)](https://codecov.io/gh/drakkan/sftpgo/branch/master)
[![Go Report Card](https://goreportcard.com/badge/github.com/drakkan/sftpgo)](https://goreportcard.com/report/github.com/drakkan/sftpgo)
[![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0)
[![Mentioned in Awesome Go](https://awesome.re/mentioned-badge.svg)](https://github.com/avelino/awesome-go)
2019-07-20 10:26:52 +00:00
2020-08-11 21:56:10 +00:00
Fully featured and highly configurable SFTP server with optional FTP/S and WebDAV support, written in Go.
It can serve local filesystem, S3 or Google Cloud Storage.
2019-07-20 10:26:52 +00:00
## Features
2020-08-11 21:56:10 +00:00
- SFTPGo uses virtual accounts stored inside a "data provider".
2020-03-04 05:28:59 +00:00
- SQLite, MySQL, PostgreSQL, bbolt (key/value store in pure Go) and in-memory data providers are supported.
2020-08-11 21:56:10 +00:00
- Each account is chrooted to its home directory.
2019-08-29 11:52:22 +00:00
- Public key and password authentication. Multiple public keys per user are supported.
- SSH user [certificate authentication](https://cvsweb.openbsd.org/src/usr.bin/ssh/PROTOCOL.certkeys?rev=1.8).
2020-02-25 11:18:45 +00:00
- Keyboard interactive authentication. You can easily setup a customizable multi-factor authentication.
- Partial authentication. You can configure multi-step authentication requiring, for example, the user password after successful public key authentication.
2020-05-23 10:47:44 +00:00
- Per user authentication methods. You can configure the allowed authentication methods for each user.
2020-04-30 12:23:55 +00:00
- Custom authentication via external programs/HTTP API is supported.
- Dynamic user modification before login via external programs/HTTP API is supported.
2019-09-02 07:36:02 +00:00
- Quota support: accounts can have individual quota expressed as max total size and/or max number of files.
2019-08-29 11:52:22 +00:00
- Bandwidth throttling is supported, with distinct settings for upload and download.
- Per user maximum concurrent sessions.
2020-02-25 11:18:45 +00:00
- Per user and per directory permission management: list directory contents, upload, overwrite, download, delete, rename, create directories, create symlinks, change owner/group and mode, change access and modification times.
2020-03-04 22:10:58 +00:00
- Per user files/folders ownership mapping: you can map all the users to the system account that runs SFTPGo (all platforms are supported) or you can run SFTPGo as root user and map each user or group of users to a different system account (\*NIX only).
- Per user IP filters are supported: login can be restricted to specific ranges of IP addresses or to a specific IP address.
- Per user and per directory file extensions filters are supported: files can be allowed or denied based on their extensions.
- Virtual folders are supported: directories outside the user home directory can be exposed as virtual folders.
- Configurable custom commands and/or HTTP notifications on file upload, download, pre-delete, delete, rename, on SSH commands and on user add, update and delete.
2019-08-29 11:52:22 +00:00
- Automatically terminating idle connections.
- Atomic uploads are configurable.
- Support for Git repositories over SSH.
2019-12-31 10:11:07 +00:00
- SCP and rsync are supported.
- FTP/S is supported. You can configure the FTP service to require TLS for both control and data connections.
- [WebDAV](./docs/webdav.md) is supported.
2020-08-11 21:56:10 +00:00
- Support for serving local filesystem, S3 Compatible Object Storage and Google Cloud Storage over SFTP/SCP/FTP/WebDAV.
- Per user protocols restrictions. You can configure the allowed protocols (SSH/FTP/WebDAV) for each user.
2020-03-04 22:10:58 +00:00
- [Prometheus metrics](./docs/metrics.md) are exposed.
2020-08-11 21:56:10 +00:00
- Support for HAProxy PROXY protocol: you can proxy and/or load balance the SFTP/SCP/FTP/WebDAV service without losing the information about the client's address.
- [REST API](./docs/rest-api.md) for users and folders management, backup, restore and real time reports of the active connections with possibility of forcibly closing a connection.
- [Web based administration interface](./docs/web-admin.md) to easily manage users, folders and connections.
- Easy [migration](./examples/rest-api-cli#convert-users-from-other-stores) from Linux system user accounts.
2020-03-04 22:10:58 +00:00
- [Portable mode](./docs/portable-mode.md): a convenient way to share a single directory on demand.
2020-03-15 22:33:12 +00:00
- Performance analysis using built-in [profiler](./docs/profiling.md).
2020-02-25 11:18:45 +00:00
- Configuration format is at your choice: JSON, TOML, YAML, HCL, envfile are supported.
2020-03-04 22:10:58 +00:00
- Log files are accurate and they are saved in the easily parsable JSON format ([more information](./docs/logs.md)).
2019-07-20 10:26:52 +00:00
## Platforms
SFTPGo is developed and tested on Linux. After each commit, the code is automatically built and tested on Linux, macOS and Windows using a [GitHub Action](./.github/workflows/development.yml). The test cases are regularly manually executed and passed on FreeBSD. Other *BSD variants should work too.
2019-07-20 10:26:52 +00:00
## Requirements
- Go 1.13 or higher as build only dependency.
- A suitable SQL server to use as data provider: PostgreSQL 9.4+ or MySQL 5.6+ or SQLite 3.x.
- The SQL server is optional: you can choose to use an embedded bolt database as key/value store or an in memory data provider.
2019-07-20 10:26:52 +00:00
## Installation
2020-03-04 22:10:58 +00:00
Binary releases for Linux, macOS, and Windows are available. Please visit the [releases](https://github.com/drakkan/sftpgo/releases "releases") page.
2019-12-27 22:12:44 +00:00
Official Docker images are available. Documentation is [here](./docker/README.md).
2019-12-27 22:12:44 +00:00
2020-01-01 22:44:33 +00:00
Some Linux distro packages are available:
- For Arch Linux via AUR:
2020-03-05 08:32:29 +00:00
- [sftpgo](https://aur.archlinux.org/packages/sftpgo/). This package follows stable releases. It requires `git`, `gcc` and `go` to build.
- [sftpgo-bin](https://aur.archlinux.org/packages/sftpgo-bin/). This package follows stable releases downloading the prebuilt linux binary from GitHub. It does not require `git`, `gcc` and `go` to build.
- [sftpgo-git](https://aur.archlinux.org/packages/sftpgo-git/). This package builds and installs the latest git master. It requires `git`, `gcc` and `go` to build.
2020-09-27 07:24:10 +00:00
- Deb and RPM packages are built after each commit and for each release.
- For Ubuntu a PPA is available [here](https://launchpad.net/~sftpgo/+archive/ubuntu/sftpgo).
2020-01-01 22:44:33 +00:00
You can easily test new features selecting a commit from the [Actions](https://github.com/drakkan/sftpgo/actions) page and downloading the matching build artifacts for Linux, macOS or Windows. GitHub stores artifacts for 90 days.
2020-03-04 22:10:58 +00:00
Alternately, you can [build from source](./docs/build-from-source.md).
2019-09-16 06:52:58 +00:00
2019-07-20 10:26:52 +00:00
## Configuration
2020-03-04 22:10:58 +00:00
A full explanation of all configuration methods can be found [here](./docs/full-configuration.md).
2019-09-16 07:22:27 +00:00
2020-03-04 22:10:58 +00:00
Please make sure to [initialize the data provider](#data-provider-initialization) before running the daemon!
2020-09-13 17:43:56 +00:00
To start SFTPGo with the default settings, simply run:
2019-07-20 10:26:52 +00:00
2020-03-04 22:10:58 +00:00
```bash
sftpgo serve
2019-08-01 13:39:30 +00:00
```
2020-03-04 22:10:58 +00:00
Check out [this documentation](./docs/service.md) if you want to run SFTPGo as a service.
### Data provider initialization and update
Before starting the SFTPGo server please ensure that the configured data provider is properly initialized/updated.
SQL based data providers (SQLite, MySQL, PostgreSQL) require the creation of a database containing the required tables. Memory and bolt data providers do not require an initialization but they could require an update to the existing data after upgrading SFTPGo.
For PostgreSQL and MySQL providers, you need to create the configured database.
SFTPGo will attempt to automatically detect if the data provider is initialized/updated and if not, will attempt to initialize/ update it on startup as needed.
Alternately, you can create/update the required data provider structures yourself using the `initprovider` command.
2020-03-04 05:28:59 +00:00
For example, you can simply execute the following command from the configuration directory:
2020-03-04 22:10:58 +00:00
```bash
sftpgo initprovider
```
Take a look at the CLI usage to learn how to specify a different configuration file:
2020-03-04 22:10:58 +00:00
```bash
sftpgo initprovider --help
```
You can disable automatic data provider checks/updates at startup by setting the `update_mode` configuration key to `1`.
2020-09-13 17:43:56 +00:00
## Tutorials
Some step-to-step tutorials can be found inside the source tree [howto](./docs/howto "How-to") directory.
2020-03-04 22:10:58 +00:00
## Authentication options
2020-03-04 22:10:58 +00:00
### External Authentication
2020-03-04 22:10:58 +00:00
Custom authentication methods can easily be added. SFTPGo supports external authentication modules, and writing a new backend can be as simple as a few lines of shell script. More information can be found [here](./docs/external-auth.md).
2020-01-07 08:39:20 +00:00
2020-03-04 22:10:58 +00:00
### Keyboard Interactive Authentication
2020-03-04 05:28:59 +00:00
Keyboard interactive authentication is, in general, a series of questions asked by the server with responses provided by the client.
This authentication method is typically used for multi-factor authentication.
2020-03-04 22:10:58 +00:00
More information can be found [here](./docs/keyboard-interactive.md).
## Dynamic user creation or modification
A user can be created or modified by an external program just before the login. More information about this can be found [here](./docs/dynamic-user-mod.md).
## Custom Actions
2020-05-23 10:47:44 +00:00
SFTPGo allows to configure custom commands and/or HTTP notifications on file upload, download, delete, rename, on SSH commands and on user add, update and delete.
2020-03-04 22:10:58 +00:00
More information about custom actions can be found [here](./docs/custom-actions.md).
## Virtual folders
Directories outside the user home directory can be exposed as virtual folders, more information [here](./docs/virtual-folders.md).
## Other hooks
You can get notified as soon as a new connection is established using the [Post-connect hook](./docs/post-connect-hook.md) and after each login using the [Post-login hook](./docs/post-login-hook.md).
You can use your own hook to [check passwords](./docs/check-password-hook.md).
2020-03-04 22:10:58 +00:00
## Storage backends
### S3 Compatible Object Storage backends
Each user can be mapped to the whole bucket or to a bucket virtual folder. This way, the mapped bucket/virtual folder is exposed over SFTP/SCP/FTP/WebDAV. More information about S3 integration can be found [here](./docs/s3.md).
2020-03-04 22:10:58 +00:00
### Google Cloud Storage backend
Each user can be mapped with a Google Cloud Storage bucket or a bucket virtual folder. This way, the mapped bucket/virtual folder is exposed over SFTP/SCP/FTP/WebDAV. More information about Google Cloud Storage integration can be found [here](./docs/google-cloud-storage.md).
2020-03-04 22:10:58 +00:00
### Other Storage backends
2020-03-04 05:28:59 +00:00
Adding new storage backends is quite easy:
- implement the [Fs interface](./vfs/vfs.go#L18 "interface for filesystem backends").
- update the user method `GetFilesystem` to return the new backend
- update the web interface and the REST API CLI
- add the flags for the new storage backed to the `portable` mode
2020-03-04 05:28:59 +00:00
Anyway, some backends require a pay per use account (or they offer free account for a limited time period only). To be able to add support for such backends or to review pull requests, please provide a test account. The test account must be available for enough time to be able to maintain the backend and do basic tests before each new release.
2020-03-04 22:10:58 +00:00
## Brute force protection
2020-03-04 23:01:40 +00:00
The [connection failed logs](./docs/logs.md) can be used for integration in tools such as [Fail2ban](http://www.fail2ban.org/). Example of [jails](./fail2ban/jails) and [filters](./fail2ban/filters) working with `systemd`/`journald` are available in fail2ban directory.
2019-07-20 10:26:52 +00:00
## Account's configuration properties
2020-03-04 22:10:58 +00:00
Details information about account configuration properties can be found [here](./docs/account.md).
## Performance
SFTPGo can easily saturate a Gigabit connection on low end hardware with no special configuration, this is generally enough for most use cases.
2020-03-04 22:10:58 +00:00
More in-depth analysis of performance can be found [here](./docs/performance.md).
2019-07-20 10:26:52 +00:00
## Acknowledgements
SFTPGo makes use of the third party libraries listed inside [go.mod](./go.mod).
Some code was initially taken from [Pterodactyl SFTP Server](https://github.com/pterodactyl/sftp-server).
We are very grateful to all the people who contributed with ideas and/or pull requests.
2019-07-20 10:26:52 +00:00
## License
2019-09-02 07:36:02 +00:00
GNU GPLv3