]> git.proxmox.com Git - proxmox-backup.git/log
proxmox-backup.git
3 years agod/changelog: fix typos
Fabian Grünbichler [Mon, 19 Oct 2020 11:38:57 +0000 (13:38 +0200)]
d/changelog: fix typos

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
3 years agoupdate d/control
Fabian Grünbichler [Mon, 19 Oct 2020 11:38:17 +0000 (13:38 +0200)]
update d/control

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
3 years agofixup worker task: add time prefix again
Thomas Lamprecht [Mon, 19 Oct 2020 11:22:37 +0000 (13:22 +0200)]
fixup worker task: add time prefix again

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agobump proxmox dependency to 0.5.0 for nix 0.19
Wolfgang Bumiller [Mon, 19 Oct 2020 10:35:03 +0000 (12:35 +0200)]
bump proxmox dependency to 0.5.0 for nix 0.19

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
3 years agobuild: bump nix dependency
Fabian Grünbichler [Mon, 19 Oct 2020 10:12:33 +0000 (12:12 +0200)]
build: bump nix dependency

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
3 years agofile logger: add option to make the backup user the log file owner
Thomas Lamprecht [Mon, 19 Oct 2020 08:35:54 +0000 (10:35 +0200)]
file logger: add option to make the backup user the log file owner

and use that in ApiConfig to avoid that it is owned by root if the
proxmox-backup-api process creates it first.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agohttp_client: set connect timeout to 10 seconds
Dietmar Maurer [Mon, 19 Oct 2020 07:36:01 +0000 (09:36 +0200)]
http_client: set connect timeout to 10 seconds

3 years agocargo: bump dependency of proxmox crate
Thomas Lamprecht [Fri, 16 Oct 2020 10:18:46 +0000 (12:18 +0200)]
cargo: bump dependency of proxmox crate

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoapi: access: log to separate file, reduce syslog to errors
Thomas Lamprecht [Fri, 16 Oct 2020 09:06:48 +0000 (11:06 +0200)]
api: access: log to separate file, reduce syslog to errors

for now log auth errors also to the syslog, on a protected (LAN
and/or firewalled) setup this should normally happen due to
missconfiguration, not tries to break in.

This reduces syslog noise *a lot*. A current full journal output from
the current boot here has 72066 lines, of which 71444 (>99% !!) are
"successful auth for user ..." messages

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoserver/rest: also log user agent
Thomas Lamprecht [Fri, 16 Oct 2020 09:06:47 +0000 (11:06 +0200)]
server/rest: also log user agent

allows easily to see if a request is from a browser or a proxmox-backup-client
CLI

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoserver/rest: implement request access log
Thomas Lamprecht [Fri, 16 Oct 2020 09:06:46 +0000 (11:06 +0200)]
server/rest: implement request access log

reuse the FileLogger module in append mode.
As it implements write, which is not thread safe (mutable self) and
we use it in a async context we need to serialize access using a
mutex.

Try to use the same format we do in pveproxy, namely the one which is
also used in apache or nginx by default.

Use the response extensions to pass up the userid, if we extract it
from a ticket.

The privileged and unprivileged dameons log both to the same file, to
have a unified view, and avoiding the need to handle more log files.
We avoid extra intra-process locking by reusing the fact that a write
smaller than PIPE_BUF (4k on linux) is atomic for files opened with
the 'O_APPEND' flag. For now the logged request path is not yet
guaranteed to be smaller than that, this will be improved in a future
patch.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agotools file logger: fix example and comments
Thomas Lamprecht [Fri, 16 Oct 2020 09:16:29 +0000 (11:16 +0200)]
tools file logger: fix example and comments

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agotools: file logger: use option struct to control behavior
Thomas Lamprecht [Thu, 15 Oct 2020 15:49:18 +0000 (17:49 +0200)]
tools: file logger: use option struct to control behavior

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoserver: rest: also log the query part of URL
Thomas Lamprecht [Thu, 15 Oct 2020 15:49:17 +0000 (17:49 +0200)]
server: rest: also log the query part of URL

As it is part of the request and we do so in our other products

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoserver: rest: implement max URI path and query length request limits
Thomas Lamprecht [Thu, 15 Oct 2020 15:49:16 +0000 (17:49 +0200)]
server: rest: implement max URI path and query length request limits

