]> git.proxmox.com Git - proxmox-backup.git/log
proxmox-backup.git
2 years agomove RRD code into proxmox-rrd crate
Dietmar Maurer [Wed, 6 Oct 2021 05:06:17 +0000 (07:06 +0200)]
move RRD code into proxmox-rrd crate

2 years agobump version to 2.0.11-1
Thomas Lamprecht [Tue, 5 Oct 2021 14:34:35 +0000 (16:34 +0200)]
bump version to 2.0.11-1

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agod/changelog: fixup release
Thomas Lamprecht [Tue, 5 Oct 2021 12:23:28 +0000 (14:23 +0200)]
d/changelog: fixup release

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoproxmox-rest-server: use new ServerAdapter trait instead of callbacks
Dietmar Maurer [Tue, 5 Oct 2021 09:01:05 +0000 (11:01 +0200)]
proxmox-rest-server: use new ServerAdapter trait instead of callbacks

Async callbacks are a PITA, so we now pass a single trait object which
implements check_auth and get_index.

2 years agoproxmox-rest-server: pass owned RestEnvironment to get_index
Dietmar Maurer [Mon, 4 Oct 2021 12:49:25 +0000 (14:49 +0200)]
proxmox-rest-server: pass owned RestEnvironment to get_index

This way we avoid pointers with lifetimes.

2 years agoproxmox-rest-server: cleanup, access api_auth using a method
Dietmar Maurer [Mon, 4 Oct 2021 11:32:19 +0000 (13:32 +0200)]
proxmox-rest-server: cleanup, access api_auth using a method

2 years agofix deprecated use of std::u64/... modules
Wolfgang Bumiller [Mon, 4 Oct 2021 12:58:55 +0000 (14:58 +0200)]
fix deprecated use of std::u64/... modules

integer primitive type modules are deprecated, use
associated constants instead

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2 years agoui: datastore/Content: add empty text for no snapshots
Dominik Csapak [Fri, 1 Oct 2021 09:56:55 +0000 (11:56 +0200)]
ui: datastore/Content: add empty text for no snapshots

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2 years agoui: datastore/Content: reload in activate listener
Dominik Csapak [Fri, 1 Oct 2021 09:56:54 +0000 (11:56 +0200)]
ui: datastore/Content: reload in activate listener

when we trigger the first load before the panel was fully created,
there was no load mask for it (but the snapshots would "pop in" on load)

move the first reload into the 'activate' listener. this will be called
the every time a user opens the content tab of a datastore, so guard
it by a 'firstLoad' bool.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2 years agorest: daemon: group systemd FFI together
Thomas Lamprecht [Fri, 1 Oct 2021 14:46:59 +0000 (16:46 +0200)]
rest: daemon: group systemd FFI together

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agorest: daemon: sd notify: code cleanup
Thomas Lamprecht [Fri, 1 Oct 2021 14:45:19 +0000 (16:45 +0200)]
rest: daemon: sd notify: code cleanup

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agorest: daemon: sd notify barrier: avoid barging in between SystemdNotify enum and...
Thomas Lamprecht [Fri, 1 Oct 2021 14:44:28 +0000 (16:44 +0200)]
rest: daemon: sd notify barrier: avoid barging in between SystemdNotify enum and systemd_notify

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agorest: daemon: sd notify barrier: allow caller to set timeout
Thomas Lamprecht [Fri, 1 Oct 2021 13:27:46 +0000 (15:27 +0200)]
rest: daemon: sd notify barrier: allow caller to set timeout

else it's rather to subtle and not a nice interface considering that
we only want to have a thin wrapper for sd_notify_barrier..

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agorest: daemon: comment why using a systemd barrier is important for main PID handover
Thomas Lamprecht [Fri, 1 Oct 2021 13:04:58 +0000 (15:04 +0200)]
rest: daemon: comment why using a systemd barrier is important for main PID handover

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agorest-server/daemon: use sd_notify_barrier for service reloading
Dominik Csapak [Thu, 30 Sep 2021 07:18:58 +0000 (09:18 +0200)]
rest-server/daemon: use sd_notify_barrier for service reloading

until now, we manually polled the systemd service state during a reload
so that the sd_notify messages get processed in the correct order
(RELOAD(old) -> MAINPID(old) -> READY(new))

