]> git.proxmox.com Git - proxmox-backup.git/commit - proxmox-restore-daemon/src/main.rs
file-restore-daemon: add binary with virtio-vsock API server
authorStefan Reiter <s.reiter@proxmox.com>
Wed, 31 Mar 2021 10:21:52 +0000 (12:21 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Thu, 8 Apr 2021 11:57:57 +0000 (13:57 +0200)
commitdd9cef56fca0a01e4b96b0b2b2be5a6208f59333
tree08632ce2c312d672d5ddfea438c2853f56167ed7
parent26858dba84dbfc5e5ca97198d6a818c08ea9ab0e
file-restore-daemon: add binary with virtio-vsock API server

Implements the base of a small daemon to run within a file-restore VM.

The binary spawns an API server on a virtio-vsock socket, listening for
connections from the host. This happens mostly manually via the standard
Unix socket API, since tokio/hyper do not have support for vsock built
in. Once we have the accept'ed file descriptor, we can create a
UnixStream and use our tower service implementation for that.

The binary is deliberately not installed in the usual $PATH location,
since it shouldn't be executed on the host by a user anyway.

For now, only the API calls 'status' and 'stop' are implemented, to
demonstrate and test proxmox::api functionality.

Authorization is provided via a custom ApiAuth only checking a header
value against a static /ticket file.

Since the REST server implementation uses the log!() macro, we can
redirect its output to stdout by registering env_logger as the logging
target. env_logger is already in our dependency tree via zstd/bindgen.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Cargo.toml
Makefile
debian/control
debian/proxmox-file-restore.install
src/api2/types/file_restore.rs [new file with mode: 0644]
src/api2/types/mod.rs
src/bin/proxmox-restore-daemon.rs [new file with mode: 0644]
src/bin/proxmox_restore_daemon/api.rs [new file with mode: 0644]
src/bin/proxmox_restore_daemon/auth.rs [new file with mode: 0644]
src/bin/proxmox_restore_daemon/mod.rs [new file with mode: 0644]