]> git.proxmox.com Git - proxmox-backup.git/log
proxmox-backup.git
3 years agodatastore api: only decode unencrypted indices
Fabian Grünbichler [Mon, 10 Aug 2020 11:25:05 +0000 (13:25 +0200)]
datastore api: only decode unencrypted indices

these checks were already in place for regular downloading of backed up
files, also do them when attempting to decode a catalog, or when
downloading decoded files referenced by a pxar index.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
3 years agoimpl PartialEq between Realm and RealmRef
Wolfgang Bumiller [Mon, 10 Aug 2020 10:22:33 +0000 (12:22 +0200)]
impl PartialEq between Realm and RealmRef

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
3 years agoassert that Username does not impl PartialEq
Wolfgang Bumiller [Mon, 10 Aug 2020 10:21:12 +0000 (12:21 +0200)]
assert that Username does not impl PartialEq

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
3 years agointroduce Username, Realm and Userid api types
Wolfgang Bumiller [Thu, 6 Aug 2020 13:46:01 +0000 (15:46 +0200)]
introduce Username, Realm and Userid api types

and begin splitting up types.rs as it has grown quite large
already

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
3 years agod/control: proxmox 0.3.3
Wolfgang Bumiller [Mon, 10 Aug 2020 10:04:43 +0000 (12:04 +0200)]
d/control: proxmox 0.3.3

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
3 years agobump proxmox dependency to 0.3.3 for serde helpers
Wolfgang Bumiller [Mon, 10 Aug 2020 09:31:45 +0000 (11:31 +0200)]
bump proxmox dependency to 0.3.3 for serde helpers

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
3 years agomove types.rs to types/mod.rs
Wolfgang Bumiller [Mon, 10 Aug 2020 08:32:31 +0000 (10:32 +0200)]
move types.rs to types/mod.rs

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
3 years agoconfig.rs: sort modules
Wolfgang Bumiller [Thu, 6 Aug 2020 10:06:18 +0000 (12:06 +0200)]
config.rs: sort modules

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
3 years agobackup: only allow finished backups as base snapshot
Stefan Reiter [Tue, 4 Aug 2020 10:42:00 +0000 (12:42 +0200)]
backup: only allow finished backups as base snapshot

If the datastore holds broken backups for some reason, do not attempt to
base following snapshots on those. This would lead to an error on
/previous, leaving the client no choice but to upload all chunks, even
though there might be potential for incremental savings.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
3 years agoadministration-guide.rst: move Encryption headline up one level
Dietmar Maurer [Fri, 7 Aug 2020 05:10:12 +0000 (07:10 +0200)]
administration-guide.rst: move Encryption headline up one level

3 years agoadministration-guide.rst: fix headline (avoid compile error)
Dietmar Maurer [Fri, 7 Aug 2020 04:56:58 +0000 (06:56 +0200)]
administration-guide.rst: fix headline (avoid compile error)

3 years agoadmin-guide: add section explaining master keys
Dylan Whyte [Thu, 6 Aug 2020 10:03:31 +0000 (12:03 +0200)]
admin-guide: add section explaining master keys

Adds a section under encryption which goes into detail on how to
use a master key to store and recover backup encryption keys.

Signed-off-by: Dylan Whyte <d.whyte@proxmox.com>
3 years agofix: master-key: upload RSA encoded key with backup
Dylan Whyte [Thu, 6 Aug 2020 07:13:40 +0000 (09:13 +0200)]
fix: master-key: upload RSA encoded key with backup

When uploading an RSA encoded key alongside the backup,
the backup would fail with the error message: "wrong blob
file extension".
Adding the '.blob' extension to rsa-encrypted.key before the
the call to upload_blob_from_data(), rather than after, fixes
the issue.

Signed-off-by: Dylan Whyte <d.whyte@proxmox.com>
3 years agofinish_backup: mark backup as finished only after checks have passed
Stefan Reiter [Tue, 4 Aug 2020 10:41:59 +0000 (12:41 +0200)]
finish_backup: mark backup as finished only after checks have passed

Commit 9fa55e09 "finish_backup: test/verify manifest at server side"
moved the finished-marking above some checks, which means if those fail
the backup would still be marked as successful on the server.