with systemd >= 246 there is now 'sd_notify_barrier' which
blocks until systemd processed all prior messages

with that change, the daemon does not need to know the service name anymore

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoproxmox-rest-server: make get_index async
Dietmar Maurer [Fri, 1 Oct 2021 07:38:10 +0000 (09:38 +0200)]
proxmox-rest-server: make get_index async

2 years agoproxmox-rest-server: add comment why ApiService needs to be 'pub'
Dietmar Maurer [Fri, 1 Oct 2021 06:35:51 +0000 (08:35 +0200)]
proxmox-rest-server: add comment why ApiService needs to be 'pub'

2 years agoproxmox-rest-server: make check_auth async
Dietmar Maurer [Fri, 1 Oct 2021 05:29:11 +0000 (07:29 +0200)]
proxmox-rest-server: make check_auth async

2 years agoproxmox-rest-server: fix spelling errors
Dietmar Maurer [Fri, 1 Oct 2021 04:43:30 +0000 (06:43 +0200)]
proxmox-rest-server: fix spelling errors

2 years agoproxmox-rest-server: improve ApiService docs
Dietmar Maurer [Thu, 30 Sep 2021 15:18:47 +0000 (17:18 +0200)]
proxmox-rest-server: improve ApiService docs

2 years agoproxmox-rest-server: start module docs
Dietmar Maurer [Thu, 30 Sep 2021 11:49:29 +0000 (13:49 +0200)]
proxmox-rest-server: start module docs

2 years agorename CommandoSocket to CommandSocket
Dietmar Maurer [Thu, 30 Sep 2021 10:31:38 +0000 (12:31 +0200)]
rename CommandoSocket to CommandSocket

2 years agotools::format: avoid some string copies
Wolfgang Bumiller [Thu, 30 Sep 2021 09:41:21 +0000 (11:41 +0200)]
tools::format: avoid some string copies

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2 years agodrop str::join helper
Wolfgang Bumiller [Thu, 30 Sep 2021 09:35:12 +0000 (11:35 +0200)]
drop str::join helper

the standard join method can do this now

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2 years agodrop fd_change_cloexec from proxmox-rest-server
Wolfgang Bumiller [Thu, 30 Sep 2021 10:42:28 +0000 (12:42 +0200)]
drop fd_change_cloexec from proxmox-rest-server

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2 years agoproxmox-rest-server: improve docs
Dietmar Maurer [Thu, 30 Sep 2021 09:59:21 +0000 (11:59 +0200)]
proxmox-rest-server: improve docs

And rename enable_file_log to enable_access_log.

2 years agoproxmox-rest-server: improve docs
Dietmar Maurer [Thu, 30 Sep 2021 08:33:57 +0000 (10:33 +0200)]
proxmox-rest-server: improve docs

And renames abort_worker_async to abort_worker_nowait (avoid confusion,
because the function itself is not async).

2 years agoproxmox-rest-server: cleanup FileLogger docs
Dietmar Maurer [Thu, 30 Sep 2021 06:51:23 +0000 (08:51 +0200)]
proxmox-rest-server: cleanup FileLogger docs

2 years agosubscription: switch verification domain over to shop.proxmox.com
Thomas Lamprecht [Thu, 30 Sep 2021 08:28:50 +0000 (10:28 +0200)]
subscription: switch verification domain over to shop.proxmox.com

With the merger the shop got moved from shop.maurer-it to
shop.proxmox.com, while we transparently redirect we also want to
stop doing that in a few years, so use new domain.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agocleanup: move use clause to top
Dietmar Maurer [Thu, 30 Sep 2021 06:40:55 +0000 (08:40 +0200)]
cleanup: move use clause to top

2 years agoproxmox-rest-server: allow to catch SIGINT and SIGHUP separately
Dietmar Maurer [Thu, 30 Sep 2021 06:03:34 +0000 (08:03 +0200)]
proxmox-rest-server: allow to catch SIGINT and SIGHUP separately

And make ServerState private.

2 years agoproxmox-rtest-server: make Reloader and Reloadable private
Dietmar Maurer [Thu, 30 Sep 2021 05:37:16 +0000 (07:37 +0200)]
proxmox-rtest-server: make Reloader and Reloadable private

