]> git.proxmox.com Git - proxmox-backup.git/log
proxmox-backup.git
3 years agotools: file logger: avoid some possible unwraps in log method
Thomas Lamprecht [Mon, 2 Nov 2020 18:26:59 +0000 (19:26 +0100)]
tools: file logger: avoid some possible unwraps in log method

writing to a file can explode quite easily.
time formatting to rfc3339 should be more robust, but it has a few
conditions where it could fail, so catch that too (and only really
do it if required).

The writes to stdout are left as is, it normally is redirected to
journal which is in memory, and thus breaks later than most stuff,
and at that point we probably do not care anymore anyway.

It could make sense to actually return a result here..

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agotools: log rotate: compressing rotated files
Thomas Lamprecht [Mon, 2 Nov 2020 17:31:31 +0000 (18:31 +0100)]
tools: log rotate: compressing rotated files

We renamed the last one always to a file without compression
extension, even if it was .zst previously. So always add the correct
ending to the new last one, if compress was true.

Further, we cannot detect if there'd be a compression required if we
rotated (renamed) it already to the file with .zst included.

So check on rotation itself if it would be a "no .zst" -> ",zst"
transition, and call compress there.

it really should be OK now *knocking wood*

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agotools: log rotate: fix file ending for compressed files
Thomas Lamprecht [Mon, 2 Nov 2020 16:45:02 +0000 (17:45 +0100)]
tools: log rotate: fix file ending for compressed files

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoconfig: support netmask when parsing interfaces file
Dietmar Maurer [Mon, 2 Nov 2020 13:32:35 +0000 (14:32 +0100)]
config: support netmask when parsing interfaces file

3 years agoui: fix verificationjob task description
Dietmar Maurer [Mon, 2 Nov 2020 09:03:36 +0000 (10:03 +0100)]
ui: fix verificationjob task description

3 years agofile logger: allow reopening file
Thomas Lamprecht [Mon, 2 Nov 2020 07:51:24 +0000 (08:51 +0100)]
file logger: allow reopening file

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agopull out /run and /var/log directory constants to buildcfg
Thomas Lamprecht [Mon, 2 Nov 2020 07:50:56 +0000 (08:50 +0100)]
pull out /run and /var/log directory constants to buildcfg

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agonotify: add link to server GUI
Dietmar Maurer [Mon, 2 Nov 2020 08:11:08 +0000 (09:11 +0100)]
notify: add link to server GUI

3 years agogc: remove extra empty lines in email notification template
Dietmar Maurer [Mon, 2 Nov 2020 07:02:51 +0000 (08:02 +0100)]
gc: remove extra empty lines in email notification template

3 years agoui: fix dashboard subscription
Thomas Lamprecht [Mon, 2 Nov 2020 07:08:25 +0000 (08:08 +0100)]
ui: fix dashboard subscription

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agosync: allow sync for non-superusers
Fabian Grünbichler [Fri, 30 Oct 2020 11:36:42 +0000 (12:36 +0100)]
sync: allow sync for non-superusers

by requiring
- Datastore.Backup permission for target datastore
- Remote.Read permission for source remote/datastore
- Datastore.Prune if vanished snapshots should be removed
- Datastore.Modify if another user should own the freshly synced
snapshots

reading a sync job entry only requires knowing about both the source
remote and the target datastore.

note that this does not affect the Authid used to authenticate with the
remote, which of course also needs permissions to access the source
datastore.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
3 years agofix #2864: add owner option to sync
Fabian Grünbichler [Fri, 30 Oct 2020 11:36:41 +0000 (12:36 +0100)]
fix #2864: add owner option to sync

instead of hard-coding 'backup@pam'. this allows a bit more flexibility
(e.g., syncing to a datastore that can directly be used as restore
source) without overly complicating things.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
3 years agomanager: subscription commands s/delete/remove/
Thomas Lamprecht [Sun, 1 Nov 2020 12:19:29 +0000 (13:19 +0100)]
manager: subscription commands s/delete/remove/

