pub struct SshPolicy {
pub rules: Vec<SshRule>,
}Expand description
An owned Tailscale SSH policy. Mirrors tailcfg.SSHPolicy.
Fields§
§rules: Vec<SshRule>Rules evaluated in order; the first matching rule decides the connection.
Implementations§
Source§impl SshPolicy
impl SshPolicy
Sourcepub fn from_serde(p: &SSHPolicy<'_>) -> Self
pub fn from_serde(p: &SSHPolicy<'_>) -> Self
Build the owned policy from the borrowed wire view parsed off the netmap.
Sourcepub fn evaluate_at_unix(
&self,
id: &SshConnIdentity,
requested_user: &str,
now_unix_secs: i64,
) -> SshDecision
pub fn evaluate_at_unix( &self, id: &SshConnIdentity, requested_user: &str, now_unix_secs: i64, ) -> SshDecision
Evaluate this policy as of a wall-clock time given in Unix seconds.
Convenience wrapper over evaluate for callers that cannot construct a
chrono::DateTime<Utc> (the workspace pins chrono without its clock feature, so
Utc::now() is unavailable outside crates that carry chrono). An out-of-range timestamp is
clamped to the Unix epoch — for rule-expiry that at worst treats a rule as already-expired
(fail-closed).
Sourcepub fn evaluate(
&self,
id: &SshConnIdentity,
requested_user: &str,
now: DateTime<Utc>,
) -> SshDecision
pub fn evaluate( &self, id: &SshConnIdentity, requested_user: &str, now: DateTime<Utc>, ) -> SshDecision
Evaluate this policy against an incoming connection requesting requested_user, as of
now. Returns the first matching rule’s outcome, or a default-deny.
This is the Rust analogue of Go evalSSHPolicy: first-match-wins over the ordered rules,
default-deny when nothing matches.
Trait Implementations§
impl Eq for SshPolicy
impl StructuralPartialEq for SshPolicy
Auto Trait Implementations§
impl Freeze for SshPolicy
impl RefUnwindSafe for SshPolicy
impl Send for SshPolicy
impl Sync for SshPolicy
impl Unpin for SshPolicy
impl UnsafeUnpin for SshPolicy
impl UnwindSafe for SshPolicy
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.