Revert that part and comment the line for the future.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
3 years agofix #2909: handle missing chunks gracefully in garbage collection
Oguz Bektas [Wed, 5 Aug 2020 10:22:15 +0000 (12:22 +0200)]
fix #2909: handle missing chunks gracefully in garbage collection

instead of bailing and stopping the entire GC process, warn about the
missing chunks and continue.

this results in "TASK WARNINGS: X" as the status.

Signed-off-by: Oguz Bektas <o.bektas@proxmox.com>
3 years agod/control: bump proxmox to 0.3.2
Wolfgang Bumiller [Tue, 4 Aug 2020 09:34:58 +0000 (11:34 +0200)]
d/control: bump proxmox to 0.3.2

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
3 years agoremove timer and lock functions, fix building with proxmox 0.3.2
Wolfgang Bumiller [Tue, 4 Aug 2020 09:33:02 +0000 (11:33 +0200)]
remove timer and lock functions, fix building with proxmox 0.3.2

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
3 years agobump proxmox dependency to 0.3.2 for timer / file locking
Wolfgang Bumiller [Tue, 4 Aug 2020 09:16:05 +0000 (11:16 +0200)]
bump proxmox dependency to 0.3.2 for timer / file locking

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
3 years agobuild: properly regenerate d/control
Fabian Grünbichler [Tue, 4 Aug 2020 09:14:40 +0000 (11:14 +0200)]
build: properly regenerate d/control

and commit the latest change

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
3 years agogui: user: fix #2898 add dialog to set password
Aaron Lauterer [Mon, 3 Aug 2020 09:56:25 +0000 (11:56 +0200)]
gui: user: fix #2898 add dialog to set password

Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
3 years agoGC: use time pre phase1 to calculate min_atime in phase2
Aaron Lauterer [Tue, 21 Jul 2020 15:29:40 +0000 (17:29 +0200)]
GC: use time pre phase1 to calculate min_atime in phase2

Used chunks are marked in phase1 of the garbage collection process by
using the atime property. Each used chunk gets touched so that the atime
gets updated (if older than 24h, see relatime).

Should there ever be a situation in which the phase1 in the GC run needs
a very long time to finish, it could happen that the grace period
calculated in phase2 is not long enough and thus the marking of the
chunks (atime) becomes invalid. This would result in the removal of
needed chunks.

Even though the likelyhood of this happening is very low, using the
timestamp from right before phase1 is started, to calculate the grace
period in phase2 should avoid this situation.

Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
3 years agodatastore: allow browsing signed pxar files
Fabian Grünbichler [Mon, 3 Aug 2020 12:10:46 +0000 (14:10 +0200)]
datastore: allow browsing signed pxar files

just because we can't verify the signature, does not mean the contents
are not accessible. it might make sense to make it obvious with a hint
or click-through warning that no signature verification can take place
or this and downloading.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
3 years agosync: verify size and checksum of pulled archives
Fabian Grünbichler [Mon, 3 Aug 2020 12:10:45 +0000 (14:10 +0200)]
sync: verify size and checksum of pulled archives

and not just of previously synced ones.

we can't use BackupManifest::verify_file as the archive is still stored
under the tmp path at this point.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
3 years agosync: verify chunk size and digest, if possible
Fabian Grünbichler [Mon, 3 Aug 2020 12:10:44 +0000 (14:10 +0200)]
sync: verify chunk size and digest, if possible

for encrypted chunks this is currently not possible, as we need the key
to decode the chunk.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
3 years agoblobs: attempt to verify on decode when possible
Fabian Grünbichler [Mon, 3 Aug 2020 12:10:43 +0000 (14:10 +0200)]
blobs: attempt to verify on decode when possible

regular chunks are only decoded when their contents are accessed, in
which case we need to have the key anyway and want to verify the digest.

for blobs we need to verify beforehand, since their checksums are always
calculated based on their raw content, and stored in the manifest.

manifests are also stored as blobs, but don't have a digest in the
traditional sense (they might have a signature covering parts of their
contents, but that is verified already when loading the manifest).