no idea why I added it as "delete", for all other such operations we
use the "remove" sub-command...

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoapt: sort packages for update notifcation mail
Thomas Lamprecht [Sat, 31 Oct 2020 21:55:54 +0000 (22:55 +0100)]
apt: sort packages for update notifcation mail

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoadd daily update and maintenance task
Thomas Lamprecht [Sat, 31 Oct 2020 20:27:06 +0000 (21:27 +0100)]
add daily update and maintenance task

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoapi: apt: implement support to send notification email on new updates
Thomas Lamprecht [Sat, 31 Oct 2020 20:09:21 +0000 (21:09 +0100)]
api: apt: implement support to send notification email on new updates

again, base idea copied off PVE, but, we safe the information about
which pending version we send a mail out already in a separate
object, to keep the api return type APTUpdateInfo clean.

This also makes a few things a bit easier, as we can update the
package status without saving/restoring the notify information.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoapi: implement apt pkg cache
Thomas Lamprecht [Sat, 31 Oct 2020 20:02:25 +0000 (21:02 +0100)]
api: implement apt pkg cache

based on the idea of PVE

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoapi: apt: factor out and improve calling apt update
Thomas Lamprecht [Sat, 31 Oct 2020 19:54:53 +0000 (20:54 +0100)]
api: apt: factor out and improve calling apt update

apt changes some of its state/cache also if it errors out, most of
the time, so we actually want to print both, stderr and stdout.

Further, only warn if its exit code is non-zero, for the same
rationale, it may bring updates available even if it errors (e.g.,
because a future pbs-enterprise repo is additionally configured but
not accessible).

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoapi/tools: split out apt helpers from api to own module
Thomas Lamprecht [Sat, 31 Oct 2020 19:40:05 +0000 (20:40 +0100)]
api/tools: split out apt helpers from api to own module

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoapi types: derive Debug for APTUpdateInfo
Thomas Lamprecht [Sat, 31 Oct 2020 20:28:57 +0000 (21:28 +0100)]
api types: derive Debug for APTUpdateInfo

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoworker task: drop debug prints
Thomas Lamprecht [Sat, 31 Oct 2020 18:46:54 +0000 (19:46 +0100)]
worker task: drop debug prints

they are not useful anymore, rather noisy

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agotools: do not unnecessarily prefix module path
Thomas Lamprecht [Sat, 31 Oct 2020 20:30:29 +0000 (21:30 +0100)]
tools: do not unnecessarily prefix module path

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agotrivial: fix typo in comment
Thomas Lamprecht [Sat, 31 Oct 2020 20:29:34 +0000 (21:29 +0100)]
trivial: fix typo in comment

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoui: ACL view: do not save grid state
Thomas Lamprecht [Sat, 31 Oct 2020 10:36:48 +0000 (11:36 +0100)]
ui: ACL view: do not save grid state

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoui: improve ACL view layout
Thomas Lamprecht [Sat, 31 Oct 2020 10:33:31 +0000 (11:33 +0100)]
ui: improve ACL view layout

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoui: bump sync/verify grid stateid
Thomas Lamprecht [Sat, 31 Oct 2020 09:58:42 +0000 (10:58 +0100)]
ui: bump sync/verify grid stateid

so that people get the improved view by default

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoui: improve sync job view layout
Thomas Lamprecht [Sat, 31 Oct 2020 09:54:14 +0000 (10:54 +0100)]
ui: improve sync job view layout

Avoid overuse of flex, that is as bad as having all to fixed widths.

In spirit similar to the previous commit for the verify panel, see
that for some rationale.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoui: improve verify job view layout, show job-id
Thomas Lamprecht [Sat, 31 Oct 2020 09:30:23 +0000 (10:30 +0100)]
ui: improve verify job view layout, show job-id

Avoid overuse of flex, that is as bad as having all to fixed widths.

