Nicola Murino
e09ea00d8b
improve transfer error log
2019-09-07 23:27:37 +02:00
Nicola Murino
bc5779e26f
actions: don't execute actions on errors
...
detect upload/download errors and don't execute actions if a transfer
error happen.
To detect SFTP errors this patch is needed:
https://github.com/pkg/sftp/pull/307
2019-09-07 23:10:20 +02:00
Nicola Murino
2a7e56ed29
docker: minor fixes
2019-09-07 18:21:03 +02:00
Nicola Murino
4f1c2c094f
improve logging
...
this partially revert #45
2019-09-06 15:19:01 +02:00
Jo Vandeginste
abbb7f272b
Refactor the logging system
...
* created a "Log" function for type "Connection"
* created a "log" function for type "Provider"
* replace logger calls to Log/log where possible
I also renamed PGSSQL to PGSQL, as this seemed to be a typo
Signed-off-by: Jo Vandeginste <Jo.Vandeginste@kuleuven.be>
2019-09-06 13:43:21 +02:00
Nicola Murino
a26343a694
improve more logs
2019-09-05 23:42:00 +02:00
Jo Vandeginste
25260297aa
Show info about public key during login
...
This will show the key fingerprint and the associated comment, or
"password" when password was used, during login.
Eg.:
```
message":"User id: 1, logged in with: \"public_key:SHA256:FV3+wlAKGzYy7+J02786fh8N8c06+jga/mdiSOSPT7g:jo@desktop\",
```
or
```
message":"User id: 1, logged in with: \"password\",
...`
Signed-off-by: Jo Vandeginste <Jo.Vandeginste@kuleuven.be>
2019-09-05 22:58:14 +02:00
Jo Vandeginste
bb589c6fc8
Show user info, remove some extraneous connection ids
...
Signed-off-by: Jo Vandeginste <Jo.Vandeginste@kuleuven.be>
2019-09-05 22:58:14 +02:00
Jo Vandeginste
0737c672f5
Add connectionID to as many entries as possible
...
Signed-off-by: Jo Vandeginste <Jo.Vandeginste@kuleuven.be>
2019-09-05 22:58:14 +02:00
Jo Vandeginste
795ffc4c5f
Add quotes to certain strings
...
Signed-off-by: Jo Vandeginste <Jo.Vandeginste@kuleuven.be>
2019-09-05 16:14:31 +02:00
Nicola Murino
49a40f7a0b
sftpd: add configuration options for allowed ciphers, MACs and KEX algorithms
...
add support for login banner too
Fixes #32
2019-09-03 12:08:09 +02:00
Nicola Murino
dc5eeb54fd
scp: fix quota update after file overwrite
...
added a test case too
2019-09-02 23:12:41 +02:00
Nicola Murino
25fb639465
actions: properly release resources once the external command exits
2019-08-30 03:58:54 +02:00
Nicola Murino
d4969cde03
scp: add test case and document remote to remote transfers
2019-08-25 13:51:54 +02:00
Nicola Murino
1c5aac0dc4
simplify scp upload code and add some test cases
2019-08-24 22:44:01 +02:00
Nicola Murino
e50c521c33
add SCP support
...
SCP is an experimental feature, we have our own SCP implementation
since we can't rely on scp system command to proper handle permissions,
quota and user's home dir restrictions. The SCP protocol is quite simple
but there is no official docs about it, so we need more testing and
feedbacks before enabling it by default.
We may not handle some borderline cases or have sneaky bugs.
This commit contains some breaking changes to the REST API.
SFTPGo API should be stable now and I hope no more breaking changes
before the first stable release.
2019-08-24 14:41:15 +02:00
Nicola Murino
8dc3501a1f
add test cases for password stored using bcrypt and pbkdf2
2019-08-17 16:54:02 +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
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
8f421b7d0f
switch to viper for configuration and use cobra for cli
2019-08-07 22:46:52 +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
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
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
Nicola Murino
a7a3d533e7
Add documentation and tests for multiple public keys support
2019-07-31 17:06:12 +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
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
Philip Hofstetter
88a288ccfe
make the server banner configurable
2019-07-29 08:07:59 +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
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
Nicola Murino
e177366be9
windows: fix test cases
2019-07-27 21:19:30 +02:00
Nicola Murino
4a46b84dd5
Improve http action notification
...
Send the notification using a goroutine and set the request timeout to 15 seconds
2019-07-27 19:29:33 +02:00
Nicola Murino
25f7043fb3
sftpd transfer: close the file before executing any action ...
...
... that could potentially move or delete it
2019-07-27 11:17:32 +02:00
Nicola Murino
48451a9924
add support for custom actions
...
Configurable custom commands and/or HTTP notifications on SFTP upload, download, delete or rename
2019-07-27 09:38:09 +02:00
Nicola Murino
aaa4c22911
sftpd: test case for SetStat
...
SetStat is silently ignored. Ownership and permissions are configured globally
or per account
2019-07-26 17:18:51 +02:00
Nicola Murino
5d3a93baae
sftpd: improve test cases
2019-07-26 16:15:42 +02:00
Nicola Murino
9f61415832
add more test cases
2019-07-26 15:08:08 +02:00
Nicola Murino
ff8fb80e3c
fix check for used quota
...
remove unused data provider from sftpd configuration struct
2019-07-26 13:07:08 +02:00