Skip to main content

FirecrackerConfig

Struct FirecrackerConfig 

Source
pub struct FirecrackerConfig {
Show 16 fields pub binary_path: PathBuf, pub kernel_image_path: PathBuf, pub rootfs_image_path: PathBuf, pub jailer_binary_path: Option<PathBuf>, pub chroot_base_dir: PathBuf, pub socket_dir: PathBuf, pub jailer_uid: u32, pub jailer_gid: u32, pub scratch_dir: Option<PathBuf>, pub manifest_path: Option<PathBuf>, pub require_jailer: bool, pub allow_no_manifest: bool, pub enable_network: bool, pub allow_no_vsock: bool, pub no_vsock_timeout: Duration, pub no_seccomp: bool,
}

Fields§

§binary_path: PathBuf§kernel_image_path: PathBuf§rootfs_image_path: PathBuf§jailer_binary_path: Option<PathBuf>§chroot_base_dir: PathBuf§socket_dir: PathBuf

Directory for Firecracker API socket files; defaults to /tmp. Ignored when the jailer is active — the jailer places the API socket inside the chroot at <chroot_base>/<fc_filename>/<cell_id>/root/run/firecracker.socket.

§jailer_uid: u32

Numeric uid the jailer drops to before exec’ing firecracker. Defaults to 10002. This user must exist on the host and must own no sensitive files.

§jailer_gid: u32

Numeric gid the jailer drops to before exec’ing firecracker. Defaults to 10002.

§scratch_dir: Option<PathBuf>

Directory where per-cell writable scratch ext4 images are created. When set, rootfs is mounted read-only and a writable scratch drive is attached as a second virtio-blk device. When None (default), rootfs is mounted read-write (v0.2 behaviour — not safe for concurrent cells sharing the same rootfs image).

§manifest_path: Option<PathBuf>

Path to the artifact manifest file produced by the build pipeline. When set, create() verifies the SHA256 digest of each declared artifact (kernel, rootfs, optionally firecracker) before booting the VM. When None AND allow_no_manifest is true, verification is skipped with a loud warning — supported for development only. Otherwise, from_env() rejects the configuration outright.

§require_jailer: bool

When true (the default), create() refuses to proceed unless the jailer binary is configured. Operators may opt out for development by setting CELLOS_FIRECRACKER_ALLOW_NO_JAILER=1, which logs a loud warning and downgrades this flag to false.

§allow_no_manifest: bool

When true, create() will permit booting a VM without a manifest (skipping pre-boot artifact digest verification). Defaults to false — a missing CELLOS_FIRECRACKER_MANIFEST is a hard error. Operators may opt out for development by setting BOTH CELLOS_FIRECRACKER_ALLOW_NO_MANIFEST=1 AND the second escape-hatch flag CELLOS_FIRECRACKER_ALLOW_NO_MANIFEST_REALLY=1; only the combination flips this flag to true and emits a loud WARN log containing the literal string MANIFEST VERIFICATION DISABLED.

The two-flag handshake is deliberate. A single env var can be set in a shared base image, a Helm chart copied between environments, or an .env file leaking from dev to prod by mistake. Requiring a paired _REALLY flag forces the operator to make the trade-off explicit on the same line, in the same operation, so the dev opt-out cannot drift into a production deployment unnoticed.

It is an error to set both CELLOS_FIRECRACKER_MANIFEST and the two-flag opt-out — that combination is inconsistent and from_env() rejects it. Setting CELLOS_FIRECRACKER_ALLOW_NO_MANIFEST=1 without the paired _REALLY flag (or vice-versa) is also rejected with a hard error so misconfigured deployments fail closed.

§enable_network: bool

When true, create() provisions a per-cell TAP interface, attaches it to the VM as virtio-net, and installs an nftables ruleset that drops all egress except destinations declared in spec.authority.egressRules. Linux-only: defaults to true on Linux and false on every other OS (the ip and nft commands and TAP devices do not exist there). Override with CELLOS_FIRECRACKER_ENABLE_NETWORK=0|1.

§allow_no_vsock: bool

When true, [wait_for_command_exit] uses a short bounded timeout instead of waiting indefinitely for the in-VM vsock exit code.

Motivation: a kernel built with the wrong vsock symbol (CONFIG_VIRTIO_VSOCK is a typo for CONFIG_VIRTIO_VSOCKETS) silently has no vsock device. The supervisor then waits forever for a 4-byte exit code that no one will ever send, and the only signal the operator gets is a hung process. Set CELLOS_FIRECRACKER_ALLOW_NO_VSOCK=1 (and optionally CELLOS_FIRECRACKER_NO_VSOCK_TIMEOUT_SECS=<n> — default 5) to fail fast and surface the misconfiguration in seconds.

The terminal state for the cell will be forced (no authenticated in-VM exit was received), which is the correct audit signal.

§no_vsock_timeout: Duration

Wait budget when allow_no_vsock is true. Ignored otherwise. Default: 5 seconds. Override via CELLOS_FIRECRACKER_NO_VSOCK_TIMEOUT_SECS.

§no_seccomp: bool

When true, passes --no-seccomp to the Firecracker process.

Firecracker’s seccomp BPF filters are compiled with x86-64 syscall numbers. Under arm64 emulation (Rosetta/QEMU in Colima) the BPF program is rejected by the kernel with EINVAL because the syscall table doesn’t match. Set CELLOS_FIRECRACKER_NO_SECCOMP=1 to bypass seccomp for emulated development environments.

Never set this in production. Seccomp is a critical attack-surface reduction — bypassing it removes a significant isolation layer.

Implementations§

Trait Implementations§

Source§

impl Clone for FirecrackerConfig

Source§

fn clone(&self) -> FirecrackerConfig

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for FirecrackerConfig

Source§

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

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

impl PartialEq for FirecrackerConfig

Source§

fn eq(&self, other: &FirecrackerConfig) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Eq for FirecrackerConfig

Source§

impl StructuralPartialEq for FirecrackerConfig

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.
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