Add a generous limit now and return the correct error (414 URI Too
Long). Otherwise we could to pretty larger GET requests, 64 KiB and
possible bigger (at 64 KiB my simple curl test failed due to
shell/curl limitations).

For now allow a 3072 characters as combined length of URI path and
query.

This is conform with the HTTP/1.1 RFCs (e.g., RFC 7231, 6.5.12 and
RFC 2616, 3.2.1) which do not specify any limits, upper or lower, but
require that all server accessible resources mus be reachable without
getting 414, which is normally fulfilled as we have various length
limits for stuff which could be in an URI, in place, e.g.:
 * user id: max. 64 chars
 * datastore: max. 32 chars

The only known problematic API endpoint is the catalog one, used in
the GUI's pxar file browser:
GET /api2/json/admin/datastore/<id>/catalog?..&filepath=<path>

The <path> is the encoded archive path, and can be arbitrary long.

But, this is a flawed design, as even without this new limit one can
easily generate archives which cannot be browsed anymore, as hyper
only accepts requests with max. 64 KiB in the URI.
So rather, we should move that to a GET-as-POST call, which has no
such limitations (and would not need to base32 encode the path).

Note: This change was inspired by adding a request access log, which
profits from such limits as we can then rely on certain atomicity
guarantees when writing requests to the log.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoserver/rest: forward real client IP on proxied request
Thomas Lamprecht [Thu, 15 Oct 2020 15:43:42 +0000 (17:43 +0200)]
server/rest: forward real client IP on proxied request

needs new proxmox dependency to get the RpcEnvironment changes,
adding client_ip getter and setter.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agorustdoc: overhaul backup rustdoc and add locking table
Stefan Reiter [Thu, 15 Oct 2020 10:49:16 +0000 (12:49 +0200)]
rustdoc: overhaul backup rustdoc and add locking table

Rewrite most of the documentation to be more readable and correct
(according to the current implementations).

Add a table visualizing all different locks used to synchronize
concurrent operations.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
3 years agorustdoc: add crate level doc
Stefan Reiter [Thu, 15 Oct 2020 10:49:15 +0000 (12:49 +0200)]
rustdoc: add crate level doc

Contains a link to the 'backup' module's doc, as that explains a lot
about the inner workings of PBS and probably marks a good entry point
for new readers.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
3 years agodatastore: add manifest locking
Stefan Reiter [Fri, 16 Oct 2020 07:31:12 +0000 (09:31 +0200)]
datastore: add manifest locking

Avoid races when updating manifest data by flocking a lock file.
update_manifest is used to ensure updates always happen with the lock
held.

Snapshot deletion also acquires the lock, so it cannot interfere with an
outstanding manifest write.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
3 years agomark_used_chunks: simply ignore vanished files
Dietmar Maurer [Fri, 16 Oct 2020 06:01:38 +0000 (08:01 +0200)]
mark_used_chunks: simply ignore vanished files

In case a prune operation removed a file in the meantime.

3 years agoserver: rest: refactor code to avoid multiple log_response calls
Thomas Lamprecht [Thu, 15 Oct 2020 07:03:54 +0000 (09:03 +0200)]
server: rest: refactor code to avoid multiple log_response calls

The 'Ok::<_, Self::Error>(res)' type annotation was from a time where
we could not use async, and had a combinator here which needed
explicity type information. We switched over to async in commit
91e4587343c155cd3aa9274bd2c736dcc1ccf977 and, as the type annotation
is already included in the Future type, we can safely drop it.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agocode cleanups
Thomas Lamprecht [Wed, 14 Oct 2020 17:02:03 +0000 (19:02 +0200)]
code cleanups

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agopxar: anchor pxarexcludes starting with a slash
Wolfgang Bumiller [Thu, 15 Oct 2020 10:26:45 +0000 (12:26 +0200)]
pxar: anchor pxarexcludes starting with a slash

Given the .pxarexclude file

    foo
    /bar

The following happens:

    exclude: /foo
    exclude: /bar
    exclude: /subdir/foo
    include: /subdir/bar

since the `/bar` line is an absolute path

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
3 years agoIntroduction: reword & link to encryption section
Dylan Whyte [Thu, 15 Oct 2020 09:58:42 +0000 (11:58 +0200)]
Introduction: reword & link to encryption section