this commit does not cover pull/sync code which copies blobs and chunks
as-is without decoding them.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
3 years agopxar/extract: fixup path stack for errors
Wolfgang Bumiller [Mon, 3 Aug 2020 10:20:30 +0000 (12:20 +0200)]
pxar/extract: fixup path stack for errors

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
3 years agomore whitespace fixups
Wolfgang Bumiller [Mon, 3 Aug 2020 10:02:19 +0000 (12:02 +0200)]
more whitespace fixups

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
3 years agowhitespace fixup
Wolfgang Bumiller [Mon, 3 Aug 2020 10:00:59 +0000 (12:00 +0200)]
whitespace fixup

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
3 years agopxar: better error handling on extract
Wolfgang Bumiller [Fri, 31 Jul 2020 12:08:02 +0000 (14:08 +0200)]
pxar: better error handling on extract

Errors while applying metadata will not be considered fatal
by default using `pxar extract` unless `--strict` was passed
in which case it'll bail out immediately.

It'll still return an error exit status if something had
failed along the way.

Note that most other errors will still cause it to bail out
(eg. errors creating files, or I/O errors while writing
the contents).

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
3 years agoworker_task: add getter for upid
Dominik Csapak [Fri, 31 Jul 2020 12:43:24 +0000 (14:43 +0200)]
worker_task: add getter for upid

sometimes we need the upid inside the worker itself, so give a
possibilty to get it

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
3 years agoworker_task: refactor log text generator
Dominik Csapak [Fri, 31 Jul 2020 12:43:23 +0000 (14:43 +0200)]
worker_task: refactor log text generator

we will need this elsewhere, so pull it out

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
3 years agosystemd/time: fix weekday wrapping on month
Dominik Csapak [Fri, 31 Jul 2020 12:15:13 +0000 (14:15 +0200)]
systemd/time: fix weekday wrapping on month

the weekday does not change depending on the month, so remove that wrapping

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
3 years agosystemd/time: add tests for weekday month wrapping
Dominik Csapak [Fri, 31 Jul 2020 12:15:12 +0000 (14:15 +0200)]
systemd/time: add tests for weekday month wrapping

this will fail for now, gets fixed in the next commit

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
3 years agodepend on proxmox 0.3.1
Dietmar Maurer [Sun, 2 Aug 2020 10:02:21 +0000 (12:02 +0200)]
depend on proxmox 0.3.1

3 years agopxar: create: attempt to use O_NOATIME
Wolfgang Bumiller [Fri, 31 Jul 2020 09:46:53 +0000 (11:46 +0200)]
pxar: create: attempt to use O_NOATIME

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
3 years agopxar: create: move common O_ flags to open_file
Wolfgang Bumiller [Fri, 31 Jul 2020 09:42:05 +0000 (11:42 +0200)]
pxar: create: move common O_ flags to open_file

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
3 years agolist_snapshots: Returns new "comment" property (fisrt line from notes)
Dietmar Maurer [Fri, 31 Jul 2020 09:31:43 +0000 (11:31 +0200)]
list_snapshots: Returns new "comment" property (fisrt line from notes)

3 years agobuild: track generated d/control in git
Fabian Grünbichler [Fri, 31 Jul 2020 09:18:33 +0000 (11:18 +0200)]
build: track generated d/control in git

to track changes and allow bootstrap-installation of build dependencies.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
3 years agocleanup: manifest is always CryptMode::None
Dietmar Maurer [Fri, 31 Jul 2020 08:25:30 +0000 (10:25 +0200)]
cleanup: manifest is always CryptMode::None

3 years agosrc/api2/admin/datastore.rs: add API to get/set Notes for backus
Dietmar Maurer [Fri, 31 Jul 2020 08:17:35 +0000 (10:17 +0200)]
src/api2/admin/datastore.rs: add API to get/set Notes for backus

3 years agolock_file: return std::io::Error
Dietmar Maurer [Fri, 31 Jul 2020 06:53:00 +0000 (08:53 +0200)]
lock_file: return std::io::Error

