Full-featured and highly configurable SFTP, HTTP/S, FTP/S and WebDAV server - S3, Google Cloud Storage, Azure Blob
Find a file
2020-12-12 10:31:09 +01:00
.github CI Docker: don't build full image on pull request 2020-11-24 18:51:10 +01:00
cmd add sftpfs storage backend 2020-12-12 10:31:09 +01:00
common add sftpfs storage backend 2020-12-12 10:31:09 +01:00
config config: make config file relative to the config dir 2020-12-03 17:16:35 +01:00
dataprovider add sftpfs storage backend 2020-12-12 10:31:09 +01:00
docker add a dedicated struct to store encrypted credentials 2020-11-22 21:53:04 +01:00
docs add sftpfs storage backend 2020-12-12 10:31:09 +01:00
examples add sftpfs storage backend 2020-12-12 10:31:09 +01:00
fail2ban proxy protocol: added an option to make the proxy header required 2020-02-29 00:02:06 +01:00
ftpd add sftpfs storage backend 2020-12-12 10:31:09 +01:00
httpclient httpclient: add a configuration parameter to skip TLS certificate validation 2020-05-03 11:37:50 +02:00
httpd add sftpfs storage backend 2020-12-12 10:31:09 +01:00
init systemd unit: run as "sftpgo" system user 2020-09-25 18:23:04 +02:00
kms add sftpfs storage backend 2020-12-12 10:31:09 +01:00
logger add support for SFTP subsystem mode 2020-10-29 19:23:33 +01:00
metrics add metrics for Azure Blob storage 2020-10-26 19:01:17 +01:00
pkgs update nfpm to 1.10.2 2020-11-27 18:07:27 +01:00
service add sftpfs storage backend 2020-12-12 10:31:09 +01:00
sftpd add sftpfs storage backend 2020-12-12 10:31:09 +01:00
static REST API: add a method to get the status of the services 2020-12-08 11:18:34 +01:00
templates add sftpfs storage backend 2020-12-12 10:31:09 +01:00
utils add a dedicated struct to store encrypted credentials 2020-11-22 21:53:04 +01:00
version back to development 2020-11-18 21:53:23 +01:00
vfs add sftpfs storage backend 2020-12-12 10:31:09 +01:00
webdavd add sftpfs storage backend 2020-12-12 10:31:09 +01:00
windows-installer windows setup: allow installation on older Windows version 2020-10-31 11:04:24 +01:00
.gitignore Update README add section for dataprovider init 2020-01-31 08:56:15 +01:00
.golangci.yml add more linters 2020-05-06 19:36:34 +02:00
Dockerfile docker: add slim image 2020-11-12 22:40:53 +01:00
Dockerfile.alpine docker: add slim image 2020-11-12 22:40:53 +01:00
Dockerfile.full docker: add slim image 2020-11-12 22:40:53 +01:00
Dockerfile.full.alpine docker: add slim image 2020-11-12 22:40:53 +01:00
go.mod add sftpfs storage backend 2020-12-12 10:31:09 +01:00
go.sum add sftpfs storage backend 2020-12-12 10:31:09 +01:00
LICENSE Initial commit 2019-07-20 12:18:32 +02:00
main.go sftpd: update pkg/sftp 2020-09-06 11:40:31 +02:00
README.md add sftpfs storage backend 2020-12-12 10:31:09 +01:00
SECURITY.md back to development 2020-10-11 09:29:17 +02:00
sftpgo.json add KMS support 2020-11-30 21:46:34 +01:00

SFTPGo

CI Status Code Coverage Go Report Card License: GPL v3 Docker Pulls Mentioned in Awesome Go

Fully featured and highly configurable SFTP server with optional FTP/S and WebDAV support, written in Go. It can serve local filesystem, S3 (compatible) Object Storage, Google Cloud Storage and Azure Blob Storage.

