Commit graph

282 commits

Author SHA1 Message Date
Juergen Hoetzel
33c41b55bb Security: Prevent loading of usernames containing a slash
"/" is valid char in HTTP authorization headers, but is also used in
rest-server to map usernames to private repos.

This commit prevents loading maliciously composed usernames like
"/foo/config" by restricting the allowed characters to the unicode
character class, numbers, "-", "." and "@".

Closes #131
2020-12-28 11:30:00 +01:00
Alexander Neumann
ba581f22ed
Merge pull request #120 from andreaso/prefer-https-links
Prefer https:// links in the documentation
2020-09-14 16:32:12 +02:00
Andreas Olsson
0155ba8a1b
Prefer https:// links in the documentation 2020-09-13 17:09:47 +02:00
Alexander Neumann
037fe06973
Merge pull request #118 from andreaso/restrict-systemd-service
Make example systemd service more restrictive
2020-09-13 16:13:37 +02:00
Andreas Olsson
a994d347ca
Make example systemd service more restrictive
In addition to any existing filesystem restrictions on the (www-data)
backup user these config options uses namespaces and other kernel
features to further restrict what the _rest-server_ is allowed to do.

* `ProtectSystem=strict` and `ReadWritePaths=/path/to/backups` ensures
  that the _rest-server_ is only allowed to write to its data directory.

* `ProtectHome=yes` and `PrivateTmp=yes` limits what the _rest-server_
  gets (read) access to.

* `NoNewPrivileges=yes` prevents the _rest-server_ from using setuid
  binaries, etc to escalate its privileges.

See https://www.freedesktop.org/software/systemd/man/systemd.exec.html
for further details

While at I also replaced the _/tmp/restic_ path with a more explicit
placeholder path. Given that one rarely wants to backup to _/tmp_ I
figured it better to force a choice of path rather than to have
someone accidentally end up using _/tmp/restic_ for their backups.
2020-09-13 14:21:32 +02:00
Alexander Neumann
14bbb9c18a Fix URLs 2020-09-13 12:14:14 +02:00
Alexander Neumann
53576a1454 Update changelog template for rest-server 2020-09-13 12:12:58 +02:00
Alexander Neumann
4b8ef2cbd7 Fix tests 2020-09-13 12:08:46 +02:00
Alexander Neumann
65fb54cbca Update version for development 2020-09-13 11:45:09 +02:00
Alexander Neumann
9313f19441 Generate CHANGELOG.md for 0.10.0 2020-09-13 11:24:29 +02:00
Alexander Neumann
d4b929ef35 Move changelog files for 0.10.0 2020-09-13 11:24:26 +02:00
Alexander Neumann
13f56bbb3c Update VERSION files for 0.10.0 2020-09-13 11:24:22 +02:00
Alexander Neumann
ecfa514256 Fix goreleaser config for version 2020-09-13 11:22:59 +02:00
Alexander Neumann
c7a44dd1a2 Fix release documentation 2020-09-13 11:22:59 +02:00
Alexander Neumann
4171164a39 Write version into main.go 2020-09-13 11:19:30 +02:00
Alexander Neumann
fa516da2c4 Reformat Release.md 2020-09-13 11:19:30 +02:00
Alexander Neumann
6e44dd8eae Add config for goreleaser, document release process 2020-09-13 11:19:30 +02:00
Alexander Neumann
20603b1622 Remove old changelog
We've had an intermediate release (0.9.8) not covered by the changelog,
so let's start properly in 0.10.0.
2020-09-13 11:19:30 +02:00
Alexander Neumann
1488830de1 Add entry to changelog 2020-09-13 11:19:26 +02:00
Alexander Neumann
723f29e594 Cleanup path before auth check 2020-09-13 11:19:26 +02:00
Konrad Wojas
f8e774393c Stricter path sanitization
Goji routes incoming requests without first URL decoding the path, so
'%2F' in a URL will not be decoded to a '/' before routing. But by the
time that we perform the path checks for private urls on r.URL.Path,
these characters have been decoded.

As a consequence, a user 'foo' could use 'foo%2Fbar' as the repo name.
The private repo check would see that the path starts with 'foo/' and
allow it, and rest-server would happily create a 'foo/bar' repo. Other
more harmful variants are possible.

To resolve this issue, we now reject any name part that contains a '/'.

