]> git.proxmox.com Git - proxmox.git/log
proxmox.git
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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
df52ba5e4578176326da718d9660efa893d063a5 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>
4 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>
4 years agoserver/REST: check auth: code cleanup, better variable names
Thomas Lamprecht [Mon, 12 Oct 2020 16:39:45 +0000 (18:39 +0200)]
server/REST: check auth: code cleanup, better variable names

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agoserver/REST: make handle_request private
Thomas Lamprecht [Mon, 12 Oct 2020 16:38:58 +0000 (18:38 +0200)]
server/REST: make handle_request private

it's not used anywhere else, so do not suggest so

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agoserver: get index: make content-type non mutable
Thomas Lamprecht [Mon, 12 Oct 2020 08:38:13 +0000 (10:38 +0200)]
server: get index: make content-type non mutable

feels more idiomatic

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agoserver/rest: code cleanup: use async
Thomas Lamprecht [Mon, 12 Oct 2020 08:36:32 +0000 (10:36 +0200)]
server/rest: code cleanup: use async

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agoREST: don't print CSRF token
Fabian Grünbichler [Thu, 8 Oct 2020 13:37:20 +0000 (15:37 +0200)]
REST: don't print CSRF token

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
4 years agoREST server: avoid hard coding world readable API endpoints
Thomas Lamprecht [Fri, 2 Oct 2020 11:17:12 +0000 (13:17 +0200)]
REST server: avoid hard coding world readable API endpoints

while we probably do not add much more to them, it still looks ugly.

If this was made so that adding a World readable API call is "hard"
and not done by accident, it rather should be done as a test on build
time. But, IMO, the API permission schema definitions are easy to
review, and not often changed/added - so any wrong World readable API
call will normally still caught.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agorest server: cleanup use statements
Thomas Lamprecht [Fri, 2 Oct 2020 11:04:08 +0000 (13:04 +0200)]
rest server: cleanup use statements

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agoavoid chrono dependency, depend on proxmox 0.3.8
Dietmar Maurer [Sat, 12 Sep 2020 13:10:47 +0000 (15:10 +0200)]
avoid chrono dependency, depend on proxmox 0.3.8

- remove chrono dependency

- depend on proxmox 0.3.8

- remove epoch_now, epoch_now_u64 and epoch_now_f64

- remove tm_editor (moved to proxmox crate)

- use new helpers from proxmox 0.3.8
  * epoch_i64 and epoch_f64
  * parse_rfc3339
  * epoch_to_rfc3339_utc
  * strftime_local

- BackupDir changes:
  * store epoch and rfc3339 string instead of DateTime
  * backup_time_to_string now return a Result
  * remove unnecessary TryFrom<(BackupGroup, i64)> for BackupDir

- DynamicIndexHeader: change ctime to i64

- FixedIndexHeader: change ctime to i64

4 years agodon't truncate DateTime nanoseconds
Fabian Grünbichler [Fri, 11 Sep 2020 12:34:35 +0000 (14:34 +0200)]
don't truncate DateTime nanoseconds

where we don't care about them anyway..

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
4 years agoui: add translation support
Thomas Lamprecht [Mon, 7 Sep 2020 12:33:05 +0000 (14:33 +0200)]
ui: add translation support

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agotools: rename extract_auth_cookie to extract_cookie
Thomas Lamprecht [Mon, 7 Sep 2020 12:30:44 +0000 (14:30 +0200)]
tools: rename extract_auth_cookie to extract_cookie

It does nothing specific to authentication..

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agoreplace and remove old ticket functions
Wolfgang Bumiller [Wed, 12 Aug 2020 10:05:52 +0000 (12:05 +0200)]
replace and remove old ticket functions

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agointroduce Username, Realm and Userid api types
Wolfgang Bumiller [Thu, 6 Aug 2020 13:46:01 +0000 (15:46 +0200)]
introduce Username, Realm and Userid api types