Add link from encryption sentence in  "What is Proxmox
Backup Server?" to the Encryption section of the docs.
Also, reword the sentence.

V2:
Clarify that encryption takes place on the client side

Signed-off-by: Dylan Whyte <d.whyte@proxmox.com>
3 years agopxar: fix relative '!' rules in .pxarexclude
Wolfgang Bumiller [Thu, 15 Oct 2020 10:17:55 +0000 (12:17 +0200)]
pxar: fix relative '!' rules in .pxarexclude

and reduce indentation

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
3 years agomore clippy lints
Wolfgang Bumiller [Wed, 14 Oct 2020 12:22:38 +0000 (14:22 +0200)]
more clippy lints

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
3 years agodatastore: remove individual snapshots before group
Stefan Reiter [Wed, 14 Oct 2020 12:16:37 +0000 (14:16 +0200)]
datastore: remove individual snapshots before group

Removing a snapshot has some more safety checks which we don't want to
ignore when removing an entire group (i.e. locking the manifest and
notifying GC).

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
3 years agodatastore: remove load_manifest_json
Stefan Reiter [Wed, 14 Oct 2020 12:16:35 +0000 (14:16 +0200)]
datastore: remove load_manifest_json

There's no point in having that as a seperate method, just parse the
thing into a struct and write it back out correctly.

Also makes further changes to the method simpler.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
3 years agoverify: acquire shared snapshot flock and skip on error
Stefan Reiter [Wed, 14 Oct 2020 12:16:33 +0000 (14:16 +0200)]
verify: acquire shared snapshot flock and skip on error

If we can't acquire a lock (either because the snapshot disappeared, it
is about to be forgotten/pruned, or it is currently still running) skip
the snapshot. Hold the lock during verification, so that it cannot be
deleted while we are still verifying.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
3 years agoreader: acquire shared flock on open snapshot
Stefan Reiter [Wed, 14 Oct 2020 12:16:32 +0000 (14:16 +0200)]
reader: acquire shared flock on open snapshot

...to avoid it being forgotten or pruned while in use.

Update lock error message for deletions to be consistent.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
3 years agobackup: use shared flock for base snapshot
Stefan Reiter [Wed, 14 Oct 2020 12:16:31 +0000 (14:16 +0200)]
backup: use shared flock for base snapshot

To allow other reading operations on the base snapshot as well. No
semantic changes with this patch alone, as all other locks on snapshots
are exclusive.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
3 years agoprune: never fail, just warn about failed removals
Stefan Reiter [Wed, 14 Oct 2020 12:16:30 +0000 (14:16 +0200)]
prune: never fail, just warn about failed removals

A removal can fail if the snapshot is already gone (this is fine, our
job is done either way) or we couldn't get a lock (also fine, it can't
be removed then, just warn the user so he knows what happened and why it
wasn't removed) - keep going either way.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
3 years agoprune: respect snapshot flock
Stefan Reiter [Wed, 14 Oct 2020 12:16:29 +0000 (14:16 +0200)]
prune: respect snapshot flock

A snapshot that's currently being read can still appear in the prune
list, but should not be removed.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
3 years agointroduction: history: minor rewording and fixup
Dylan Whyte [Wed, 14 Oct 2020 14:19:13 +0000 (16:19 +0200)]
introduction: history: minor rewording and fixup

Some minor spelling and grammar fixes.
Rewording of some sentences.

Signed-off-by: Dylan Whyte <d.whyte@proxmox.com>
3 years agoAsyncIndexReader: avoid memcpy, add clippy lint fixup comment
Wolfgang Bumiller [Wed, 14 Oct 2020 12:10:28 +0000 (14:10 +0200)]
AsyncIndexReader: avoid memcpy, add clippy lint fixup comment

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
3 years agomore clippy fixups
Wolfgang Bumiller [Wed, 14 Oct 2020 09:33:45 +0000 (11:33 +0200)]
more clippy fixups

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
3 years agobump version to 0.9.1-1 v0.9.1
Dietmar Maurer [Wed, 14 Oct 2020 11:42:30 +0000 (13:42 +0200)]
bump version to 0.9.1-1

