]> git.proxmox.com Git - proxmox-backup.git/log
proxmox-backup.git
3 years agoui: datastore: change GC/Prune title and buttons a bit
Thomas Lamprecht [Tue, 27 Oct 2020 16:42:29 +0000 (17:42 +0100)]
ui: datastore: change GC/Prune title and buttons a bit

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoui: datastore: add confirmation message to verify all
Thomas Lamprecht [Tue, 27 Oct 2020 16:41:55 +0000 (17:41 +0100)]
ui: datastore: add confirmation message to verify all

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoui: DataStorePanel: save active tab statefully
Dominik Csapak [Tue, 27 Oct 2020 15:20:11 +0000 (16:20 +0100)]
ui: DataStorePanel: save active tab statefully

so that the last selected tab for datastores will get selected
the next time any datastore is selected, even across browser
reloads

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
3 years agoui: MainView/NavigationTree: improve tree selection handling
Dominik Csapak [Tue, 27 Oct 2020 15:20:10 +0000 (16:20 +0100)]
ui: MainView/NavigationTree: improve tree selection handling

this fixes some bugs related to selection handling in the treelist:
* datastores were not selected after a reload
* reloading when in a tabpanel on any tab but the first, would
  not select a treenode
* changing between datastores on any tab but the first would
  not select the same tab on the new datastore

fixed those by mostly rewriting the changePath handling for
datastores and tabpanels in general

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
3 years agoui: NavigationTree: add 'Add Datastore' button below datastore list
Dominik Csapak [Tue, 27 Oct 2020 15:20:09 +0000 (16:20 +0100)]
ui: NavigationTree: add 'Add Datastore' button below datastore list

and make 'Datastore' unclickable

since we have all options and information on the relevant datastore panels,
we do not need a datastore config anymore (besides the creation,
which we add here)

this also fixes the sorted insertion and removal of new/old datastores

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
3 years agoui: move sync/verify jobs to the datastores
Dominik Csapak [Tue, 27 Oct 2020 15:20:08 +0000 (16:20 +0100)]
ui: move sync/verify jobs to the datastores

add the datastore as parameter for the store, remove
the datastore selector for the edit windows and give the datastore
to it instead

also remove the autostart from the rstore, since we only want to start
it when we change to the relevant tab

and add icons for all other datastore tabs

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
3 years agoui: add DataStoreSummary and move Statistics into it
Dominik Csapak [Tue, 27 Oct 2020 15:20:07 +0000 (16:20 +0100)]
ui: add DataStoreSummary and move Statistics into it

this adds a 'Summary' panel to the datastores, similar to what we have
for PVE's nodes/guests/storages

contains an info panel with useful information, a comment field, and
the charts from the statistics panel (which can be deleted since it is
not necessary any more)

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
3 years agoui: add DataStorePruneAndGC panel and add it to datastore panel
Dominik Csapak [Tue, 27 Oct 2020 15:20:06 +0000 (16:20 +0100)]
ui: add DataStorePruneAndGC panel and add it to datastore panel

a simple objectgrid to display datastore gc/prune options
needs the prune inputpanel to be refactored in its own class

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
3 years agoui: DataStoreContent: add 'Verify All' button
Dominik Csapak [Tue, 27 Oct 2020 15:20:05 +0000 (16:20 +0100)]
ui: DataStoreContent: add 'Verify All' button

to verify the complete datastore

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
3 years agoapi/{verify, syncjobs}: add optional datastore parameter
Dominik Csapak [Tue, 27 Oct 2020 15:20:04 +0000 (16:20 +0100)]
api/{verify, syncjobs}: add optional datastore parameter

to limit the lists to the given datastores

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
3 years agoadmin/datastore: add more info to status call
Dominik Csapak [Fri, 23 Oct 2020 14:32:33 +0000 (16:32 +0200)]
admin/datastore: add more info to status call

add also the snapshot counts as well as the status of the last garbage
collection

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
3 years agobackup/datastore: save garbage collection status to disk
Dominik Csapak [Fri, 23 Oct 2020 14:32:32 +0000 (16:32 +0200)]
backup/datastore: save garbage collection status to disk

