wasmer_config/app/
ssh.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
use indexmap::IndexMap;
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};

/// Configure SSH server credentials and settings.
#[derive(Serialize, Deserialize, JsonSchema, Clone, Debug, PartialEq, Eq)]
pub struct CapabilitySshServerV1 {
    /// Enable an SSH server.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub enabled: Option<bool>,

    #[serde(skip_serializing_if = "Option::is_none")]
    pub users: Option<Vec<SshUserV1>>,

    /// Additional unknown fields.
    /// This provides a small bit of forwards compatibility.
    #[serde(flatten)]
    pub other: IndexMap<String, serde_json::Value>,
}

#[derive(Serialize, Deserialize, JsonSchema, PartialEq, Eq, Clone, Debug)]
pub struct SshUserV1 {
    /// The username used for SSH login.
    pub username: String,

    /// Passwords for this user.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub passwords: Option<Vec<PasswordV1>>,

    /// SSH public keys for this user.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub authorized_keys: Option<Vec<String>>,

    /// Additional unknown fields.
    /// This provides a small bit of forwards compatibility.
    #[serde(flatten)]
    pub other: IndexMap<String, serde_json::Value>,
}

#[derive(Serialize, Deserialize, JsonSchema, PartialEq, Eq, Clone, Debug)]
#[serde(rename_all = "snake_case", tag = "type")]
pub enum PasswordV1 {
    /// Plain text password.
    Plain { password: String },
    /// Bcrypt password hash.
    Bcrypt { hash: String },
}