Additionally, we immediately reject a few other characters that are
disallowed under some operating systems or filesystems.
2020-09-13 11:19:26 +02:00
Alexander Neumann
6367043b2c Also run linters and tests on PRs 2020-09-13 11:16:17 +02:00
Alexander Neumann
6e44ec0763 Replace Travis with GitHub Actions 2020-09-13 11:13:35 +02:00
Alexander Neumann
06f8484400 Docker: Don't delete htpasswd file 2020-09-12 17:28:18 +02:00
Alexander Neumann
1629c824c9 Add config for GitHub 2020-09-12 17:02:11 +02:00
Leo R. Lundgren
fd635e3965 Merge branch 'jtagcat-issue-template' based on pull request #105 from jtagcat/master 2020-05-06 15:00:49 +02:00
jtagcat
8300e75c77 Issue templates: how to get version using docker 2020-05-06 14:56:06 +02:00
rawtaz
f9fcc40305
Merge pull request #101 from ProactiveServices/patch-1
Update systemd unit file to current standards
2020-04-12 20:24:34 +02:00
rawtaz
fcf9220630
Add maintaner edit checkbox to PR template 2020-04-12 19:51:03 +02:00
Adam Piggott
c74c36e175 Tweak systemd unit file
The directive "StartLimitInterval" has been replaced by [StartLimitIntervalSec=interval, StartLimitBurst=burst](https://www.freedesktop.org/software/systemd/man/systemd.unit.html#StartLimitIntervalSec=interval). I'd suggest that the default backoff settings are fine (in Ubuntu 19.10 no more than 5 restarts per 10 seconds, else delayed by 10 seconds per attempt) so this directive can simply be removed.
2020-04-12 18:29:39 +01:00
Leo R. Lundgren
b7b5d32538 doc: Fix incorrect URL for private repos in README.md 2020-04-12 14:30:42 +02:00
Alexander Neumann
3fcbbc7b65 Merge pull request #106 from restic/remove-vendor
Remove vendored dependencies
2020-04-04 21:24:41 +02:00
Alexander Neumann
27264c0a7a Fix changelog template 2020-04-04 21:13:07 +02:00
Alexander Neumann
c69d473fa5 Add changelog 2020-04-04 21:13:07 +02:00
Alexander Neumann
687804a02b Update README, require Go >= 1.11 2020-04-04 21:13:07 +02:00
Alexander Neumann
59afaed1a6 Update Travis 2020-04-04 21:13:07 +02:00
Alexander Neumann
9ae066589d Fix build.go 2020-04-04 20:41:32 +02:00
Alexander Neumann
46fd57c36e Remove vendored dependencies 2020-04-04 20:41:24 +02:00
Alexander Neumann
0cfe4320c0 Update Go version for Travis 2020-02-26 21:35:20 +01:00
Alexander Neumann
f3408b3e46 Convert to Go Modules 2020-02-26 21:34:33 +01:00
rawtaz
d9757b2022
Update PR template to encourage preceding issues. 2019-12-26 20:52:04 +01:00
rawtaz
35e3a30949
Merge pull request #81 from qbit/reload
Reload htpasswd on SIGHUP
2019-12-19 00:32:23 +01:00
rawtaz
947374fbfb
Merge pull request #86 from rafacouto/bugfix-issue#85
Fix docker create_user script error when reading password from command line.
2019-12-18 23:55:23 +01:00
Rafa Couto
13cae78c8f Patch to issue #85 (Docker create_user script error when reading password as argument). 2019-12-18 23:53:36 +01:00
rawtaz
a48d6947d9
Merge pull request #98 from rawtaz/95-templates
Add templates for bug and feature issues as well as PRs.
2019-12-18 23:19:20 +01:00
rawtaz
9a62754e15
Merge pull request #97 from rawtaz/96-persist-unreleased
Add .gitkeep to persist changelog/unreleased/ when empty.
2019-12-18 23:18:36 +01:00
Leo R. Lundgren
527c7ab1c8 Add templates for bug and feature issues as well as PRs. 2019-12-18 23:17:13 +01:00
Leo R. Lundgren
6ebedcc0b2 Add .gitkeep to persist changelog/unreleased/ when empty. 2019-12-18 23:14:09 +01:00
Aaron Bieber
f18a5c16be
reload htpasswd on SIGHUP 2019-03-04 16:55:29 -07:00
Matt Holt
a87d968870
Add --max-size flag to limit size of repositories (#72)
* Add --max-size flag to limit repository size

* Only update repo size on successful write

* Use initial size as current size for first SaveBlob

* Apply LimitReader to request body

* Use HTTP 413 for size overage responses

* Refactor size limiting; do checks after every write

* Remove extra commented lines, d'oh

* Account for deleting blobs when counting space usage

* Remove extra commented line

* Fix unrelated bug (inverted err check)

* Update comment to trigger new CI build
2018-06-14 15:53:29 -06:00