forked from oasisprotocol/oasis-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request oasisprotocol#2136 from oasisprotocol/kostko/featu…
…re/rofl-containers-secrets rofl-containers: Add support for container secret provisioning
- Loading branch information
Showing
12 changed files
with
280 additions
and
28 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ | |
mod routes; | ||
pub mod services; | ||
pub(crate) mod state; | ||
pub mod types; | ||
|
||
use std::sync::Arc; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
//! Various types used by rofl-appd. | ||
use oasis_runtime_sdk::core::common::crypto::{mrae::deoxysii, x25519}; | ||
|
||
/// Envelope used for storing encrypted secrets. | ||
#[derive(Clone, Debug, Default, cbor::Encode, cbor::Decode)] | ||
pub struct SecretEnvelope { | ||
/// Ephemeral public key used for X25519. | ||
pub pk: x25519::PublicKey, | ||
/// Nonce. | ||
pub nonce: [u8; deoxysii::NONCE_SIZE], | ||
/// Encrypted secret name. | ||
pub name: Vec<u8>, | ||
/// Encrypted secret value. | ||
pub value: Vec<u8>, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[package] | ||
name = "rofl-containers" | ||
version = "0.2.1" | ||
version = "0.3.0" | ||
edition = "2021" | ||
|
||
[dependencies] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
use anyhow::Result; | ||
use cmd_lib::run_cmd; | ||
|
||
/// Initialize container environment. | ||
pub async fn init() -> Result<()> { | ||
// Setup networking. | ||
run_cmd!( | ||
mount none -t tmpfs "/tmp"; | ||
udhcpc -i eth0 -q -n; | ||
)?; | ||
|
||
// Mount cgroups and create /dev/shm for Podman locks. | ||
run_cmd!( | ||
mount -t cgroup2 none "/sys/fs/cgroup"; | ||
mkdir -p "/dev/shm"; | ||
mount -t tmpfs none "/dev/shm"; | ||
)?; | ||
|
||
// Cleanup state after reboot. | ||
run_cmd!( | ||
rm -rf "/storage/containers/run"; | ||
rm -rf "/storage/containers/net"; | ||
rm -rf "/var/lib/cni"; | ||
|
||
mkdir -p "/storage/containers/run"; | ||
mkdir -p "/storage/containers/graph"; | ||
mkdir -p "/storage/containers/graph/tmp"; | ||
mkdir -p "/storage/containers/net"; | ||
)?; | ||
|
||
// Update TUN device permissions. | ||
run_cmd!(chmod 0666 "/dev/net/tun")?; | ||
|
||
// Migrate existing containers if needed. | ||
run_cmd!( | ||
podman system migrate; | ||
podman system prune --external; | ||
)?; | ||
|
||
Ok(()) | ||
} | ||
|
||
/// Start containers. | ||
pub async fn start() -> Result<()> { | ||
// Bring containers up. | ||
run_cmd!( | ||
cd "/etc/oasis/containers"; | ||
podman-compose up --detach --remove-orphans --force-recreate; | ||
)?; | ||
|
||
Ok(()) | ||
} |
Oops, something went wrong.