3 years agouse SslAcceptor::mozilla_intermediate_v5
Dietmar Maurer [Wed, 14 Oct 2020 10:24:15 +0000 (12:24 +0200)]
use SslAcceptor::mozilla_intermediate_v5

This allows TLSv1.3, and let the client select ciphers. After this
change AES is prefered over chacha20, so TLS speed is now much faster.

3 years agopxar: remove unused parameter
Wolfgang Bumiller [Wed, 14 Oct 2020 09:32:22 +0000 (11:32 +0200)]
pxar: remove unused parameter

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
3 years agopxar: pass full path to callback, let verbose flag list files
Wolfgang Bumiller [Wed, 14 Oct 2020 09:31:42 +0000 (11:31 +0200)]
pxar: pass full path to callback, let verbose flag list files

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
3 years agoclippy fixups
Wolfgang Bumiller [Wed, 14 Oct 2020 09:18:26 +0000 (11:18 +0200)]
clippy fixups

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
3 years agointroduction.rst: add History
Dietmar Maurer [Wed, 14 Oct 2020 07:46:52 +0000 (09:46 +0200)]
introduction.rst: add History

3 years agofix #2847: proxmox-backup-client: add change-owner cmd
Dylan Whyte [Tue, 13 Oct 2020 08:58:41 +0000 (10:58 +0200)]
fix #2847: proxmox-backup-client: add change-owner cmd

This adds a change-owner command to proxmox-backup-client,
that allows a caller with datastore modify privileges
to change the owner of a backup-group.

Signed-off-by: Dylan Whyte <d.whyte@proxmox.com>
3 years agoavoid compiler warning
Dietmar Maurer [Wed, 14 Oct 2020 06:36:39 +0000 (08:36 +0200)]
avoid compiler warning

3 years agofix #2847: api: datastore: change backup owner
Dylan Whyte [Tue, 13 Oct 2020 08:58:40 +0000 (10:58 +0200)]
fix #2847: api: datastore: change backup owner

This adds an api method to change the owner of
a backup-group.

Signed-off-by: Dylan Whyte <d.whyte@proxmox.com>
3 years agoproxmox-backup-client key: rename 'paper-key' command to 'paperkey' (remove dash)
Dietmar Maurer [Tue, 13 Oct 2020 07:44:40 +0000 (09:44 +0200)]
proxmox-backup-client key: rename 'paper-key' command to 'paperkey' (remove dash)

3 years agoserver/REST: check auth: code cleanup, better variable names
Thomas Lamprecht [Mon, 12 Oct 2020 16:39:45 +0000 (18:39 +0200)]
server/REST: check auth: code cleanup, better variable names

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoserver/REST: make handle_request private
Thomas Lamprecht [Mon, 12 Oct 2020 16:38:58 +0000 (18:38 +0200)]
server/REST: make handle_request private

it's not used anywhere else, so do not suggest so

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agodon't require WorkerTask in backup/
Wolfgang Bumiller [Mon, 12 Oct 2020 09:46:34 +0000 (11:46 +0200)]
don't require WorkerTask in backup/

To untangle the server code from the actual backup
implementation.
It would be ideal if the whole backup/ dir could become its
own crate with minimal dependencies, certainly without
depending on the actual api server. That would then also be
used more easily to create forensic tools for all the data
file types we have in the backup repositories.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
3 years agointroduce TaskState trait
Wolfgang Bumiller [Mon, 12 Oct 2020 09:28:03 +0000 (11:28 +0200)]
introduce TaskState trait

Used to not require access to the WorkerTask struct outside
the `server` and `api2` module, so it'll be easier to
separate those backup/server/client parts into separate
crates.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
3 years agoserver: get index: make content-type non mutable
Thomas Lamprecht [Mon, 12 Oct 2020 08:38:13 +0000 (10:38 +0200)]
server: get index: make content-type non mutable

feels more idiomatic

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoserver/rest: code cleanup: use async
Thomas Lamprecht [Mon, 12 Oct 2020 08:36:32 +0000 (10:36 +0200)]
server/rest: code cleanup: use async

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoreadme: allow to directly copy+paste+execute commands
Thomas Lamprecht [Mon, 12 Oct 2020 08:34:52 +0000 (10:34 +0200)]
readme: allow to directly copy+paste+execute commands