and begin splitting up types.rs as it has grown quite large
already

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agobump proxmox to 0.3, cleanup http_err macro usage
Wolfgang Bumiller [Wed, 29 Jul 2020 07:38:11 +0000 (09:38 +0200)]
bump proxmox to 0.3, cleanup http_err macro usage

Also swap the order of a couple of `.map_err().await` to
`.await.map_err()` since that's generally more efficient.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agofollowup: server/state: rename task_count to internal_task_count
Thomas Lamprecht [Fri, 24 Jul 2020 10:11:33 +0000 (12:11 +0200)]
followup: server/state: rename task_count to internal_task_count

so that the relation with spawn_internal_task is made more clear

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agoserver/state: add spawn_internal_task and use it for websockets
Dominik Csapak [Thu, 23 Jul 2020 13:20:13 +0000 (15:20 +0200)]
server/state: add spawn_internal_task and use it for websockets

is a helper to spawn an internal tokio task without it showing up
in the task list

it is still tracked for reload and notifies the last_worker_listeners

this enables the console to survive a reload of proxmox-backup-proxy

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
4 years agoserver/rest: add console to index
Dominik Csapak [Tue, 21 Jul 2020 09:10:39 +0000 (11:10 +0200)]
server/rest: add console to index

register the console template and render it when the 'console' parameter
is given

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
4 years agoserver/config: add mechanism to update template
Dominik Csapak [Tue, 21 Jul 2020 09:10:36 +0000 (11:10 +0200)]
server/config: add mechanism to update template

instead of exposing handlebars itself, offer a register_template and
a render_template ourselves.

render_template checks if the template file was modified since
the last render and reloads it when necessary

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
4 years agoserver: add path value to NOT_FOUND http error
Thomas Lamprecht [Wed, 15 Jul 2020 07:11:16 +0000 (09:11 +0200)]
server: add path value to NOT_FOUND http error

Especially helpful for requests not coming from browsers (where the
URL is normally easy to find out).

Makes it easier to detect if one triggered a request with an old
client, or so..

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agosrc/server/rest.rs: avoid compiler warning
Dietmar Maurer [Fri, 10 Jul 2020 04:56:12 +0000 (06:56 +0200)]
src/server/rest.rs: avoid compiler warning

4 years agosrc/server/rest.rs: disable debug logs
Dietmar Maurer [Thu, 9 Jul 2020 14:18:14 +0000 (16:18 +0200)]
src/server/rest.rs: disable debug logs

4 years agoimprove 'debug' parameter
Dominik Csapak [Thu, 25 Jun 2020 08:45:49 +0000 (10:45 +0200)]
improve 'debug' parameter

instead of checking on '1' or 'true', check that it is there and not
'0' and 'false'. this allows using simply

https://foo:8007/?debug

instead of

https://foo:8007/?debug=1

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
4 years agosrc/tools/daemon.rs: reopen STDOUT/STDERR journald streams to get correct PID in...
Dietmar Maurer [Mon, 22 Jun 2020 11:06:11 +0000 (13:06 +0200)]
src/tools/daemon.rs: reopen STDOUT/STDERR journald streams to get correct PID in logs

4 years agotools::daemon: sync with child after MainPid message
Wolfgang Bumiller [Mon, 22 Jun 2020 08:58:04 +0000 (10:58 +0200)]
tools::daemon: sync with child after MainPid message

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agotools::daemon: fetch exe name in the beginning
Wolfgang Bumiller [Mon, 22 Jun 2020 08:20:51 +0000 (10:20 +0200)]
tools::daemon: fetch exe name in the beginning

We get the path to our executable via a readlink() on
"/proc/self/exe", which appends a " (deleted)" during
package reloads.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agotypo fixes all over the place
Thomas Lamprecht [Sat, 30 May 2020 14:37:33 +0000 (16:37 +0200)]
typo fixes all over the place

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agodepend on proxmox 0.1.31 - use Value to store result metadata
Dietmar Maurer [Mon, 18 May 2020 07:57:35 +0000 (09:57 +0200)]
depend on proxmox 0.1.31 - use Value to store result metadata

