howto: add event manager
add groups section in the getting started guide. Suggest to prefer configuration with env vars instead of modifying the default configuration file Signed-off-by: Nicola Murino <nicola.murino@gmail.com>
@@ -5,6 +5,7 @@ Here we collect step-to-step tutorials. SFTPGo users are encouraged to contribut
|
||||
- [Getting Started](./getting-started.md)
|
||||
- [Securing SFTPGo with a free Let's Encrypt TLS Certificate](./lets-encrypt-certificate.md)
|
||||
- [Two-factor Authentication](./two-factor-authentication.md)
|
||||
- [Event Manager](./eventmanager.md)
|
||||
- [SFTPGo as OpenSSH's SFTP subsystem](./openssh-sftp-subsystem.md)
|
||||
- [SFTPGo with PostgreSQL data provider and S3 backend](./postgresql-s3.md)
|
||||
- [SFTPGo on Windows with Active Directory Integration + Caddy Static File Server](https://www.youtube.com/watch?v=M5UcJI8t4AI)
|
||||
|
||||
96
docs/howto/eventmanager.md
Normal file
@@ -0,0 +1,96 @@
|
||||
# Event Manager
|
||||
|
||||
The Event Manager allows an administrator to configure HTTP notifications, commands execution, email notifications and carry out certain server operations based on server events or schedules. More details [here](../eventmanager.md).
|
||||
|
||||
Let's see some common use cases.
|
||||
|
||||
- [Preliminary Note](#preliminary-note)
|
||||
- [Daily backups](#daily-backups)
|
||||
- [Automatically create a folder structure](#automatically-create-a-folder-structure)
|
||||
- [Upload notifications](#upload-notifications)
|
||||
|
||||
## Preliminary Note
|
||||
|
||||
We will use email actions in the following paragraphs, so let's assume you have a working SMTP configuration.
|
||||
You can adapt the following snippet to configure an SMTP server using environment variables.
|
||||
|
||||
```shell
|
||||
SFTPGO_SMTP__HOST="your smtp server host"
|
||||
SFTPGO_SMTP__FROM="SFTPGo <sftpgo@example.com>"
|
||||
SFTPGO_SMTP__USER=sftpgo@example.com
|
||||
SFTPGO_SMTP__PASSWORD="your password"
|
||||
SFTPGO_SMTP__AUTH_TYPE=1 # change based on what your server supports
|
||||
SFTPGO_SMTP__ENCRYPTION=2 # change based on what your server supports
|
||||
```
|
||||
|
||||
SFTPGo supports several placeholders for event actions. You can see all supported placeholders by clicking on the "info" icon at the top right of the add/update action page.
|
||||
|
||||
## Daily backups
|
||||
|
||||
You can schedule SFTPGo data backups (users, folders, groups, admins etc.) on a regular basis, such as daily.
|
||||
|
||||
From the WebAdmin expand the `Event Manager` section, select `Event actions` and add a new action.
|
||||
Create an action named `backup` and set the type to `Backup`.
|
||||
|
||||

|
||||
|
||||
Create another action named `backup notification`, set the type to `Email` and fill the recipient/s.
|
||||
As email subject set `Backup {{StatusString}}`. The `{{StatusString}}` placeholder will be expanded to `OK` or `KO`.
|
||||
As email body set `Backup done {{ErrorString}}`. The error string will be empty if no errors occur.
|
||||
|
||||

|
||||
|
||||
Now select `Event rules` and create a rule named `Daily backup`, select `Schedule` as trigger and schedule a backup at midnight UTC time.
|
||||
|
||||

|
||||
|
||||
As actions select `backup` and `backup notification`.
|
||||
|
||||

|
||||
|
||||
Done! SFTPGo will make a new backup every day and you will receive an email with the status of the backup. The backup will be saved on the server side in the configured backup directory. The backup files will have names like this `backup_<week day>_<hour>.json`.
|
||||
|
||||
## Automatically create a folder structure
|
||||
|
||||
Suppose you want to automatically create the folders `in` and `out` when you create new users.
|
||||
|
||||
From the WebAdmin expand the `Event Manager` section, select `Event actions` and add a new action.
|
||||
Create an action named `create dirs`, with the settings you can see in the following screen.
|
||||
|
||||

|
||||
|
||||
Create another action named `create dirs failure notification`, set the type to `Email` and fill the recipient/s.
|
||||
As email subject set `Unable to create dirs for user {{ObjectName}}`.
|
||||
As email body set `Error: {{ErrorString}}`.
|
||||
|
||||

|
||||
|
||||
Now select `Event rules` and create a rule named `Create dirs for users`, select `Provider event` as trigger, `add` as provider event and `user` as object filters.
|
||||
|
||||

|
||||
|
||||
As actions select `create dirs` and `create dirs failure notification`, check `Is failure action` for the notification action.
|
||||
This way you will only be notified by email if an error occurs.
|
||||
|
||||

|
||||
|
||||
Done! Create a new user and check that the defined directories are automatically created.
|
||||
|
||||
## Upload notifications
|
||||
|
||||
Let's see how you can receive an email notification after each upload and, optionally, the uploaded file as well.
|
||||
|
||||
From the WebAdmin expand the `Event Manager` section, select `Event actions` and add a new action.
|
||||
Create an action named `upload notification`, with the settings you can see in the following screen.
|
||||
|
||||

|
||||
|
||||
You can optionally add the uploaded file as an attachment but note that SFTPGo allows you to attach a maximum of 10MB. Then the action will fail for files bigger than 10MB.
|
||||
|
||||
Now select `Event rules` and create a rule named `Upload rule`, select `Filesystem evens` as trigger and `upload` as filesystem event.
|
||||
You can also filters events based on protocol, user and group name, filepath shell-like patterns, file size. We omit these additional filters for simplicity.
|
||||
|
||||

|
||||
|
||||
As actions, select `upload notification`.
|
||||
Done! Try uploading a new file and you will receive the configured email notification.
|
||||
@@ -14,6 +14,9 @@ In this tutorial we explore the main features and concepts using the built-in we
|
||||
- [Creating users with a local encrypted backend (Data At Rest Encryption)](#creating-users-with-a-local-encrypted-backend-data-at-rest-Encryption)
|
||||
- [Virtual permissions](#virtual-permissions)
|
||||
- [Virtual folders](#virtual-folders)
|
||||
- [Groups](#groups)
|
||||
- [Usage example](#usage-example)
|
||||
- [Simplify user page](#simplify-user-page)
|
||||
- [Configuration parameters](#configuration-parameters)
|
||||
- [Use PostgreSQL data provider](#use-postgresql-data-provider)
|
||||
- [Use MySQL/MariaDB data provider](#use-mysqlmariadb-data-provider)
|
||||
@@ -237,6 +240,87 @@ sftp> quit
|
||||
|
||||
The last upload failed since we exceeded the number of files quota limit.
|
||||
|
||||
## Groups
|
||||
|
||||
Using groups simplifies the administration of multiple SFTPGo users: you can assign settings once to a group, instead of multiple times to each individual user.
|
||||
|
||||
SFTPGo supports the following types of groups:
|
||||
|
||||
- primary groups
|
||||
- secondary groups
|
||||
- membership groups
|
||||
|
||||
A user can be a member of a primary group and many secondary and membership groups. Depending on the group type, the settings are inherited differently, more details [here](../groups.md).
|
||||
|
||||
:warning: SFTPGo groups are completely unrelated to system groups. Therefore, it is not necessary to add Linux/Windows groups to use SFTPGo groups.
|
||||
|
||||
### Usage example
|
||||
|
||||
Suppose you have the following requirements:
|
||||
|
||||
- each user must be restricted to a local home directory containing the username as last element of the path, for example `/srv/sftpgo/data/<username>`
|
||||
- for each user, the maximum upload size for a single file must be limited to 1GB
|
||||
- each user must have an S3 virtual folder available in the path `/s3<username>` and each user can only access a specified "prefix" of the S3 bucket. It must not be able to access other users' files
|
||||
- each user must have an S3 virtual folder available in the path `/shared`. This is a folder shared with other users
|
||||
- a group of users can only download and list contents in the `/shared` path while another group of users have full access
|
||||
|
||||
We can easily meet these requirements by defining two groups.
|
||||
|
||||
From the SFTPGo WebAdmin UI, click on `Folders` and then on the `+` icon.
|
||||
|
||||
Create a folder named `S3private`.
|
||||
Set the storage to `AWS S3 (Compatible)` and fill the required parameters:
|
||||
|
||||
- bucket name
|
||||
- region
|
||||
- credentials: access key and access secret
|
||||
|
||||

|
||||
|
||||
The important part is the `Key Prefix`, set it to `users/%username%/`
|
||||
|
||||

|
||||
|
||||
The placeholder `%username%` will be replaced with the associated username.
|
||||
|
||||
Create another folder named `S3shared` with the same settings as `S3private` but this time set the `Key Prefix` to `shared/`.
|
||||
The `Key Prefix` has no placeholder, so the folder will operate on a static path that won't change based on the associated user.
|
||||
|
||||
Now click on `Groups` and then on the `+` icon and add a group named `Primary`.
|
||||
|
||||
Set the `Home Dir` to `/srv/sftpgo/data/%username%`.
|
||||
|
||||

|
||||
|
||||
As before, the placeholder `%username%` will be replaced with the associated username.
|
||||
|
||||
Add the two virtual folders to this group and set the `Max file upload size` to 1GB.
|
||||
|
||||

|
||||
|
||||
Add a new group and name it `SharedReadOnly`, in the ACLs section set the permission on the `/shared` path so that read only access is granted.
|
||||
|
||||

|
||||
|
||||
The group setup is now complete. We can now create our users and set the primary group to `Primary`.
|
||||
For the users who need read-only access to the `/shared` path we also have to set `SharedReadOnly` as a secondary group.
|
||||
|
||||
You can now login with any SFTP client like FileZilla, WinSCP etc. and verify that the requirements are met.
|
||||
|
||||
### Simplify user page
|
||||
|
||||
The add/update user page has many configuration options and can be intimidating for some administrators. We can hide most of the settings and automatically add groups to newly created users. This way the hidden settings are inherited from the automatically assigned groups and therefore administrators can add new users simply by setting the username and credentials.
|
||||
|
||||
Click on `Admins` and then on the `+` icon and add an admin named `simply`.
|
||||
In the `Groups for users` section set `Primary` as primary group and `SharedReadOnly` as `seconday` group.
|
||||
In the `User page preferences` section hide all the sections.
|
||||
|
||||

|
||||
|
||||
Log in using the newly created administrator and try to add a new user. The user page is simplified as you can see in the following screen.
|
||||
|
||||

|
||||
|
||||
## Configuration parameters
|
||||
|
||||
Until now we used the default configuration, to change the global service parameters you have to edit the configuration file, or set appropriate environment variables, and restart SFTPGo to apply the changes.
|
||||
@@ -245,6 +329,11 @@ A full explanation of all configuration methods can be found [here](./../full-co
|
||||
|
||||
The default configuration file is `sftpgo.json` and it can be found within the `/etc/sftpgo` directory if you installed from Linux distro packages. On Windows the configuration file can be found within the `{commonappdata}\SFTPGo` directory where `{commonappdata}` is typically `C:\ProgramData`. SFTPGo also supports reading from TOML and YAML configuration files.
|
||||
|
||||
The configuration file can change between different versions and merging your custom settings with the default configuration file, after updating SFTPGo, may be time-consuming. For this reason we suggest to set your custom settings using environment variables.
|
||||
If you install SFTPGo on Linux using the official deb/rpm packages you can set your custom environment variables in the file `/etc/sftpgo/sftpgo.env`.
|
||||
SFTPGo also reads files inside the `env.d` directory relative to config dir (`/etc/sftpgo/env.d` on Linux and `{commonappdata}\SFTPGo\env.d` on Windows) and then exports the valid variables into environment variables if they are not already set.
|
||||
Of course you can also set environment variables with the method provided by the operating system of your choice.
|
||||
|
||||
The following snippets assume your are running SFTPGo on Linux but they can be easily adapted for other operating systems.
|
||||
|
||||
### Use PostgreSQL data provider
|
||||
@@ -259,7 +348,7 @@ grant all privileges on database "sftpgo" to "sftpgo";
|
||||
\q
|
||||
```
|
||||
|
||||
Open the SFTPGo configuration file, search for the `data_provider` section and change it as follow.
|
||||
You can open the SFTPGo configuration file, search for the `data_provider` section and change it as follow.
|
||||
|
||||
```json
|
||||
"data_provider": {
|
||||
@@ -273,6 +362,17 @@ Open the SFTPGo configuration file, search for the `data_provider` section and c
|
||||
}
|
||||
```
|
||||
|
||||
Alternatively (recommended), you can use environment variables by creating the file `/etc/sftpgo/env.d/postgresql.env` with the following content.
|
||||
|
||||
```shell
|
||||
SFTPGO_DATA_PROVIDER__DRIVER=postgresql
|
||||
SFTPGO_DATA_PROVIDER__NAME=sftpgo
|
||||
SFTPGO_DATA_PROVIDER__HOST=127.0.0.1
|
||||
SFTPGO_DATA_PROVIDER__PORT=5432
|
||||
SFTPGO_DATA_PROVIDER__USERNAME=sftpgo
|
||||
SFTPGO_DATA_PROVIDER__PASSWORD=your password here
|
||||
```
|
||||
|
||||
Confirm that the database connection works by initializing the data provider.
|
||||
|
||||
```shell
|
||||
@@ -313,7 +413,7 @@ MariaDB [(none)]> quit
|
||||
Bye
|
||||
```
|
||||
|
||||
Open the SFTPGo configuration file, search for the `data_provider` section and change it as follow.
|
||||
You can open the SFTPGo configuration file, search for the `data_provider` section and change it as follow.
|
||||
|
||||
```json
|
||||
"data_provider": {
|
||||
@@ -327,6 +427,17 @@ Open the SFTPGo configuration file, search for the `data_provider` section and c
|
||||
}
|
||||
```
|
||||
|
||||
Alternatively (recommended), you can use environment variables by creating the file `/etc/sftpgo/env.d/mysql.env` with the following content.
|
||||
|
||||
```shell
|
||||
SFTPGO_DATA_PROVIDER__DRIVER=mysql
|
||||
SFTPGO_DATA_PROVIDER__NAME=sftpgo
|
||||
SFTPGO_DATA_PROVIDER__HOST=127.0.0.1
|
||||
SFTPGO_DATA_PROVIDER__PORT=3306
|
||||
SFTPGO_DATA_PROVIDER__USERNAME=sftpgo
|
||||
SFTPGO_DATA_PROVIDER__PASSWORD=your password here
|
||||
```
|
||||
|
||||
Confirm that the database connection works by initializing the data provider.
|
||||
|
||||
```shell
|
||||
@@ -357,7 +468,7 @@ We suppose you have installed CockroachDB this way:
|
||||
|
||||
```shell
|
||||
sudo su
|
||||
export CRDB_VERSION=22.1.0 # set the latest available version here
|
||||
export CRDB_VERSION=22.1.8 # set the latest available version here
|
||||
wget -qO- https://binaries.cockroachdb.com/cockroach-v${CRDB_VERSION}.linux-amd64.tgz | tar xvz
|
||||
cp -i cockroach-v${CRDB_VERSION}.linux-amd64/cockroach /usr/local/bin/
|
||||
mkdir -p /usr/local/lib/cockroach
|
||||
@@ -387,9 +498,8 @@ ExecStart=/usr/local/bin/cockroach start-single-node --certs-dir=/etc/cockroach/
|
||||
TimeoutStopSec=60
|
||||
Restart=always
|
||||
RestartSec=10
|
||||
StandardOutput=syslog
|
||||
StandardError=syslog
|
||||
SyslogIdentifier=cockroach
|
||||
StandardOutput=journal
|
||||
StandardError=journal
|
||||
User=sftpgo
|
||||
[Install]
|
||||
WantedBy=default.target
|
||||
@@ -404,7 +514,7 @@ CREATE DATABASE
|
||||
Time: 13ms
|
||||
```
|
||||
|
||||
Open the SFTPGo configuration file, search for the `data_provider` section and change it as follow.
|
||||
You can open the SFTPGo configuration file, search for the `data_provider` section and change it as follow.
|
||||
|
||||
```json
|
||||
"data_provider": {
|
||||
@@ -422,6 +532,20 @@ Open the SFTPGo configuration file, search for the `data_provider` section and c
|
||||
}
|
||||
```
|
||||
|
||||
Alternatively (recommended), you can use environment variables by creating the file `/etc/sftpgo/env.d/cockroachdb.env` with the following content.
|
||||
|
||||
```shell
|
||||
SFTPGO_DATA_PROVIDER__DRIVER=cockroachdb
|
||||
SFTPGO_DATA_PROVIDER__NAME=sftpgo
|
||||
SFTPGO_DATA_PROVIDER__HOST=localhost
|
||||
SFTPGO_DATA_PROVIDER__PORT=26257
|
||||
SFTPGO_DATA_PROVIDER__USERNAME=root
|
||||
SFTPGO_DATA_PROVIDER__SSLMODE=3
|
||||
SFTPGO_DATA_PROVIDER__ROOT_CERT="/etc/cockroach/certs/ca.crt"
|
||||
SFTPGO_DATA_PROVIDER__CLIENT_CERT="/etc/cockroach/certs/client.root.crt"
|
||||
SFTPGO_DATA_PROVIDER__CLIENT_KEY="/etc/cockroach/certs/client.root.key"
|
||||
```
|
||||
|
||||
Confirm that the database connection works by initializing the data provider.
|
||||
|
||||
```shell
|
||||
@@ -452,7 +576,7 @@ Restart SFTPGo to apply the changes.
|
||||
|
||||
### Enable FTP service
|
||||
|
||||
Open the SFTPGo configuration file, search for the `ftpd` section and change it as follow.
|
||||
You can set the configuration options to enable the FTP service by opening the SFTPGo configuration file, looking for the `ftpd` section and editing it as follows.
|
||||
|
||||
```json
|
||||
"ftpd": {
|
||||
@@ -485,6 +609,12 @@ Open the SFTPGo configuration file, search for the `ftpd` section and change it
|
||||
}
|
||||
```
|
||||
|
||||
Alternatively (recommended), you can use environment variables by creating the file `/etc/sftpgo/env.d/ftpd.env` with the following content.
|
||||
|
||||
```shell
|
||||
SFTPGO_FTPD__BINDINGS__0__PORT=2121
|
||||
```
|
||||
|
||||
Restart SFTPGo to apply the changes. The FTP service is now available on port `2121`.
|
||||
|
||||
You can also configure the passive ports range (`50000-50100` by default), these ports must be reachable for passive FTP to work. If your FTP server is on the private network side of a NAT configuration you have to set `force_passive_ip` to your external IP address. You may also need to open the passive port range on your firewall.
|
||||
@@ -493,7 +623,7 @@ It is recommended that you provide a certificate and key file to expose FTP over
|
||||
|
||||
### Enable WebDAV service
|
||||
|
||||
Open the SFTPGo configuration file, search for the `webdavd` section and change it as follow.
|
||||
You can set the configuration options to enable the FTP service by opening the SFTPGo configuration file, looking for the `webdavd` section and editing it as follows.
|
||||
|
||||
```json
|
||||
"webdavd": {
|
||||
@@ -510,11 +640,18 @@ Open the SFTPGo configuration file, search for the `webdavd` section and change
|
||||
"prefix": "",
|
||||
"proxy_allowed": [],
|
||||
"client_ip_proxy_header": "",
|
||||
"client_ip_header_depth": 0
|
||||
"client_ip_header_depth": 0,
|
||||
"disable_www_auth_header": false
|
||||
}
|
||||
],
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
Alternatively (recommended), you can use environment variables by creating the file `/etc/sftpgo/env.d/webdavd.env` with the following content.
|
||||
|
||||
```shell
|
||||
SFTPGO_WEBDAVD__BINDINGS__0__PORT=10080
|
||||
```
|
||||
|
||||
Restart SFTPGo to apply the changes. The WebDAV service is now available on port `10080`. It is recommended that you provide a certificate and key file to expose WebDAV over https.
|
||||
|
||||
BIN
docs/howto/img/add-group.png
Normal file
|
After Width: | Height: | Size: 49 KiB |
BIN
docs/howto/img/add-user-simplified.png
Normal file
|
After Width: | Height: | Size: 30 KiB |
BIN
docs/howto/img/backup-action.png
Normal file
|
After Width: | Height: | Size: 22 KiB |
BIN
docs/howto/img/backup-notification-action.png
Normal file
|
After Width: | Height: | Size: 53 KiB |
BIN
docs/howto/img/create-dirs-action.png
Normal file
|
After Width: | Height: | Size: 41 KiB |
BIN
docs/howto/img/create-dirs-failure-notification.png
Normal file
|
After Width: | Height: | Size: 54 KiB |
BIN
docs/howto/img/create-dirs-rule-actions.png
Normal file
|
After Width: | Height: | Size: 34 KiB |
BIN
docs/howto/img/create-dirs-rule.png
Normal file
|
After Width: | Height: | Size: 30 KiB |
BIN
docs/howto/img/daily-backup-actions.png
Normal file
|
After Width: | Height: | Size: 33 KiB |
BIN
docs/howto/img/daily-backup-schedule.png
Normal file
|
After Width: | Height: | Size: 57 KiB |
BIN
docs/howto/img/primary-group-settings.png
Normal file
|
After Width: | Height: | Size: 82 KiB |
BIN
docs/howto/img/read-only-share.png
Normal file
|
After Width: | Height: | Size: 22 KiB |
BIN
docs/howto/img/s3-key-prefix.png
Normal file
|
After Width: | Height: | Size: 13 KiB |
BIN
docs/howto/img/s3-private-folder.png
Normal file
|
After Width: | Height: | Size: 59 KiB |
BIN
docs/howto/img/simplified-admin.png
Normal file
|
After Width: | Height: | Size: 83 KiB |
BIN
docs/howto/img/upload-notification.png
Normal file
|
After Width: | Height: | Size: 62 KiB |
BIN
docs/howto/img/upload-rule.png
Normal file
|
After Width: | Height: | Size: 24 KiB |
@@ -117,7 +117,7 @@ When the certificate is renewed you should see SFTPGo logs like the following to
|
||||
|
||||
## Obtaining a certificate using the ACME protocol built into SFTPGo
|
||||
|
||||
Open the SFTPGo configuration file, search for the `acme` section and change it as follow.
|
||||
You can open the SFTPGo configuration file, search for the `acme` section and change it as follow.
|
||||
|
||||
```json
|
||||
"acme": {
|
||||
@@ -138,6 +138,14 @@ Open the SFTPGo configuration file, search for the `acme` section and change it
|
||||
}
|
||||
```
|
||||
|
||||
Alternatively (recommended), you can use environment variables by creating the file `/etc/sftpgo/env.d/acme.env` with the following content.
|
||||
|
||||
```shell
|
||||
SFTPGO_ACME__DOMAINS="sftpgo.com"
|
||||
SFTPGO_ACME__EMAIL="<you email address here>"
|
||||
SFTPGO_ACME__HTTP01_CHALLENGE__WEBROOT="/var/www/sftpgo.com"
|
||||
```
|
||||
|
||||
Make sure that the `sftpgo` user can write to the `/var/www/sftpgo.com` directory or pre-create the `/var/www/sftpgo.com/.well-known/acme-challenge` directory with the appropriate permissions.
|
||||
This directory must be publicly served by your web server.
|
||||
|
||||
@@ -151,7 +159,7 @@ If this command completes successfully, you are done. The SFTPGo service will ta
|
||||
|
||||
## Enable HTTPS for SFTPGo Web UI and REST API
|
||||
|
||||
Open the SFTPGo configuration file, search for the `httpd` section and change it as follow.
|
||||
You can open the SFTPGo configuration file, search for the `httpd` section and change it as follow.
|
||||
|
||||
```json
|
||||
"httpd": {
|
||||
@@ -161,17 +169,27 @@ Open the SFTPGo configuration file, search for the `httpd` section and change it
|
||||
"address": "",
|
||||
"enable_web_admin": true,
|
||||
"enable_web_client": true,
|
||||
"enable_rest_api": true,
|
||||
"enable_https": true,
|
||||
"certificate_file": "/var/lib/sftpgo/certs/sftpgo.com.crt",
|
||||
"certificate_key_file": "/var/lib/sftpgo/certs/sftpgo.com.key",
|
||||
.....
|
||||
```
|
||||
|
||||
Alternatively (recommended), you can use environment variables by creating the file `/etc/sftpgo/env.d/httpd.env` with the following content.
|
||||
|
||||
```shell
|
||||
SFTPGO_HTTPD__BINDINGS__0__PORT=9443
|
||||
SFTPGO_HTTPD__BINDINGS__0__ENABLE_HTTPS=1
|
||||
SFTPGO_HTTPD__BINDINGS__0__CERTIFICATE_FILE="/var/lib/sftpgo/certs/sftpgo.com.crt"
|
||||
SFTPGO_HTTPD__BINDINGS__0__CERTIFICATE_KEY_FILE="/var/lib/sftpgo/certs/sftpgo.com.key"
|
||||
```
|
||||
|
||||
Restart SFTPGo to apply the changes. The HTTPS service is now available on port `9443`.
|
||||
|
||||
## Enable HTTPS for WebDAV service
|
||||
|
||||
Open the SFTPGo configuration file, search for the `webdavd` section and change it as follow.
|
||||
You can open the SFTPGo configuration file, search for the `webdavd` section and change it as follow.
|
||||
|
||||
```json
|
||||
"webdavd": {
|
||||
@@ -185,11 +203,20 @@ Open the SFTPGo configuration file, search for the `webdavd` section and change
|
||||
...
|
||||
```
|
||||
|
||||
Alternatively (recommended), you can use environment variables by creating the file `/etc/sftpgo/env.d/webdavd.env` with the following content.
|
||||
|
||||
```shell
|
||||
SFTPGO_WEBDAVD__BINDINGS__0__PORT=10443
|
||||
SFTPGO_WEBDAVD__BINDINGS__0__ENABLE_HTTPS=1
|
||||
SFTPGO_WEBDAVD__CERTIFICATE_FILE="/var/lib/sftpgo/certs/sftpgo.com.crt"
|
||||
SFTPGO_WEBDAVD__CERTIFICATE_KEY_FILE="/var/lib/sftpgo/certs/sftpgo.com.key"
|
||||
```
|
||||
|
||||
Restart SFTPGo to apply the changes. WebDAV is now availble over HTTPS on port `10443`.
|
||||
|
||||
## Enable explicit FTP over TLS
|
||||
|
||||
Open the SFTPGo configuration file, search for the `ftpd` section and change it as follow.
|
||||
You can open the SFTPGo configuration file, search for the `ftpd` section and change it as follow.
|
||||
|
||||
```json
|
||||
"ftpd": {
|
||||
@@ -204,4 +231,13 @@ Open the SFTPGo configuration file, search for the `ftpd` section and change it
|
||||
...
|
||||
```
|
||||
|
||||
Alternatively (recommended), you can use environment variables by creating the file `/etc/sftpgo/env.d/ftpd.env` with the following content.
|
||||
|
||||
```shell
|
||||
SFTPGO_FTPD__BINDINGS__0__PORT=2121
|
||||
SFTPGO_FTPD__BINDINGS__0__TLS_MODE=1
|
||||
SFTPGO_FTPD__BINDINGS__0__CERTIFICATE_FILE="/var/lib/sftpgo/certs/sftpgo.com.crt"
|
||||
SFTPGO_FTPD__BINDINGS__0__CERTIFICATE_KEY_FILE="/var/lib/sftpgo/certs/sftpgo.com.key"
|
||||
```
|
||||
|
||||
Restart SFTPGo to apply the changes. FTPES service is now available on port `2121` and TLS is required for both control and data connection (`tls_mode` is 1).
|
||||
|
||||
@@ -144,6 +144,17 @@ Search for the `data_provider` section and change it as follow.
|
||||
}
|
||||
```
|
||||
|
||||
Alternatively (recommended), you can use environment variables by creating the file `/etc/sftpgo/env.d/postgresql.env` with the following content.
|
||||
|
||||
```shell
|
||||
SFTPGO_DATA_PROVIDER__DRIVER=postgresql
|
||||
SFTPGO_DATA_PROVIDER__NAME="sftpgo.db"
|
||||
SFTPGO_DATA_PROVIDER__HOST=127.0.0.1
|
||||
SFTPGO_DATA_PROVIDER__PORT=5432
|
||||
SFTPGO_DATA_PROVIDER__USERNAME=sftpgo
|
||||
SFTPGO_DATA_PROVIDER__PASSWORD=sftpgo_pg_pwd
|
||||
```
|
||||
|
||||
This way we set the PostgreSQL connection parameters.
|
||||
|
||||
If you want to connect to PostgreSQL over a Unix Domain socket you have to set the value `/var/run/postgresql` for the `host` configuration key instead of `127.0.0.1`.
|
||||
|
||||
@@ -42,6 +42,8 @@ SFTPGo can use 2FA for `HTTP`, `SSH` (SFTP, SCP) and `FTP` protocols. If you pla
|
||||
...
|
||||
```
|
||||
|
||||
Or setting the environment variable `SFTPGO_SFTPD__KEYBOARD_INTERACTIVE_AUTHENTICATION=1`.
|
||||
|
||||
## Enable 2FA for admins
|
||||
|
||||
Each admin can view/change his/her two-factor authentication by selecting the `Two-Factor Auth` link from the top-right web UI menu.
|
||||
|
||||