4834 Commits

Author SHA1 Message Date
Wolfgang Bumiller
20ecaad13b cargo fmt
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2023-03-27 15:03:05 +02:00
Lukas Wagner
a1a9fdd8b8 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>
2023-03-27 14:40:41 +02:00
Lukas Wagner
9273dc188f 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>
2023-03-27 14:23:11 +02:00
Wolfgang Bumiller
5f0965edba 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>
2023-03-27 11:51:34 +02:00
Wolfgang Bumiller
750704400a realm sync: replace and_then chain with '?' in lookup closure
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2023-03-27 11:47:26 +02:00
Wolfgang Bumiller
0010d56a00 realm sync: take schema per reference
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2023-03-27 11:47:26 +02:00
Lukas Wagner
cf4ff8a783 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>
2023-03-27 11:47:13 +02:00
Thomas Lamprecht
6b815bc022 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>
2023-03-14 17:54:16 +01:00
Stefan Sterz
ee0eaeae63 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>
2023-03-14 17:50:55 +01:00
Stefan Sterz
a443dd5c52 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>
2023-03-09 08:04:18 +01:00
Thomas Lamprecht
dd06b7f1ee server: switch to inline template variables & small cleanups
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-03-09 08:03:43 +01:00
Wolfgang Bumiller
15280f936f typo fix
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2023-03-07 15:50:19 +01:00
Dominik Csapak
98c359241a 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>
2023-03-07 15:48:43 +01:00
Wolfgang Bumiller
d97ff8ae2a use new auth api crate
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-03-02 17:01:35 +01:00
Wolfgang Bumiller
5aeeb44a32 adapt to rest-server 0.3 and http 0.8 changes
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2023-03-02 15:15:36 +01:00
Wolfgang Bumiller
26f03f9e53 use proxmox-sortable-macro directly
instead of via proxmox-sys

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2023-03-02 15:15:36 +01:00
Dominik Csapak
250a1363e1 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>
2023-03-01 08:19:59 +01:00
Dominik Csapak
a59ffbbe2c 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>
2023-03-01 08:17:12 +01:00
Fabian Grünbichler
06e9e20cdb backup: fix indentation
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2023-02-24 10:15:02 +01:00
Lukas Wagner
06c01f55d0 auth: unify naming for all authenticator implementations
This also removes the need for two clippy-allow directives.

Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
2023-02-10 12:46:19 +01:00
Lukas Wagner
7c4189522d auth: add dummy OpenIdAuthenticator struct
When manually adding a user, `lookup_authenticator` is called
to verify whether a realm actually exists. Thus is is necessary
to have dummy implementation for the `ProxmoxAuthenticator` trait
for OpenID realms.

Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
2023-02-10 12:46:19 +01:00
Lukas Wagner
b9d67b014c docs: add configuration file reference for domains.cfg
Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
2023-02-10 12:46:19 +01:00
Lukas Wagner
2b75fbaa33 manager: add commands for managing LDAP realms
Adds commands for managing LDAP realms, including user sync, to
`proxmox-backup-manager`.

Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
2023-02-10 12:46:19 +01:00
Lukas Wagner
73757fe2df server: add LDAP realm sync job
This commit adds sync jobs for LDAP user sync. As of now, they
can only be started manually.

Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
2023-02-10 12:46:19 +01:00
Lukas Wagner
3eb6a5d957 api-types: add config options for LDAP user sync
Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
2023-02-10 12:46:19 +01:00
Lukas Wagner
19dfcfd80f auth: add LDAP realm authenticator
This commits also makes user authentication async, so that e.g. a not
responding LDAP server cannot block other logins.

Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
2023-02-10 12:46:19 +01:00
Lukas Wagner
3f22f650a9 api: add routes for managing LDAP realms
Note: bind-passwords set via the API  are not stored in `domains.cfg`,
but in a separate `ldap_passwords.json` file located in
`/etc/proxmox-backup/`.
Similar to the already existing `shadow.json`, the file is
stored with 0600 permissions and is owned by root.

Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
2023-02-10 12:46:19 +01:00
Lukas Wagner
039fb8066c debug cli: use handle_worker in proxmox-rest-server
The function was moved to proxmox-rest-server to make it
usable in the proxmox-backup-manager cli binary.

Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
2023-02-10 12:46:19 +01:00
Friedrich Weber
86acc77ee9 fix #4341: manager cli: add commands to run prune/sync/verify jobs
Running configured jobs was already possible using the Web UI, but not
using the CLI. To fix that, this commit adds the following commands to
`proxmox-backup-manager`:

* prune-job run <id>
* sync-job run <id>
* verify-job run <id>

Signed-off-by: Friedrich Weber <f.weber@proxmox.com>
2023-02-09 11:38:24 +01:00
Fabian Grünbichler
c78437e320 verify/protect: improve error on disappearing snapshots
or clients passing in a non-existent snapshot.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2023-02-08 15:19:32 +01:00
Fabian Grünbichler
07b6db8099 backup/snapshot reader: improve error message for ENOENT
instead of

 Error: unable to open snapshot directory "/full/path/to/snapshot" for locking - ENOENT: No such file or directory

