]> git.proxmox.com Git - proxmox-backup.git/log
proxmox-backup.git
12 months agobuild: inject repoid into build environment
Fabian Grünbichler [Wed, 4 Jan 2023 14:13:09 +0000 (15:13 +0100)]
build: inject repoid into build environment

to support building outside of the git tree, e.g. via sbuild.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
12 months agod/source: override some false-positive lintian tags
Thomas Lamprecht [Sun, 21 May 2023 11:50:27 +0000 (13:50 +0200)]
d/source: override some false-positive lintian tags

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
12 months agod/file-restore.postinst: add DEBHELPER stanza
Thomas Lamprecht [Sun, 21 May 2023 11:49:59 +0000 (13:49 +0200)]
d/file-restore.postinst: add DEBHELPER stanza

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
12 months agod/control: avoid versioned build-dependcies with a -1 revision
Thomas Lamprecht [Sun, 21 May 2023 11:48:57 +0000 (13:48 +0200)]
d/control: avoid versioned build-dependcies with a -1 revision

no use, just makes backporting harder

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
12 months agobuildsys: always pre-clean for den and dsc target
Thomas Lamprecht [Sun, 21 May 2023 11:42:19 +0000 (13:42 +0200)]
buildsys: always pre-clean for den and dsc target

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
12 months agobuildsys: make deb target always build doc package, add deb-nodoc
Thomas Lamprecht [Sun, 21 May 2023 11:35:55 +0000 (13:35 +0200)]
buildsys: make deb target always build doc package, add deb-nodoc

deb should be our common "build all" target, so rather make the
exception a specific target than vice versa.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
12 months agobuildsys: simplify getting workspace crate list
Thomas Lamprecht [Sun, 21 May 2023 11:32:43 +0000 (13:32 +0200)]
buildsys: simplify getting workspace crate list

we got awk already in the mix, most of the time one doesn't need
anything else..

Also split over multiple lines for readability

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
12 months agobuildsys: get metadata only for workspace when resolving sub crates
Thomas Lamprecht [Sun, 21 May 2023 11:17:50 +0000 (13:17 +0200)]
buildsys: get metadata only for workspace when resolving sub crates

Allows for building a DSC without having the librust-* source code
build-dependencies installed.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
12 months agobump version to 2.4.2-1
Thomas Lamprecht [Wed, 17 May 2023 15:37:38 +0000 (17:37 +0200)]
bump version to 2.4.2-1

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
12 months agobackup-client: clippy fixes
Thomas Lamprecht [Wed, 17 May 2023 15:36:38 +0000 (17:36 +0200)]
backup-client: clippy fixes

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
12 months agofile restore: clippy and format argument fixes
Thomas Lamprecht [Wed, 17 May 2023 15:36:20 +0000 (17:36 +0200)]
file restore: clippy and format argument fixes

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
12 months agopbs-datastore: clippy fixes
Thomas Lamprecht [Wed, 17 May 2023 15:35:42 +0000 (17:35 +0200)]
pbs-datastore: clippy fixes

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
12 months agopbs-client: clippy fixes
Thomas Lamprecht [Wed, 17 May 2023 15:34:52 +0000 (17:34 +0200)]
pbs-client: clippy fixes

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
12 months agopbs-tape: clippy and format string fixes
Thomas Lamprecht [Wed, 17 May 2023 14:47:03 +0000 (16:47 +0200)]
pbs-tape: clippy and format string fixes

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
12 months agopbs-config: clippy fixes
Thomas Lamprecht [Wed, 17 May 2023 14:40:41 +0000 (16:40 +0200)]
pbs-config: clippy fixes

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
12 months agoclippy fixes
Thomas Lamprecht [Wed, 17 May 2023 14:10:34 +0000 (16:10 +0200)]
clippy fixes

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
12 months agodatastore: return error instead of unreachable
Thomas Lamprecht [Wed, 17 May 2023 14:06:25 +0000 (16:06 +0200)]
datastore: return error instead of unreachable

very unexpected and unreachable is probably fine here, but it's not
really winning us anything, so avoid the panic-potential and just
bail out.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
12 months agotape: MAM: replace tuple with struct for better readability
Thomas Lamprecht [Wed, 17 May 2023 13:52:24 +0000 (15:52 +0200)]
tape: MAM: replace tuple with struct for better readability

It's needlessly adding mental complexity to always have to translate
usages like info.0 or info.1 in ones head when reading the code.