4 years agosrc/server/command_socket.rs: do not abort loop on client errors, allow backup gid
Dietmar Maurer [Thu, 7 May 2020 06:24:48 +0000 (08:24 +0200)]
src/server/command_socket.rs: do not abort loop on client errors, allow backup gid

4 years agochange index to templates using handlebars
Dominik Csapak [Wed, 29 Apr 2020 09:59:31 +0000 (11:59 +0200)]
change index to templates using handlebars

using a handlebars instance in ApiConfig, to cache the templates
as long as possible, this is currently ok, as the index template
can only change when the whole package changes

if we split this in the future, we have to trigger a reload of
the daemon on gui package upgrade (so that the template gets reloaded)

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
4 years agosrc/config/cached_user_info.rs: cache it up to 5 seconds
Dietmar Maurer [Sat, 18 Apr 2020 06:49:20 +0000 (08:49 +0200)]
src/config/cached_user_info.rs: cache it up to 5 seconds

4 years agoswitch from failure to anyhow
Wolfgang Bumiller [Fri, 17 Apr 2020 12:11:25 +0000 (14:11 +0200)]
switch from failure to anyhow

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agosrc/server/rest.rs: reduce delay for permission error to 500ms
Dietmar Maurer [Thu, 16 Apr 2020 10:56:34 +0000 (12:56 +0200)]
src/server/rest.rs: reduce delay for permission error to 500ms

4 years agostart impl. access permissions
Dietmar Maurer [Thu, 16 Apr 2020 08:01:59 +0000 (10:01 +0200)]
start impl. access permissions

4 years agoapi: add list_domains
Dietmar Maurer [Thu, 9 Apr 2020 09:36:45 +0000 (11:36 +0200)]
api: add list_domains

4 years agosrc/server/rest.rs: use correct formatter
Dietmar Maurer [Thu, 26 Mar 2020 11:54:20 +0000 (12:54 +0100)]
src/server/rest.rs: use correct formatter

4 years agobump proxmox crate to 0.1.7
Wolfgang Bumiller [Tue, 21 Jan 2020 11:28:01 +0000 (12:28 +0100)]
bump proxmox crate to 0.1.7

The -sys, -tools and -api crate have now been merged into
the proxmx crate directly. Only macro crates are separate
(but still reexported by the proxmox crate in their
designated locations).

When we need to depend on "parts" of the crate later on
we'll just have to use features.

The reason is mostly that these modules had
inter-dependencies which really make them not independent
enough to be their own crates.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agoupdate to nix 0.16
Dietmar Maurer [Thu, 19 Dec 2019 08:29:44 +0000 (09:29 +0100)]
update to nix 0.16

4 years agoadd CSS file for PBS ExtJS6 basic ui
Thomas Lamprecht [Mon, 16 Dec 2019 17:16:05 +0000 (18:16 +0100)]
add CSS file for PBS ExtJS6 basic ui

some fitting rules copied over from PVE's ext6-pve.css file.
simply place it in the css subfolder where the proxmox-backup-gui.js
file is hosted and add a "css/" alias for that directory, the
formatter gets use the right content type with that.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agohandle_static_file_download: move from and_then to await
Thomas Lamprecht [Tue, 17 Dec 2019 07:56:52 +0000 (08:56 +0100)]
handle_static_file_download: move from and_then to await

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agoapi2: update for latest proxmox-api changes
Dietmar Maurer [Mon, 16 Dec 2019 08:59:45 +0000 (09:59 +0100)]
api2: update for latest proxmox-api changes

- rename ApiFuture into ApiResponseFuture
- impl. ApiHandler::Async

