]>
Commit | Line | Data |
---|---|---|
151c6ce2 DM |
1 | //! Client side interface to the proxmox backup server |
2 | //! | |
3 | //! This library implements the client side to access the backups | |
4 | //! server using https. | |
5 | ||
6b68e5d5 | 6 | use anyhow::Error; |
01a08021 | 7 | use openssl::pkey::{PKey, Private}; |
6b68e5d5 | 8 | |
9eb78407 WB |
9 | use pbs_api_types::{Authid, Userid}; |
10 | use pbs_tools::ticket::Ticket; | |
4805edc4 | 11 | use pbs_tools::cert::CertInfo; |
6b68e5d5 | 12 | |
2b7f8dd5 | 13 | pub mod catalog_shell; |
eb5e0ae6 | 14 | pub mod dynamic_index; |
2b7f8dd5 WB |
15 | pub mod pxar; |
16 | pub mod tools; | |
17 | ||
aa1b2e04 | 18 | mod merge_known_chunks; |
c443f58b | 19 | pub mod pipe_to_stream; |
e3dbd41b | 20 | |
151c6ce2 | 21 | mod http_client; |
c443f58b | 22 | pub use http_client::*; |
151c6ce2 | 23 | |
89d25b19 SR |
24 | mod vsock_client; |
25 | pub use vsock_client::*; | |
26 | ||
5a0b484b DM |
27 | mod task_log; |
28 | pub use task_log::*; | |
29 | ||
9e490a74 DM |
30 | mod backup_reader; |
31 | pub use backup_reader::*; | |
32 | ||
cf9271e2 DM |
33 | mod backup_writer; |
34 | pub use backup_writer::*; | |
35 | ||
7f99bf69 DM |
36 | mod remote_chunk_reader; |
37 | pub use remote_chunk_reader::*; | |
38 | ||
8968258b DM |
39 | mod pxar_backup_stream; |
40 | pub use pxar_backup_stream::*; | |
151c6ce2 DM |
41 | |
42 | mod backup_repo; | |
43 | pub use backup_repo::*; | |
07ad6470 | 44 | |
7cc3473a DM |
45 | mod backup_specification; |
46 | pub use backup_specification::*; | |
47 | ||
38629c39 WB |
48 | mod chunk_stream; |
49 | pub use chunk_stream::{ChunkStream, FixedChunkStream}; | |
50 | ||
4805edc4 WB |
51 | pub const PROXMOX_BACKUP_TCP_KEEPALIVE_TIME: u32 = 120; |
52 | ||
6b68e5d5 DM |
53 | /// Connect to localhost:8007 as root@pam |
54 | /// | |
55 | /// This automatically creates a ticket if run as 'root' user. | |
01a08021 WB |
56 | pub fn connect_to_localhost(auth_key: Option<&PKey<Private>>) -> Result<HttpClient, Error> { |
57 | let options = if let Some(auth_key) = auth_key { | |
6b68e5d5 | 58 | let ticket = Ticket::new("PBS", Userid::root_userid())? |
01a08021 | 59 | .sign(auth_key, None)?; |
9eb78407 | 60 | let fingerprint = CertInfo::new()?.fingerprint()?; |
01a08021 | 61 | HttpClientOptions::new_non_interactive(ticket, Some(fingerprint)) |
6b68e5d5 | 62 | } else { |
01a08021 | 63 | HttpClientOptions::new_interactive(None, None) |
6b68e5d5 DM |
64 | }; |
65 | ||
01a08021 | 66 | HttpClient::new("localhost", 8007, Authid::root_auth_id(), options) |
6b68e5d5 | 67 | } |