add some docs for the plugin system
This commit is contained in:
parent
338301955f
commit
030507a2ce
3 changed files with 31 additions and 1 deletions
|
@ -54,6 +54,7 @@ Several storage backends are supported: local filesystem, encrypted local filesy
|
||||||
- Performance analysis using built-in [profiler](./docs/profiling.md).
|
- Performance analysis using built-in [profiler](./docs/profiling.md).
|
||||||
- Configuration format is at your choice: JSON, TOML, YAML, HCL, envfile are supported.
|
- 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](./docs/logs.md)).
|
- Log files are accurate and they are saved in the easily parsable JSON format ([more information](./docs/logs.md)).
|
||||||
|
- SFTPGo supports a [plugin system](./docs/plugins.md) and therefore can be extended using external plugins.
|
||||||
|
|
||||||
## Platforms
|
## Platforms
|
||||||
|
|
||||||
|
|
|
@ -239,7 +239,7 @@ The configuration file contains the following sections:
|
||||||
- `url`
|
- `url`
|
||||||
- `master_key_path`
|
- `master_key_path`
|
||||||
- **plugins**, list of external plugins. Each plugin is configured using a struct with the following fields:
|
- **plugins**, list of external plugins. Each plugin is configured using a struct with the following fields:
|
||||||
- `type`, string. Defines the plugin type. Supported types: `notifier`.
|
- `type`, string. Defines the plugin type. Supported types: `notifier`, `kms`.
|
||||||
- `notifier_options`, struct. Defines the options for notifier plugins.
|
- `notifier_options`, struct. Defines the options for notifier plugins.
|
||||||
- `fs_events`, list of strings. Defines the filesystem events that will be notified to this plugin.
|
- `fs_events`, list of strings. Defines the filesystem events that will be notified to this plugin.
|
||||||
- `user_events`, list of strings. Defines the user events that will be notified to this plugin.
|
- `user_events`, list of strings. Defines the user events that will be notified to this plugin.
|
||||||
|
|
29
docs/plugins.md
Normal file
29
docs/plugins.md
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
# Plugin system
|
||||||
|
|
||||||
|
SFTPGo's plugins are completely separate, standalone applications that SFTPGo executes and communicates with over RPC. This means the plugin process does not share the same memory space as SFTPGo and therefore can only access the interfaces and arguments given to it. This also means a crash in a plugin can not crash the entirety of SFTPGo.
|
||||||
|
|
||||||
|
## Configuration
|
||||||
|
|
||||||
|
The plugins are configured via the `plugins` section in the main SFTPGo configuration file. You basically have to set the path to your plugin, the plugin type and any plugin specific configuration parameters. If you set the SHA256 checksum for the plugin executable, SFTPGo will verify the plugin integrity before starting it.
|
||||||
|
|
||||||
|
For added security you can enable the automatic TLS. In this way, the client and the server automatically negotiate mutual TLS for transport authentication. This ensures that only the original client will be allowed to connect to the server, and all other connections will be rejected. The client will also refuse to connect to any server that isn't the original instance started by the client.
|
||||||
|
|
||||||
|
Full configuration details can be found [here](./full-configuration.md)
|
||||||
|
|
||||||
|
## Available plugins
|
||||||
|
|
||||||
|
Some "official" supported plugins can be found [here](https://github.com/sftpgo/).
|
||||||
|
|
||||||
|
## Plugin Development
|
||||||
|
|
||||||
|
:warning: Advanced topic! Plugin development is a highly advanced topic in SFTPGo, and is not required knowledge for day-to-day usage. If you don't plan on writing any plugins, we recommend not reading this section of the documentation.
|
||||||
|
|
||||||
|
Because SFTPGo communicates to plugins over a RPC interface, you can build and distribute a plugin for SFTPGo without having to rebuild SFTPGo itself.
|
||||||
|
|
||||||
|
In theory, because the plugin interface is HTTP, you could even develop a plugin using a completely different programming language! (Disclaimer, you would also have to re-implement the plugin API which is not a trivial amount of work).
|
||||||
|
|
||||||
|
Developing a plugin is simple. The only knowledge necessary to write a plugin is basic command-line skills and basic knowledge of the [Go programming language](http://golang.org/).
|
||||||
|
|
||||||
|
Your plugin implementation needs to satisfy the interface for the plugin type you want to build. You can find these definitions in the [docs](https://pkg.go.dev/github.com/drakkan/sftpgo/v2/sdk/plugin#section-directories).
|
||||||
|
|
||||||
|
The SFTPGo plugin system uses the HashiCorp [go-plugin](https://github.com/hashicorp/go-plugin) library. Please refer to its documentation for more in-depth information on writing plugins.
|
Loading…
Reference in a new issue