3 years agosrc/api2/backup/environment.rs: remove debug code
Dietmar Maurer [Fri, 31 Jul 2020 05:48:53 +0000 (07:48 +0200)]
src/api2/backup/environment.rs: remove debug code

3 years agosrc/api2/backup/environment.rs: remove debug code
Dietmar Maurer [Fri, 31 Jul 2020 05:47:08 +0000 (07:47 +0200)]
src/api2/backup/environment.rs: remove debug code

3 years agofinish_backup: add chunk_upload_stats to manifest
Dietmar Maurer [Fri, 31 Jul 2020 05:27:57 +0000 (07:27 +0200)]
finish_backup: add chunk_upload_stats to manifest

3 years agofinish_backup: test/verify manifest at server side
Dietmar Maurer [Thu, 30 Jul 2020 10:19:22 +0000 (12:19 +0200)]
finish_backup: test/verify manifest at server side

We want to make sure that the client uploaded a readable manifest.

3 years agosrc/backup/datastore.rs: add helpers to load/store manifest
Dietmar Maurer [Fri, 31 Jul 2020 05:19:14 +0000 (07:19 +0200)]
src/backup/datastore.rs: add helpers to load/store manifest

We want this to modify the manifest "unprotected" data, for example
to add upload statistics, notes, ...

3 years agointroduction: language improvement (fix typos, grammar, wording)
Dylan Whyte [Wed, 29 Jul 2020 10:20:48 +0000 (12:20 +0200)]
introduction: language improvement (fix typos, grammar, wording)

Fix typos and grammatical errors.
Reword some sentences for better readability.
Clean up the list found under "Software Stack", so that it maintains a consistent
style throughout.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
3 years agoapi2/node/termproxy: fix user in worker task
Dominik Csapak [Mon, 27 Jul 2020 06:54:48 +0000 (08:54 +0200)]
api2/node/termproxy: fix user in worker task

'username' here is without realm, but we really want to use user@realm

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
3 years agosrc/api2/backup.rs: aquire backup lock earlier in create_locked_backup_group()
Dietmar Maurer [Thu, 30 Jul 2020 08:48:33 +0000 (10:48 +0200)]
src/api2/backup.rs: aquire backup lock earlier in create_locked_backup_group()

3 years agoapi2/node/termproxy: fix zombies on worker abort
Dominik Csapak [Wed, 29 Jul 2020 11:50:27 +0000 (13:50 +0200)]
api2/node/termproxy: fix zombies on worker abort

tokios kill_on_drop sometimes leaves zombies around, especially
when there is not another tokio::process::Command spawned after

so instead of relying on the 'kill_on_drop' feature, we explicitly
kill the child on a worker abort. to be able to do this
we have to use 'tokio::select' instead of 'futures::select' since
the latter requires the future to be fused, which consumes the
child handle, leaving us no possibility to kill it after fusing.
(tokio::select does not need the futures to be fused, so we
can reuse the child future after the select again)

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
3 years agoverify: keep track and log which dirs failed the verification
Dominik Csapak [Thu, 30 Jul 2020 07:09:05 +0000 (09:09 +0200)]
verify: keep track and log which dirs failed the verification

so that we can print a list at the end of the worker which backups
are corrupt.

this is useful if there are many snapshots and some in between had an
error. Before this patch, the task log simply says to 'look in the logs'
but if the log is very long it makes it hard to see what exactly failed.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
3 years agoverify: keep also track of corrupt chunks
Dominik Csapak [Thu, 30 Jul 2020 07:09:04 +0000 (09:09 +0200)]
verify: keep also track of corrupt chunks

so that we do not have to verify a corrupt one multiple times

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
3 years agoverify: check all chunks of an index, even if we encounter a corrupt one
Dominik Csapak [Thu, 30 Jul 2020 07:09:03 +0000 (09:09 +0200)]
verify: check all chunks of an index, even if we encounter a corrupt one

this makes it easier to see which chunks are corrupt
(and enables us in the future to build a 'complete' list of
corrupt chunks)

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
3 years agofix #2873: if --pattern is used, default to not extracting
Wolfgang Bumiller [Thu, 30 Jul 2020 07:29:20 +0000 (09:29 +0200)]
fix #2873: if --pattern is used, default to not extracting