Transforming this to a struct allows for using descriptive names when
accessing the specific fields and allows for implementing a
constructor per MamFormat, reducing the resulting MAM attribute list
by quite a few lines.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
12 months agotape: avoid panic potential in MAM attribute decoder
Thomas Lamprecht [Wed, 17 May 2023 12:57:15 +0000 (14:57 +0200)]
tape: avoid panic potential in MAM attribute decoder

We already saw that quite some tape libraries/loaders/... ain't
always _that_ standard conform, and even if it'd be guaranteed, it
just makes no sense to create a potential for panicking the whole
daemon due to some sub-features hiccup, rather go for actual error
handling...

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
12 months agotape: update link to IBM SCSI reference LTO 5 - 9
Thomas Lamprecht [Wed, 17 May 2023 12:52:29 +0000 (14:52 +0200)]
tape: update link to IBM SCSI reference LTO 5 - 9

The linked PDF is also captured and archived here:
https://web.archive.org/web/20230517122521/https://www.ibm.com/support/pages/system/files/inline-files/LTO%20SCSI%20Reference_GA32-0928-05%20%28EXTERNAL%29_0.pdf#

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
12 months agotape: reduce indentation depth of MAM attribute decoder
Thomas Lamprecht [Wed, 17 May 2023 12:43:01 +0000 (14:43 +0200)]
tape: reduce indentation depth of MAM attribute decoder

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
12 months agodatastore: fix compiler warning for unused FromStr import
Thomas Lamprecht [Wed, 17 May 2023 12:33:11 +0000 (14:33 +0200)]
datastore: fix compiler warning for unused FromStr import

Fixes: 161a8864 ("fix #4357: datastore: take into account namespaces ...")
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
12 months agoui: main view: rename "Theme" selector to "Color Theme"
Stefan Sterz [Fri, 14 Apr 2023 13:28:10 +0000 (15:28 +0200)]
ui: main view: rename "Theme" selector to "Color Theme"

this is already the case in Proxmox VE so just use the same wording
here too to stay consistent

Signed-off-by: Stefan Sterz <s.sterz@proxmox.com>
12 months agodocs: fix api viewer dark theme path
Stefan Sterz [Fri, 14 Apr 2023 13:28:09 +0000 (15:28 +0200)]
docs: fix api viewer dark theme path

previously the path to the dark theme's css pointed to the wrong file.
it didn't exist, this one should.

Signed-off-by: Stefan Sterz <s.sterz@proxmox.com>
12 months agofix #4357: datastore: take into account namespaces when marking chunks
Stefan Sterz [Thu, 20 Apr 2023 08:08:53 +0000 (10:08 +0200)]
fix #4357: datastore: take into account namespaces when marking chunks

previously when marking used chunks the namespace wasn't taken into
account and valid snapshots were marked as "strange paths". this lead
to a line in the log of a gc job such as this:

found (and marked) 2 index files outside of expected directory scheme

which some users perceived as an error. parse the namespace too and
only mark the path as strange if parsing the namespace and/or backup
dir fails.

Signed-off-by: Stefan Sterz <s.sterz@proxmox.com>
12 months agoui: tape: fix restoring a single datastore
Dominik Csapak [Tue, 25 Apr 2023 13:59:56 +0000 (15:59 +0200)]
ui: tape: fix restoring a single datastore

if the user selected a single datastore to restore from tape on a
media-set that includes more than one, the ui suggests (and is
intended to) that only that datastore will be restored on the selected
target.

The logic to construct the store mapping parameter did not consider that
case, and simply gave the target as default store, which meant all
datastores were restored onto the target.

To fix that, we have to get the source datastore from the field, and
construct the correct parameter ("source=target").

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
12 months agoui: tape: fix code style/formatting
Dominik Csapak [Tue, 25 Apr 2023 13:59:55 +0000 (15:59 +0200)]
ui: tape: fix code style/formatting

this is a separate statement, it should be on a separate line

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
12 months agoui: dashboard: show tape backups/restores on task summary
Dominik Csapak [Wed, 3 May 2023 12:25:18 +0000 (14:25 +0200)]
ui: dashboard: show tape backups/restores on task summary

for that we have to increase the panel height a bit

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
12 months agoui: dashboard: fix missing prune jobs on task summary
Dominik Csapak [Wed, 3 May 2023 12:25:17 +0000 (14:25 +0200)]
ui: dashboard: fix missing prune jobs on task summary

we want to count types 'prune' and 'prunejobs' for this

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
12 months agofix #4722: allow all netmask values for reverse lookup
Fabian Grünbichler [Tue, 9 May 2023 09:15:13 +0000 (11:15 +0200)]
fix #4722: allow all netmask values for reverse lookup