plus fix s/ssh:/git:/ for protocol

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agofix #3070: replace internal with public URLs
Fabian Grünbichler [Mon, 12 Oct 2020 10:10:29 +0000 (12:10 +0200)]
fix #3070: replace internal with public URLs

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
3 years agobackup: index readers: drop useless shared lock
Thomas Lamprecht [Fri, 9 Oct 2020 10:45:36 +0000 (12:45 +0200)]
backup: index readers: drop useless shared lock

This is only acquired in those two methods, both as shared. So it has
no use.

It seems, that it was planned in the past that the index deletion
should take the exclusive, while read and write takes the shared
flock on the index, as one can guess from the lock comments in commit
046521895307aa8bde8bab7ea3ef9e437d5ab5e5

But then later, in commit c8ec450e379f54e7ac648b3a3ff701b37e9a6620)
the documented semantics where changed to use a temp file and do an
atomic rename instead for atomicity.

The reader shared flock on the index file was done inbetween,
probably as preparatory step, but was not removed again when strategy
was changed to using the file rename instead.

Do so now, to avoid confusion of readers and a useless flock.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoadd "Build" section to README.rst
Hannes Laimer [Fri, 9 Oct 2020 09:34:55 +0000 (11:34 +0200)]
add "Build" section to README.rst

Signed-off-by: Hannes Laimer <h.laimer@proxmox.com>
3 years agoreader: actually allow users to downlod their own backups
Fabian Grünbichler [Fri, 9 Oct 2020 09:21:02 +0000 (11:21 +0200)]
reader: actually allow users to downlod their own backups

via HTTP2/backup reader protocol. they already could do so via the plain
HTTP download-file/.. API calls that the GUI uses, but the reader
environment required READ permission on the whole datastore instead of
just BACKUP on the backup group itself.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
3 years agoreader: track index chunks and limit access
Fabian Grünbichler [Fri, 9 Oct 2020 09:21:01 +0000 (11:21 +0200)]
reader: track index chunks and limit access

a reader connection should not be allowed to read arbitrary chunks in
the datastore, but only those that were previously registered by opening
the corresponding index files.

this mechanism is needed to allow unprivileged users (that don't have
full READ permissions on the whole datastore) access to their own
backups via a reader environment.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
3 years agoREST: don't print CSRF token
Fabian Grünbichler [Thu, 8 Oct 2020 13:37:20 +0000 (15:37 +0200)]
REST: don't print CSRF token

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
3 years agoUserid: fix borrow/deref recursion
Fabian Grünbichler [Thu, 8 Oct 2020 13:37:19 +0000 (15:37 +0200)]
Userid: fix borrow/deref recursion

not triggered by any current code, but this would lead to a stack
exhaustion since borrow would call deref which would call borrow again..

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
3 years agoUserid: simplify comparison with str
Fabian Grünbichler [Thu, 8 Oct 2020 13:37:18 +0000 (15:37 +0200)]
Userid: simplify comparison with str

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
3 years agodepend on proxmox 0.4.3
Fabian Grünbichler [Thu, 8 Oct 2020 08:44:51 +0000 (10:44 +0200)]
depend on proxmox 0.4.3

needed for constnamedbitmap macro

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
3 years agoapi: datastore: require allocate privilege for deletion
Thomas Lamprecht [Thu, 8 Oct 2020 07:16:02 +0000 (09:16 +0200)]
api: datastore: require allocate privilege for deletion

makes only sense if we allow addition of a datastore also just with
that privilege

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoserver: add Datastore.Allocate privilege
Thomas Lamprecht [Tue, 6 Oct 2020 10:08:54 +0000 (12:08 +0200)]
server: add Datastore.Allocate privilege

Previously only Datastore.Modify was required for creating a new
datastore.

But, that endpoint allows one to pass an arbitrary path, of which all
parent directories will be created, this can allow any user with the
"Datastore Admin" role on "/datastores" to do some damage to the
system. Further, it is effectively a side channel for revealing the
systems directory structure through educated guessing and error
handling.

Add a new privilege "Datastore.Allocate" which, for now, is used
specifically for the create datastore API endpoint.