The extraction algorithm has a state (bool) indicating
whether we're currently in a positive or negative match
which has always been initialized to true at the beginning,
but when the user provides a `--pattern` argument we need to
start out with a negative match.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
3 years agobackup: ensure base snapshots are still available after backup
Stefan Reiter [Wed, 29 Jul 2020 12:33:14 +0000 (14:33 +0200)]
backup: ensure base snapshots are still available after backup

This should never trigger if everything else works correctly, but it is
still a very cheap check to avoid wrongly marking a backup as "OK" when
in fact some chunks might be missing.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
3 years agobackup: use flock on backup group to forbid multiple backups at once
Stefan Reiter [Wed, 29 Jul 2020 12:33:13 +0000 (14:33 +0200)]
backup: use flock on backup group to forbid multiple backups at once

Multiple backups within one backup group don't really make sense, but
break all sorts of guarantees (e.g. a second backup started after a
first would use a "known-chunks" list from the previous unfinished one,
which would be empty - but using the list from the last finished one is
not a fix either, as that one could be deleted or pruned once the first
simultaneous backup is finished).

Fix it by only allowing one backup per backup group at one time. This is
done via a flock on the backup group directory, thus remaining intact
even after a reload.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
3 years agodatastore: prevent deletion of snaps in use as "previous backup"
Stefan Reiter [Wed, 29 Jul 2020 12:33:11 +0000 (14:33 +0200)]
datastore: prevent deletion of snaps in use as "previous backup"

To prevent a race with a background GC operation, do not allow deletion
of backups who's index might currently be referenced as the "known chunk
list" for successive backups. Otherwise the GC could delete chunks it
thinks are no longer referenced, while at the same time telling the
client that it doesn't need to upload said chunks because they already
exist.

Additionally, prevent deletion of whole backup groups, if there are
snapshots contained that appear to be currently in-progress. This is
currently unlikely to trigger, as that function is only used for sync
jobs, but it's a useful safeguard either way.

Deleting a single snapshot has a 'force' parameter, which is necessary
to allow deleting incomplete snapshots on an aborted backup. Pruning
also sets force=true to avoid the check, since it calculates which
snapshots to keep on its own.

To avoid code duplication, the is_finished method is factored out.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
3 years agotools: add nonblocking mode to lock_file
Stefan Reiter [Wed, 29 Jul 2020 12:33:12 +0000 (14:33 +0200)]
tools: add nonblocking mode to lock_file

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
3 years agofix typo: avgerage to average
Stefan Reiter [Wed, 29 Jul 2020 12:33:10 +0000 (14:33 +0200)]
fix typo: avgerage to average

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
3 years agosrc/backup/verify.rs: try to verify chunks only once
Dietmar Maurer [Wed, 29 Jul 2020 11:29:13 +0000 (13:29 +0200)]
src/backup/verify.rs: try to verify chunks only once

We use a HashSet (per BackupGroup) to track already verified chunks.

3 years agobump proxmox to 0.3, cleanup http_err macro usage
Wolfgang Bumiller [Wed, 29 Jul 2020 07:38:11 +0000 (09:38 +0200)]
bump proxmox to 0.3, cleanup http_err macro usage

Also swap the order of a couple of `.map_err().await` to
`.await.map_err()` since that's generally more efficient.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
3 years agosrc/api2/node.rs: 'mod' statement cleanup
Wolfgang Bumiller [Wed, 29 Jul 2020 07:19:56 +0000 (09:19 +0200)]
src/api2/node.rs: 'mod' statement cleanup

split them into groups: `pub`, `pub(crate)` and non-pub

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
3 years agoupdate to pxar 0.3 to support negative timestamps
Wolfgang Bumiller [Tue, 28 Jul 2020 10:33:16 +0000 (12:33 +0200)]
update to pxar 0.3 to support negative timestamps

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
3 years agoui: fix in-progress snapshots always showing as "Encrypted"
Stefan Reiter [Tue, 28 Jul 2020 12:32:11 +0000 (14:32 +0200)]
ui: fix in-progress snapshots always showing as "Encrypted"