4 years agoupdate a chunk of stuff to the hyper release
Wolfgang Bumiller [Thu, 12 Dec 2019 14:27:07 +0000 (15:27 +0100)]
update a chunk of stuff to the hyper release

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agosrc/server/formatter.rs: impl. new result attribute "active"
Dietmar Maurer [Sat, 7 Dec 2019 14:29:42 +0000 (15:29 +0100)]
src/server/formatter.rs: impl. new result attribute "active"

4 years agorename ApiHandler::Async into ApiHandler::AsyncHttp
Dietmar Maurer [Sat, 23 Nov 2019 08:03:21 +0000 (09:03 +0100)]
rename ApiHandler::Async into ApiHandler::AsyncHttp

4 years agosrc/server/rest.rs: simplify code
Dietmar Maurer [Fri, 22 Nov 2019 17:44:14 +0000 (18:44 +0100)]
src/server/rest.rs: simplify code

4 years agosrc/server/rest.rs: rename get_request_parameters_async to get_request_parameters
Dietmar Maurer [Fri, 22 Nov 2019 16:24:16 +0000 (17:24 +0100)]
src/server/rest.rs: rename get_request_parameters_async to get_request_parameters

4 years agosrc/server/rest.rs - only pass ObjectSchema to get_request_parameters_async()
Dietmar Maurer [Fri, 22 Nov 2019 16:22:07 +0000 (17:22 +0100)]
src/server/rest.rs - only pass ObjectSchema to get_request_parameters_async()

4 years agosrc/server/rest.rs: cleanup async code
Dietmar Maurer [Fri, 22 Nov 2019 12:02:05 +0000 (13:02 +0100)]
src/server/rest.rs: cleanup async code

4 years agomove src/api_schema/config.rs -> src/server/config.rs
Dietmar Maurer [Fri, 22 Nov 2019 08:23:03 +0000 (09:23 +0100)]
move src/api_schema/config.rs -> src/server/config.rs

4 years agoapi/compat: drop more compat imports from api_schema.rs
Wolfgang Bumiller [Thu, 21 Nov 2019 13:36:28 +0000 (14:36 +0100)]
api/compat: drop more compat imports from api_schema.rs

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agoapi/compat: drop api_handler submodule
Wolfgang Bumiller [Thu, 21 Nov 2019 13:18:41 +0000 (14:18 +0100)]
api/compat: drop api_handler submodule

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agoapi: BoxFut -> ApiFuture
Wolfgang Bumiller [Thu, 21 Nov 2019 13:16:37 +0000 (14:16 +0100)]
api: BoxFut -> ApiFuture

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agomove api schema into proxmox::api crate
Wolfgang Bumiller [Thu, 21 Nov 2019 13:14:54 +0000 (14:14 +0100)]
move api schema into proxmox::api crate

And leave some compat imports in api_schema.rs to get it to
build with minimal changes.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agouse const api definitions
Dietmar Maurer [Thu, 21 Nov 2019 08:36:41 +0000 (09:36 +0100)]
use const api definitions

5 years agoavoid some clippy warnings
Dietmar Maurer [Sat, 26 Oct 2019 09:36:01 +0000 (11:36 +0200)]
avoid some clippy warnings

5 years agoavoid some clippy warnings
Dietmar Maurer [Fri, 25 Oct 2019 16:44:51 +0000 (18:44 +0200)]
avoid some clippy warnings