the only place this is used (parsing a 'netmask XXX' directive in an interfaces
file) allows any integer as value both when parsing and when validating, so
there is no reason to restrict this to only allow string netmasks >=
8/255.0.0.0 as far as I can tell..

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
12 months agoui: fix reloading subscription info after key upload
Thomas Lamprecht [Wed, 17 May 2023 06:17:37 +0000 (08:17 +0200)]
ui: fix reloading subscription info after key upload

ExtJS has a `listeners` but no `listener` config, so add the missing
`s` to ensure the upload window destroy event callback is triggered.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
12 months agodisable tfa lockout for now
Wolfgang Bumiller [Wed, 10 May 2023 09:47:19 +0000 (11:47 +0200)]
disable tfa lockout for now

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
12 months agobump proxmox-tfa dep to 4
Wolfgang Bumiller [Wed, 10 May 2023 09:43:27 +0000 (11:43 +0200)]
bump proxmox-tfa dep to 4

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
12 months agofix #4719: wait for tape to be available in changer
Dominik Csapak [Mon, 8 May 2023 11:03:41 +0000 (13:03 +0200)]
fix #4719: wait for tape to be available in changer

instead of aborting. If the tape is currently e.g. offline, in an
import/export slot or in the wrong drive, this gives the user the chance to
manually move it/insert it, so that the backup job can continue.

Send an e-mail like we do on a standalone drive, but adapt the messages
to contain the changer instead of the drive.

This can help when not all tapes are currently available in the changer.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
12 months agotape restore: show required tape list on single snapshot restore
Dominik Csapak [Fri, 5 May 2023 14:38:42 +0000 (16:38 +0200)]
tape restore: show required tape list on single snapshot restore

like we do on a full restore, for that refactor the functionality into
'log_required_tapes' to be reused across the workers

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
12 months agodocs: fix location of webauthn configuration
Thomas Lamprecht [Mon, 8 May 2023 11:16:05 +0000 (13:16 +0200)]
docs: fix location of webauthn configuration

This was it's own panel for some time but moved into a more general
"Other" panel together with some other settings that are normally
only changed once, on initial setup (better names welcome...).

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
13 months agopull: impl Display for SkipReason
Fabian Grünbichler [Mon, 24 Apr 2023 13:56:26 +0000 (15:56 +0200)]
pull: impl Display for SkipReason

instead of manually doing it in SkipInfo's Display implementation.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
13 months agoui: sync job: add transfer-last parameter
Stefan Hanreich [Tue, 18 Apr 2023 14:59:47 +0000 (16:59 +0200)]
ui: sync job: add transfer-last parameter

Signed-off-by: Stefan Hanreich <s.hanreich@proxmox.com>
13 months agosync job: pull: improve log output
Stefan Hanreich [Tue, 18 Apr 2023 14:59:46 +0000 (16:59 +0200)]
sync job: pull: improve log output

Adding an opening line for every group makes parsing the log easier.

We can also remove the 're-sync [...] done' line, because the next
line should be a progress line anyway.

The new output for the sync job/pull logs looks as follows:

- skipped already synced (happens in most jobs, except for first run)
- re-sync of last synced snapshot (if it still exists on source)
- skipped because of transfer-last (if set and skips something)
- sync of new snapshots (if they exist)

Suggested-By: Fabian Grünbichler <f.gruenbichler@proxmox.com>
Signed-off-by: Stefan Hanreich <s.hanreich@proxmox.com>
13 months agopartial fix #3701: sync job: pull: add transfer-last parameter
Stefan Hanreich [Tue, 18 Apr 2023 14:59:45 +0000 (16:59 +0200)]
partial fix #3701: sync job: pull: add transfer-last parameter

Specifying the transfer-last parameter limits the amount of backups
that get synced via the pull command/sync job. The parameter specifies
how many of the N latest backups should get pulled/synced. All other
backups will get skipped.

This is particularly useful in situations where the sync target has
less disk space than the source. Syncing all backups from the source
is not possible if there is not enough disk space on the target.
Additionally this can be used for limiting the amount of data
transferred, reducing load on the network.

The newest backup will always get re-synced, regardless of the setting
of the transfer-last parameter.

Signed-off-by: Stefan Hanreich <s.hanreich@proxmox.com>
13 months agoui: tape: prevent mislabeling tapes in changers
Dominik Csapak [Mon, 17 Apr 2023 11:59:05 +0000 (13:59 +0200)]
ui: tape: prevent mislabeling tapes in changers

