move pbs_config::tape_encryption_keys to pbs crate lib

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
Wolfgang Bumiller 2022-12-12 14:26:02 +01:00
parent 1104d2a268
commit 8ebb984fbe
10 changed files with 12 additions and 14 deletions

View File

@ -27,5 +27,3 @@ proxmox-time.workspace = true
pbs-api-types.workspace = true
pbs-buildcfg.workspace = true
pbs-key-config.workspace = true
pbs-tools.workspace = true

View File

@ -10,7 +10,6 @@ pub mod network;
pub mod prune;
pub mod remote;
pub mod sync;
pub mod tape_encryption_keys;
pub mod tape_job;
pub mod token_shadow;
pub mod traffic_control;

View File

@ -13,10 +13,11 @@ use pbs_api_types::{
use pbs_config::CachedUserInfo;
use pbs_config::open_backup_lockfile;
use pbs_config::tape_encryption_keys::{
use pbs_key_config::KeyConfig;
use crate::tape::encryption_keys::{
insert_key, load_key_configs, load_keys, save_key_configs, save_keys, TAPE_KEYS_LOCKFILE,
};
use pbs_key_config::KeyConfig;
#[api(
input: {

View File

@ -22,7 +22,6 @@ use pbs_api_types::{
use pbs_api_types::{PRIV_TAPE_AUDIT, PRIV_TAPE_READ, PRIV_TAPE_WRITE};
use pbs_config::tape_encryption_keys::insert_key;
use pbs_config::CachedUserInfo;
use pbs_tape::{
linux_list_drives::{lookup_device_identification, lto_tape_device_list, open_lto_tape_device},
@ -40,6 +39,7 @@ use crate::{
open_lto_tape_drive, required_media_changer, set_tape_device_state, LtoTapeHandle,
TapeDriver,
},
encryption_keys::insert_key,
file_formats::{MediaLabel, MediaSetLabel},
lock_media_pool, lock_media_set, lock_unassigned_media_pool, Inventory, MediaCatalog,
MediaId, TAPE_STATUS_DIR,

View File

@ -10,11 +10,11 @@ use pbs_api_types::{
TAPE_ENCRYPTION_KEY_FINGERPRINT_SCHEMA,
};
use pbs_config::tape_encryption_keys::{complete_key_fingerprint, load_key_configs};
use pbs_datastore::paperkey::{generate_paper_key, PaperkeyFormat};
use pbs_key_config::KeyConfig;
use proxmox_backup::api2;
use proxmox_backup::tape::encryption_keys::{complete_key_fingerprint, load_key_configs};
pub fn encryption_key_commands() -> CommandLineInterface {
let cmd_def = CliCommandMap::new()

View File

@ -6,9 +6,9 @@ use proxmox_schema::api;
use pbs_api_types::MEDIA_POOL_NAME_SCHEMA;
use pbs_config::media_pool::complete_pool_name;
use pbs_config::tape_encryption_keys::complete_key_fingerprint;
use proxmox_backup::api2;
use proxmox_backup::tape::encryption_keys::complete_key_fingerprint;
pub fn pool_commands() -> CommandLineInterface {
let cmd_def = CliCommandMap::new()

View File

@ -294,7 +294,7 @@ impl TapeDriver for LtoTapeHandle {
) -> Result<(), Error> {
if nix::unistd::Uid::effective().is_root() {
if let Some((ref key_fingerprint, ref uuid)) = key_fingerprint {
let (key_map, _digest) = pbs_config::tape_encryption_keys::load_keys()?;
let (key_map, _digest) = crate::tape::encryption_keys::load_keys()?;
match key_map.get(key_fingerprint) {
Some(item) => {
// derive specialized key for each media-set

View File

@ -15,11 +15,11 @@ use std::collections::HashMap;
use anyhow::{bail, Error};
use serde::{Deserialize, Serialize};
use pbs_api_types::Fingerprint;
use pbs_key_config::KeyConfig;
use proxmox_sys::fs::file_read_optional_string;
use crate::{open_backup_lockfile, replace_backup_config, replace_secret_config};
use pbs_api_types::Fingerprint;
use pbs_config::{open_backup_lockfile, replace_backup_config, replace_secret_config};
use pbs_key_config::KeyConfig;
mod hex_key {
use hex::FromHex;

View File

@ -18,8 +18,8 @@ mod inventory;
pub use inventory::*;
pub mod changer;
pub mod drive;
pub mod encryption_keys;
mod media_pool;
pub use media_pool::*;

View File

@ -15,13 +15,13 @@ use anyhow::{bail, Error};
use proxmox_sys::{task_log, task_warn};
use proxmox_uuid::Uuid;
use pbs_config::tape_encryption_keys::load_key_configs;
use pbs_datastore::{DataStore, SnapshotReader};
use pbs_tape::{sg_tape::tape_alert_flags_critical, TapeWrite};
use proxmox_rest_server::WorkerTask;
use crate::tape::{
drive::{media_changer, request_and_load_media, TapeDriver},
encryption_keys::load_key_configs,
file_formats::{
tape_write_catalog, tape_write_snapshot_archive, ChunkArchiveWriter, MediaSetLabel,
},