Features

  • SFTPGo uses virtual accounts stored inside a "data provider".
  • SQLite, MySQL, PostgreSQL, bbolt (key/value store in pure Go) and in-memory data providers are supported.
  • Each account is chrooted to its home directory.
  • Public key and password authentication. Multiple public keys per user are supported.
  • SSH user certificate authentication.
  • 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.
  • Per user authentication methods. You can configure the allowed authentication methods for each user.
  • Custom authentication via external programs/HTTP API is supported.
  • Data At Rest Encryption is supported.
  • Dynamic user modification before login via external programs/HTTP API is supported.
  • Quota support: accounts can have individual quota expressed as max total size and/or max number of files.
  • Bandwidth throttling is supported, with distinct settings for upload and download.
  • Per user maximum concurrent sessions.
  • 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.
  • 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 shell like patterns filters are supported: files can be allowed or denied based on shell like patterns.
  • 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.
  • Automatically terminating idle connections.
  • Atomic uploads are configurable.
  • Support for Git repositories over SSH.
  • 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 is supported.
  • Support for serving local filesystem, S3 Compatible Object Storage, Google Cloud Storage, Azure Blob Storage or another SFTP server over SFTP/SCP/FTP/WebDAV.
  • Per user protocols restrictions. You can configure the allowed protocols (SSH/FTP/WebDAV) for each user.
  • Prometheus metrics are exposed.
  • 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 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 to easily manage users, folders and connections.
  • Easy migration from Linux system user accounts.
  • Portable mode: a convenient way to share a single directory on demand.
  • SFTP subsystem mode: you can use SFTPGo as OpenSSH's SFTP subsystem.
  • Performance analysis using built-in profiler.
  • Configuration format is at your choice: JSON, TOML, YAML, HCL, envfile are supported.
  • Log files are accurate and they are saved in the easily parsable JSON format (more information).

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. The test cases are regularly manually executed and passed on FreeBSD. Other *BSD variants should work too.

Requirements

  • Go 1.14 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.

Installation

Binary releases for Linux, macOS, and Windows are available. Please visit the releases page.

An official Docker image is available. Documentation is here.

Some Linux distro packages are available:

  • For Arch Linux via AUR:
    • sftpgo. This package follows stable releases. It requires git, gcc and go to build.
    • 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. This package builds and installs the latest git master. It requires git, gcc and go to build.
  • Deb and RPM packages are built after each commit and for each release.
  • For Ubuntu a PPA is available here.

You can easily test new features selecting a commit from the Actions page and downloading the matching build artifacts for Linux, macOS or Windows. GitHub stores artifacts for 90 days.

Alternately, you can build from source.

Configuration

A full explanation of all configuration methods can be found here.

Please make sure to initialize the data provider before running the daemon!

To start SFTPGo with the default settings, simply run:

sftpgo serve

Check out this documentation if you want to run SFTPGo as a service.

Data provider initialization and management

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.

For example, you can simply execute the following command from the configuration directory:

sftpgo initprovider

Take a look at the CLI usage to learn how to specify a different configuration file:

sftpgo initprovider --help

You can disable automatic data provider checks/updates at startup by setting the update_mode configuration key to 1.

If for some reason you want to downgrade SFTPGo, you may need to downgrade your data provider schema and data as well. You can use the revertprovider command for this task.

We support the follwing schema versions:

  • 6, this is the current git master
  • 4, this is the schema for v1.0.0-v1.2.x

So, if you plan to downgrade from git master to 1.2.x, you can prepare your data provider executing the following command from the configuration directory:

sftpgo revertprovider --to-version 4

Take a look at the CLI usage to learn how to specify a different configuration file:

sftpgo revertprovider --help

The revertprovider command is not supported for the memory provider.

Users and folders management

After starting SFTPGo you can manage users and folders using:

To support embedded data providers like bolt and SQLite we can't have a CLI that directly write users and folders to the data provider, we always have to use the REST API.

Tutorials

Some step-to-step tutorials can be found inside the source tree howto directory.

Authentication options

External Authentication

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.

Keyboard Interactive Authentication

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.

More information can be found here.

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.

Custom Actions

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.

More information about custom actions can be found here.

Virtual folders

Directories outside the user home directory can be exposed as virtual folders, more information here.

Other hooks

You can get notified as soon as a new connection is established using the Post-connect hook and after each login using the Post-login hook. You can use your own hook to check passwords.

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.

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.

Azure Blob Storage backend

Each user can be mapped with an Azure Blob Storage container or a container virtual folder. This way, the mapped container/virtual folder is exposed over SFTP/SCP/FTP/WebDAV. More information about Azure Blob Storage integration can be found here.

SFTP backend

Each user can be mapped to another SFTP server account or a subfolder of it. More information can be found here.

Encrypted backend

Data at-rest encryption is supported via the cryptfs backend.

Other Storage backends

Adding new storage backends is quite easy:

  • implement the Fs interface.
  • 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

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.

Brute force protection

The connection failed logs can be used for integration in tools such as Fail2ban. Example of jails and filters working with systemd/journald are available in fail2ban directory.

Account's configuration properties

Details information about account configuration properties can be found here.

Performance

SFTPGo can easily saturate a Gigabit connection on low end hardware with no special configuration, this is generally enough for most use cases.

More in-depth analysis of performance can be found here.

Release Cadence

SFTPGo releases are feature-driven, we don't have a fixed time based schedule. As a rough estimate, you can expect 1 or 2 new releases per year.

Acknowledgements

SFTPGo makes use of the third party libraries listed inside go.mod. Some code was initially taken from Pterodactyl SFTP Server. We are very grateful to all the people who contributed with ideas and/or pull requests.

License

GNU GPLv3