when labeling a tape in a changer, we pre-fill the label field with
the one from the barcode (if it exists). Letting the user change
the label here does not make much sense, since we assume that they are
the same (e.g. for move operations etc.)

So instead simply display the label to protect users from accidentally
changing it. If a user really needs to have a different label than the
suggested one, it's still possible on the cli.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
13 months agotape: typo fixes
Dominik Csapak [Mon, 24 Apr 2023 07:51:04 +0000 (09:51 +0200)]
tape: typo fixes

replacable to replaceable
 the field 'field_replacable_unit_code' is not currently used anywhere
descriptior to descriptor
Resuqest to Request
and flags2 to flags3 (the number indicates the numbering of the field
 and it's the third field, not the second)

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
13 months agotape: implement 6 byte fallback for MODE SENSE/SELECT
Dietmar Maurer [Fri, 21 Apr 2023 11:01:44 +0000 (13:01 +0200)]
tape: implement 6 byte fallback for MODE SENSE/SELECT

there are tape drives (esp. virtual ones) that don't implement the
10-byte variants of MODE SENSE/SELECT. Since the pages we set/request
are never bigger than 255 bytes anyway, we can implement a fallback
with the 6 byte variant here.

Implementing this as a fallback to make sure that existing working
drives keep the existing implementation.

Tested with Starwind VTL.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
13 months agoupdate to syslog 6
Fabian Grünbichler [Thu, 20 Apr 2023 12:25:13 +0000 (14:25 +0200)]
update to syslog 6

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
13 months agotape: continue without MAM media_usage page
Dominik Csapak [Thu, 30 Mar 2023 11:28:43 +0000 (13:28 +0200)]
tape: continue without MAM media_usage page

sometimes we cannot parse these pages (e.g. vendor quirks that implement
the field differently)

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
13 months agotape: use correct MAM attribute definitions
Dominik Csapak [Thu, 30 Mar 2023 11:28:42 +0000 (13:28 +0200)]
tape: use correct MAM attribute definitions

080Ch: it's binary not ascii, and the length is not specified
    (hp says 23-n bytes)
0820h and 0821h are also binary and not ascii

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
13 months agochunk store: handle insertion edge cases
Fabian Grünbichler [Fri, 31 Mar 2023 08:43:45 +0000 (10:43 +0200)]
chunk store: handle insertion edge cases

these were previously called out in a comment, but should now be handled (as
much as they can be).

the performance impact shouldn't be too bad, since we only look at the magic 8
bytes at the start of the existing chunk (we already did a stat on it, so that
might even be prefetched already by storage), and only if there is a size
mismatch and encryption is enabled.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
 [ T: fold in "just to be sure" touch_chunk calls ]
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
13 months agodocs: make logo path and index link absolute
Stefan Sterz [Wed, 5 Apr 2023 08:12:09 +0000 (10:12 +0200)]
docs: make logo path and index link absolute

the relative path failed as some pages are more deeply nested, such as
the man page for `proxmox-tape`. this meant that on these pages the
logo wouldn't be displayed correctly and the link lead to a non-
existent file.

Signed-off-by: Stefan Sterz <s.sterz@proxmox.com>
13 months agodocs: dark theme, dim borders and minor fixups
Stefan Sterz [Wed, 5 Apr 2023 08:12:08 +0000 (10:12 +0200)]
docs: dark theme, dim borders and minor fixups

this commit adjust several border colors that weren't styled before
and appeared too brightly. also add styles to the "hide search
matches" link that had poor contrasts before.

Signed-off-by: Stefan Sterz <s.sterz@proxmox.com>
13 months agodocs: make dark mode variables more consistent
Stefan Sterz [Wed, 5 Apr 2023 08:12:07 +0000 (10:12 +0200)]
docs: make dark mode variables more consistent

this commit roles some color values into variables, cleans up unused
variables and makes variable naming a bit more consistent.

Signed-off-by: Stefan Sterz <s.sterz@proxmox.com>
13 months agoapi types: fix non-capturing group syntax
Dominik Csapak [Thu, 30 Mar 2023 07:20:42 +0000 (09:20 +0200)]
api types: fix non-capturing group syntax

a non capturing group is '(?:)' not '(:?)' so fix that.
None of these regexes are used where would use capturing groups.
DATASTORE_MAP_REGEX and TAPE_RESTORE_SNAPSHOT_REGEX are only used
as api types and BLOCKDEVICE_NAME_REGEX is only used once outside of the
api and there we also don't look at the capturing groups.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
13 months agodocs: dark mode: adapt background for bottom links in mobile view
Dominik Csapak [Thu, 30 Mar 2023 06:49:25 +0000 (08:49 +0200)]
docs: dark mode: adapt background for bottom links in mobile view

the background there was white, so override them to the initial value
(the same as the remaining page).

this was missing in my last patch

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
14 months agoRevert "cli: manager, tape, debug: setup auth context to make local connect work"
Thomas Lamprecht [Wed, 29 Mar 2023 12:58:35 +0000 (14:58 +0200)]
Revert "cli: manager, tape, debug: setup auth context to make local connect work"

This reverts commit 6bac67195e0f57edf80b34558ea791da68d4d1a5 and
commit 783e88c2df600675ccc98b4a99bfbe1c4d18f55e as they were both
superseded by 569324cb ("provide separate helpers for pub/priv auth
keyring access").

14 months agoprovide separate helpers for pub/priv auth keyring access
Wolfgang Bumiller [Wed, 29 Mar 2023 12:37:20 +0000 (14:37 +0200)]
provide separate helpers for pub/priv auth keyring access

This used to be the case before the switch to the auth api
crate and is required for some helpers where we don't want
to have to setup the complete auth context.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
14 months agoapi-types: anchor datastore-map regex
Thomas Lamprecht [Wed, 29 Mar 2023 09:58:57 +0000 (11:58 +0200)]
api-types: anchor datastore-map regex

Fixes: 4c4e5c2b ("api2/tape/restore: enable restore mapping of datastores")
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
14 months agoapi-types: ldap: properly anchor DN regex
Lukas Wagner [Wed, 29 Mar 2023 09:22:41 +0000 (11:22 +0200)]
api-types: ldap: properly anchor DN regex

Otherwise, a substring match is enough to fulfill the constraint.

Fixes: c001aca0 ("api-types: ldap: add verification regex for LDAP DNs")
Reported-by: Friedrich Weber <f.weber@proxmox.com>
Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
14 months agobump version to 2.4.1-1 v2.4.1
Thomas Lamprecht [Tue, 28 Mar 2023 17:23:24 +0000 (19:23 +0200)]
bump version to 2.4.1-1

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
14 months agocli: manager, tape, debug: avoid setting up auth context for printdoc
Thomas Lamprecht [Tue, 28 Mar 2023 17:02:46 +0000 (19:02 +0200)]
cli: manager, tape, debug: avoid setting up auth context for printdoc

as otherwise build fails in a clean environment, where no API auth
key is available.

This whole printdoc command injection is quite ugly and causes
headache in general though, we'd be better off if we could do away
with that..

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
14 months agoui: user edit: rework interaction of realm and view model
Thomas Lamprecht [Tue, 28 Mar 2023 16:46:38 +0000 (18:46 +0200)]
ui: user edit: rework interaction of realm and view model

avoid accessing private members directly but rather try to use the
public API, this then allows us do drop declaring a reference on the
realm combobox, which was not directly used and thus a bit subtle.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
14 months agoui: user edit: fix filtering out pam realm on user-add
Thomas Lamprecht [Tue, 28 Mar 2023 16:21:02 +0000 (18:21 +0200)]
ui: user edit: fix filtering out pam realm on user-add

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
14 months agocli: manager, tape, debug: setup auth context to make local connect work
Thomas Lamprecht [Tue, 28 Mar 2023 15:05:07 +0000 (17:05 +0200)]
cli: manager, tape, debug: setup auth context to make local connect work

The manager, tape and debug admin and debug CLI tools all are meant
to run locally on the PBS directly and often directly by the root
user.

So for convenience they will create a valid API ticket for `root@pam`
to connect via localhost to the API proxy, either transparently if
the UID is 0 (= root) or interactively by asking the password of the
root user.

In d97ff8ae ("use new auth api crate") the API key handling was
reworked, but while the call sites that get the auth keys for signing
a ticket where adapted to use the new auth_keyring helper, the
reworked API keeps the key in shared OnceCell which needs to be
actually setup once per executable to the respective correct key,
i.e., public for the proxy, which only checks signatures, but never
creates them, and private for all those that want to sign tickets;
and that was only added for the prrivileged and public daemon, but
not above mentioned CLI tools.

So all calls into the tools that actually required to create a ticket
for connecting to the local API panicked.

Fix this by adding a call to setup_auth_context in the main entry
point of each of those CLI tools, so that they have the private key
available to be used if the tools is executed by root.

Fixes: d97ff8ae ("use new auth api crate")
Reported-by: Friedrich Weber <f.weber@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
14 months agoapi-types: ldap: add verification regex for LDAP DNs
Lukas Wagner [Tue, 28 Mar 2023 14:20:14 +0000 (16:20 +0200)]
api-types: ldap: add verification regex for LDAP DNs

Regex was taken from the LDAP implementation in PVE.

Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
14 months agoui: dark mode: add dark mode colors to the datastore usage charts
Dominik Csapak [Tue, 28 Mar 2023 13:11:48 +0000 (15:11 +0200)]
ui: dark mode: add dark mode colors to the datastore usage charts

For the `Datastore -> Summary` overview for all configured datastores.

Fix is adapted from the PVE's ceph's status details or performance
runningCharts, which are both similar (but not really the same)

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
 [ T: expand commit message to note that this is adapted from PVE ]
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
14 months agodocs: exand PBS to Proxmox Backup (Server)
Fabian Grünbichler [Tue, 28 Mar 2023 12:12:25 +0000 (14:12 +0200)]
docs: exand PBS to Proxmox Backup (Server)

where applicable.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
14 months agod/rules: version check: exit early and fine-tune error message
Thomas Lamprecht [Tue, 28 Mar 2023 11:54:44 +0000 (13:54 +0200)]
d/rules: version check: exit early and fine-tune error message

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
14 months agofix #4521: api/tasks: replace upid as filename for task log downloads
Stefan Sterz [Thu, 9 Feb 2023 11:41:39 +0000 (12:41 +0100)]
fix #4521: api/tasks: replace upid as filename for task log downloads

previously the upid would just be used without a file extension when
downloading a task log. this lead to rather strange filenames that
appeared unfamiliar to users as the upid is not very prevalent in the
gui. set a proper file name based on the node name, worker type and a
time stamp instead. also add the ".log" file extension to indicate
that these files contain logs.

Signed-off-by: Stefan Sterz <s.sterz@proxmox.com>
14 months agod/rules: verify version between Cargo.toml and debian/changelog
Wolfgang Bumiller [Tue, 28 Mar 2023 07:41:35 +0000 (09:41 +0200)]
d/rules: verify version between Cargo.toml and debian/changelog

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
14 months agod/copyright: update years
Thomas Lamprecht [Mon, 27 Mar 2023 18:09:22 +0000 (20:09 +0200)]
d/copyright: update years

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
14 months agobump version to 2.4.0-2
Thomas Lamprecht [Mon, 27 Mar 2023 17:34:53 +0000 (19:34 +0200)]
bump version to 2.4.0-2

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
14 months agodocs: implement auto dark mode
Dominik Csapak [Fri, 24 Mar 2023 15:53:21 +0000 (16:53 +0100)]
docs: implement auto dark mode

the colors are inspired/copied from the pmg/pve docs dark mode, but
i tried to apply them such that theme is faithful to the original
docs style regarding contrast etc.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
14 months agodrop exclusive lock for verify-after-complete
Fabian Grünbichler [Mon, 27 Feb 2023 09:50:12 +0000 (10:50 +0100)]
drop exclusive lock for verify-after-complete

the backup is finished at that point, the only lock clash that is possible when
dropping the exclusive and attempting to obtain a shared lock would be

- the snapshot is pruned/removed
- the backup is in a pre-upgrade process, and the post-upgrade process opens a reader

the first case is OK, if the other invocation wins the race and removes the
snapshot verification is pointless anyway.

the second case means the snapshot is not verified directly after completion
(this fact would be logged in the backup task log), but usable immediately for
pulling/restoring/..

this should decrease the chances of triggering the issues described in #4523

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
14 months agocargo fmt
Wolfgang Bumiller [Mon, 27 Mar 2023 13:03:02 +0000 (15:03 +0200)]
cargo fmt

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
14 months agoreport: add `date -R` to general system info section
Lukas Wagner [Thu, 23 Feb 2023 15:51:11 +0000 (16:51 +0100)]
report: add `date -R` to general system info section

Sometimes it can be quite useful to know when exactly a system report
was generated. Adds the following output:

 # date -R
 Thu, 23 Feb 2023 16:21:12 +0100

Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
14 months agomanager: use view_task_result function for realm sync
Lukas Wagner [Mon, 13 Feb 2023 14:29:31 +0000 (15:29 +0100)]
manager: use view_task_result function for realm sync

Previously, the same approach as in `proxmox-backup-debug` was used.
With the changes from this commit, realm syncing uses the same method for
waiting for task output as other parts of `proxmox-backup-manager`.

Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
14 months agodocs: ldap: break long lines/remove trailing whitespace
Lukas Wagner [Mon, 13 Feb 2023 14:24:21 +0000 (15:24 +0100)]
docs: ldap: break long lines/remove trailing whitespace

Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
14 months agodocs: reword WORM tape documentation
Aaron Lauterer [Thu, 2 Mar 2023 11:18:03 +0000 (12:18 +0100)]
docs: reword WORM tape documentation

Mainly splitting long sentences into smaller ones. Some rewording
happened in the process.

The changes should still transport the same information.

Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
Reviewed-by: Dominik Csapak <d.csapak@proxmox.com>
14 months agorealm sync: replace formatted .context() calls
Wolfgang Bumiller [Mon, 27 Mar 2023 09:51:17 +0000 (11:51 +0200)]
realm sync: replace formatted .context() calls

with .map_err/.ok_or_else - since the formatting should not
happen in the non-error case

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
14 months agorealm sync: replace and_then chain with '?' in lookup closure
Wolfgang Bumiller [Mon, 27 Mar 2023 09:46:02 +0000 (11:46 +0200)]
realm sync: replace and_then chain with '?' in lookup closure

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
14 months agorealm sync: take schema per reference
Wolfgang Bumiller [Mon, 27 Mar 2023 09:43:50 +0000 (11:43 +0200)]
realm sync: take schema per reference

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
14 months agorealm sync: show warnings if attributes do not meet their constraints
Lukas Wagner [Mon, 13 Feb 2023 14:31:04 +0000 (15:31 +0100)]
realm sync: show warnings if attributes do not meet their constraints

Previously, if the value of a synced property did not validate properly
(e.g only 1 character in length instead of the required 2), the whole
sync job failed without any useful error message.

In this commit, the values are validated manually by their
respective StringSchema. If the validation fails, the value is
ignored and a warning is displayed in the task log.

In addition to that, some error messages have been improved.
Also, user sync is now more fault-tolerant in general, showing
warnings if something goes wrong while creating/updating a
single user, instead of aborting the whole sync job.

Reported-by: Friedrich Weber <f.weber@proxmox.com>
Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
Tested-by: Friedrich Weber <f.weber@proxmox.com>
14 months agopxar creation: use log crate for error reporting
Fabian Grünbichler [Wed, 8 Mar 2023 10:57:48 +0000 (11:57 +0100)]
pxar creation: use log crate for error reporting

gives a higher (runtime) control via PBS_LOG, so that users can decide
themselves which messages, sources and levels are interesting for a particular
use case.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
14 months agofix #4578: use log crate for pxar create logging
Fabian Grünbichler [Wed, 8 Mar 2023 10:57:47 +0000 (11:57 +0100)]
fix #4578: use log crate for pxar create logging

since proxmox-backup-client is used in cron jobs and similar automated
fashions, PBS_LOG= should control the output..

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
14 months agoproxy: limit theme value in length and disallow '/'
Thomas Lamprecht [Tue, 14 Mar 2023 16:54:14 +0000 (17:54 +0100)]
proxy: limit theme value in length and disallow '/'

while with rust strings we cannot inject \0, it feels a bit safer to
enforce some basic restrictions, with length and not containing any
slash seems sensible enough.

Admins should not put sensible data as theme-XYZ.css files in
/usr/share (which is normally readable by all system users anyway)

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
14 months agoproxy: switch to "auto" as the default theme
Stefan Sterz [Tue, 14 Mar 2023 14:02:00 +0000 (15:02 +0100)]
proxy: switch to "auto" as the default theme

use the "auto" theme per default. it uses a media query to detect the
users preferred theme.

Signed-off-by: Stefan Sterz <s.sterz@proxmox.com>
14 months agodocs: add dark mode support to the api viewer
Stefan Sterz [Wed, 8 Mar 2023 16:45:55 +0000 (17:45 +0100)]
docs: add dark mode support to the api viewer

adds dark mode support to the api viewer that is activated depending
on the users theme preference. similar to the main gui's "auto"
theme.

this requires a bump of the widget toolkit so the dark theme css file
is present

Signed-off-by: Stefan Sterz <s.sterz@proxmox.com>
 [ T: fixup commit subject, got garbled on send ]
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
14 months agoui: remove white backgrounds from package versions and system report
Stefan Sterz [Wed, 8 Mar 2023 16:41:40 +0000 (17:41 +0100)]
ui: remove white backgrounds from package versions and system report

removes the style that gets added directly to the element of the
package versions and system report views. this makes them harder to
style through css as normal selectors cannot override the element's
style. since they behave properly without these styles anyway, remove
them.

Signed-off-by: Stefan Sterz <s.sterz@proxmox.com>
14 months agoproxy/ui: implement theme switcher
Stefan Sterz [Wed, 8 Mar 2023 16:41:39 +0000 (17:41 +0100)]
proxy/ui: implement theme switcher

adds a theme switcher to the ui and handles the necessary cookies in
the backend.

this requires a bump of the widget toolkit so the necessary widgets
are present.

Signed-off-by: Stefan Sterz <s.sterz@proxmox.com>
14 months agoserver: switch to inline template variables & small cleanups
Thomas Lamprecht [Thu, 9 Mar 2023 07:03:43 +0000 (08:03 +0100)]
server: switch to inline template variables & small cleanups

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
14 months agotypo fix
Wolfgang Bumiller [Tue, 7 Mar 2023 14:50:19 +0000 (15:50 +0100)]
typo fix

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
14 months agojobstate: fix wrong error message
Dominik Csapak [Tue, 7 Mar 2023 14:10:57 +0000 (15:10 +0100)]
jobstate: fix wrong error message

we try to create the job stat dir, not the rrdb one

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
15 months agouse new auth api crate
Wolfgang Bumiller [Wed, 1 Feb 2023 15:01:12 +0000 (16:01 +0100)]
use new auth api crate

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
15 months agobump d/control
Wolfgang Bumiller [Thu, 2 Mar 2023 15:47:25 +0000 (16:47 +0100)]
bump d/control

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
15 months agoadapt to rest-server 0.3 and http 0.8 changes
Wolfgang Bumiller [Wed, 25 Jan 2023 11:06:49 +0000 (12:06 +0100)]
adapt to rest-server 0.3 and http 0.8 changes

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
15 months agouse proxmox-sortable-macro directly
Wolfgang Bumiller [Wed, 1 Mar 2023 12:44:44 +0000 (13:44 +0100)]
use proxmox-sortable-macro directly

instead of via proxmox-sys

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
15 months agoui: subscription: use downloadAsFile helper from widget-toolkit
Thomas Lamprecht [Thu, 2 Mar 2023 14:12:30 +0000 (15:12 +0100)]
ui: subscription: use downloadAsFile helper from widget-toolkit

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
15 months agoui: subscription: code cleanups
Thomas Lamprecht [Thu, 2 Mar 2023 14:11:57 +0000 (15:11 +0100)]
ui: subscription: code cleanups

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
15 months agodocs: add WORM tape documentation
Dominik Csapak [Tue, 28 Feb 2023 13:17:22 +0000 (14:17 +0100)]
docs: add WORM tape documentation

a short section about how to use WORM tapes (since we currently don't
handle them differently than normal tapes)

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
15 months agofix #4412: tape: initial WORM support
Dominik Csapak [Tue, 28 Feb 2023 13:17:21 +0000 (14:17 +0100)]
fix #4412: tape: initial WORM support

the only thing preventing us from using WORM tapes was that we relied
on being able to rewrite the media set label when first using a tape
that was pre-allocated in a media-pool.

so instead of needing to write a meida set label with a special uuid,
just save the pool in the media label itself. This has currently no
downsides, as we're not able to move tapes from one pool to another
anyway.

this makes some checks a bit trickier, as we now have to get the pool
out of the media set label and as a fallback look into the media label.

such new tapes can still be read and restored by older proxmox-bacukp-server
versions. The only thing missing is when a tape labeled with the new
format that has an assigned pool, that pool won't show up when the tape
is inventoried in an old version (but can still be used otherwise).

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
15 months agotape: inventory: don't skip unassigned tapes completely
Dominik Csapak [Tue, 28 Feb 2023 13:17:20 +0000 (14:17 +0100)]
tape: inventory: don't skip unassigned tapes completely

since commit 139acf37 ("tape: inventory: skip unassigned tapes")
we skip unassigned tapes (special all-zero media-set uuid) when we look
for a catalog. We accidentally skipped storing it in the inventory
completely, which means we never inventoried completely empty tapes.

to fix that, simply move the check below the inserting in the inventory

Fixes: 139acf37 ("tape: inventory: skip unassigned tapes")
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
15 months agobackup: fix indentation
Fabian Grünbichler [Fri, 24 Feb 2023 09:14:16 +0000 (10:14 +0100)]
backup: fix indentation

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>