* Set date-time fields to 150 px as they are fixed width text.
* Duration is maximal 3 units, so it can be made fixed too.
* Schedule is flex with lower and upper limits, this is useful as
  it's a field which can be both, quite short (daily) or long
  (mon..fri *-10..12-1..7 02:00/30:30)
* Status and comment is flex, this way we always get a filled grid

Move status after last verify date and duration field, increases
information density at the left of the grid - reducing need for eye
movement, also, it groups together the "information about last job"
nicer.

Show job-id by default even if they are auto generated when adding
over the gui, as it can help finding the respective job faster when
getting a mail with an error.

Reported-by: Dietmar Maurer <dietmar@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoui: administration: set icons for tabs
Thomas Lamprecht [Sat, 31 Oct 2020 08:11:10 +0000 (09:11 +0100)]
ui: administration: set icons for tabs

orient on PVE, the ones for Updates, ServerStatus, should by
self-explanatory.

Services is in PVE named "System", but reusing that cogs icon makes
similar sense here too, and seems in line with search result of a
"service icons" query.

Syslog is the same as our general log icon, but as we also use this
normally for worker task logs and that is present here too, I
changed the worker task log icon to the alternative list, which
resembles a task view window - so IMO even better than before.

Sync that change also into the always present tasks button at the top
right.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agocleanup: fix wording in GC status emails
Dietmar Maurer [Sat, 31 Oct 2020 06:55:30 +0000 (07:55 +0100)]
cleanup: fix wording in GC status emails

3 years agodocs: client: avoid that repo gets detected as email address
Thomas Lamprecht [Fri, 30 Oct 2020 16:08:08 +0000 (17:08 +0100)]
docs: client: avoid that repo gets detected as email address

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agodocs: fixup bad RST table format
Thomas Lamprecht [Fri, 30 Oct 2020 16:05:49 +0000 (17:05 +0100)]
docs: fixup bad RST table format

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agodocs: add token example to client, and reformat a bit
Thomas Lamprecht [Fri, 30 Oct 2020 16:01:18 +0000 (17:01 +0100)]
docs: add token example to client, and reformat a bit

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agodocs: add API tokens to documentation
Fabian Grünbichler [Fri, 30 Oct 2020 14:18:42 +0000 (15:18 +0100)]
docs: add API tokens to documentation

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
3 years agoapi: replace auth_id with auth-id
Fabian Grünbichler [Fri, 30 Oct 2020 14:18:41 +0000 (15:18 +0100)]
api: replace auth_id with auth-id

in parameters, and fix up the completion for the ACL update parameter.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
3 years agoprivs: add some more comments explaining privileges
Fabian Grünbichler [Fri, 30 Oct 2020 11:36:44 +0000 (12:36 +0100)]
privs: add some more comments explaining privileges

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
3 years agoprivs: remove PRIV_REMOVE_PRUNE
Fabian Grünbichler [Fri, 30 Oct 2020 11:36:43 +0000 (12:36 +0100)]
privs: remove PRIV_REMOVE_PRUNE

it's not used anywhere, and not needed either until the day we might
implement push syncs.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
3 years agoverify jobs: add permissions
Fabian Grünbichler [Fri, 30 Oct 2020 11:36:40 +0000 (12:36 +0100)]
verify jobs: add permissions

equivalent to verifying a whole datastore, except for reading job
(entries), which is accessible to regular Datastore.Audit/Backup users
as well.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
3 years agoverify: introduce & use new Datastore.Verify privilege
Fabian Grünbichler [Fri, 30 Oct 2020 11:36:39 +0000 (12:36 +0100)]
verify: introduce & use new Datastore.Verify privilege

for verifying a whole datastore. Datastore.Backup now allows verifying
only backups owned by the triggering user.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
3 years agoprivs: use Datastore.Modify|Backup to set backup notes
Fabian Grünbichler [Fri, 30 Oct 2020 11:36:38 +0000 (12:36 +0100)]
privs: use Datastore.Modify|Backup to set backup notes

