pub enum ServiceAccount {
LocalSystem,
Root,
InvokingUser,
}Expand description
The account a registration runs under.
Not an operator choice. It is a function of the start mode and the platform,
because the start mode decides which secret store the daemon must read and
the store’s own access control decides which accounts can read it. See
docs/service-account.md, and review_least_privilege for the check.
Variants§
LocalSystem
NT AUTHORITY\SYSTEM. The only stock Windows account named by the
machine-scoped store’s DACL.
Root
root. What a LaunchDaemon and a systemd system unit run as, and what
the macOS System Keychain’s root-only master key requires.
InvokingUser
The operator’s own account, for a login-mode registration.
Implementations§
Source§impl ServiceAccount
impl ServiceAccount
Sourcepub const fn for_definition(kind: DefinitionKind, mode: StartMode) -> Self
pub const fn for_definition(kind: DefinitionKind, mode: StartMode) -> Self
The account a given kind of definition obliges.
Keyed on the definition rather than on cfg!(windows), and the
difference is not academic: a Windows developer rendering the launchd
property list would otherwise write UserName = NT AUTHORITY\SYSTEM
into it, which is not an account macOS has. A definition’s account is a
property of the definition, and the whole point of rendering being pure
is that any host can render any platform’s and get the right answer.
Sourcepub const fn for_start_mode(mode: StartMode) -> Self
pub const fn for_start_mode(mode: StartMode) -> Self
The account the given start mode obliges on the platform this binary was built for.
Sourcepub const fn justification(&self) -> &'static str
pub const fn justification(&self) -> &'static str
Why this is the minimum account that can do the job, not merely the convenient one.
Printed by service status and by review_least_privilege, because a
privileged account with no stated reason is indistinguishable from a
privileged account nobody thought about.
Sourcepub const fn needs_elevation(&self) -> bool
pub const fn needs_elevation(&self) -> bool
Whether registering under this account needs administrative rights.
Trait Implementations§
Source§impl Clone for ServiceAccount
impl Clone for ServiceAccount
Source§fn clone(&self) -> ServiceAccount
fn clone(&self) -> ServiceAccount
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more