5 years agoclippy: use write_all in file logger
Wolfgang Bumiller [Wed, 11 Sep 2019 11:56:09 +0000 (13:56 +0200)]
clippy: use write_all in file logger

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
5 years agoupdate to tokio 0.2.0-alpha.4
Wolfgang Bumiller [Mon, 2 Sep 2019 13:16:21 +0000 (15:16 +0200)]
update to tokio 0.2.0-alpha.4

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
5 years agosrc/server/state.rs: update to tokio alpha.2
Wolfgang Bumiller [Mon, 2 Sep 2019 11:04:44 +0000 (13:04 +0200)]
src/server/state.rs: update to tokio alpha.2

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
5 years agosrc/server/rest.rs: use tokio::timer::delay
Wolfgang Bumiller [Mon, 2 Sep 2019 10:40:53 +0000 (12:40 +0200)]
src/server/rest.rs: use tokio::timer::delay

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
5 years agosrc/tools/daemon.rs: switch to async
Wolfgang Bumiller [Fri, 23 Aug 2019 11:47:30 +0000 (13:47 +0200)]
src/tools/daemon.rs: switch to async

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
5 years agosrc/server/state.rs: switch to async
Wolfgang Bumiller [Fri, 23 Aug 2019 11:41:38 +0000 (13:41 +0200)]
src/server/state.rs: switch to async

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
5 years agosrc/server/rest.rs: switch to async
Wolfgang Bumiller [Mon, 26 Aug 2019 11:33:38 +0000 (13:33 +0200)]
src/server/rest.rs: switch to async

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
5 years agosrc/server/h2service.rs: switch to async
Wolfgang Bumiller [Fri, 23 Aug 2019 12:11:14 +0000 (14:11 +0200)]
src/server/h2service.rs: switch to async

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
5 years agosrc/server/command_socket.rs: switch to async
Wolfgang Bumiller [Fri, 23 Aug 2019 13:00:18 +0000 (15:00 +0200)]
src/server/command_socket.rs: switch to async

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
5 years agouse new proxmox::tools::nodename
Dietmar Maurer [Sat, 3 Aug 2019 15:06:23 +0000 (17:06 +0200)]
use new proxmox::tools::nodename

5 years agoupdate to nix 0.14, use code from proxmox:tools
Dietmar Maurer [Sat, 3 Aug 2019 11:05:38 +0000 (13:05 +0200)]
update to nix 0.14, use code from proxmox:tools

5 years agosrc/server/rest.rs: avoid unwrap
Dietmar Maurer [Wed, 3 Jul 2019 10:00:43 +0000 (12:00 +0200)]
src/server/rest.rs: avoid unwrap

5 years agosrc/server/rest.rs: log peer address, use hyper MakeService
Dietmar Maurer [Wed, 3 Jul 2019 09:54:35 +0000 (11:54 +0200)]
src/server/rest.rs: log peer address, use hyper MakeService

5 years agodaemon: remove last use of tools::read/write
Wolfgang Bumiller [Mon, 1 Jul 2019 08:39:13 +0000 (10:39 +0200)]
daemon: remove last use of tools::read/write

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
5 years agofile download: avoid unnecessary copy
Dietmar Maurer [Fri, 28 Jun 2019 05:07:52 +0000 (07:07 +0200)]
file download: avoid unnecessary copy

5 years agosrc/server/h2service.rs: implement generic h2 service
Dietmar Maurer [Wed, 26 Jun 2019 15:29:12 +0000 (17:29 +0200)]
src/server/h2service.rs: implement generic h2 service

5 years agotree-wide: use 'dyn' for all trait objects
Wolfgang Bumiller [Fri, 7 Jun 2019 11:10:56 +0000 (13:10 +0200)]
tree-wide: use 'dyn' for all trait objects

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
5 years agosrc/server/rest.rs: correctly verify json parameters
Dietmar Maurer [Fri, 24 May 2019 07:10:59 +0000 (09:10 +0200)]
src/server/rest.rs: correctly verify json parameters

5 years agosrc/server/rest.rs: improve error handling
Dietmar Maurer [Thu, 23 May 2019 06:15:32 +0000 (08:15 +0200)]
src/server/rest.rs: improve error handling

5 years agosrc/server/rest.rs: do not log 1xx status codes as errors
Dietmar Maurer [Tue, 14 May 2019 04:23:22 +0000 (06:23 +0200)]
src/server/rest.rs: do not log 1xx status codes as errors