and load it again when opening it

this way we can persist the status of the last garbage collect across
daemon reloads and reboots

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
3 years agobackup/datastore: count still bad chunks for the status
Dominik Csapak [Fri, 23 Oct 2020 14:32:31 +0000 (16:32 +0200)]
backup/datastore: count still bad chunks for the status

we want to show the user that there are still bad chunks after a garbage
collection

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
3 years agoapt auth: add newline to the end
Thomas Lamprecht [Tue, 27 Oct 2020 12:38:12 +0000 (13:38 +0100)]
apt auth: add newline to the end

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agohack: workaround unused code warning until proxmox-api-macro bump
Thomas Lamprecht [Tue, 27 Oct 2020 16:41:20 +0000 (17:41 +0100)]
hack: workaround unused code warning until proxmox-api-macro bump

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoui: allow one to delete the description
Thomas Lamprecht [Tue, 27 Oct 2020 11:27:52 +0000 (12:27 +0100)]
ui: allow one to delete the description

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoui: code cleanup
Thomas Lamprecht [Tue, 27 Oct 2020 11:27:38 +0000 (12:27 +0100)]
ui: code cleanup

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agotools: get_hardware_address: better error handling
Thomas Lamprecht [Tue, 27 Oct 2020 11:26:53 +0000 (12:26 +0100)]
tools: get_hardware_address: better error handling

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoimplement subscription handling and api
Thomas Lamprecht [Tue, 27 Oct 2020 11:25:59 +0000 (12:25 +0100)]
implement subscription handling and api

mostly modelled after PVE

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agotools: http: add simple general post method
Thomas Lamprecht [Tue, 27 Oct 2020 08:52:45 +0000 (09:52 +0100)]
tools: http: add simple general post method

This is intended for when the server needs to do requests on
arbitrary, non PBS, external HTTP resources.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoapi: disks: cleanup use statement
Thomas Lamprecht [Tue, 27 Oct 2020 08:55:19 +0000 (09:55 +0100)]
api: disks: cleanup use statement

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agointroduction: fix title formatting
Dylan Whyte [Tue, 27 Oct 2020 11:07:53 +0000 (12:07 +0100)]
introduction: fix title formatting

fix title formatting to remove warning from build

Signed-off-by: Dylan Whyte <d.whyte@proxmox.com>
3 years agoget_hardware_address: must be uppercased
Thomas Lamprecht [Mon, 26 Oct 2020 19:18:26 +0000 (20:18 +0100)]
get_hardware_address: must be uppercased

we're a bit strict here what we accept, rather than changing that
lets do it like PVE/PMG and uppercase.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoapi: add world accessible ping dummy endpoint
Thomas Lamprecht [Fri, 2 Oct 2020 11:12:18 +0000 (13:12 +0200)]
api: add world accessible ping dummy endpoint

This is indented to be used for the PVE storage library, replacing
the missuse of the much more expensive status API call.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoapt: improve error messages
Fabian Grünbichler [Thu, 22 Oct 2020 15:13:26 +0000 (17:13 +0200)]
apt: improve error messages

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
3 years agoapt: add /changelog API call similar to PVE
Stefan Reiter [Wed, 21 Oct 2020 09:41:16 +0000 (11:41 +0200)]
apt: add /changelog API call similar to PVE

For proxmox packages it works the same way as PVE, by retrieving the
changelog URL and issuing a HTTP GET to it, forwarding the output to the
client. As this is only supposed to be a workaround removed in the
future, a simple block_on is used to avoid async.

For debian packages we can simply call 'apt-get changelog' and forward
it's output.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
3 years agofix #2934: list to-be-installed packages in updates
Stefan Reiter [Wed, 21 Oct 2020 09:41:15 +0000 (11:41 +0200)]
fix #2934: list to-be-installed packages in updates

As always, libapt is mocking us with complexity, but we can get the
approximate result we want by retrieving dependencies of all
to-be-updated packages and then seeing if they are missing.