We can't know if they are encrypted or not when they're not even
finished yet.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
3 years agoui: fix error when reloading DataStoreContent
Stefan Reiter [Tue, 28 Jul 2020 12:32:10 +0000 (14:32 +0200)]
ui: fix error when reloading DataStoreContent

...when an entry is selected, that doesn't exist after the reload.

E.g. when one deletes selects a file within a snapshot and then clicks
the delete icon for said snapshot, focusRow would then fail and the
loading mask stay on until a reload.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
3 years agofix #2856: also check whole device for device mapper
Dominik Csapak [Tue, 28 Jul 2020 07:48:22 +0000 (09:48 +0200)]
fix #2856: also check whole device for device mapper

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
3 years agoupload_chunk: allow upload of empty blobs
Dominik Csapak [Mon, 27 Jul 2020 11:22:26 +0000 (13:22 +0200)]
upload_chunk: allow upload of empty blobs

a blob can be empty (e.g. an empty pct fw conf), so we
have to set the minimum size to the header size

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
3 years agoadministration-guide: fix typo that breaks example command
Dylan Whyte [Tue, 28 Jul 2020 07:48:36 +0000 (09:48 +0200)]
administration-guide: fix typo that breaks example command

The ' ' (space) between 'etc/ **/*.txt' resulted in the example command's output
not matching the given example output. Removing this space fixes the command.

3 years agodocs: pxar create: update docs to match current behavior
Dylan Whyte [Tue, 28 Jul 2020 07:24:04 +0000 (09:24 +0200)]
docs: pxar create: update docs to match current behavior

This removes parts of the previous explanation of the tool that are no longer
correct, and adds an explanation of '--exclude' parameter, instead.

Adds more clarity to the command, by use of '/path/to/source' to signify
source directory.

Specify that the pattern matching style of the exclude parameter is that of
gitignore's syntax.

3 years agosrc/backup/data_blob.rs: new load_from_reader(), which verifies the CRC
Dietmar Maurer [Tue, 28 Jul 2020 08:23:16 +0000 (10:23 +0200)]
src/backup/data_blob.rs: new load_from_reader(), which verifies the CRC

And make verify_crc private for now. We always call load_from_reader() to
verify the CRC.

Also add load_chunk() to datastore.rs (from chunk_store::read_chunk())

3 years agoui: DataStoreContent: keep selection and expansion on reload
Dominik Csapak [Thu, 23 Jul 2020 11:03:51 +0000 (13:03 +0200)]
ui: DataStoreContent: keep selection and expansion on reload

when clicking reload, we keep the existing selection
(if it still exists), and the previous expanded elements expanded

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
3 years agoui: add search box to DataStore content
Dominik Csapak [Thu, 23 Jul 2020 11:03:50 +0000 (13:03 +0200)]
ui: add search box to DataStore content

which searches the whole tree (name & owner)

we do this by traversing the tree and marking elements as matches,
then afterwards make a simple filter that matches on a boolean

worst case cost of this is O(2n) since we have to traverse the
tree (in the worst) case one time, and the filter function does it again

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
3 years agoui: rework DataStore content Panel
Dominik Csapak [Thu, 23 Jul 2020 11:03:49 +0000 (13:03 +0200)]
ui: rework DataStore content Panel

instead of having the files as a column, put the files into the tree
as a third level

with this, we can move the actions into an action column and remove
the top buttons (except reload)

clicking the download action now downloads directly, so we would
not need the download window anymore

clicking the browse action, opens the pxar browser like before,
but expands and selects (&focus) the selected pxar file

also changes the icon of 'signed' to the one to locked
but color codes them (singed => greyed out, encrypted => green),
similar to what browsers do/did for certificates

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
3 years agosrc/backup/manifest.rs: cleanup - again, avoid recursive call to write_canonical_json
Dietmar Maurer [Mon, 27 Jul 2020 08:31:34 +0000 (10:31 +0200)]
src/backup/manifest.rs: cleanup - again, avoid recursive call to write_canonical_json

And use re-borrow instead of dyn trait casting.