2 years agoproxmox-rest-server: improve logging
Dietmar Maurer [Wed, 29 Sep 2021 12:34:25 +0000 (14:34 +0200)]
proxmox-rest-server: improve logging

And rename server_state_init() into catch_shutdown_and_reload_signals().

2 years agoproxmox-rest-server: avoid useless call to request_shutdown
Dietmar Maurer [Wed, 29 Sep 2021 10:46:00 +0000 (12:46 +0200)]
proxmox-rest-server: avoid useless call to request_shutdown

Also avoid unsafe code.

2 years agomake pbs_tools::cert not depend on pbs-buildcfg
Wolfgang Bumiller [Wed, 29 Sep 2021 12:01:38 +0000 (14:01 +0200)]
make pbs_tools::cert not depend on pbs-buildcfg

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2 years agoremove pbs_client::connect_to_localhost
Wolfgang Bumiller [Wed, 29 Sep 2021 11:58:07 +0000 (13:58 +0200)]
remove pbs_client::connect_to_localhost

It also used `CertInfo` from pbs-tools which is also server
specific.

The original helper is now in the main crate's
client_helpers instead.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2 years agoadd all autotraits to output_or_stdout trait object
Wolfgang Bumiller [Wed, 29 Sep 2021 10:39:51 +0000 (12:39 +0200)]
add all autotraits to output_or_stdout trait object

just in case we ever need any of them in async code that
requires them and loses it because of accessing such a trait
object...

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2 years agoremove wrong calls to systemd_notify
Dietmar Maurer [Wed, 29 Sep 2021 09:22:57 +0000 (11:22 +0200)]
remove wrong calls to systemd_notify

We alrteady call systemd_notify inside the create_service future.

2 years agodaemon: simlify code (make it easier to use)
Dietmar Maurer [Wed, 29 Sep 2021 09:21:32 +0000 (11:21 +0200)]
daemon: simlify code (make it easier to use)

2 years agodrop pbs_tools::auth
Wolfgang Bumiller [Wed, 29 Sep 2021 09:05:26 +0000 (11:05 +0200)]
drop pbs_tools::auth

`pbs_client::connect_to_localhost` now requires the key as
optional parameter

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2 years agocleanup: make BoxedStoreFunc private
Dietmar Maurer [Wed, 29 Sep 2021 07:40:56 +0000 (09:40 +0200)]
cleanup: make BoxedStoreFunc private

There is no need to export this type.

2 years agoexamples: add example for a simple rest server with a small api
Dominik Csapak [Wed, 29 Sep 2021 07:04:19 +0000 (09:04 +0200)]
examples: add example for a simple rest server with a small api

show how to generally start a daemon that serves a rest api + index page

api calls are (prefixed with either /api2/json or /api2/extjs):
/ GET listing
/ping GET returns "pong"
/items GET lists existing items
POST lets user create new items
/items/{id} GET returns the content of a single item
PUT updates an item
DELETE deletes an item

Contains a small dummy user/authinfo

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoremove tools/async_io.rs
Dominik Csapak [Wed, 29 Sep 2021 07:04:18 +0000 (09:04 +0200)]
remove tools/async_io.rs

nothing from here is used anymore, so remove it

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agorest-server: use hypers AddrIncoming for proxmox-backup-api
Dominik Csapak [Wed, 29 Sep 2021 07:04:17 +0000 (09:04 +0200)]
rest-server: use hypers AddrIncoming for proxmox-backup-api

this has a 'from_listener' (tokio::net::TcpListener) since hyper 0.14.5 in
the 'tcp' feature (we use 'full', which includes that; since 0.14.13
it is not behind a feature flag anymore).

this makes it possible to create a hyper server without our
'StaticIncoming' wrapper and thus makes it unnecessary.

The only other thing we have to do is to change the Service impl from
tokio::net::TcpStream to hyper::server::conn::AddStream to fulfill the trait
requirements.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoExtJsFormatter: use ParameterError to correctly compute 'errors'
Dietmar Maurer [Tue, 28 Sep 2021 08:11:56 +0000 (10:11 +0200)]
ExtJsFormatter: use ParameterError to correctly compute 'errors'

By default, 'errors' is now empty.

Depend on proxmox 0.13.5.