Datastore.Backup is limited to owned groups, as usual.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
3 years agoprivs: allow reading notes with Datastore.Audit
Fabian Grünbichler [Fri, 30 Oct 2020 11:36:37 +0000 (12:36 +0100)]
privs: allow reading notes with Datastore.Audit

they are returned when reading the manifest, which just requires
Datastore.Audit as well. Datastore.Read is for reading backup contents,
not metadata.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
3 years agoui: permission path selector: cbind typeAhead to editable
Thomas Lamprecht [Fri, 30 Oct 2020 15:30:57 +0000 (16:30 +0100)]
ui: permission path selector: cbind typeAhead to editable

ExtJS throws an exception if 'typeAhead' is true but 'editable' is
false.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoupdate d/control
Wolfgang Bumiller [Fri, 30 Oct 2020 15:11:50 +0000 (16:11 +0100)]
update d/control

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
3 years agoimpl From<Authid> for Userid
Wolfgang Bumiller [Fri, 30 Oct 2020 08:13:05 +0000 (09:13 +0100)]
impl From<Authid> for Userid

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
3 years agobump proxmox dependency to 0.7.0 for totp udpates
Wolfgang Bumiller [Fri, 30 Oct 2020 14:18:00 +0000 (15:18 +0100)]
bump proxmox dependency to 0.7.0 for totp udpates

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
3 years agoui: Utils: add product specific task descriptions
Dominik Csapak [Fri, 30 Oct 2020 13:02:58 +0000 (14:02 +0100)]
ui: Utils: add product specific task descriptions

and sort them alphabetically

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
3 years agoserver/rest: accept also = as token separator
Thomas Lamprecht [Fri, 30 Oct 2020 12:34:21 +0000 (13:34 +0100)]
server/rest: accept also = as token separator

Like we do in Proxmox VE

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoserver/rest: user constants for HTTP headers
Thomas Lamprecht [Fri, 30 Oct 2020 12:33:36 +0000 (13:33 +0100)]
server/rest: user constants for HTTP headers

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoapi tokens: add authorization method
Fabian Grünbichler [Fri, 30 Oct 2020 12:10:38 +0000 (13:10 +0100)]
api tokens: add authorization method

and properly decode secret (which is a no-op with the current scheme).

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
3 years agoproxmox-backup-manager: add subscription commands
Thomas Lamprecht [Fri, 30 Oct 2020 11:51:19 +0000 (12:51 +0100)]
proxmox-backup-manager: add subscription commands

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoapi: define subscription module and methods as public
Thomas Lamprecht [Fri, 30 Oct 2020 12:03:51 +0000 (13:03 +0100)]
api: define subscription module and methods as public

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoapi: define subscription key schema and use it
Thomas Lamprecht [Fri, 30 Oct 2020 11:56:35 +0000 (12:56 +0100)]
api: define subscription key schema and use it

nicer to have the correct regex checked in parameter verification
already

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoproxy: fix warnings
Fabian Grünbichler [Fri, 30 Oct 2020 11:49:43 +0000 (12:49 +0100)]
proxy: fix warnings

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
3 years agoproxy: split out code to run garbage collection job
Dietmar Maurer [Fri, 30 Oct 2020 09:54:31 +0000 (10:54 +0100)]
proxy: split out code to run garbage collection job

3 years agocheck_schedule cleanup: use &str instead of String
Dietmar Maurer [Fri, 30 Oct 2020 08:48:35 +0000 (09:48 +0100)]
check_schedule cleanup: use &str instead of String

This way we can avoid many clone() calls.

3 years agoproxy: extract commonly used logic for scheduling into new function
Hannes Laimer [Fri, 30 Oct 2020 08:07:25 +0000 (09:07 +0100)]
proxy: extract commonly used logic for scheduling into new function

Signed-off-by: Hannes Laimer <h.laimer@proxmox.com>
3 years agoproxy: move prune logic into new file
Hannes Laimer [Fri, 30 Oct 2020 08:07:24 +0000 (09:07 +0100)]
proxy: move prune logic into new file

