pub enum CallerPrincipal {
Uid(u32),
VsockToken,
Unattributed,
}Expand description
Who asked, as opposed to what they were allowed to do.
CallerRole answers “was this permitted”; two members of
sysknife-admin share a role and are indistinguishable by it. The principal
answers “which account”, and is signed into the audit chain
(crate::audit_chain::ChainIdentity::V3) so the trail can name the account
rather than the class.
An account is not a person: a uid survives su, shared logins, and reuse
after a user is deleted. See the attribution-strength limit in SECURITY.md.
Every rendering is scheme:value, and the scheme is signed along with the
value on purpose, because the strength of the evidence differs. uid:1000
was attested by the kernel through SO_PEERCRED. token:vsock means a
pre-shared secret was presented, and any holder of that file could have
presented it. none:unattributed means the daemon could establish neither.
A bare string would erase those distinctions.
Variants§
Uid(u32)
A Unix-socket peer whose uid the kernel supplied at connect().
VsockToken
A vsock connection authenticated by the pre-shared token. No uid exists on that path: the peer is in another kernel.
Unattributed
The daemon could not establish an account for this connection, either
because SO_PEERCRED failed, or because it returned no usable pid, or
because the peer is not representable in this daemon’s namespaces (the
kernel then reports the overflow uid, which names nobody rather than
the caller).
The connection is still handled, at Observer (the pre-existing
fallback), and the row records that attribution failed instead of
inventing a uid. A signed lie about who acted would be worse than a
signed admission of ignorance.
Implementations§
Source§impl CallerPrincipal
impl CallerPrincipal
Sourcepub fn scheme(&self) -> &'static str
pub fn scheme(&self) -> &'static str
Evidence class of this principal. Signed as the part before the colon.
Split out from Self::as_signed_str so a new variant cannot be added
without declaring which class it belongs to, and so
every_principal_renders_as_a_known_scheme can walk the whole set.
Sourcepub fn as_signed_str(&self) -> String
pub fn as_signed_str(&self) -> String
The exact string signed into the chain and stored in caller_principal.
Never empty for any variant, which matters: ChainRow::identity treats an
empty principal on a chain_version = 3 row as a missing one and reports
the row broken. A variant that rendered empty would turn every honest row
on an affected host into a false tamper report.
Sourcepub fn claim(&self) -> PrincipalClaim
pub fn claim(&self) -> PrincipalClaim
What this principal claims about who acted.
Exhaustive on self, so a new variant cannot be added without deciding
here whether it names an account. Self::classify answers for a stored
string by rebuilding the variant and then asking this.
Sourcepub fn classify(stored: &str) -> PrincipalClaim
pub fn classify(stored: &str) -> PrincipalClaim
Read a stored caller_principal back into what it claims about who acted.
Deliberately the inverse of Self::as_signed_str and kept beside it, so
the writer and the reader of this column cannot drift apart.
This is not a parse into Self for the caller’s use, and that is the
point: it classifies strings this daemon may never have written. The census
reads a database column rather than a live connection, so it meets rows
that were tampered with, and rows signed by a newer daemon using a scheme
this binary does not know. Both must come back as
PrincipalClaim::Unrecognized instead of being credited as an account: a
report that turns an unreadable principal into “someone was named” is the
failure mode worth designing against.
Trait Implementations§
Source§impl Clone for CallerPrincipal
impl Clone for CallerPrincipal
Source§fn clone(&self) -> CallerPrincipal
fn clone(&self) -> CallerPrincipal
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for CallerPrincipal
Source§impl Debug for CallerPrincipal
impl Debug for CallerPrincipal
impl Eq for CallerPrincipal
Source§impl PartialEq for CallerPrincipal
impl PartialEq for CallerPrincipal
impl StructuralPartialEq for CallerPrincipal
Auto Trait Implementations§
impl Freeze for CallerPrincipal
impl RefUnwindSafe for CallerPrincipal
impl Send for CallerPrincipal
impl Sync for CallerPrincipal
impl Unpin for CallerPrincipal
impl UnsafeUnpin for CallerPrincipal
impl UnwindSafe for CallerPrincipal
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more