Skip to main content

EnrollService

Struct EnrollService 

Source
pub struct EnrollService {
    pub listen: SocketAddr,
    /* private fields */
}

Fields§

§listen: SocketAddr

Implementations§

Source§

impl EnrollService

Source

pub fn start( config: &EnrollConfig, ) -> Result<(Arc<Self>, UnboundedReceiver<EnrollEvent>), EnrollmentError>

Source

pub fn handle_enroll(&self, body: &[u8], peer: IpAddr) -> HttpReply

Public enroll request body -> reply. Errors are generic towards the caller.

Source

pub async fn handle_build(&self, body: &[u8], peer: IpAddr) -> HttpReply

POST /v1/build: a node-signed request to build and sign a configured recipe. Checks, in order: shape, clock window, replay, node signature (enrolled identity key), status/capability policy (build), then forwards to the build host with a bearer the node never sees. Failures towards the node are generic.

Source

pub async fn handle_node_call(&self, body: &[u8], peer: IpAddr) -> HttpReply

POST /v1/node-call: a node-signed mail/task operation. Same gate as builds (shape, clock, replay, signature, status policy for the operation’s capability), then forwarded to the server’s control API with a bearer only C2 holds. The server re-checks its own ledger.

Source

pub fn handle_operator( &self, method: &str, path: &str, body: &[u8], ) -> HttpReply

Operator endpoints under /v1/enroll/... (the caller has checked the bearer).

Source

pub fn callhome_allowed(&self, node_id: &str) -> bool

Is this node enrolled and allowed to connect (neutral, member, trusted)?

Source

pub fn allows(&self, node_id: &str, capability: &str) -> Option<bool>

Policy decision for an enrolled node: its current status must hold capability.

Source

pub fn reload_policy(&self) -> Result<(), String>

Re-read the policy file. On any error the previous policy stays in force.

Source

pub fn nodes_without(&self, capability: &str) -> Vec<String>

Enrolled nodes whose current status no longer holds capability.

Source

pub async fn signed_call_home( &self, stream: &mut TcpStream, node_id: &str, ) -> Result<String, String>

Run the signed call-home exchange on a socket whose announce named node_id. Returns the per-connection session token on success.

Trait Implementations§

Source§

impl CapabilityGate for EnrollService

Source§

fn allows(&self, node_id: &str, capability: &str) -> Option<bool>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more