[team] Team vaults: member keys, member slots (kind 6), policies per environment, the canonical sign.request, approval statements, policy proofs; cosign and Tauri updater envelopes; v0.18.0
This commit is contained in:
@@ -0,0 +1,66 @@
|
||||
//! Target credentials (docs/TEAM.md, "Target credentials"): what they are, and the plaintext a released one is
|
||||
//! sealed as.
|
||||
|
||||
use std::fmt;
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "kebab-case")]
|
||||
pub enum TargetKind {
|
||||
/// An OpenSSH private key.
|
||||
SshKey,
|
||||
/// A WinRM user and password.
|
||||
Winrm,
|
||||
/// An OpenSSH user and password.
|
||||
Openssh,
|
||||
/// A Docker registry token.
|
||||
Registry,
|
||||
/// A kubeconfig.
|
||||
Kubeconfig,
|
||||
}
|
||||
|
||||
impl TargetKind {
|
||||
pub fn word(self) -> &'static str {
|
||||
match self {
|
||||
TargetKind::SshKey => "ssh-key",
|
||||
TargetKind::Winrm => "winrm",
|
||||
TargetKind::Openssh => "openssh",
|
||||
TargetKind::Registry => "registry",
|
||||
TargetKind::Kubeconfig => "kubeconfig",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// The largest target credential.
|
||||
pub const MAX_SECRET: usize = 64 * 1024;
|
||||
|
||||
/// A released credential, as sealed to the Fabrica server's one-time key (`team-target:<request id>`).
|
||||
#[derive(Clone, PartialEq, Eq, Serialize, Deserialize)]
|
||||
#[serde(deny_unknown_fields)]
|
||||
pub struct TargetRelease {
|
||||
pub v: u32,
|
||||
pub op: String,
|
||||
pub team: String,
|
||||
pub target: String,
|
||||
pub kind: TargetKind,
|
||||
pub name: String,
|
||||
pub host: String,
|
||||
pub user: String,
|
||||
pub secret: String,
|
||||
/// The deployment's request hash.
|
||||
pub deployment: String,
|
||||
pub project: String,
|
||||
pub env: String,
|
||||
}
|
||||
|
||||
impl fmt::Debug for TargetRelease {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
f.debug_struct("TargetRelease")
|
||||
.field("target", &self.target)
|
||||
.field("kind", &self.kind)
|
||||
.field("deployment", &self.deployment)
|
||||
.field("secret", &"[redacted]")
|
||||
.finish_non_exhaustive()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user