1 //! Client side interface to the proxmox backup server
3 //! This library implements the client side to access the backups
4 //! server using https.
8 use pbs_api_types
::{Authid, Userid}
;
9 use pbs_tools
::ticket
::Ticket
;
10 use pbs_tools
::cert
::CertInfo
;
11 use pbs_tools
::auth
::private_auth_key
;
13 pub mod catalog_shell
;
14 pub mod dynamic_index
;
18 mod merge_known_chunks
;
19 pub mod pipe_to_stream
;
22 pub use http_client
::*;
25 pub use vsock_client
::*;
31 pub use backup_reader
::*;
34 pub use backup_writer
::*;
36 mod remote_chunk_reader
;
37 pub use remote_chunk_reader
::*;
39 mod pxar_backup_stream
;
40 pub use pxar_backup_stream
::*;
43 pub use backup_repo
::*;
45 mod backup_specification
;
46 pub use backup_specification
::*;
49 pub use chunk_stream
::{ChunkStream, FixedChunkStream}
;
51 pub const PROXMOX_BACKUP_TCP_KEEPALIVE_TIME
: u32 = 120;
53 /// Connect to localhost:8007 as root@pam
55 /// This automatically creates a ticket if run as 'root' user.
56 pub fn connect_to_localhost() -> Result
<HttpClient
, Error
> {
58 let uid
= nix
::unistd
::Uid
::current();
60 let client
= if uid
.is_root() {
61 let ticket
= Ticket
::new("PBS", Userid
::root_userid())?
62 .sign(private_auth_key(), None
)?
;
63 let fingerprint
= CertInfo
::new()?
.fingerprint()?
;
64 let options
= HttpClientOptions
::new_non_interactive(ticket
, Some(fingerprint
));
66 HttpClient
::new("localhost", 8007, Authid
::root_auth_id(), options
)?
68 let options
= HttpClientOptions
::new_interactive(None
, None
);
70 HttpClient
::new("localhost", 8007, Authid
::root_auth_id(), options
)?