2 years agoproxmox-rest-server: cleanup formatter, improve docs
Dietmar Maurer [Mon, 27 Sep 2021 10:59:06 +0000 (12:59 +0200)]
proxmox-rest-server: cleanup formatter, improve docs

Use trait for OutputFormatter. This is functionally equivalent,
but more rust-like...

2 years agomove src/backup/read_chunk.rs to pbs-datastore/src/local_chunk_reader.rs
Dietmar Maurer [Mon, 27 Sep 2021 09:10:14 +0000 (11:10 +0200)]
move src/backup/read_chunk.rs to pbs-datastore/src/local_chunk_reader.rs

2 years agomove src/backup/snapshot_reader.rs to pbs_datastore crate
Dietmar Maurer [Mon, 27 Sep 2021 07:58:20 +0000 (09:58 +0200)]
move src/backup/snapshot_reader.rs to pbs_datastore crate

2 years agoWorkerTaskContext: make it Send + Sync
Dietmar Maurer [Mon, 27 Sep 2021 06:39:44 +0000 (08:39 +0200)]
WorkerTaskContext: make it Send + Sync

2 years agomove src/backup/datastore.rs into pbs_datastore crate
Dietmar Maurer [Mon, 27 Sep 2021 06:24:26 +0000 (08:24 +0200)]
move src/backup/datastore.rs into pbs_datastore crate

2 years agotools: smart: only throw error for smartctl fatal errors
Dominik Csapak [Tue, 31 Aug 2021 13:48:25 +0000 (15:48 +0200)]
tools: smart: only throw error for smartctl fatal errors

only bit 0-2 are fatal errors, bit 3-7 are used to indicate
some drive conditions. for details see the manpage of smartctl(8)

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
 [ Thomas: resolved merge-conflict due to moved run_command ]
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoproxmox-backup-manager: avoid proxmox_rest_server::init_worker_tasks() for "bashcompl...
Dietmar Maurer [Fri, 24 Sep 2021 10:31:42 +0000 (12:31 +0200)]
proxmox-backup-manager: avoid proxmox_rest_server::init_worker_tasks() for "bashcomplete" and "printdoc"

2 years agoWorkerTaskContext: add shutdown_requested() and fail_on_shutdown()
Dietmar Maurer [Fri, 24 Sep 2021 09:56:53 +0000 (11:56 +0200)]
WorkerTaskContext: add shutdown_requested() and fail_on_shutdown()

2 years agocleanup WorkerTaskContext
Dietmar Maurer [Fri, 24 Sep 2021 09:39:30 +0000 (11:39 +0200)]
cleanup WorkerTaskContext

2 years agocleanup worker task logging
Dietmar Maurer [Fri, 24 Sep 2021 07:30:00 +0000 (09:30 +0200)]
cleanup worker task logging

In order to avoid name conflicts with WorkerTaskContext

- renamed WorkerTask::log to WorkerTask::log_message

Note: Methods have different fuction signatures

Also renamed WorkerTask::warn to WorkerTask::log_warning for
consistency reasons.

Use the task_log!() and task_warn!() macros more often.

2 years agorename TaskState to WorkerTaskContext
Dietmar Maurer [Fri, 24 Sep 2021 05:40:49 +0000 (07:40 +0200)]
rename TaskState to WorkerTaskContext

2 years agomove src/server/h2service.rs into proxmox-rest-server crate
Dietmar Maurer [Thu, 23 Sep 2021 10:38:09 +0000 (12:38 +0200)]
move src/server/h2service.rs into proxmox-rest-server crate

2 years agoproxmox-backup-manager: setup worker and command socket
Dietmar Maurer [Thu, 23 Sep 2021 09:43:50 +0000 (11:43 +0200)]
proxmox-backup-manager: setup worker and command socket

2 years agoproxmox-daily-update: setup worker and command socket
Dietmar Maurer [Thu, 23 Sep 2021 09:12:27 +0000 (11:12 +0200)]
proxmox-daily-update: setup worker and command socket

2 years agomove worker_task.rs into proxmox-rest-server crate
Dietmar Maurer [Thu, 23 Sep 2021 08:09:19 +0000 (10:09 +0200)]
move worker_task.rs into proxmox-rest-server crate

Also moved pbs-datastore/src/task.rs to pbs-tools, which now depends on 'log'.