3 years agosrc/backup/manifest.rs: cleanup - avoid recursive call to write_canonical_json
Dietmar Maurer [Mon, 27 Jul 2020 06:48:11 +0000 (08:48 +0200)]
src/backup/manifest.rs: cleanup - avoid recursive call to write_canonical_json

3 years agoservices: make reload safer and default to it in gui
Thomas Lamprecht [Sat, 25 Jul 2020 18:23:12 +0000 (20:23 +0200)]
services: make reload safer and default to it in gui

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoui: acl: add improved permission selector
Thomas Lamprecht [Sat, 25 Jul 2020 18:10:06 +0000 (20:10 +0200)]
ui: acl: add improved permission selector

taken mostly from PVE, with adaption to how PBS does things.
Main difference is that we do not have a resource store singleton
here which we can use, but for datastores we can already use the
always present datastore-list store. Register it to the store manager
with a "storeId" property (vs. our internal storeid one).

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoapi: service command: fix test for essential service
Thomas Lamprecht [Fri, 24 Jul 2020 17:35:17 +0000 (19:35 +0200)]
api: service command: fix test for essential service

makes no sense to disallow reload or start (even if start cannot
really happen)

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agofollowup: server/state: rename task_count to internal_task_count
Thomas Lamprecht [Fri, 24 Jul 2020 10:11:33 +0000 (12:11 +0200)]
followup: server/state: rename task_count to internal_task_count

so that the relation with spawn_internal_task is made more clear

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agobump version to 0.8.9-1 v0.8.9
Thomas Lamprecht [Fri, 24 Jul 2020 09:24:56 +0000 (11:24 +0200)]
bump version to 0.8.9-1

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoserver/state: add spawn_internal_task and use it for websockets
Dominik Csapak [Thu, 23 Jul 2020 13:20:13 +0000 (15:20 +0200)]
server/state: add spawn_internal_task and use it for websockets

is a helper to spawn an internal tokio task without it showing up
in the task list

it is still tracked for reload and notifies the last_worker_listeners

this enables the console to survive a reload of proxmox-backup-proxy

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
3 years agotermproxy: let users stop the termproxy task
Dominik Csapak [Thu, 23 Jul 2020 13:20:12 +0000 (15:20 +0200)]
termproxy: let users stop the termproxy task

for that we have to do a select on the workers abort_future

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
3 years agofix 2885: bail on duplicate backup target
Stoiko Ivanov [Thu, 23 Jul 2020 16:16:36 +0000 (16:16 +0000)]
fix 2885: bail on duplicate backup target

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
3 years agoclient: log archive upload duration more accurate, fix grammar
Thomas Lamprecht [Fri, 24 Jul 2020 08:13:40 +0000 (10:13 +0200)]
client: log archive upload duration more accurate, fix grammar

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoclient: avoid division by zero in avg speed calculation, be more accurate
Thomas Lamprecht [Fri, 24 Jul 2020 07:49:44 +0000 (09:49 +0200)]
client: avoid division by zero in avg speed calculation, be more accurate

using micros vs. as_secs_f64 allows to have it calculated as usize
bytes, easier to handle - this was also used when it still lived in
upload_chunk_info_stream

Co-authored-by: Stoiko Ivanov <s.ivanov@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agobump version to 0.8.8-1 v0.8.8
Thomas Lamprecht [Thu, 23 Jul 2020 09:33:30 +0000 (11:33 +0200)]
bump version to 0.8.8-1

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agotermproxy: cmd: support upgrade
Thomas Lamprecht [Thu, 23 Jul 2020 11:12:13 +0000 (13:12 +0200)]
termproxy: cmd: support upgrade

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agod/control: add dependecy for pve-xtermjs
Thomas Lamprecht [Thu, 23 Jul 2020 10:45:56 +0000 (12:45 +0200)]
d/control: add dependecy for pve-xtermjs

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoapi: termproxy: fix ACL as /nodes is /system
Thomas Lamprecht [Thu, 23 Jul 2020 10:38:10 +0000 (12:38 +0200)]
api: termproxy: fix ACL as /nodes is /system

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoapi: apt: use schema default const for quiet param
Thomas Lamprecht [Thu, 23 Jul 2020 10:25:20 +0000 (12:25 +0200)]
api: apt: use schema default const for quiet param

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoupdate proxmox crate to get latest websocket implementation
Thomas Lamprecht [Thu, 23 Jul 2020 10:15:49 +0000 (12:15 +0200)]
update proxmox crate to get latest websocket implementation

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoui: add Console Button
Dominik Csapak [Tue, 21 Jul 2020 09:10:40 +0000 (11:10 +0200)]
ui: add Console Button

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
3 years agoserver/rest: add console to index
Dominik Csapak [Tue, 21 Jul 2020 09:10:39 +0000 (11:10 +0200)]
server/rest: add console to index