If they are, we assume they will be installed.

For this, query_detailed_info is extended to allow reading details for
non-installed packages, and this is also exposed in
list_installed_apt_packages via 'all_versions_for'. This is necessary so
we can retrieve changelogs for such packages.

Note that we cannot retrieve all that information all the time, as
querying details for packages that aren't installed takes a rather long
time.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
3 years agoapt: refactor package detail reading into function
Stefan Reiter [Wed, 21 Oct 2020 09:41:14 +0000 (11:41 +0200)]
apt: refactor package detail reading into function

No functional change intended.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
3 years agoapt: use 'apt-get changelog --print-uris' in get_changelog_url
Stefan Reiter [Wed, 21 Oct 2020 09:41:12 +0000 (11:41 +0200)]
apt: use 'apt-get changelog --print-uris' in get_changelog_url

Avoids custom hardcoded logic, but can only be used for debian packages
as of now. Adds a FIXME to switch over to use --print-uris only once our
package repos support that changelog format.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
3 years agoapt: allow filter to select different package version
Stefan Reiter [Wed, 21 Oct 2020 09:41:10 +0000 (11:41 +0200)]
apt: allow filter to select different package version

To get package details for a specific version instead of only the
candidate.

Also cleanup filter function with extra struct instead of unnamed &str
parameters.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
3 years agoupid: use systemd escape to decode/encode the worker_id
Dietmar Maurer [Thu, 22 Oct 2020 06:24:37 +0000 (08:24 +0200)]
upid: use systemd escape to decode/encode the worker_id

This way we can store values containing "/" and ":".

3 years agoadd tools::http for generic HTTP GET and move HttpsConnector there
Stefan Reiter [Wed, 21 Oct 2020 09:41:11 +0000 (11:41 +0200)]
add tools::http for generic HTTP GET and move HttpsConnector there

...to avoid having the tools:: module depend on api2.

The get_string function is based directly on hyper and thus relatively
simple, not supporting redirects for example.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
3 years agoui: verify config: eslint fix
Thomas Lamprecht [Wed, 21 Oct 2020 13:53:54 +0000 (15:53 +0200)]
ui: verify config: eslint fix

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agotools/zip: fix doc tests
Dominik Csapak [Wed, 21 Oct 2020 12:14:22 +0000 (14:14 +0200)]
tools/zip: fix doc tests

the doc code was not compiling and blocking cargo test

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
3 years agopostinst: correct invalid old datastore configs
Hannes Laimer [Tue, 20 Oct 2020 09:10:12 +0000 (11:10 +0200)]
postinst: correct invalid old datastore configs

Signed-off-by: Hannes Laimer <h.laimer@proxmox.com>
3 years agoapi proxy: remove old verification scheduling
Hannes Laimer [Tue, 20 Oct 2020 09:10:11 +0000 (11:10 +0200)]
api proxy: remove old verification scheduling