Add it only to the "Admin" role.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoacl: use modified constnamedbitmap macro
Thomas Lamprecht [Tue, 6 Oct 2020 10:08:53 +0000 (12:08 +0200)]
acl: use modified constnamedbitmap macro

avoiding the need for reshuffling all bits when a new privilege is
added at the start or in the middle of this definition.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agofuse_loop: handle unmap on crashed instance
Stefan Reiter [Wed, 7 Oct 2020 11:53:08 +0000 (13:53 +0200)]
fuse_loop: handle unmap on crashed instance

If a fuse_loop instance dies suddenly (e.g. SIGKILL), the FUSE mount and
loop device assignment are left behind. We can determine this scenario
on specific unmap, when the PID file is either missing or contains a PID
of a non-running process, but the backing file and potentially loop
device are still there.

If that's the case, do an "emergency cleanup", by unassigning the
loopdev, calling 'fusermount -u' and then cleaning any leftover files
manually.

With this in place, pretty much any situation is now recoverable via
only the 'proxmox-backup-client' binary, by either calling 'unmap' with
or without parameters.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
3 years agofuse_loop: wait for instance to close after killing
Stefan Reiter [Wed, 7 Oct 2020 11:53:07 +0000 (13:53 +0200)]
fuse_loop: wait for instance to close after killing

On unmap, only report success if the instance we are killing actually
terminates. This is especially important so that cleanup routines can be
assured that /run files are actually cleaned up after calling
cleanup_unused_run_files.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
3 years agofuse_loop: add automatic cleanup of run files and dangling instances
Stefan Reiter [Wed, 7 Oct 2020 11:53:06 +0000 (13:53 +0200)]
fuse_loop: add automatic cleanup of run files and dangling instances

A 'map' call will only clean up what it needs, that is only leftover
files or dangling instances of it's own name.

For a full cleanup the user can call 'unmap' without any arguments.

The 'cleanup on error' behaviour of map_loop is removed. It is no longer
needed (since the next call will clean up anyway), and in fact fixes a
bug where trying to map an image twice would result in an error, but
also cleanup the .pid file of the running instance, causing 'unmap' to
fail afterwards.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
3 years agomount/map: use names for map/unmap for easier use
Stefan Reiter [Wed, 7 Oct 2020 11:53:05 +0000 (13:53 +0200)]
mount/map: use names for map/unmap for easier use

So user doesn't need to remember which loop devices he has mapped to
what.

systemd unit encoding is used to transform a unique identifier for the
mapped image into a suitable name. The files created in /run/pbs-loopdev
will be named accordingly.

The encoding all happens outside fuse_loop.rs, so the fuse_loop module
does not need to care about encodings - it can always assume a name is a
valid filename.

'unmap' without parameter displays all current mappings. It's
autocompletion handler will list the names of all currently mapped
images for easy selection. Unmap by /dev/loopX or loopdev number is
maintained, as those can be distinguished from mapping names.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
3 years agoloopdev: add module doc
Stefan Reiter [Wed, 7 Oct 2020 11:53:04 +0000 (13:53 +0200)]
loopdev: add module doc

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
3 years agofuse_loop: add documentation
Stefan Reiter [Wed, 7 Oct 2020 11:53:03 +0000 (13:53 +0200)]
fuse_loop: add documentation

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
3 years agoformat: fix typo in function name
Stefan Reiter [Wed, 7 Oct 2020 11:53:02 +0000 (13:53 +0200)]
format: fix typo in function name

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
3 years agodocs: typo fixups
Oguz Bektas [Wed, 7 Oct 2020 12:03:48 +0000 (14:03 +0200)]
docs: typo fixups

Signed-off-by: Oguz Bektas <o.bektas@proxmox.com>
3 years agoui: network: remove create VLAN option
Oguz Bektas [Wed, 7 Oct 2020 11:32:18 +0000 (13:32 +0200)]
ui: network: remove create VLAN option

for now this isn't needed and would take quite a bit of effort to
match the API schema with PVE.

if there are a lot of requests at some point we can add it in.

