]> git.proxmox.com Git - proxmox-backup.git/log
proxmox-backup.git
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>
3 years agobackup manifest: make lookup_file_info public
Thomas Lamprecht [Thu, 23 Jul 2020 08:39:18 +0000 (10:39 +0200)]
backup manifest: make lookup_file_info public

useful to get info like, was the previous snapshot encrypted in
libproxmox-backup-qemu

Requested-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agodocs: remove duplicate feature
Moayad Almalat [Thu, 23 Jul 2020 08:03:18 +0000 (10:03 +0200)]
docs: remove duplicate feature

Signed-off-by: Moayad Almalat <m.almalat@proxmox.com>
3 years agoclient: log index.json upload only when verbose
Thomas Lamprecht [Thu, 23 Jul 2020 08:04:36 +0000 (10:04 +0200)]
client: log index.json upload only when verbose

I mean the user expects that we know what archives, fidx or didx, are
in a backup, so this is internal info and should not be logged by
default

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoclient: don't use debug format for printing BackupRepository
Thomas Lamprecht [Thu, 23 Jul 2020 07:43:20 +0000 (09:43 +0200)]
client: don't use debug format for printing BackupRepository

It implements the fmt::Display  trait after all

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoclient writer: do not output chunklist for now on verbose true
Thomas Lamprecht [Thu, 23 Jul 2020 07:49:29 +0000 (09:49 +0200)]
client writer: do not output chunklist for now on verbose true

Verbosity needs to be a non binary level, as this now is just
debug/development info, for endusers normally to much.

We want to have it available, but with a much higher verbosity level.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoclient: rework logging upload size, bandwidth, ... info
Thomas Lamprecht [Thu, 23 Jul 2020 07:45:48 +0000 (09:45 +0200)]
client: rework logging upload size, bandwidth, ... info

Track reused size and chunk counts.
Log reused size and use pretty print for all sizes and bandwidth
metrics.
Calculate speed over the actually uploaded size, as else it can be
skewed really bad (showing like terabytes per second)

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agotools/format: add struct to pretty print bytes
Thomas Lamprecht [Thu, 23 Jul 2020 07:36:02 +0000 (09:36 +0200)]
tools/format: add struct to pretty print bytes

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agosystemd/time: document CalendarEvent struct and add TODOs
Thomas Lamprecht [Thu, 23 Jul 2020 05:55:38 +0000 (07:55 +0200)]
systemd/time: document CalendarEvent struct and add TODOs

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agofixed index: chunk_from_offset: avoid slow modulo operation
Thomas Lamprecht [Wed, 22 Jul 2020 15:46:02 +0000 (17:46 +0200)]
fixed index: chunk_from_offset: avoid slow modulo operation

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoremove BufferedFixedReader interface
Stefan Reiter [Wed, 22 Jul 2020 13:56:23 +0000 (15:56 +0200)]
remove BufferedFixedReader interface

replaced by AsyncIndexReader

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
3 years agoimplement AsyncSeek for AsyncIndexReader
Stefan Reiter [Wed, 22 Jul 2020 13:56:22 +0000 (15:56 +0200)]
implement AsyncSeek for AsyncIndexReader

Requires updating the AsyncRead implementation to cope with byte-wise
seeks to intra-chunk positions.

Uses chunk_from_offset to get locations within chunks, but tries to
avoid it for sequential read to not reduce performance from before.

AsyncSeek needs to use the temporary seek_to_pos to avoid changing the
position in case an invalid seek is given and it needs to error in
poll_complete.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
3 years agoadd and implement chunk_from_offset for IndexFile
Stefan Reiter [Wed, 22 Jul 2020 13:56:21 +0000 (15:56 +0200)]
add and implement chunk_from_offset for IndexFile

Necessary for byte-wise seeking through chunks in an index.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
3 years agodatastore/chunker: fix comment typos
Thomas Lamprecht [Wed, 22 Jul 2020 14:12:49 +0000 (16:12 +0200)]
datastore/chunker: fix comment typos

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agobackup: list images: handle walkdir error, catch "lost+found"
Thomas Lamprecht [Wed, 22 Jul 2020 14:01:50 +0000 (16:01 +0200)]
backup: list images: handle walkdir error, catch "lost+found"

We support using an ext4 mountpoint directly as datastore and even do
so ourself when creating one through the disk manage code.

Such ext4 ountpoints have a lost+found directory which only root can
traverse into. As the GC list images is done as backup:backup user
walkdir gets an error.

We cannot ignore just all permission errors, as they could lead to
missing some backup indexes and thus possibly sweeping more chunks
than desired. While *normally* that should not happen through our
stack, we had already user report that they do rsyncs to move a
datastore from old to new server and got the permission wrong.

So for now be still very strict, only allow a "lost+found" directory
as immediate child of the datastore base directory, nothing else.

If deemed safe, this can always be made less strict. Possibly by
filtering the known backup-types on the highest level first.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agodatastore: fix typo
Thomas Lamprecht [Wed, 22 Jul 2020 13:04:14 +0000 (15:04 +0200)]
datastore: fix typo

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agofix #2871: close FDs when scanning backup group
Fabian Grünbichler [Tue, 21 Jul 2020 13:03:36 +0000 (15:03 +0200)]
fix #2871: close FDs when scanning backup group

otherwise we leak those descriptors and run into EMFILE when a backup
group contains many snapshots.

fcntl::openat and Dir::openat are not the same ;)

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
3 years agofix #2865: detect and skip vanished snapshots
Fabian Grünbichler [Tue, 21 Jul 2020 13:03:35 +0000 (15:03 +0200)]
fix #2865: detect and skip vanished snapshots

also when they have been removed/forgotten since we retrieved the
snapshot list for the currently syncing backup group.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
3 years agoapi: translate ENOTFOUND to 404 for downloads
Fabian Grünbichler [Tue, 21 Jul 2020 13:03:34 +0000 (15:03 +0200)]
api: translate ENOTFOUND to 404 for downloads

and percolate the HttpError back up on the client side

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
3 years agofix #2860: skip in-progress snapshots when syncing
Fabian Grünbichler [Tue, 21 Jul 2020 13:03:33 +0000 (15:03 +0200)]
fix #2860: skip in-progress snapshots when syncing

they don't have a final manifest yet and are not done, so they can't be
synced either.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
3 years ago.gitignore: add build directory
Fabian Grünbichler [Tue, 21 Jul 2020 13:03:32 +0000 (15:03 +0200)]
.gitignore: add build directory

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
3 years agoui: add calendar event selector
Thomas Lamprecht [Tue, 21 Jul 2020 17:32:25 +0000 (19:32 +0200)]
ui: add calendar event selector

modelled after the PVE one, but we are not 1:1 compatible and need
deleteEmpty support. For now let's just have some duplicate code, but
we should try to move this to widget toolkit ASAP.

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