2 years agouse UPID and systemd helpers from proxmox 0.13.4
Dietmar Maurer [Wed, 22 Sep 2021 10:46:44 +0000 (12:46 +0200)]
use UPID and systemd helpers from proxmox 0.13.4

2 years agoworker task: allow to configure path and owner/group
Dietmar Maurer [Wed, 22 Sep 2021 06:44:48 +0000 (08:44 +0200)]
worker task: allow to configure path and owner/group

And application now needs to call init_worker_tasks() before using
worker tasks.

Notable changes:
- need to call  init_worker_tasks() before using worker tasks.
- create_task_log_dirs() ís called inside init_worker_tasks()
- removed UpidExt trait
- use atomic_open_or_create_file()
- remove pbs_config and pbs_buildcfg dependency

2 years agosrc/server/worker_task.rs: Avoid using pbs-api-type::Authid
Dietmar Maurer [Tue, 21 Sep 2021 10:14:19 +0000 (12:14 +0200)]
src/server/worker_task.rs: Avoid using pbs-api-type::Authid

Because we want to move worker_task.rs into proxmox-rest-server crate.

2 years agobuildsys: better group and sort --bin arguments
Thomas Lamprecht [Wed, 22 Sep 2021 14:27:37 +0000 (16:27 +0200)]
buildsys: better group and sort --bin arguments

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agomove dump-catalog-shell-cli doc-helper to proxmox-backup-client crate
Thomas Lamprecht [Wed, 22 Sep 2021 14:25:07 +0000 (16:25 +0200)]
move dump-catalog-shell-cli doc-helper to proxmox-backup-client crate

it's only used for generating the docs for the interactive-shell
parts of the client.

Ideally we'd avoid that whole separate binary in the first place and
let the client dump it, but we'd need to have some more elaborate
"hide this command from the help/usage" mechanisms in the CLI
helper/formatter code to make that play out more nicely.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agobump version to 2.0.10-1 v2.0.10
Thomas Lamprecht [Wed, 22 Sep 2021 09:36:42 +0000 (11:36 +0200)]
bump version to 2.0.10-1

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agocargo: switch from proc-macro pin-project to declarative pin-project-lite
Thomas Lamprecht [Wed, 22 Sep 2021 09:15:38 +0000 (11:15 +0200)]
cargo: switch from proc-macro pin-project to declarative pin-project-lite

In our simple use cases they both should generate the same code, see
[0] for notable differences. While we cannot drop proc-macro due to
that switch, all of our dependencies that use pinning already use
pin-project-lite, so this allows us to drop a whole crate in general
while not loosing anything.

[0]: https://github.com/taiki-e/pin-project-lite#pin-project-vs-pin-project-lite

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agodocs: troubleshooting: reformat & adapt
Thomas Lamprecht [Wed, 22 Sep 2021 05:41:45 +0000 (07:41 +0200)]
docs: troubleshooting: reformat & adapt

Text-width should be 80 cc in the docs.

Avoid using relative paths in examples, they only confuse users as
one has less of a specific idea what the example may do. Rather use a
"descriptive" example path.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agodocs/technical-overview: add troubleshooting section
Hannes Laimer [Mon, 20 Sep 2021 09:18:39 +0000 (11:18 +0200)]
docs/technical-overview: add troubleshooting section

2 years agodebug: api ls: make path optional and default to "/"
Thomas Lamprecht [Tue, 21 Sep 2021 13:11:36 +0000 (15:11 +0200)]
debug: api ls: make path optional and default to "/"

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agodocs: proxmox-backup-debug: add info about the 'api' subcommand
Dominik Csapak [Tue, 21 Sep 2021 10:11:18 +0000 (12:11 +0200)]
docs: proxmox-backup-debug: add info about the 'api' subcommand

and mention PROXMOX_DEBUG_API_CODE and that its dangerous.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agodocs: add proxmox-backup-debug to the list of command line tools
Dominik Csapak [Tue, 21 Sep 2021 10:11:17 +0000 (12:11 +0200)]
docs: add proxmox-backup-debug to the list of command line tools

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoapi: make some workers log on CLI
Dominik Csapak [Tue, 21 Sep 2021 10:11:16 +0000 (12:11 +0200)]
api: make some workers log on CLI