Signed-off-by: Oguz Bektas <o.bektas@proxmox.com>
3 years agoui: dashboard: code cleanup
Thomas Lamprecht [Tue, 6 Oct 2020 13:16:00 +0000 (15:16 +0200)]
ui: dashboard: code cleanup

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoui: dashboard: add tooltip to gears edit tool
Thomas Lamprecht [Tue, 6 Oct 2020 13:15:43 +0000 (15:15 +0200)]
ui: dashboard: add tooltip to gears edit tool

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoui: fixup: s/Hours/Days/
Thomas Lamprecht [Tue, 6 Oct 2020 13:15:18 +0000 (15:15 +0200)]
ui: fixup: s/Hours/Days/

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoui: Dashboard/TaskSummary: show task overlay when clicking on a count
Dominik Csapak [Tue, 6 Oct 2020 10:25:28 +0000 (12:25 +0200)]
ui: Dashboard/TaskSummary: show task overlay when clicking on a count

when clicking on a count in the summary, a small task overlay now pops
up that shows those tasks. this way, the user has an easy way
of seeing which tasks failed exactly

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
3 years agoui: Dashboard/TaskSummary: add Verifies to the Summary
Dominik Csapak [Tue, 6 Oct 2020 10:25:27 +0000 (12:25 +0200)]
ui: Dashboard/TaskSummary: add Verifies to the Summary

and count every type that starts with 'verify' (e.g. verifyjob)

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
3 years agoui: Dashboard/TaskSummary: refactor types and title
Dominik Csapak [Tue, 6 Oct 2020 10:25:26 +0000 (12:25 +0200)]
ui: Dashboard/TaskSummary: refactor types and title

by moving the definition into the controller and dynamically use them
in the updateTasks function

we will reuse/extend this later

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
3 years agoui: implment task history limit and make it configurable
Dominik Csapak [Tue, 6 Oct 2020 10:25:25 +0000 (12:25 +0200)]
ui: implment task history limit and make it configurable

we showed 'last month' even if we did not limit the api call
implement that and make the number of days configurable
(we have most of the code already available for that, since
the base dashboard got copied from pmg and never cleaned up)

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
3 years agoapi2/status: add type- and statusfilter to tasks api call
Dominik Csapak [Tue, 6 Oct 2020 10:25:24 +0000 (12:25 +0200)]
api2/status: add type- and statusfilter to tasks api call

we will use this for the pbs dashboard

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
3 years agoapi2/types: add TaskStateType struct
Dominik Csapak [Tue, 6 Oct 2020 10:25:23 +0000 (12:25 +0200)]
api2/types: add TaskStateType struct

the same as the regular TaskState, but without its fields, so that
we can use the api macro and use it as api call parameter

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
3 years agod/control: add ',' after qrencode dependency
Fabian Grünbichler [Tue, 6 Oct 2020 10:00:49 +0000 (12:00 +0200)]
d/control: add ',' after qrencode dependency

'${misc:Depends}' is empty at the moment, otherwise this would have
already generated invalid packages..

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
3 years agodocs: installation: add system requirements section
Thomas Lamprecht [Tue, 6 Oct 2020 08:27:17 +0000 (10:27 +0200)]
docs: installation: add system requirements section

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoacl: document Admin and NoAccess a bit
Thomas Lamprecht [Mon, 5 Oct 2020 12:53:49 +0000 (14:53 +0200)]
acl: document Admin and NoAccess a bit

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agodocs: typo fix
Thomas Lamprecht [Tue, 6 Oct 2020 08:26:46 +0000 (10:26 +0200)]
docs: typo fix

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agosrc/bin/proxmox_backup_client/mount.rs: fix img name completion
Dietmar Maurer [Tue, 6 Oct 2020 07:17:58 +0000 (09:17 +0200)]
src/bin/proxmox_backup_client/mount.rs: fix img name completion

3 years agoclient: implement map/unmap commands for .img backups
Stefan Reiter [Mon, 5 Oct 2020 08:57:58 +0000 (10:57 +0200)]
client: implement map/unmap commands for .img backups

Allows mapping fixed-index .img files (usually from VM backups) to be
mapped to a local loopback device.

The architecture uses a FUSE-backed temp file mapped to a loopdev:

  /dev/loopX -> FUSE /run/pbs-loopdev/xxx -> backup client -> PBS

Since unmapping requires some cleanup (unmap the loopdev, stop FUSE,
remove the temp files) a special 'unmap' command is added, which uses a
PID file to send SIGINT to the backup-client instance started with
'map', which will handle the cleanup itself.