Signed-off-by: Hannes Laimer <h.laimer@proxmox.com>
3 years agoui: user menu: allow changing language while logged in
Thomas Lamprecht [Fri, 30 Oct 2020 08:46:04 +0000 (09:46 +0100)]
ui: user menu: allow changing language while logged in

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agobump version to 0.9.4-2
Thomas Lamprecht [Thu, 29 Oct 2020 19:09:40 +0000 (20:09 +0100)]
bump version to 0.9.4-2

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agod/postinst: followup: grep and sed use different regex escaping ..
Thomas Lamprecht [Thu, 29 Oct 2020 19:25:28 +0000 (20:25 +0100)]
d/postinst: followup: grep and sed use different regex escaping ..

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agod/postinst: make more resilient
Thomas Lamprecht [Thu, 29 Oct 2020 18:58:41 +0000 (19:58 +0100)]
d/postinst: make more resilient

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agobump version to 0.9.3-2 v0.9.4
Thomas Lamprecht [Thu, 29 Oct 2020 16:19:20 +0000 (17:19 +0100)]
bump version to 0.9.3-2

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoui: move user, token and permissions into an access control tab panel
Thomas Lamprecht [Thu, 29 Oct 2020 15:47:18 +0000 (16:47 +0100)]
ui: move user, token and permissions into an access control tab panel

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agod/control: update
Thomas Lamprecht [Thu, 29 Oct 2020 15:18:40 +0000 (16:18 +0100)]
d/control: update

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoui: datastore summary: handle missing snapshot of a types
Thomas Lamprecht [Thu, 29 Oct 2020 14:52:45 +0000 (15:52 +0100)]
ui: datastore summary: handle missing snapshot of a types

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoapi2/access/user: fix return type schema
Wolfgang Bumiller [Thu, 29 Oct 2020 14:20:10 +0000 (15:20 +0100)]
api2/access/user: fix return type schema

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
3 years agoapi2/access/user: drop Option, treat empty Vec as None
Wolfgang Bumiller [Thu, 29 Oct 2020 14:17:53 +0000 (15:17 +0100)]
api2/access/user: drop Option, treat empty Vec as None

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
3 years agofixup hardcoded paths
Wolfgang Bumiller [Thu, 29 Oct 2020 14:15:17 +0000 (15:15 +0100)]
fixup hardcoded paths

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
3 years agogui: add API token ACLs
Fabian Grünbichler [Wed, 28 Oct 2020 10:07:27 +0000 (11:07 +0100)]
gui: add API token ACLs

and the needed API token selector.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
3 years agoacls: allow viewing/editing user's token ACLs
Fabian Grünbichler [Wed, 28 Oct 2020 08:49:25 +0000 (09:49 +0100)]
acls: allow viewing/editing user's token ACLs

even for otherwise unprivileged users.

since effective privileges of an API token are always intersected with
those of their owning user, this does not allow an unprivileged user to
elevate their privileges in practice, but avoids the need to involve a
privileged user to deploy API tokens.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
3 years agogui: add API token UI
Fabian Grünbichler [Thu, 22 Oct 2020 09:40:43 +0000 (11:40 +0200)]
gui: add API token UI

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
3 years agogui: add permissions button to user view
Fabian Grünbichler [Wed, 21 Oct 2020 07:42:56 +0000 (09:42 +0200)]
gui: add permissions button to user view

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
3 years agomanager: add user permissions command
Fabian Grünbichler [Fri, 16 Oct 2020 09:18:02 +0000 (11:18 +0200)]
manager: add user permissions command

useful for debugging complex ACL setups.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
3 years agomanager: add token commands
Fabian Grünbichler [Thu, 15 Oct 2020 12:49:04 +0000 (14:49 +0200)]
manager: add token commands

to generate, list and delete tokens. adding them to ACLs already works
out of the box.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
3 years agotasks: allow unpriv users to read their tokens' tasks
Fabian Grünbichler [Thu, 15 Oct 2020 09:27:47 +0000 (11:27 +0200)]
tasks: allow unpriv users to read their tokens' tasks

