1
0
mirror of https://github.com/restic/restic.git synced 2024-06-24 07:46:38 +02:00
restic/src/cmds/restic-server
Jan Stürtz b108966b12 Fix 567 (#570)
* Patch for  https://github.com/restic/restic/issues/567
Backup also files on windows with longer pathnames than 255 chars (e.g. from node).

as fd0 says "So, as far as I can see, we need to have custom methods for all functions that accept a path, so that on Windows we can substitute the normal (possibly relative) path used within restic by an (absolute) UNC path, and only then call the underlying functions like os.Stat(), os.Lstat(), os.Open() and so on.

I've already thought about adding a generic abstraction for the file system (so we can mock this easier in tests), and this looks like a good opportunity to build it."

* fixed building tests

* Restructured patches
Add Wrapper for filepath.Walk

* using \\?\ requires absolute pathes to be used.
Now all tests run

* used gofmt on the code

* Restructured Code. No patches dir, integrate the file functions into restic/fs/

There is still an issue, because restic.fs.Open has a different api the os.Open, which returns the result of OpenFile, but takes only a string

* Changed the last os.Open() calls to fs.Open() after extending the File interface

* fixed name-clash of restic.fs and fuse.fs detected by travis

* fixed fmt with gofmt

* c&p failure: removed fixpath() call.

* missing include

* fixed includes in linux variant

* Fix for Linux. Fd() is required on File interface

* done gofmt
2016-08-15 21:59:13 +02:00
..
.gitignore Move commands to src/cmds 2016-02-23 07:21:28 +01:00
handlers.go Fix 567 (#570) 2016-08-15 21:59:13 +02:00
htpasswd.go Fix 567 (#570) 2016-08-15 21:59:13 +02:00
LICENSE Move commands to src/cmds 2016-02-23 07:21:28 +01:00
README.md Move commands to src/cmds 2016-02-23 07:21:28 +01:00
router_test.go Move commands to src/cmds 2016-02-23 07:21:28 +01:00
router.go Move commands to src/cmds 2016-02-23 07:21:28 +01:00
server.go Move commands to src/cmds 2016-02-23 07:21:28 +01:00

Restic Server

Restic Server is a sample server that implement restic's rest backend api. It has been developed for demonstration purpose and is not intented to be used in production.

Getting started

By default the server persists backup data in /tmp/restic. Build and start the server with a custom persistence directory:

go build
./restic-server -path /user/home/backup

The server use an .htpasswd file to specify users. You can create such a file at the root of the persistence directory by executing the following command. In order to append new user to the file, just omit the -c argument.

htpasswd -s -c .htpasswd username

By default the server uses http. This is not very secure since with Basic Authentication, username and passwords will be present in every request. In order to enable TLS support just add the -tls argument and add a private and public key at the root of your persistence directory.

Signed certificate are required by the restic backend but if you just want to test the feature you can generate unsigned keys with the following commands:

openssl genrsa -out private_key 2048
openssl req -new -x509 -key private_key -out public_key -days 365