The polling with select! in mount.rs needs to be split in two, since we
have a chicken and egg problem between running FUSE and setting up the
loop device - so we need to do them concurrently, until the loopdev is
assigned, at which point we can report success and daemonize, and then
continue polling the FUSE loop future.

A loopdev module is added to tools containing all required functions for
mapping a loop device to the FUSE file, with the ioctls moved into an
inline module to avoid exposing them directly.

The client code is placed in the 'mount' module, which, while
admittedly a loose fit, allows reuse of the daemonizing code.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
3 years agomount: handle SIGTERM as well
Stefan Reiter [Mon, 5 Oct 2020 08:57:57 +0000 (10:57 +0200)]
mount: handle SIGTERM as well

instead of only SIGINT

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
3 years agofix comma dangle
Thomas Lamprecht [Mon, 5 Oct 2020 15:15:28 +0000 (17:15 +0200)]
fix comma dangle

...

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agodocs: fix broken reference to backup_remote
Oguz Bektas [Mon, 5 Oct 2020 15:08:16 +0000 (17:08 +0200)]
docs: fix broken reference to backup_remote

while restructuring the docs, explicit title wasn't included in the
correct file

fixes commit 04e24b14f0c51f01a1f8afe2d0eff124c1095758

Signed-off-by: Oguz Bektas <o.bektas@proxmox.com>
3 years agogui: add onlineHelp for 'Prune Options'
Oguz Bektas [Mon, 5 Oct 2020 15:01:29 +0000 (17:01 +0200)]
gui: add onlineHelp for 'Prune Options'

also renamed the 'pruning' ref to 'backup-pruning' for clarity.

Signed-off-by: Oguz Bektas <o.bektas@proxmox.com>
3 years agoscanrefs: match all instances of 'onlineHelp' in js files
Oguz Bektas [Mon, 5 Oct 2020 14:57:10 +0000 (16:57 +0200)]
scanrefs: match all instances of 'onlineHelp' in js files

previously it looked for the first instance. this behavior
became an issue while trying to add multiple onlineHelp buttons

Signed-off-by: Oguz Bektas <o.bektas@proxmox.com>
3 years agoui: refactor render_icon code
Dominik Csapak [Mon, 5 Oct 2020 13:43:14 +0000 (15:43 +0200)]
ui: refactor render_icon code

we will reuse this later

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
3 years agotask archive rotation: better handle non-existing archive
Dominik Csapak [Fri, 2 Oct 2020 13:20:10 +0000 (15:20 +0200)]
task archive rotation: better handle non-existing archive

if the archive file does not exist yet, we cannot rotate it, but it's not
actually an error, so just return Ok(false) to indicate no rotation took
place

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
3 years agoRestructure docs (more first level headings)
Dylan Whyte [Fri, 2 Oct 2020 14:12:57 +0000 (16:12 +0200)]
Restructure docs (more first level headings)

This removes the "Backup Management" first level heading in the docs,
and either uses the sub headings contained within it as first level
headings, or groups previous sections logically under new headings.

The administration-guide.rst file is also removed. Its contents are
instead separated into various files, that relate to their respective
first level heading.

Signed-off-by: Dylan Whyte <d.whyte@proxmox.com>
3 years agoAdd section "GUI"
Dylan Whyte [Fri, 2 Oct 2020 14:12:56 +0000 (16:12 +0200)]
Add section "GUI"

Section provides a brief overview of the web interface

Signed-off-by: Dylan Whyte <d.whyte@proxmox.com>
3 years agoREST server: avoid hard coding world readable API endpoints
Thomas Lamprecht [Fri, 2 Oct 2020 11:17:12 +0000 (13:17 +0200)]
REST server: avoid hard coding world readable API endpoints

while we probably do not add much more to them, it still looks ugly.

If this was made so that adding a World readable API call is "hard"
and not done by accident, it rather should be done as a test on build
time. But, IMO, the API permission schema definitions are easy to
review, and not often changed/added - so any wrong World readable API
call will normally still caught.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agobump version to 0.9.0-2
Thomas Lamprecht [Fri, 2 Oct 2020 13:37:59 +0000 (15:37 +0200)]
bump version to 0.9.0-2

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>