some workers did not log when called via cli

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoapi: add missing token list match_all property
Dominik Csapak [Tue, 21 Sep 2021 10:11:15 +0000 (12:11 +0200)]
api: add missing token list match_all property

to have the proper link between the token list and the sub routes
in the api, include the 'tokenname' property in the token listing

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoproxmox-backup-debug: add 'api' subcommands
Dominik Csapak [Tue, 21 Sep 2021 10:11:14 +0000 (12:11 +0200)]
proxmox-backup-debug: add 'api' subcommands

this provides some generic api call mechanisms like pvesh/pmgsh.
by default it uses the https api on localhost (creating a token
if called as root, else requesting the root@pam password interactively)

this is mainly intended for debugging, but it is also useful for
situations where some api calls do not have an equivalent in a binary
and a user does not want to go through the api

not implemented are the http2 api calls (since it is a separate api an
it wouldn't be that easy to do)

there are a few quirks though, related to the 'ls' command:
i extract the 'child-link' from the property name of the
'match_all' statement of the router, but this does not
always match with the property from the relevant 'get' api call
so it fails there (e.g. /tape/drive )

this can be fixed in the respective api calls (e.g. by renaming
the parameter that comes from the path)

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agomove proxmox-backup-debug back to main crate
Dominik Csapak [Tue, 21 Sep 2021 10:11:13 +0000 (12:11 +0200)]
move proxmox-backup-debug back to main crate

we want to add something to it that needs access to the
proxmox_backup::api2 stuff, so it cannot live in a sub crate

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoserver: refactor abort_local_worker
Dominik Csapak [Tue, 21 Sep 2021 10:11:12 +0000 (12:11 +0200)]
server: refactor abort_local_worker

we'll need this outside the module

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agorename pbs-systemd to proxmox-systemd
Dietmar Maurer [Tue, 21 Sep 2021 07:33:51 +0000 (09:33 +0200)]
rename pbs-systemd to proxmox-systemd

2 years agopbs-systemd: do not depend on pbs-tools
Dietmar Maurer [Tue, 21 Sep 2021 07:33:50 +0000 (09:33 +0200)]
pbs-systemd: do not depend on pbs-tools

Instead, copy a few line of nom helper code, and implement
a simple run_command helper.

2 years agoworker_state: move tasktype() code to src/api2/node/tasks.rs
Dietmar Maurer [Tue, 21 Sep 2021 05:58:54 +0000 (07:58 +0200)]
worker_state: move tasktype() code to src/api2/node/tasks.rs

Because this is API related code, and only used there.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agobuildsys: drop double-build hack to avoid linkage issues
Dietmar Maurer [Tue, 21 Sep 2021 05:58:53 +0000 (07:58 +0200)]
buildsys: drop double-build hack to avoid linkage issues

basically a (semantic) revert of commit
991be99c37c6f55f43a3d9a2c54edb2a8dc6d4f2 "buildsys: workaround
linkage issues from openid/curl build server stuff separate"

This is no longer required because we moved proxmox_restore_daemon
code into extra crate (previous commit)

Originally-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agomove proxmox_restore_daemon code into extra crate
Dietmar Maurer [Tue, 21 Sep 2021 05:58:52 +0000 (07:58 +0200)]
move proxmox_restore_daemon code into extra crate

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agomove src/server/rest.rs to proxmox-rest-server crate
Dietmar Maurer [Tue, 21 Sep 2021 05:58:51 +0000 (07:58 +0200)]
move src/server/rest.rs to proxmox-rest-server crate

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agorest server: cleanup auth-log handling
Dietmar Maurer [Tue, 21 Sep 2021 05:58:50 +0000 (07:58 +0200)]
rest server: cleanup auth-log handling

Handle auth logs the same way as access log.
- Configure with ApiConfig
- CommandoSocket command to reload auth-logs "api-auth-log-reopen"

Inside API calls, we now access the ApiConfig using the RestEnvironment.

The openid_login api now also logs failed logins and return http_err!(UNAUTHORIZED, ..)
on failed logins.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agorest server: do not use pbs_api_types::Authid
Dietmar Maurer [Tue, 21 Sep 2021 05:58:49 +0000 (07:58 +0200)]
rest server: do not use pbs_api_types::Authid

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agorest server: return UserInformation from ApiAuth::check_auth
Dietmar Maurer [Tue, 21 Sep 2021 05:58:48 +0000 (07:58 +0200)]
rest server: return UserInformation from ApiAuth::check_auth

This need impl UserInformation for Arc<CachedUserInfo> which is implemented
with proxmox 0.13.2

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agomake get_index and ApiConfig property (callback)
Dietmar Maurer [Tue, 21 Sep 2021 05:58:47 +0000 (07:58 +0200)]
make get_index and ApiConfig property (callback)

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agorest server: simplify get_index() method signature
Dietmar Maurer [Tue, 21 Sep 2021 05:58:46 +0000 (07:58 +0200)]
rest server: simplify get_index() method signature

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agomove normalize_uri_path and extract_cookie to proxmox-rest-server crate
Dietmar Maurer [Tue, 21 Sep 2021 05:58:45 +0000 (07:58 +0200)]
move normalize_uri_path and extract_cookie to proxmox-rest-server crate

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agomove src/tools/compression.rs to proxmox-rest-server crate
Dietmar Maurer [Tue, 21 Sep 2021 05:58:44 +0000 (07:58 +0200)]
move src/tools/compression.rs to proxmox-rest-server crate

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agomove src/server/formatter.rs to proxmox-rest-server crate
Dietmar Maurer [Tue, 21 Sep 2021 05:58:43 +0000 (07:58 +0200)]
move src/server/formatter.rs to proxmox-rest-server crate

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agomove src/server/environment.rs to proxmox-rest-server crate
Dietmar Maurer [Tue, 21 Sep 2021 05:58:42 +0000 (07:58 +0200)]
move src/server/environment.rs to proxmox-rest-server crate

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agomove src/tools/daemon.rs to proxmox-rest-server workspace
Dietmar Maurer [Tue, 21 Sep 2021 05:58:41 +0000 (07:58 +0200)]
move src/tools/daemon.rs to proxmox-rest-server workspace

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agomove ApiConfig, FileLogger and CommandoSocket to proxmox-rest-server workspace
Dietmar Maurer [Tue, 21 Sep 2021 05:58:40 +0000 (07:58 +0200)]
move ApiConfig, FileLogger and CommandoSocket to proxmox-rest-server workspace

ApiConfig: avoid using  pbs_config::backup_user()
CommandoSocket: avoid using  pbs_config::backup_user()
FileLogger: avoid using  pbs_config::backup_user()
- use atomic_open_or_create_file()

Auth Trait: moved definitions to proxmox-rest-server/src/lib.rs
- removed CachedUserInfo patrameter
- return user as String (not Authid)

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agostart new proxmox-rest-server workspace
Dietmar Maurer [Tue, 21 Sep 2021 05:58:39 +0000 (07:58 +0200)]
start new proxmox-rest-server workspace

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoapi: disks/directory: add 'name' property to list of mounts
Dominik Csapak [Mon, 13 Sep 2021 14:18:27 +0000 (16:18 +0200)]
api: disks/directory: add 'name' property to list of mounts

so that we actually have the property that 'match_all' refers to for
the templated API path.

This is mostly for improving usage of the WIP pbs-shell, i.e., its
`ls` command, it has no other functional/semantic impact.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoapi: disks/directory: factor out BASE_MOUNT_DIR path
Dominik Csapak [Mon, 13 Sep 2021 14:18:26 +0000 (16:18 +0200)]
api: disks/directory: factor out BASE_MOUNT_DIR path

will be reused in the next commit

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoapi: nodes: rustfmt
Thomas Lamprecht [Wed, 15 Sep 2021 09:42:28 +0000 (11:42 +0200)]
api: nodes: rustfmt

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoapi2: nodes: add missing node list api call
Dominik Csapak [Thu, 9 Sep 2021 13:48:19 +0000 (15:48 +0200)]
api2: nodes: add missing node list api call

to have an api call for api path traversal

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2 years agofix tests/worker-task-abort.rs - correctly spawn command socket
Dietmar Maurer [Tue, 14 Sep 2021 08:42:44 +0000 (10:42 +0200)]
fix tests/worker-task-abort.rs - correctly spawn command socket

And wait for the task.

Note: The test is still ignored (but works now when run a root)