Signed-off-by: Hannes Laimer <h.laimer@proxmox.com>
3 years agoui: add task descriptions for the different types of verification(job, snapshot,...
Hannes Laimer [Tue, 20 Oct 2020 09:10:10 +0000 (11:10 +0200)]
ui: add task descriptions for the different types of verification(job, snapshot, group, ds)

Signed-off-by: Hannes Laimer <h.laimer@proxmox.com>
3 years agoui: add verification job edit window
Hannes Laimer [Tue, 20 Oct 2020 09:10:09 +0000 (11:10 +0200)]
ui: add verification job edit window

Signed-off-by: Hannes Laimer <h.laimer@proxmox.com>
3 years agoui: add verification job view
Hannes Laimer [Tue, 20 Oct 2020 09:10:08 +0000 (11:10 +0200)]
ui: add verification job view

Signed-off-by: Hannes Laimer <h.laimer@proxmox.com>
3 years agoset a different worker_type based on what is going to be verified(snapshot, group...
Hannes Laimer [Tue, 20 Oct 2020 09:10:07 +0000 (11:10 +0200)]
set a different worker_type based on what is going to be verified(snapshot, group, ds)

Signed-off-by: Hannes Laimer <h.laimer@proxmox.com>
3 years agoproxy: add scheduling for verification jobs
Hannes Laimer [Tue, 20 Oct 2020 09:10:06 +0000 (11:10 +0200)]
proxy: add scheduling for verification jobs

Signed-off-by: Hannes Laimer <h.laimer@proxmox.com>
3 years agoapi2: add verification admin endpoint and do_verification_job function
Hannes Laimer [Tue, 20 Oct 2020 09:10:05 +0000 (11:10 +0200)]
api2: add verification admin endpoint and do_verification_job function

Signed-off-by: Hannes Laimer <h.laimer@proxmox.com>
3 years agoapi2: add verification job config endpoint
Hannes Laimer [Tue, 20 Oct 2020 09:10:04 +0000 (11:10 +0200)]
api2: add verification job config endpoint

Signed-off-by: Hannes Laimer <h.laimer@proxmox.com>
3 years agorename VERIFY_SCHEDULE_SCHEMA to VERIFICATION_SCHEDULE_SCHEMA
Hannes Laimer [Tue, 20 Oct 2020 09:10:03 +0000 (11:10 +0200)]
rename VERIFY_SCHEDULE_SCHEMA to VERIFICATION_SCHEDULE_SCHEMA

Signed-off-by: Hannes Laimer <h.laimer@proxmox.com>
3 years agoadd test for escape_unit
Dietmar Maurer [Wed, 21 Oct 2020 09:30:49 +0000 (11:30 +0200)]
add test for escape_unit

3 years agosystemd::escape_unit - allow '.' and '_'
Dietmar Maurer [Wed, 21 Oct 2020 08:36:25 +0000 (10:36 +0200)]
systemd::escape_unit - allow '.' and '_'

3 years agopass params by ref to recurse_files
Wolfgang Bumiller [Wed, 21 Oct 2020 08:47:41 +0000 (10:47 +0200)]
pass params by ref to recurse_files

gets rid of the return value and moving around of the zip
and decoder data
avoids cloning the path prefix on every recursion

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
3 years agowhitespace fixup
Wolfgang Bumiller [Wed, 21 Oct 2020 08:45:44 +0000 (10:45 +0200)]
whitespace fixup

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
3 years agoapi2/admin/datastore/pxar_file_download: download directory as zip
Dominik Csapak [Wed, 21 Oct 2020 07:29:08 +0000 (09:29 +0200)]
api2/admin/datastore/pxar_file_download: download directory as zip

by using the new ZipEncoder and recursively add files to it
the zip only contains directories, normal files and hardlinks (by simply
copying the content), no symlinks, etc.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
3 years agotools: add AsyncChannelWriter
Dominik Csapak [Wed, 21 Oct 2020 07:29:07 +0000 (09:29 +0200)]
tools: add AsyncChannelWriter

similar to StdChannelWriter, but implements AsyncWrite and sends
to a tokio::sync::mpsc::Sender

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
3 years agotools: add zip module
Dominik Csapak [Wed, 21 Oct 2020 07:29:06 +0000 (09:29 +0200)]
tools: add zip module

This modules contains the 'ZipEncoder' struct, which wraps an async writer,
to create a ZIP archive on the fly

To create a ZIP file, have a target that implements AsyncWrite,
give it to ZipEncoder::new, add entries via 'add_entry' and
at the end, call 'finish'

for now, this does not implement compression (uses ZIPs STORE mode), and
does not support empty directories or hardlinks (or any other special
files)

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
3 years agofix for prevoius patch: we want to copy all valid tickets
Dietmar Maurer [Wed, 21 Oct 2020 06:40:04 +0000 (08:40 +0200)]
fix for prevoius patch: we want to copy all valid tickets

3 years agofix #3038: check user before renewing ticket
Dylan Whyte [Tue, 20 Oct 2020 09:29:16 +0000 (11:29 +0200)]
fix #3038: check user before renewing ticket

Fixes a bug in which the userid of the ticket cache is updated,
when a user connects, but the ticket itself is not.
This means a newly connected user has a previously connected
user's ticket and thus, cannot do anything, as the client will
attempt to use the invalid ticket.

e.g. if john@pbs connected to the server first, followed by
mike@pbs, the following would be stored in the ticket cache.

{
  "localhost": {
    "mike@pbs": {
      "ticket": "PBS:john@pbs:AAAA",
      "timestamp": 1601039326,
      "token": "BBBB"
    }
  }
}

Signed-off-by: Dylan Whyte <d.whyte@proxmox.com>
3 years agobackup: avoid Transport endpoint is not connected error
Dietmar Maurer [Tue, 20 Oct 2020 12:18:14 +0000 (14:18 +0200)]
backup: avoid Transport endpoint is not connected error

We simply supress the error message if the finish flag is set.

3 years agopaperkey: use svg as image format to provide better scalability
Dietmar Maurer [Tue, 20 Oct 2020 10:04:51 +0000 (12:04 +0200)]
paperkey: use svg as image format to provide better scalability

3 years agoproxmox-backup-client: use HumanByte to render snapshot size
Dietmar Maurer [Tue, 20 Oct 2020 09:43:48 +0000 (11:43 +0200)]
proxmox-backup-client: use HumanByte to render snapshot size

3 years agologrotate: drop useless comment
Thomas Lamprecht [Tue, 20 Oct 2020 09:11:36 +0000 (11:11 +0200)]
logrotate: drop useless comment

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agolog rotate: move basic rotation logic into module for reuse
Thomas Lamprecht [Tue, 20 Oct 2020 08:32:15 +0000 (10:32 +0200)]
log rotate: move basic rotation logic into module for reuse

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agolog rotate: do NOT compress first rotation
Thomas Lamprecht [Tue, 20 Oct 2020 08:26:28 +0000 (10:26 +0200)]
log rotate: do NOT compress first rotation

The first rotation is normally the one still opened by one or more
processes for writing, so it must NOT be replaced, removed, ..., as
this then makes the remaining logging, until those processes are
noticed that they should reopen the logfile due to rotation, goes
into nirvana, which is far from ideal for a log.

Only rotating (renaming) is OK for this active file, as this does not
invalidates the file and keeps open FDs intact.

So start compressing with the second rotation, which should be clear
to use, as all writers must have been told to reopen the log during
the last rotation, reopen is a fast operation and normally triggered
at least day ago (at least if one did not dropped the state file
manually), so we are fine to archive that one for real.
If we plan to allow faster rotation the whole rotation+reopen should
be locked, so that we can guarantee that all writers switched over,
but this is unlikely to be needed.

Again, this is was logrotate sanely does by default since forever.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agolog rotate: factor out compression in private function
Thomas Lamprecht [Tue, 20 Oct 2020 08:24:46 +0000 (10:24 +0200)]
log rotate: factor out compression in private function

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agolog rotate: do NOT overwrite file with possible writers
Thomas Lamprecht [Tue, 20 Oct 2020 08:05:51 +0000 (10:05 +0200)]
log rotate: do NOT overwrite file with possible writers

this is not the job of logrotate, and the real 20+ years battle
tested log rotate binary does not do so either as it's actually
pretty dangerous.

If we "replace" the file we break any logger which already opened a
new one here, e.g., a dameon starting up, and thus that writer would
log to nirvana.

It's the job of a logger to create a file if not existing, it makes
no sense to do it here.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agofix #2988: allow verification after finishing a snapshot
Stefan Reiter [Tue, 20 Oct 2020 08:08:25 +0000 (10:08 +0200)]
fix #2988: allow verification after finishing a snapshot

To cater to the paranoid, a new datastore-wide setting "verify-new" is
introduced. When set, a verify job will be spawned right after a new
backup is added to the store (only verifying the added snapshot).

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
3 years agoadd verify_backup_dir_with_lock for callers already holding locks
Stefan Reiter [Tue, 20 Oct 2020 08:08:24 +0000 (10:08 +0200)]
add verify_backup_dir_with_lock for callers already holding locks

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
3 years agounbreak build
Fabian Grünbichler [Tue, 20 Oct 2020 07:07:32 +0000 (09:07 +0200)]
unbreak build

and silence warning.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
3 years agodatastore: cleanup open and load config only once
Stefan Reiter [Mon, 19 Oct 2020 14:45:22 +0000 (16:45 +0200)]
datastore: cleanup open and load config only once

Force consumers to use the lookup_datastore method instead of
potentially opening a datastore twice, and pass the config we have
already loaded into open_with_path, removing the need for open(1).

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
3 years agofix missing block_in_place for remove_backup
Stefan Reiter [Mon, 19 Oct 2020 14:45:21 +0000 (16:45 +0200)]
fix missing block_in_place for remove_backup

Commit 9070d11f4c26 introduced this change for other call sites,
assuming it is correct, this one was missed.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
3 years agocode/fmt cleanups
Thomas Lamprecht [Mon, 19 Oct 2020 13:11:51 +0000 (15:11 +0200)]
code/fmt cleanups

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agocompletion: fix ACL path completion
Fabian Grünbichler [Mon, 19 Oct 2020 07:54:29 +0000 (09:54 +0200)]
completion: fix ACL path completion

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
3 years agoREST: rename token to csrf_token
Fabian Grünbichler [Mon, 19 Oct 2020 07:39:07 +0000 (09:39 +0200)]
REST: rename token to csrf_token

for easier differentiation with (future) api_token

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
3 years agoset reasonable TCP keepalive timeout
Dietmar Maurer [Mon, 19 Oct 2020 11:59:33 +0000 (13:59 +0200)]
set reasonable TCP keepalive timeout

3 years agofix typos
Fabian Grünbichler [Mon, 19 Oct 2020 07:39:06 +0000 (09:39 +0200)]
fix typos

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
3 years agofix indentation
Fabian Grünbichler [Mon, 19 Oct 2020 07:39:05 +0000 (09:39 +0200)]
fix indentation

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
3 years agod/changelog: fix typos
Fabian Grünbichler [Mon, 19 Oct 2020 11:38:57 +0000 (13:38 +0200)]
d/changelog: fix typos

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
3 years agoupdate d/control
Fabian Grünbichler [Mon, 19 Oct 2020 11:38:17 +0000 (13:38 +0200)]
update d/control

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
3 years agofixup worker task: add time prefix again
Thomas Lamprecht [Mon, 19 Oct 2020 11:22:37 +0000 (13:22 +0200)]
fixup worker task: add time prefix again

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agobump proxmox dependency to 0.5.0 for nix 0.19
Wolfgang Bumiller [Mon, 19 Oct 2020 10:35:03 +0000 (12:35 +0200)]
bump proxmox dependency to 0.5.0 for nix 0.19

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
3 years agobuild: bump nix dependency
Fabian Grünbichler [Mon, 19 Oct 2020 10:12:33 +0000 (12:12 +0200)]
build: bump nix dependency

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
3 years agofile logger: add option to make the backup user the log file owner
Thomas Lamprecht [Mon, 19 Oct 2020 08:35:54 +0000 (10:35 +0200)]
file logger: add option to make the backup user the log file owner

and use that in ApiConfig to avoid that it is owned by root if the
proxmox-backup-api process creates it first.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agohttp_client: set connect timeout to 10 seconds
Dietmar Maurer [Mon, 19 Oct 2020 07:36:01 +0000 (09:36 +0200)]
http_client: set connect timeout to 10 seconds

3 years agocargo: bump dependency of proxmox crate
Thomas Lamprecht [Fri, 16 Oct 2020 10:18:46 +0000 (12:18 +0200)]
cargo: bump dependency of proxmox crate

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoapi: access: log to separate file, reduce syslog to errors
Thomas Lamprecht [Fri, 16 Oct 2020 09:06:48 +0000 (11:06 +0200)]
api: access: log to separate file, reduce syslog to errors

for now log auth errors also to the syslog, on a protected (LAN
and/or firewalled) setup this should normally happen due to
missconfiguration, not tries to break in.

This reduces syslog noise *a lot*. A current full journal output from
the current boot here has 72066 lines, of which 71444 (>99% !!) are
"successful auth for user ..." messages

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoserver/rest: also log user agent
Thomas Lamprecht [Fri, 16 Oct 2020 09:06:47 +0000 (11:06 +0200)]
server/rest: also log user agent

allows easily to see if a request is from a browser or a proxmox-backup-client
CLI

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoserver/rest: implement request access log
Thomas Lamprecht [Fri, 16 Oct 2020 09:06:46 +0000 (11:06 +0200)]
server/rest: implement request access log

reuse the FileLogger module in append mode.
As it implements write, which is not thread safe (mutable self) and
we use it in a async context we need to serialize access using a
mutex.

Try to use the same format we do in pveproxy, namely the one which is
also used in apache or nginx by default.

Use the response extensions to pass up the userid, if we extract it
from a ticket.

The privileged and unprivileged dameons log both to the same file, to
have a unified view, and avoiding the need to handle more log files.
We avoid extra intra-process locking by reusing the fact that a write
smaller than PIPE_BUF (4k on linux) is atomic for files opened with
the 'O_APPEND' flag. For now the logged request path is not yet
guaranteed to be smaller than that, this will be improved in a future
patch.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agotools file logger: fix example and comments
Thomas Lamprecht [Fri, 16 Oct 2020 09:16:29 +0000 (11:16 +0200)]
tools file logger: fix example and comments

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agotools: file logger: use option struct to control behavior
Thomas Lamprecht [Thu, 15 Oct 2020 15:49:18 +0000 (17:49 +0200)]
tools: file logger: use option struct to control behavior

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoserver: rest: also log the query part of URL
Thomas Lamprecht [Thu, 15 Oct 2020 15:49:17 +0000 (17:49 +0200)]
server: rest: also log the query part of URL

As it is part of the request and we do so in our other products

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoserver: rest: implement max URI path and query length request limits
Thomas Lamprecht [Thu, 15 Oct 2020 15:49:16 +0000 (17:49 +0200)]
server: rest: implement max URI path and query length request limits

Add a generous limit now and return the correct error (414 URI Too
Long). Otherwise we could to pretty larger GET requests, 64 KiB and
possible bigger (at 64 KiB my simple curl test failed due to
shell/curl limitations).

For now allow a 3072 characters as combined length of URI path and
query.

This is conform with the HTTP/1.1 RFCs (e.g., RFC 7231, 6.5.12 and
RFC 2616, 3.2.1) which do not specify any limits, upper or lower, but
require that all server accessible resources mus be reachable without
getting 414, which is normally fulfilled as we have various length
limits for stuff which could be in an URI, in place, e.g.:
 * user id: max. 64 chars
 * datastore: max. 32 chars

The only known problematic API endpoint is the catalog one, used in
the GUI's pxar file browser:
GET /api2/json/admin/datastore/<id>/catalog?..&filepath=<path>

The <path> is the encoded archive path, and can be arbitrary long.

But, this is a flawed design, as even without this new limit one can
easily generate archives which cannot be browsed anymore, as hyper
only accepts requests with max. 64 KiB in the URI.
So rather, we should move that to a GET-as-POST call, which has no
such limitations (and would not need to base32 encode the path).

Note: This change was inspired by adding a request access log, which
profits from such limits as we can then rely on certain atomicity
guarantees when writing requests to the log.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoserver/rest: forward real client IP on proxied request
Thomas Lamprecht [Thu, 15 Oct 2020 15:43:42 +0000 (17:43 +0200)]
server/rest: forward real client IP on proxied request

needs new proxmox dependency to get the RpcEnvironment changes,
adding client_ip getter and setter.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agorustdoc: overhaul backup rustdoc and add locking table
Stefan Reiter [Thu, 15 Oct 2020 10:49:16 +0000 (12:49 +0200)]
rustdoc: overhaul backup rustdoc and add locking table

Rewrite most of the documentation to be more readable and correct
(according to the current implementations).

Add a table visualizing all different locks used to synchronize
concurrent operations.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
3 years agorustdoc: add crate level doc
Stefan Reiter [Thu, 15 Oct 2020 10:49:15 +0000 (12:49 +0200)]
rustdoc: add crate level doc

Contains a link to the 'backup' module's doc, as that explains a lot
about the inner workings of PBS and probably marks a good entry point
for new readers.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
3 years agodatastore: add manifest locking
Stefan Reiter [Fri, 16 Oct 2020 07:31:12 +0000 (09:31 +0200)]
datastore: add manifest locking

Avoid races when updating manifest data by flocking a lock file.
update_manifest is used to ensure updates always happen with the lock
held.

Snapshot deletion also acquires the lock, so it cannot interfere with an
outstanding manifest write.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
3 years agomark_used_chunks: simply ignore vanished files
Dietmar Maurer [Fri, 16 Oct 2020 06:01:38 +0000 (08:01 +0200)]
mark_used_chunks: simply ignore vanished files

In case a prune operation removed a file in the meantime.

3 years agoserver: rest: refactor code to avoid multiple log_response calls
Thomas Lamprecht [Thu, 15 Oct 2020 07:03:54 +0000 (09:03 +0200)]
server: rest: refactor code to avoid multiple log_response calls

The 'Ok::<_, Self::Error>(res)' type annotation was from a time where
we could not use async, and had a combinator here which needed
explicity type information. We switched over to async in commit
91e4587343c155cd3aa9274bd2c736dcc1ccf977 and, as the type annotation
is already included in the Future type, we can safely drop it.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agocode cleanups
Thomas Lamprecht [Wed, 14 Oct 2020 17:02:03 +0000 (19:02 +0200)]
code cleanups

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agopxar: anchor pxarexcludes starting with a slash
Wolfgang Bumiller [Thu, 15 Oct 2020 10:26:45 +0000 (12:26 +0200)]
pxar: anchor pxarexcludes starting with a slash

Given the .pxarexclude file

    foo
    /bar

The following happens:

    exclude: /foo
    exclude: /bar
    exclude: /subdir/foo
    include: /subdir/bar

since the `/bar` line is an absolute path

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
3 years agoIntroduction: reword & link to encryption section
Dylan Whyte [Thu, 15 Oct 2020 09:58:42 +0000 (11:58 +0200)]
Introduction: reword & link to encryption section

Add link from encryption sentence in  "What is Proxmox
Backup Server?" to the Encryption section of the docs.
Also, reword the sentence.

V2:
Clarify that encryption takes place on the client side

Signed-off-by: Dylan Whyte <d.whyte@proxmox.com>
3 years agopxar: fix relative '!' rules in .pxarexclude
Wolfgang Bumiller [Thu, 15 Oct 2020 10:17:55 +0000 (12:17 +0200)]
pxar: fix relative '!' rules in .pxarexclude

and reduce indentation

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
3 years agomore clippy lints
Wolfgang Bumiller [Wed, 14 Oct 2020 12:22:38 +0000 (14:22 +0200)]
more clippy lints

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
3 years agodatastore: remove individual snapshots before group
Stefan Reiter [Wed, 14 Oct 2020 12:16:37 +0000 (14:16 +0200)]
datastore: remove individual snapshots before group

Removing a snapshot has some more safety checks which we don't want to
ignore when removing an entire group (i.e. locking the manifest and
notifying GC).

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
3 years agodatastore: remove load_manifest_json
Stefan Reiter [Wed, 14 Oct 2020 12:16:35 +0000 (14:16 +0200)]
datastore: remove load_manifest_json

There's no point in having that as a seperate method, just parse the
thing into a struct and write it back out correctly.

Also makes further changes to the method simpler.

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