and tighten down the return schema while we're at it.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
3 years agoowner checks: handle backups owned by API tokens
Fabian Grünbichler [Thu, 8 Oct 2020 13:32:41 +0000 (15:32 +0200)]
owner checks: handle backups owned by API tokens

a user should be allowed to read/list/overwrite backups owned by their
own tokens, but a token should not be able to read/list/overwrite
backups owned by their owning user.

when changing ownership of a backup group, a user should be able to
transfer ownership to/from their own tokens if the backup is owned by
them (or one of their tokens).

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
3 years agoclient/remote: allow using ApiToken + secret
Fabian Grünbichler [Thu, 8 Oct 2020 13:19:39 +0000 (15:19 +0200)]
client/remote: allow using ApiToken + secret

in place of user + password.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
3 years agoapi: add permissions endpoint
Fabian Grünbichler [Thu, 8 Oct 2020 08:34:07 +0000 (10:34 +0200)]
api: add permissions endpoint

and adapt privilege calculation to return propagate flag

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
3 years agoapi: allow listing users + tokens
Fabian Grünbichler [Wed, 7 Oct 2020 12:38:12 +0000 (14:38 +0200)]
api: allow listing users + tokens

since it's not possible to extend existing structs, UserWithTokens
duplicates most of user::User.. to avoid duplicating user::ApiToken as
well, this returns full API token IDs, not just the token name part.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
3 years agoapi: add API token endpoints
Fabian Grünbichler [Wed, 7 Oct 2020 11:12:37 +0000 (13:12 +0200)]
api: add API token endpoints

beneath the user endpoint.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
3 years agoREST: extract and handle API tokens
Fabian Grünbichler [Wed, 7 Oct 2020 11:10:37 +0000 (13:10 +0200)]
REST: extract and handle API tokens

and refactor handling of headers in the REST server while we're at it.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
3 years agoreplace Userid with Authid
Fabian Grünbichler [Fri, 23 Oct 2020 11:33:21 +0000 (13:33 +0200)]
replace Userid with Authid

in most generic places. this is accompanied by a change in
RpcEnvironment to purposefully break existing call sites.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
3 years agobump proxmox dependency to 0.6.0 for api tokens and tfa
Wolfgang Bumiller [Thu, 29 Oct 2020 14:10:23 +0000 (15:10 +0100)]
bump proxmox dependency to 0.6.0 for api tokens and tfa

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
3 years agoconfig: add token.shadow file
Fabian Grünbichler [Wed, 7 Oct 2020 11:09:13 +0000 (13:09 +0200)]
config: add token.shadow file

containing pairs of token ids and hashed secret values.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
3 years agoapi: add Authid as wrapper around Userid
Fabian Grünbichler [Fri, 23 Oct 2020 11:18:09 +0000 (13:18 +0200)]
api: add Authid as wrapper around Userid

with an optional Tokenname, appended with '!' as delimiter in the string
representation like for PVE.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
3 years agobump version to 0.9.3-1 v0.9.3
Thomas Lamprecht [Thu, 29 Oct 2020 13:58:21 +0000 (14:58 +0100)]
bump version to 0.9.3-1

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoGC: improve task logs
Thomas Lamprecht [Thu, 29 Oct 2020 13:45:32 +0000 (14:45 +0100)]
GC: improve task logs

Make it more clear that removed files are chunks (not indexes or
something like that, user cannot know that we do not touch them here)

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoGC: fix logging leftover bad chunks
Thomas Lamprecht [Thu, 29 Oct 2020 13:40:26 +0000 (14:40 +0100)]
GC: fix logging leftover bad chunks

