Nicola Murino
96a39a36bb
dataprovider: add support for bbolt key/value store
...
This way there is an alternative for embedded/small systems if CGO
is disabled at build time and so SQLite support cannot be compiled
2019-08-12 18:31:31 +02:00
Nicola Murino
cb87fe811a
dataprovider move db handle to provider struct
...
This is needed to support non SQL providers
2019-08-11 14:53:37 +02:00
Nicola Murino
51aacae3c5
version: only git commit and build date must be modifiable
...
Improved some test cases too
2019-08-08 21:42:07 +02:00
Nicola Murino
90607d4f86
sftpd stats: add file path for active upload/download
2019-08-08 19:33:16 +02:00
Nicola Murino
9f5722a894
CLI: add optional support to highlight with colors the JSON responses
2019-08-08 14:20:42 +02:00
Nicola Murino
a7158634a0
CLI: use GNU style for arguments
...
add short argument options
2019-08-08 12:03:24 +02:00
Nicola Murino
4d3c8fb6c4
add get version example
2019-08-08 10:13:32 +02:00
Nicola Murino
4f4489d3f1
add version info
2019-08-08 10:01:33 +02:00
Nicola Murino
2aca4479a5
rename public_key in public_keys
...
remove compatibility layer to convert public keys newline delimited
in json list
2019-08-07 23:41:10 +02:00
Nicola Murino
5ad222fc53
python cli: add a flag to ignore verifying the SSL certificate
2019-08-07 23:06:26 +02:00
Nicola Murino
8f421b7d0f
switch to viper for configuration and use cobra for cli
2019-08-07 22:46:52 +02:00
Nicola Murino
13d4489c48
python cli: add support for authentication
...
basic and digest auth are supported
2019-08-07 08:59:46 +02:00
Nicola Murino
20c7e2772a
api utils: join url paths in a more robust way
2019-08-05 15:18:44 +02:00
Jo Vandeginste
eb14026f6e
Add Environment
& EnvironmentFile
directives
...
Since we can now override settings through environment variables, it's handy to contain those changes in a separate file. This way, sysadmins can generate such a file without having to touch the systemd file.
Meanwhile the current flags are converted to `Environment` entries, which can be overridden in the `EnvironmentFile` if so desired.
If the file is not present, the directive [is ignored](https://www.freedesktop.org/software/systemd/man/systemd.exec.html#EnvironmentFile= )
2019-08-05 15:10:37 +02:00
Nicola Murino
4009a93713
python cli: add python2 support
...
Tested using python 3.7.4 and python 2.7.16
2019-08-05 11:11:29 +02:00
Nicola Murino
4dc52ee3e9
api_utils: return response body too
...
useful for debug and to build external API, for example a CLI interface
2019-08-04 21:37:31 +02:00
Nicola Murino
4d3c1fbad6
add more test cases
2019-08-04 12:35:33 +02:00
Nicola Murino
61b5a1d9a3
simplify FileOpenFlags to os.Flags conversion
2019-08-04 11:02:38 +02:00
Nicola Murino
80b9c40489
add support for atomic upload
...
Atomic uploads are now configurable. The default upload mode remains
non atomic
2019-08-04 09:37:58 +02:00
Nicola Murino
d2361da570
api_utils: expose missing REST API
...
REST API are now fully exposed and can be consumed by other packages
using the methods in api_utils.go
2019-08-03 13:19:00 +02:00
Nicola Murino
b8dafecdd9
transfer: initialize lastActivity
...
This avoid a random value for transfer of empty file where no reads or writes happen
2019-08-02 15:49:51 +02:00
Nicola Murino
8c40684989
sftpd: simplify initialization code
...
now gocyclo is happy again
2019-08-02 11:17:23 +02:00
Nicola Murino
ba3f9d891a
allow to set default arguments values from env vars
2019-08-02 09:47:14 +02:00
Nicola Murino
73c61cda31
arguments: document --arg form
...
go flag library supports one or two minus signs, they are equivalent.
Other Go command line parsers such as kingpin only support the -- variant
2019-08-02 00:26:20 +02:00
Nicola Murino
fe3e1db13a
Improve documentation for cli client
2019-08-02 00:06:44 +02:00
Nicola Murino
266216e372
Add sample cli client for REST API
...
It isn't written in Go to show interoperability with other programming languages
2019-08-02 00:00:48 +02:00
Nicola Murino
8d4964c16d
convert public key from newline delimited string to a real array
...
Added a compatibility layer that will convert newline delimited keys to array
when the user is fetched from the database.
This code will be removed in future versions please update your public keys,
you only need to resave the users using the REST API.
2019-08-01 22:42:46 +02:00
Nicola Murino
788e068e13
Improve documentation
2019-08-01 15:39:30 +02:00
Jo Vandeginste
bd7b6a785e
Support multiple private (host) keys
...
With this patch, one can configure one or more private (host) keys in
the configuration file.
I made it a nested struct, so we can add more options later. Eg. host
certificates might be a useful addition if I can figure out how this is
done in golang's crypto/ssh...
Signed-off-by: Jo Vandeginste <Jo.Vandeginste@kuleuven.be>
2019-08-01 14:57:15 +02:00
Nicola Murino
1566e43cd7
set track_quota to 2 as default
2019-08-01 09:24:35 +02:00
Jo Vandeginste
170e3113e1
When path starts with slash, consider it absolute
...
When SQLite path starts with a `/`, we consider this to be an absolute path.
Eg.:
```json
{
"data_provider":{
"name":"/var/lib/sftpgo/sftpgo.db"
}
}
```
2019-07-31 17:14:46 +02:00
Nicola Murino
a7a3d533e7
Add documentation and tests for multiple public keys support
2019-07-31 17:06:12 +02:00
Jo Vandeginste
c752dd8e81
Support multiple public keys
...
This will parse the public key field as a newline delimited list of public keys.
Return (valid) result on first match.
2019-07-31 15:47:51 +02:00
Jo Vandeginste
99e89f59c9
Add missing newline, add code highlighting hint
2019-07-31 14:49:21 +02:00
Nicola Murino
34543fd861
simplify test case for quota checking after file replace
2019-07-31 14:21:56 +02:00
Nicola Murino
89986b9305
add new test cases
2019-07-31 14:11:44 +02:00
Nicola Murino
2a8ab620f3
improve logger
...
log file size, rotation policy and compression are now configurable
2019-07-31 14:06:55 +02:00
Nicola Murino
fab21dcf51
Print initialization errors to standard output
...
This way debugging configuration and initialization issues is simpler
2019-07-31 08:14:31 +02:00
Nicola Murino
8058178ea0
Improve documentation
2019-07-30 20:51:29 +02:00
Nicola Murino
8dbcac15f3
fix default config
2019-07-29 09:31:41 +02:00
Nicola Murino
eb79c4effa
add license badge
2019-07-29 09:26:36 +02:00
Nicola Murino
7dd03ee24e
document bcrypt support
2019-07-29 09:20:33 +02:00
Nicola Murino
2456d5c3bf
document the new banner configuration
...
use SFTPGo as default banner and ensure that the banner is not empty
2019-07-29 08:53:22 +02:00
Philip Hofstetter
be9a1fb7c4
add bcrypt support
2019-07-29 08:11:21 +02:00
Philip Hofstetter
88a288ccfe
make the server banner configurable
2019-07-29 08:07:59 +02:00
Nicola Murino
645c4b4fa2
fix MySQL provider initialization
...
this not caused any issue since the queries are basically the same
2019-07-28 23:47:57 +02:00
Nicola Murino
0bed768909
allow quota tracking only for users with quota restrictions
...
Setting "track_quota" to 2 in sftpgo.conf will avoid a database update
after each file upload/deletion if the user has no quota restrictions
2019-07-28 22:04:50 +02:00
Nicola Murino
9987821003
rename last_quota_scan to last_quota_update
...
Existing databases must be updated using the script 20190728.sql
2019-07-28 19:29:32 +02:00
Nicola Murino
88fedd577d
sftpd handler: remove eccessive logging and prepare the code to support upload resume
...
Upload resume is currently disabled for this upstream bug:
https://github.com/pkg/sftp/issues/295
2019-07-28 13:40:12 +02:00
Nicola Murino
c547c5c9ee
quota tracking: fix concurrent updates
...
added a test case to check quota size for upload that replace an existing file
2019-07-28 13:24:46 +02:00