this will now print

 Error: Snapshot vm/800/2023-01-16T12:28:11Z does not exist.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2023-02-08 15:19:29 +01:00
Wolfgang Bumiller
d842189959 move metrics connection from pbs-config to proxy
it's the only user and pbs-config shouldn't depend on the metric client

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2023-01-20 10:59:55 +01:00
Lukas Wagner
9936c03a52 api: serde-rename deleteable properties to kebab-case
In former commit, the enum members were renamed to be CamelCase, in
accordance with the usual Rust style guide. However, this broke the
GUI in some places due to failing JSON property deserialization.
To fix this, some serde(rename = "kebab-case") directives were added.

Some properties were also serde-renamed to snake_case, otherwise
it would have been necessary to also modify proxmox-widget-toolkit
as well as PVE source code. This can follow in a later commit if so
desired.

Fixes: a2055c38 fix non-camel-case enums
Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
2023-01-20 07:35:10 +01:00
Thomas Lamprecht
1f84ac052b api: node tasks: small cleanups
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-01-19 11:37:24 +01:00
Fabian Grünbichler
158db8c01f fix #4483: fix task log command interrupt handling
`proxmox-backup-client task log ..` and `proxmox-backup-manager task log ..`
are used to view the logs of tasks that have been started by another client, so
interrupting the task progress view should not forward the interrupt to the
running task. other call sites of the same helper(s) that spawn a task and then
print its progress should keep the old behaviour of interrupting the spawned
task on C^c.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2023-01-19 10:11:25 +01:00
Fiona Ebner
07151513fa api: apt: versions: add proxmox-mail-forward to package list
Suggested-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
2023-01-18 11:26:25 +01:00
Thomas Lamprecht
0b160cfdec tape inventory: code cleanup listing media assigned to a pool
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-01-16 11:05:35 +01:00
Thomas Lamprecht
7792507a12 tape inventory: code cleanup media pool look-up
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-01-16 11:05:35 +01:00
Thomas Lamprecht
6905bd3735 tape inventory: make both media list methods use same appraoch
Was a bit odd that the very similar (same return type) methods used
a for+if/else+push and a iter+filter+collect approach.

Switch both to the latter and use a match instead of if/else for
shorter code

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-01-16 11:05:35 +01:00
Dominik Csapak
025523c059 fix #4466: show snapshots in media content again
while refactoring the the empty media set checks, we accidentally
reversed one check from !is_empty to unassigned, which now never
included the right media sets.

reversing the condition fixes that.

fixes
52517f7b: ("tape: hide internal use of all zero uuid for unassigned tapes")

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2023-01-16 10:48:31 +01:00
Wolfgang Bumiller
a2055c38fe fix non-camel-case enums
This should have never been started to begin with...
2023-01-05 11:13:46 +01:00
Dominik Csapak
79de842ca3 disk: zfs: improve error logging for zfs commands
zfs errors might include a newline in the output (e.g. when trying to
create a mirror on two differently sized disks), which trips up our
task log status parser since that expectes a 'TASK {status}' on the
beginning of the first line.

print the error from zfs into the log and bail out with a short notice
to check the task log

this fixes the 'unknown error' issue in the ui when an error happnes
during the zfs commands

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2023-01-05 10:36:57 +01:00
Christoph Heiss
ff2910666b api2/node/services: Handle optional services and expose unit-state
.. in the same way the PVE api does, esp. regarding the logic to handle
oneshot and missing services.

This then allows re-using the GUI parts from there as well, so that the
services page in PVE and PBS looks the same.

Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
2023-01-05 10:12:48 +01:00
Hannes Laimer
f6d6b5a317 fix #4256: api2: remove datastore ACL-node on removal of datastore
Signed-off-by: Hannes Laimer <h.laimer@proxmox.com>
2022-12-20 10:09:09 +01:00
Hannes Laimer
ca1da2cb3c fix #4256: api2: remove prune jobs on datastore delete
Signed-off-by: Hannes Laimer <h.laimer@proxmox.com>
2022-12-20 10:09:06 +01:00
Wolfgang Bumiller
f72ccdd65d move pbs_tools::ticket to pbs_ticket
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2022-12-13 13:58:09 +01:00
Wolfgang Bumiller
8ebb984fbe move pbs_config::tape_encryption_keys to pbs crate lib
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2022-12-12 14:26:02 +01:00
Wolfgang Bumiller
1104d2a268 move pbs_config::key_config to pbs-key-config
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2022-12-12 14:19:52 +01:00
Wolfgang Bumiller
28917c7127 update for new proxmox-api-macro
A #[default] attribute now conflicts with an explicitly
defined #[api(default: ...)] value for obvious reasons.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2022-12-12 11:40:13 +01:00
Lukas Wagner
8a8def934e manager: remove accidentally committed ldap.rs
Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
2022-12-09 14:59:15 +01:00