fixes commit b4fb2623355259528587a0ab87e3970e6bb73b40, which copied
over the "Removed bad files:" block, but only adapted the log text,
not the actual variable.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoui: datastore: fix sync/verify job removal prompt
Thomas Lamprecht [Thu, 29 Oct 2020 13:34:31 +0000 (14:34 +0100)]
ui: datastore: fix sync/verify job removal prompt

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoui: drop id field from verify/sync add window
Thomas Lamprecht [Thu, 29 Oct 2020 13:22:39 +0000 (14:22 +0100)]
ui: drop id field from verify/sync add window

the config is shared between multiple datastores with the ID as, well
the unique ID, but we only show those of a single datastore.

So if a user adds a new one with a fixed ID "12345" but a job with
that ID exists already on another store, they get a error about
duplicate IDs, but cannot relate as that duplicate job is not visible
(filtered away)

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoserver/worker_task: simplify task log writing
Dominik Csapak [Thu, 29 Oct 2020 09:50:13 +0000 (10:50 +0100)]
server/worker_task: simplify task log writing

instead of prerotating 1000 tasks
(which resulted in 2 writes each time an active worker was finished)
simply append finished tasks to the archive (which will be rotated)

page cache should be good enough so that we can get the task logs fast

since existing installations might have an 'index' file, we
still have to read tasks from there, but only if it exists

this simplifies the TaskListInfoIterator a good amount

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
3 years agoworker task: remove debug print, faster modulo
Thomas Lamprecht [Thu, 29 Oct 2020 11:35:33 +0000 (12:35 +0100)]
worker task: remove debug print, faster modulo

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoapi: datstore status: introduce proper structs and restore compatibility
Dominik Csapak [Thu, 29 Oct 2020 10:51:26 +0000 (11:51 +0100)]
api: datstore status: introduce proper structs and restore compatibility

by moving the properties of the storage status out again to the top
level object

also introduce proper structs for the types used, to get type-safety
and better documentation for the api calls

this changes the backup counts from an array of [groups,snapshots] to
an object/struct with { groups, snapshots } and include 'other' types
(though we do not have any at this moment)

this way it is better documented

this also adapts the ui code to cope with the api changes

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
3 years agosend sync job status emails
Dietmar Maurer [Thu, 29 Oct 2020 11:07:46 +0000 (12:07 +0100)]
send sync job status emails

3 years agoschedule_datastore_sync_jobs: remove unneccessary clone()
Dietmar Maurer [Thu, 29 Oct 2020 10:27:35 +0000 (11:27 +0100)]
schedule_datastore_sync_jobs: remove unneccessary clone()

3 years agosend_job_status_mail: corectly escape html characters
Dietmar Maurer [Thu, 29 Oct 2020 10:22:08 +0000 (11:22 +0100)]
send_job_status_mail: corectly escape html characters

3 years agogarbage_collection: log deduplication factor
Dietmar Maurer [Thu, 29 Oct 2020 09:37:43 +0000 (10:37 +0100)]
garbage_collection: log deduplication factor

3 years agoui: datastore: use pointer cursor for edit notes
Thomas Lamprecht [Thu, 29 Oct 2020 09:45:37 +0000 (10:45 +0100)]
ui: datastore: use pointer cursor for edit notes

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agogarbage_collection: log bad chunks (still_bad value)
Dietmar Maurer [Thu, 29 Oct 2020 09:24:31 +0000 (10:24 +0100)]
garbage_collection: log bad chunks (still_bad value)

3 years agofix #2998: encode mtime as i64 instead of u64
Dominik Csapak [Thu, 22 Oct 2020 07:05:37 +0000 (09:05 +0200)]
fix #2998: encode mtime as i64 instead of u64

saves files mtime as i64 instead of u64 which enables backup of
files with negative mtime

the catalog_decode_i64 is compatible to encoded u64 values (if < 2^63)
but not reverse, so all "old" catalogs can be read with the new
decoder, but catalogs that contain negative mtimes will decode wrongly
on older clients

also remove the arbitrary maximum value of 2^63 - 1 for
encode_u64 (we just use up to 10 bytes now) and correctly
decode them and update the comments accordingly

adds also test for i64 encode/decode and for compatibility between
u64 encode and i64 decode

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>