register the console template and render it when the 'console' parameter
is given

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
3 years agoapi2/nodes: add termproxy and vncwebsocket api calls
Dominik Csapak [Tue, 21 Jul 2020 09:10:38 +0000 (11:10 +0200)]
api2/nodes: add termproxy and vncwebsocket api calls

Even though it has nothing to do with vnc, we keep the name of the api
call for compatibility with our xtermjs client.

termproxy:
verifies that the user is allowed to open a console and starts
termproxy with the correct parameters

starts a TcpListener on "localhost:0" so that the kernel decides the
port (instead of trying to rerserving like in pve). Then it
leaves the fd open for termproxy and gives the number as port
and tells it via '--port-as-fd' that it should interpret this
as an open fd

the vncwebsocket api call checks the 'vncticket' (name for compatibility)
and connects the remote side (after an Upgrade) with a local TcpStream
connecting to the port given via WebSocket from the proxmox crate

to make sure that only the client can connect that called termproxy and
no one can connect to an arbitrary port on the host we have to include
the port in the ticket data

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
3 years agoapi2/access: implement term ticket
Dominik Csapak [Tue, 21 Jul 2020 09:10:37 +0000 (11:10 +0200)]
api2/access: implement term ticket

modeled after pves/pmgs vncticket (i substituted the vnc with term)
by putting the path and username as secret data in the ticket

when sending the ticket to /access/ticket it only verifies it,
checks the privs on the path and does not generate a new ticket

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
3 years agoserver/config: add mechanism to update template
Dominik Csapak [Tue, 21 Jul 2020 09:10:36 +0000 (11:10 +0200)]
server/config: add mechanism to update template

instead of exposing handlebars itself, offer a register_template and
a render_template ourselves.

render_template checks if the template file was modified since
the last render and reloads it when necessary

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
3 years agoapi: apt update must run protected
Thomas Lamprecht [Thu, 23 Jul 2020 09:45:46 +0000 (11:45 +0200)]
api: apt update must run protected

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoapi: apt: support refreshing package index
Thomas Lamprecht [Thu, 23 Jul 2020 09:19:52 +0000 (11:19 +0200)]
api: apt: support refreshing package index

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agodocs: epilog: point "Proxmox Backup" hyperlink to pbs wiki
Dylan Whyte [Fri, 17 Jul 2020 09:24:28 +0000 (11:24 +0200)]
docs: epilog: point "Proxmox Backup" hyperlink to pbs wiki

This changes the "Proxmox Backup" hyperlink, which is referred to throughout the
Proxmox Backup Server documentation. Following this patch, it now points to the
pbs wiki page, rather than the unpublished product page.

*Note: This change is only a temporary measure, while the product page
(https://www.proxmox.com/proxmox-backup) is in development.

Signed-off-by: Dylan Whyte <d.whyte@proxmox.com>
3 years agoadd .../apt/update API call
Stefan Reiter [Tue, 21 Jul 2020 11:41:07 +0000 (13:41 +0200)]
add .../apt/update API call

Depends on patched apt-pkg-native-rs. Changelog-URL detection is
inspired by PVE perl code for now, though marked with fixme to use 'apt
changelog' later on, if/when our repos have APT-compatible changelogs
set up.

list_installed_apt_packages iterates all packages and creates an
APTUpdateInfo with detailed information for every package matched by the
given filter Fn.

Sadly, libapt-pkg has some questionable design choices regarding their
use of 'iterators', which means quite a bit of nesting...

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>