2019-02-16 11:28:50 +00:00
|
|
|
//! Exports configuration data from the build system
|
|
|
|
|
2022-04-06 14:57:36 +00:00
|
|
|
pub const PROXMOX_PKG_VERSION: &str = concat!(
|
|
|
|
env!("CARGO_PKG_VERSION_MAJOR"),
|
|
|
|
".",
|
|
|
|
env!("CARGO_PKG_VERSION_MINOR"),
|
|
|
|
);
|
2021-07-19 12:59:17 +00:00
|
|
|
pub const PROXMOX_PKG_RELEASE: &str = env!("CARGO_PKG_VERSION_PATCH");
|
|
|
|
pub const PROXMOX_PKG_REPOID: &str = env!("REPOID");
|
|
|
|
|
2019-02-16 11:28:50 +00:00
|
|
|
/// The configured configuration directory
|
2019-09-11 10:06:59 +00:00
|
|
|
pub const CONFIGDIR: &str = "/etc/proxmox-backup";
|
2019-09-09 08:51:08 +00:00
|
|
|
pub const JS_DIR: &str = "/usr/share/javascript/proxmox-backup";
|
2019-02-04 14:13:03 +00:00
|
|
|
|
2021-09-01 10:21:51 +00:00
|
|
|
/// Unix system user used by proxmox-backup-proxy
|
|
|
|
pub const BACKUP_USER_NAME: &str = "backup";
|
|
|
|
/// Unix system group used by proxmox-backup-proxy
|
|
|
|
pub const BACKUP_GROUP_NAME: &str = "backup";
|
|
|
|
|
2020-11-02 07:50:56 +00:00
|
|
|
#[macro_export]
|
2022-04-06 14:57:36 +00:00
|
|
|
macro_rules! PROXMOX_BACKUP_RUN_DIR_M {
|
|
|
|
() => {
|
|
|
|
"/run/proxmox-backup"
|
|
|
|
};
|
|
|
|
}
|
2020-11-02 07:50:56 +00:00
|
|
|
|
2021-11-12 06:29:18 +00:00
|
|
|
#[macro_export]
|
2022-04-06 14:57:36 +00:00
|
|
|
macro_rules! PROXMOX_BACKUP_STATE_DIR_M {
|
|
|
|
() => {
|
|
|
|
"/var/lib/proxmox-backup"
|
|
|
|
};
|
|
|
|
}
|
2021-11-12 06:29:18 +00:00
|
|
|
|
2020-11-02 07:50:56 +00:00
|
|
|
#[macro_export]
|
2022-04-06 14:57:36 +00:00
|
|
|
macro_rules! PROXMOX_BACKUP_LOG_DIR_M {
|
|
|
|
() => {
|
|
|
|
"/var/log/proxmox-backup"
|
|
|
|
};
|
|
|
|
}
|
2020-11-02 07:50:56 +00:00
|
|
|
|
2021-04-01 15:43:52 +00:00
|
|
|
#[macro_export]
|
2022-04-06 14:57:36 +00:00
|
|
|
macro_rules! PROXMOX_BACKUP_CACHE_DIR_M {
|
|
|
|
() => {
|
|
|
|
"/var/cache/proxmox-backup"
|
|
|
|
};
|
|
|
|
}
|
2021-04-01 15:43:52 +00:00
|
|
|
|
|
|
|
#[macro_export]
|
|
|
|
macro_rules! PROXMOX_BACKUP_FILE_RESTORE_BIN_DIR_M {
|
2022-04-06 14:57:36 +00:00
|
|
|
() => {
|
|
|
|
"/usr/lib/x86_64-linux-gnu/proxmox-backup/file-restore"
|
|
|
|
};
|
2021-04-01 15:43:52 +00:00
|
|
|
}
|
|
|
|
|
2020-11-02 07:50:56 +00:00
|
|
|
/// namespaced directory for in-memory (tmpfs) run state
|
|
|
|
pub const PROXMOX_BACKUP_RUN_DIR: &str = PROXMOX_BACKUP_RUN_DIR_M!();
|
2020-11-02 18:18:36 +00:00
|
|
|
|
2021-11-12 06:29:18 +00:00
|
|
|
/// namespaced directory for persistent state
|
|
|
|
pub const PROXMOX_BACKUP_STATE_DIR: &str = PROXMOX_BACKUP_STATE_DIR_M!();
|
|
|
|
|
2020-11-02 07:50:56 +00:00
|
|
|
/// namespaced directory for persistent logging
|
|
|
|
pub const PROXMOX_BACKUP_LOG_DIR: &str = PROXMOX_BACKUP_LOG_DIR_M!();
|
|
|
|
|
2021-03-10 15:37:09 +00:00
|
|
|
/// logfile for all API requests handled by the proxy and privileged API daemons. Note that not all
|
2020-11-04 15:12:13 +00:00
|
|
|
/// failed logins can be logged here with full information, use the auth log for that.
|
2020-11-02 07:50:56 +00:00
|
|
|
pub const API_ACCESS_LOG_FN: &str = concat!(PROXMOX_BACKUP_LOG_DIR_M!(), "/api/access.log");
|
2020-10-16 09:06:46 +00:00
|
|
|
|
2021-03-10 15:37:09 +00:00
|
|
|
/// logfile for any failed authentication, via ticket or via token, and new successful ticket
|
2020-11-04 15:12:13 +00:00
|
|
|
/// creations. This file can be useful for fail2ban.
|
|
|
|
pub const API_AUTH_LOG_FN: &str = concat!(PROXMOX_BACKUP_LOG_DIR_M!(), "/api/auth.log");
|
|
|
|
|
2020-11-02 18:18:36 +00:00
|
|
|
/// the PID filename for the unprivileged proxy daemon
|
|
|
|
pub const PROXMOX_BACKUP_PROXY_PID_FN: &str = concat!(PROXMOX_BACKUP_RUN_DIR_M!(), "/proxy.pid");
|
|
|
|
|
|
|
|
/// the PID filename for the privileged api daemon
|
|
|
|
pub const PROXMOX_BACKUP_API_PID_FN: &str = concat!(PROXMOX_BACKUP_RUN_DIR_M!(), "/api.pid");
|
|
|
|
|
2021-04-01 15:43:52 +00:00
|
|
|
/// filename of the cached initramfs to use for booting single file restore VMs, this file is
|
|
|
|
/// automatically created by APT hooks
|
|
|
|
pub const PROXMOX_BACKUP_INITRAMFS_FN: &str =
|
|
|
|
concat!(PROXMOX_BACKUP_CACHE_DIR_M!(), "/file-restore-initramfs.img");
|
|
|
|
|
2021-05-06 15:26:16 +00:00
|
|
|
/// filename of the cached initramfs to use for debugging single file restore
|
2022-04-06 14:57:36 +00:00
|
|
|
pub const PROXMOX_BACKUP_INITRAMFS_DBG_FN: &str = concat!(
|
|
|
|
PROXMOX_BACKUP_CACHE_DIR_M!(),
|
|
|
|
"/file-restore-initramfs-debug.img"
|
|
|
|
);
|
2021-05-06 15:26:16 +00:00
|
|
|
|
2021-04-01 15:43:52 +00:00
|
|
|
/// filename of the kernel to use for booting single file restore VMs
|
|
|
|
pub const PROXMOX_BACKUP_KERNEL_FN: &str =
|
|
|
|
concat!(PROXMOX_BACKUP_FILE_RESTORE_BIN_DIR_M!(), "/bzImage");
|
|
|
|
|
2019-02-16 11:28:50 +00:00
|
|
|
/// Prepend configuration directory to a file name
|
|
|
|
///
|
|
|
|
/// This is a simply way to get the full path for configuration files.
|
|
|
|
/// #### Example:
|
|
|
|
/// ```
|
2021-07-07 10:14:07 +00:00
|
|
|
/// use pbs_buildcfg::configdir;
|
2019-02-16 11:28:50 +00:00
|
|
|
/// let cert_path = configdir!("/proxy.pfx");
|
|
|
|
/// ```
|
2019-02-04 14:13:03 +00:00
|
|
|
#[macro_export]
|
|
|
|
macro_rules! configdir {
|
2022-04-06 14:57:36 +00:00
|
|
|
($subdir:expr) => {
|
|
|
|
concat!("/etc/proxmox-backup", $subdir)
|
|
|
|
};
|
2019-02-04 14:13:03 +00:00
|
|
|
}
|
2020-12-14 13:11:32 +00:00
|
|
|
|
|
|
|
/// Prepend the run directory to a file name.
|
|
|
|
///
|
|
|
|
/// This is a simply way to get the full path for files in `/run`.
|
|
|
|
#[macro_export]
|
|
|
|
macro_rules! rundir {
|
|
|
|
($subdir:expr) => {
|
2021-07-06 09:56:35 +00:00
|
|
|
concat!($crate::PROXMOX_BACKUP_RUN_DIR_M!(), $subdir)
|
2020-12-14 13:11:32 +00:00
|
|
|
};
|
|
|
|
}
|