5 years agohandle_async_api_request: put rpcenv into a Box
Dietmar Maurer [Thu, 9 May 2019 16:01:24 +0000 (18:01 +0200)]
handle_async_api_request: put rpcenv into a Box

So that we can pass rpcenv into futures.

5 years agosrc/server/formatter.rs: further cleanups and renaming ...
Dietmar Maurer [Thu, 9 May 2019 11:28:26 +0000 (13:28 +0200)]
src/server/formatter.rs: further cleanups and renaming ...

5 years agosrc/server/formatter.rs: rename format_result to format_data
Dietmar Maurer [Thu, 9 May 2019 11:15:15 +0000 (13:15 +0200)]
src/server/formatter.rs: rename format_result to format_data

To avoid confusions with Rust Result type.

5 years agosrc/api2/admin/datastore/backup.rs: implement upload chunk
Dietmar Maurer [Thu, 9 May 2019 11:06:09 +0000 (13:06 +0200)]
src/api2/admin/datastore/backup.rs: implement upload chunk

5 years agorc/api2/admin/datastore/h2upload.rs: implement BackupEnvironment
Dietmar Maurer [Wed, 8 May 2019 09:26:54 +0000 (11:26 +0200)]
rc/api2/admin/datastore/h2upload.rs: implement BackupEnvironment

To pass arbitrary information/state to api methods.

5 years agosrc/server/rest.rs: use generics to pass RpcEnvironment
Dietmar Maurer [Wed, 8 May 2019 09:09:01 +0000 (11:09 +0200)]
src/server/rest.rs: use generics to pass RpcEnvironment

5 years agosrc/server/rest.rs: make handle_(a)sync_api_request public
Dietmar Maurer [Tue, 7 May 2019 09:23:52 +0000 (11:23 +0200)]
src/server/rest.rs: make handle_(a)sync_api_request public

5 years agoRestEnvironment: derive Clone
Dietmar Maurer [Tue, 7 May 2019 09:09:18 +0000 (11:09 +0200)]
RestEnvironment: derive Clone

5 years agomove normalize_path to tools::normalize_uri_path
Dietmar Maurer [Tue, 7 May 2019 07:44:34 +0000 (09:44 +0200)]
move normalize_path to tools::normalize_uri_path

5 years agosrc/server/state.rs: use new BroadcastData helper
Dietmar Maurer [Tue, 30 Apr 2019 08:21:48 +0000 (10:21 +0200)]
src/server/state.rs: use new BroadcastData helper

5 years agouse double-fork for reload
Wolfgang Bumiller [Thu, 25 Apr 2019 11:00:02 +0000 (11:00 +0000)]
use double-fork for reload

To ensure the new process' parent is pid 1, so systemd won't
complain about supervising a process it does not own.

Fixes the following log spam on reloads:
Apr 25 10:50:54 deb-dev systemd[1]: proxmox-backup.service: Supervising process 1625 which is not our child. We'll most likely not notice when it exits.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
5 years agouse service Type=notify
Wolfgang Bumiller [Thu, 25 Apr 2019 08:38:26 +0000 (08:38 +0000)]
use service Type=notify

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
5 years agotools/daemon: add sd_notify wrapper
Wolfgang Bumiller [Thu, 25 Apr 2019 08:35:01 +0000 (08:35 +0000)]
tools/daemon: add sd_notify wrapper

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
5 years agoapi_schema: allow generic api handler functions
Wolfgang Bumiller [Tue, 16 Apr 2019 08:36:04 +0000 (10:36 +0200)]
api_schema: allow generic api handler functions

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
5 years agosrc/server/command_socket.rs: check control socket permissions
Dietmar Maurer [Thu, 11 Apr 2019 08:51:59 +0000 (10:51 +0200)]
src/server/command_socket.rs: check control socket permissions