Skip to main content

ConnectConfig

Struct ConnectConfig 

Source
pub struct ConnectConfig {
    pub hosts: BTreeMap<String, SignstarHost>,
    pub users: BTreeMap<String, ConnectOptions>,
}
Expand description

Connection configuration for sending a signature request.

The configuration tracks a list of all valid targets for connecting.

Fields§

§hosts: BTreeMap<String, SignstarHost>

List of hosts configured.

§users: BTreeMap<String, ConnectOptions>

List of users.

Implementations§

Source§

impl ConnectConfig

Source

pub const CONFIG_ORDER: &[&str]

The order of configuration files.

The following files are inspected, in descending priority:

  • /etc/signstar/request-signature.toml
  • /run/signstar/request-signature.toml
  • /usr/share/signstar/request-signature.toml
Source

pub async fn connect(&self, username: &str) -> Result<Session, Error>

Connects to a host over SSH and returns a Session object.

This function sets up an authenticated, bidirectional channel between the client and the server. No signing requests are exchanged at this point but any number of them can be issued later using Session::send function.

§Examples
use signstar_request_signature::ssh::client::ConnectConfig;

let options = ConnectConfig::from_first_system_config()?;

let mut session = options.connect("user").await?;
// use session to send signing requests
§Errors

Returns an error if:

  • the client public key is not set,
  • the server public key is not present in the provided SSH known_hosts data,
  • the client public key is not recognized by the server,
  • the client authentication with the agent fails,
  • an SSH protocol error is encountered.
Source

fn first_existing_system_config() -> Result<PathBuf, Error>

Return the first configuration file that exists in the filesystem out of Self::CONFIG_ORDER list or returns a crate::Error::ConfigMissing error.

§Errors

Returns an error:

Source

pub fn from_first_system_config() -> Result<Self, Error>

Return the configuration created from the first configuration file that exists in the filesystem out of Self::CONFIG_ORDER list or returns a crate::Error::ConfigMissing error.

§Errors

Returns an error:

Source

pub fn from_config_file(file: impl AsRef<Path>) -> Result<Self, Error>

Reads the configuration file, validates it and returns the ConnectConfig.

§Errors

Returns an error:

Trait Implementations§

Source§

impl Debug for ConnectConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for ConnectConfig

Source§

fn default() -> ConnectConfig

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for ConnectConfig

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Validate for ConnectConfig

Source§

type Context = ()

A user-provided context. Read more
Source§

fn validate_into( &self, __garde_user_ctx: &Self::Context, __garde_path: &mut dyn FnMut() -> Path, __garde_report: &mut Report, )

Validates Self, aggregating all validation errors into Report.
§

fn validate(&self) -> Result<(), Report>
where Self::Context: Default,

Validates Self, returning an Err with an aggregate of all errors if the validation failed. Read more
§

fn validate_with(&self, ctx: &Self::Context) -> Result<(), Report>

Validates Self, returning an Err with an aggregate of all errors if the validation failed. Read more

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, 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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,