@ship.zone/runner 5.2.0 → 5.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/rust/src/guest.rs CHANGED
@@ -1,3 +1,4 @@
1
+ use crate::egress::{run_egress_tunnel, EGRESS_VSOCK_PORT};
1
2
  use crate::oci_tar::{
2
3
  normalize_tar_path, read_tar_entries, write_tar_entry, write_tar_trailer, TarEntry,
3
4
  TarEntryKind,
@@ -13,6 +14,8 @@ use std::os::unix::ffi::OsStrExt;
13
14
  use std::os::unix::fs::{MetadataExt, OpenOptionsExt, PermissionsExt};
14
15
  use std::os::unix::net::UnixListener;
15
16
  use std::path::{Component, Path, PathBuf};
17
+ use std::sync::atomic::{AtomicU16, Ordering};
18
+ use std::sync::Arc;
16
19
  use std::time::{Duration, Instant};
17
20
 
18
21
  pub const VSOCK_PORT: u32 = 1024;
@@ -71,6 +74,8 @@ enum GuestRequest {
71
74
  mode: Option<String>,
72
75
  #[serde(default, rename = "npmrcContent")]
73
76
  npmrc_content: Option<String>,
77
+ #[serde(default, rename = "enableEgress")]
78
+ enable_egress: bool,
74
79
  },
75
80
  ImportTar {
76
81
  #[serde(rename = "maximumBytes")]
@@ -89,6 +94,8 @@ enum GuestRequest {
89
94
  gid: u32,
90
95
  #[serde(default, rename = "rootMode")]
91
96
  root_mode: bool,
97
+ #[serde(default, rename = "egressEnabled")]
98
+ egress_enabled: bool,
92
99
  #[serde(rename = "timeoutMs")]
93
100
  timeout_ms: u64,
94
101
  #[serde(rename = "memoryBytes")]
@@ -134,6 +141,8 @@ enum GuestRequest {
134
141
  export_cache_dir: Option<String>,
135
142
  #[serde(default, rename = "buildctlPath")]
136
143
  buildctl_path: Option<String>,
144
+ #[serde(default, rename = "egressProxyUrl")]
145
+ egress_proxy_url: Option<String>,
137
146
  },
138
147
  ExportTar {
139
148
  selections: Vec<String>,
@@ -164,6 +173,8 @@ struct HelloResponse {
164
173
  #[serde(rename_all = "camelCase")]
165
174
  struct SimpleOkResponse {
166
175
  ok: bool,
176
+ #[serde(skip_serializing_if = "Option::is_none")]
177
+ egress_proxy_port: Option<u16>,
167
178
  }
168
179
 
169
180
  #[derive(Serialize)]
@@ -207,6 +218,7 @@ struct GuestContext {
207
218
  workspace_dir: PathBuf,
208
219
  npmrc_dir: Option<PathBuf>,
209
220
  step_counter: u64,
221
+ egress_proxy_port: Arc<AtomicU16>,
210
222
  }
211
223
 
212
224
  fn read_frame<R: Read>(reader: &mut R) -> io::Result<Option<(u8, Vec<u8>)>> {
@@ -328,6 +340,7 @@ fn handle_connection<S: Read + Write + AsRawFd>(
328
340
  gid,
329
341
  mode,
330
342
  npmrc_content,
343
+ enable_egress,
331
344
  } => match prepare_workspace(
332
345
  ctx,
333
346
  workspace_size_bytes,
@@ -338,7 +351,31 @@ fn handle_connection<S: Read + Write + AsRawFd>(
338
351
  npmrc_content.as_deref(),
339
352
  ) {
340
353
  Ok(()) => {
341
- let _ = send_json(stream, &SimpleOkResponse { ok: true });
354
+ let egress_proxy_port = if enable_egress {
355
+ let deadline = Instant::now() + Duration::from_secs(5);
356
+ let mut port = ctx.egress_proxy_port.load(Ordering::Acquire);
357
+ while port == 0 && Instant::now() < deadline {
358
+ std::thread::sleep(Duration::from_millis(10));
359
+ port = ctx.egress_proxy_port.load(Ordering::Acquire);
360
+ }
361
+ if port == 0 {
362
+ let _ = send_error(
363
+ stream,
364
+ "egress proxy tunnel was not established on vsock port 1025",
365
+ );
366
+ continue;
367
+ }
368
+ Some(port)
369
+ } else {
370
+ None
371
+ };
372
+ let _ = send_json(
373
+ stream,
374
+ &SimpleOkResponse {
375
+ ok: true,
376
+ egress_proxy_port,
377
+ },
378
+ );
342
379
  }
343
380
  Err(msg) => {
344
381
  let _ = send_error(stream, msg);
@@ -387,6 +424,7 @@ fn handle_connection<S: Read + Write + AsRawFd>(
387
424
  uid,
388
425
  gid,
389
426
  root_mode,
427
+ egress_enabled,
390
428
  timeout_ms,
391
429
  memory_bytes,
392
430
  cpus,
@@ -408,6 +446,7 @@ fn handle_connection<S: Read + Write + AsRawFd>(
408
446
  uid,
409
447
  gid,
410
448
  root_mode,
449
+ egress_enabled,
411
450
  timeout_ms,
412
451
  memory_bytes,
413
452
  cpus,
@@ -443,6 +482,7 @@ fn handle_connection<S: Read + Write + AsRawFd>(
443
482
  import_cache_dir,
444
483
  export_cache_dir,
445
484
  buildctl_path,
485
+ egress_proxy_url,
446
486
  } => {
447
487
  match execute_image_build(
448
488
  stream,
@@ -464,6 +504,7 @@ fn handle_connection<S: Read + Write + AsRawFd>(
464
504
  import_cache_dir,
465
505
  export_cache_dir,
466
506
  buildctl_path,
507
+ egress_proxy_url,
467
508
  },
468
509
  ) {
469
510
  Ok(res) => {
@@ -508,7 +549,13 @@ fn handle_connection<S: Read + Write + AsRawFd>(
508
549
  }
509
550
  },
510
551
  GuestRequest::Shutdown => {
511
- let _ = send_json(stream, &SimpleOkResponse { ok: true });
552
+ let _ = send_json(
553
+ stream,
554
+ &SimpleOkResponse {
555
+ ok: true,
556
+ egress_proxy_port: None,
557
+ },
558
+ );
512
559
  return Ok(true);
513
560
  }
514
561
  }
@@ -952,6 +999,7 @@ struct StepSpec {
952
999
  uid: u32,
953
1000
  gid: u32,
954
1001
  root_mode: bool,
1002
+ egress_enabled: bool,
955
1003
  timeout_ms: u64,
956
1004
  memory_bytes: u64,
957
1005
  cpus: f64,
@@ -1115,17 +1163,21 @@ unsafe fn setup_pid1_step_sandbox(
1115
1163
  spec: &StepSpec,
1116
1164
  ) -> Result<(), &'static str> {
1117
1165
  let oci_rootfs = target_rootfs;
1118
- // Isolate mount, IPC, UTS, and network namespaces (loopback only).
1119
- if unsafe {
1120
- libc::unshare(
1121
- libc::CLONE_NEWNS | libc::CLONE_NEWIPC | libc::CLONE_NEWUTS | libc::CLONE_NEWNET,
1122
- )
1123
- } != 0
1124
- {
1166
+ // Isolate mount, IPC, UTS, and (unless host-proxied egress is enabled) network namespaces.
1167
+ // Even with egress enabled, the Firecracker microVM has no NIC — only loopback (`lo`) —
1168
+ // so the step can reach only the guest-init loopback proxy backed by host vsock port 1025.
1169
+ let unshare_flags = if spec.egress_enabled {
1170
+ libc::CLONE_NEWNS | libc::CLONE_NEWIPC | libc::CLONE_NEWUTS
1171
+ } else {
1172
+ libc::CLONE_NEWNS | libc::CLONE_NEWIPC | libc::CLONE_NEWUTS | libc::CLONE_NEWNET
1173
+ };
1174
+ if unsafe { libc::unshare(unshare_flags) } != 0 {
1125
1175
  return Err("unshare failed");
1126
1176
  }
1127
- unsafe {
1128
- bring_up_loopback();
1177
+ if !spec.egress_enabled {
1178
+ unsafe {
1179
+ bring_up_loopback();
1180
+ }
1129
1181
  }
1130
1182
 
1131
1183
  // Make all mounts private so our changes never leak back.
@@ -1276,21 +1328,31 @@ unsafe fn setup_pid1_step_sandbox(
1276
1328
  }
1277
1329
  }
1278
1330
 
1279
- // pivot_root into oci_rootfs using /tmp/.oldroot as put_old, then detach & remove oldroot.
1280
- let put_old = oci_rootfs.join("tmp/.oldroot");
1281
- fs::create_dir(&put_old).map_err(|_| "mkdir put_old failed")?;
1282
- let put_old_c = CString::new(put_old.as_os_str().as_bytes()).unwrap();
1283
- if unsafe { libc::syscall(libc::SYS_pivot_root, rootfs_c.as_ptr(), put_old_c.as_ptr()) } != 0 {
1284
- return Err("pivot_root failed");
1331
+ // Switch root into oci_rootfs inside our private mount namespace.
1332
+ // Note: pivot_root(2) returns EINVAL when current / is initramfs (rootfs), so use the
1333
+ // standard Linux switch_root sequence: chdir(new_root) -> mount(".", "/", MS_MOVE) -> chroot(".").
1334
+ if unsafe { libc::chdir(rootfs_c.as_ptr()) } != 0 {
1335
+ return Err("chdir oci_rootfs failed");
1336
+ }
1337
+ let dot = CString::new(".").unwrap();
1338
+ if unsafe {
1339
+ libc::mount(
1340
+ dot.as_ptr(),
1341
+ slash.as_ptr(),
1342
+ std::ptr::null(),
1343
+ libc::MS_MOVE,
1344
+ std::ptr::null(),
1345
+ )
1346
+ } != 0
1347
+ {
1348
+ return Err("mount MS_MOVE rootfs failed");
1349
+ }
1350
+ if unsafe { libc::chroot(dot.as_ptr()) } != 0 {
1351
+ return Err("chroot rootfs failed");
1285
1352
  }
1286
1353
  if unsafe { libc::chdir(slash.as_ptr()) } != 0 {
1287
1354
  return Err("chdir / failed");
1288
1355
  }
1289
- let old_in_new = CString::new("/tmp/.oldroot").unwrap();
1290
- unsafe {
1291
- libc::umount2(old_in_new.as_ptr(), libc::MNT_DETACH);
1292
- }
1293
- let _ = fs::remove_dir("/tmp/.oldroot");
1294
1356
 
1295
1357
  if !spec.root_mode {
1296
1358
  // OCI mode: remount root filesystem read-only and drop all privileges to numeric uid:gid.
@@ -1666,6 +1728,7 @@ struct ImageBuildSpec {
1666
1728
  import_cache_dir: Option<String>,
1667
1729
  export_cache_dir: Option<String>,
1668
1730
  buildctl_path: Option<String>,
1731
+ egress_proxy_url: Option<String>,
1669
1732
  }
1670
1733
 
1671
1734
  fn base64_encode(input: &[u8]) -> String {
@@ -1872,10 +1935,18 @@ fn execute_image_build<S: Read + Write + AsRawFd>(
1872
1935
  .iter()
1873
1936
  .map(|a| CString::new(a.as_bytes()).map_err(|_| "buildctl arg contains NUL".to_owned()))
1874
1937
  .collect::<Result<_, _>>()?;
1875
- let env_pairs = [
1938
+ let mut env_pairs = vec![
1876
1939
  format!("DOCKER_CONFIG={}", docker_config_dir.display()),
1877
1940
  "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin".to_owned(),
1878
1941
  ];
1942
+ if let Some(ref proxy_url) = spec.egress_proxy_url {
1943
+ env_pairs.push(format!("HTTP_PROXY={proxy_url}"));
1944
+ env_pairs.push(format!("HTTPS_PROXY={proxy_url}"));
1945
+ env_pairs.push(format!("http_proxy={proxy_url}"));
1946
+ env_pairs.push(format!("https_proxy={proxy_url}"));
1947
+ env_pairs.push("NO_PROXY=localhost,127.0.0.1,::1".to_owned());
1948
+ env_pairs.push("no_proxy=localhost,127.0.0.1,::1".to_owned());
1949
+ }
1879
1950
  let envp: Vec<CString> = env_pairs
1880
1951
  .iter()
1881
1952
  .map(|e| CString::new(e.as_bytes()).unwrap())
@@ -2106,6 +2177,38 @@ pub fn run_pid1() -> Result<(), Error> {
2106
2177
  );
2107
2178
  }
2108
2179
 
2180
+ #[cfg(target_os = "linux")]
2181
+ unsafe {
2182
+ bring_up_loopback();
2183
+ }
2184
+
2185
+ let egress_proxy_port = Arc::new(AtomicU16::new(0));
2186
+ if let Ok(egress_listener) = listen_vsock(EGRESS_VSOCK_PORT) {
2187
+ let port_for_thread = Arc::clone(&egress_proxy_port);
2188
+ std::thread::spawn(move || loop {
2189
+ let client_fd = unsafe {
2190
+ libc::accept4(
2191
+ egress_listener.as_raw_fd(),
2192
+ std::ptr::null_mut(),
2193
+ std::ptr::null_mut(),
2194
+ libc::SOCK_CLOEXEC,
2195
+ )
2196
+ };
2197
+ if client_fd < 0 {
2198
+ if io::Error::last_os_error().kind() == io::ErrorKind::Interrupted {
2199
+ continue;
2200
+ }
2201
+ std::thread::sleep(Duration::from_millis(20));
2202
+ continue;
2203
+ }
2204
+ let writer_file = unsafe { File::from_raw_fd(client_fd) };
2205
+ let Ok(reader_file) = writer_file.try_clone() else {
2206
+ continue;
2207
+ };
2208
+ run_egress_tunnel(reader_file, writer_file, Arc::clone(&port_for_thread), 18080);
2209
+ });
2210
+ }
2211
+
2109
2212
  let listener = listen_vsock(VSOCK_PORT)?;
2110
2213
  let mut ctx = GuestContext {
2111
2214
  pid1_mode: true,
@@ -2114,6 +2217,7 @@ pub fn run_pid1() -> Result<(), Error> {
2114
2217
  workspace_dir: PathBuf::from("/workspace"),
2115
2218
  npmrc_dir: None,
2116
2219
  step_counter: 0,
2220
+ egress_proxy_port,
2117
2221
  };
2118
2222
 
2119
2223
  loop {
@@ -2166,6 +2270,7 @@ pub fn serve_unix_socket(
2166
2270
  workspace_dir: workspace_dir.to_path_buf(),
2167
2271
  npmrc_dir: None,
2168
2272
  step_counter: 0,
2273
+ egress_proxy_port: Arc::new(AtomicU16::new(0)),
2169
2274
  };
2170
2275
  println!("listening");
2171
2276
  let _ = io::stdout().flush();
package/rust/src/lib.rs CHANGED
@@ -2,6 +2,7 @@
2
2
  compile_error!("runnerworkspace requires a Unix platform");
3
3
 
4
4
  pub mod cpio;
5
+ pub mod egress;
5
6
  pub mod extfs;
6
7
  pub mod guest;
7
8
  pub mod oci_tar;
@@ -3,6 +3,6 @@
3
3
  */
4
4
  export const commitinfo = {
5
5
  name: '@ship.zone/runner',
6
- version: '5.2.0',
6
+ version: '5.4.0',
7
7
  description: 'The Firecracker microVM OCI job runner for ship.zone CI/CD'
8
8
  }
package/ts/api-client.ts CHANGED
@@ -271,7 +271,7 @@ const identifierField = (value: string, field: string): string => {
271
271
  return value;
272
272
  };
273
273
 
274
- const errorDetail = (body: Uint8Array): string | undefined => {
274
+ const parseErrorPayload = (body: Uint8Array): { code: string; message: string } | undefined => {
275
275
  if (body.byteLength === 0) return undefined;
276
276
  let parsed: unknown;
277
277
  try {
@@ -281,7 +281,12 @@ const errorDetail = (body: Uint8Array): string | undefined => {
281
281
  }
282
282
  if (!isValidWireMessage('ErrorResponse', parsed)) return undefined;
283
283
  const { code, message } = (parsed as IErrorResponse).error;
284
- return `${code}: ${sanitizeErrorText(message)}`;
284
+ return { code, message: sanitizeErrorText(message) };
285
+ };
286
+
287
+ const errorDetail = (body: Uint8Array): string | undefined => {
288
+ const parsed = parseErrorPayload(body);
289
+ return parsed ? `${parsed.code}: ${parsed.message}` : undefined;
285
290
  };
286
291
 
287
292
  export class RunnerApiClient {
@@ -847,7 +852,13 @@ export class RunnerApiClient {
847
852
  operation: string,
848
853
  ): Promise<never> {
849
854
  const body = await readBoundedBody(response, this.options.maximumResponseBytes);
850
- if (response.status === 401 || response.status === 403) throw new AuthenticationError();
855
+ if (response.status === 401 || response.status === 403) {
856
+ const parsed = parseErrorPayload(body);
857
+ throw new AuthenticationError(
858
+ parsed ? `Runner authentication was rejected (${parsed.code}: ${parsed.message})` : undefined,
859
+ parsed?.code,
860
+ );
861
+ }
851
862
  if (response.status === 409 && fenced) throw new LeaseLostError();
852
863
  if (response.status === 413) {
853
864
  throw new ProtocolError('Coordinator rejected a request above the protocol limit');
package/ts/cli.ts CHANGED
@@ -9,7 +9,12 @@ import {
9
9
  validateRunnerConfig,
10
10
  withRunnerCredential,
11
11
  } from './config.js';
12
- import { ConfigurationError } from './errors.js';
12
+ import { decommissionRunnerHost } from './decommission.js';
13
+ import {
14
+ ConfigurationError,
15
+ isRunnerDecommissionedError,
16
+ RUNNER_DECOMMISSIONED_EXIT_CODE,
17
+ } from './errors.js';
13
18
  import type {
14
19
  IRegisterRunnerRequest,
15
20
  IRegisterRunnerResponse,
@@ -32,13 +37,14 @@ interface IParsedArguments {
32
37
 
33
38
  const cliInvocation = 'ship-zone-runner';
34
39
 
35
- const BOOLEAN_FLAGS = new Set<string>(['allow-insecure-loopback']);
40
+ const BOOLEAN_FLAGS = new Set<string>(['allow-insecure-loopback', 'allow-egress', 'from-systemd']);
36
41
  const VALUE_OPTIONS = new Set<string>([
37
42
  'config',
38
43
  'control-plane',
39
44
  'name',
40
45
  'labels',
41
46
  'state-directory',
47
+ 'service-name',
42
48
  'kernel-path',
43
49
  'builder-rootfs-path',
44
50
  'builder-image',
@@ -53,11 +59,12 @@ const VALUE_OPTIONS = new Set<string>([
53
59
  const usage = `ship.zone runner ${runnerVersion} (Firecracker microVM · ci-spec ${runnerSpecVersion})
54
60
 
55
61
  Usage:
56
- ${cliInvocation} enroll --control-plane <url> [--config <path>] [--name <name>] [--labels <a,b>] [--kernel-path <path>] [--builder-rootfs-path <path> | --builder-image <ref@sha256:...>] [--smartvm-socket <path>]
57
- ${cliInvocation} init --control-plane <url> [--config <path>] [--name <name>] [--labels <a,b>] [--kernel-path <path>] [--builder-rootfs-path <path> | --builder-image <ref@sha256:...>] [--smartvm-socket <path>]
62
+ ${cliInvocation} enroll --control-plane <url> [--config <path>] [--name <name>] [--labels <a,b>] [--allow-egress] [--kernel-path <path>] [--builder-rootfs-path <path> | --builder-image <ref@sha256:...>] [--smartvm-socket <path>]
63
+ ${cliInvocation} init --control-plane <url> [--config <path>] [--name <name>] [--labels <a,b>] [--allow-egress] [--kernel-path <path>] [--builder-rootfs-path <path> | --builder-image <ref@sha256:...>] [--smartvm-socket <path>]
58
64
  ${cliInvocation} register [--config <path>]
59
65
  ${cliInvocation} run [--config <path>]
60
66
  ${cliInvocation} once [--config <path>]
67
+ ${cliInvocation} decommission-host [--config <path>] [--state-directory <path>] [--service-name <name>] [--from-systemd]
61
68
  ${cliInvocation} config [--config <path>]
62
69
  ${cliInvocation} version | --version
63
70
 
@@ -92,9 +99,9 @@ export const parseArguments = (arguments_: string[]): IParsedArguments => {
92
99
  '--profile was removed in 5.0.0; one unified microVM runner executes oci, vm, and oci-image jobs',
93
100
  );
94
101
  }
95
- if (name === 'allow-egress' || name === 'allow-network') {
102
+ if (name === 'allow-network') {
96
103
  throw new ConfigurationError(
97
- `--${name} is not supported yet; Firecracker guest egress transport is not wired`,
104
+ `--${name} is not supported; use --allow-egress to enable host-enforced egress`,
98
105
  );
99
106
  }
100
107
  throw new ConfigurationError(`Unknown option: --${name}`);
@@ -219,6 +226,7 @@ const buildConfigFromOptions = (
219
226
  const helperPath = singleOption(options, 'workspace-helper-path');
220
227
  if (helperPath) config.oci.workspaceHelperPath = helperPath;
221
228
  if (flags.has('allow-insecure-loopback')) config.allowInsecureLoopback = true;
229
+ if (flags.has('allow-egress')) config.oci.allowedNetworks = ['none', 'egress'];
222
230
  const blockedCidrs = listOption(options, 'egress-blocked-cidr');
223
231
  if (blockedCidrs) config.oci.egressBlockedCidrs = blockedCidrs;
224
232
  validateRunnerConfig(config);
@@ -317,6 +325,7 @@ const runDaemon = async (
317
325
  const signals = ['SIGINT', 'SIGTERM'] as const;
318
326
  for (const signal of signals) process.on(signal, shutdownListener);
319
327
  const executor = new MicroVmExecutor(config, stateOwner);
328
+ let decommissionedError: unknown;
320
329
  try {
321
330
  const api = apiFor(config);
322
331
  const reportMessage = (message: string): void => console.error(message);
@@ -336,11 +345,59 @@ const runDaemon = async (
336
345
  });
337
346
  const result = await runner.run({ once, signal: shutdown.signal });
338
347
  if (once) console.log(result.claimed ? `Job ${result.status}` : 'No job available');
348
+ } catch (error) {
349
+ if (isRunnerDecommissionedError(error)) {
350
+ decommissionedError = error;
351
+ } else {
352
+ throw error;
353
+ }
339
354
  } finally {
340
355
  for (const signal of signals) process.off(signal, shutdownListener);
341
356
  await executor.close().catch(() => {});
342
357
  await stateOwner.release();
343
358
  }
359
+
360
+ if (isRunnerDecommissionedError(decommissionedError)) {
361
+ const isRoot = typeof process.getuid === 'function' && process.getuid() === 0;
362
+ const result = await decommissionRunnerHost({
363
+ configPath: path,
364
+ stateDirectory: config.stateDirectory,
365
+ removeSystemdService: isRoot,
366
+ });
367
+ const reason = decommissionedError.code === 'runner_deleted' ? 'deleted' : 'revoked';
368
+ console.error(
369
+ `Runner was ${reason} by the control plane; removed ${result.removedPaths.length} local path(s)${result.removedService ? ' and systemd service' : ''}.`,
370
+ );
371
+ process.exitCode = RUNNER_DECOMMISSIONED_EXIT_CODE;
372
+ }
373
+ };
374
+
375
+ const runDecommissionHost = async (
376
+ options: Map<string, string[]>,
377
+ flags: Set<string>,
378
+ ): Promise<void> => {
379
+ if (flags.has('from-systemd')) {
380
+ const exitCode = process.env.EXIT_CODE;
381
+ const exitStatus = process.env.EXIT_STATUS;
382
+ if (exitCode !== 'exited' || exitStatus !== String(RUNNER_DECOMMISSIONED_EXIT_CODE)) {
383
+ return;
384
+ }
385
+ }
386
+ const path = configPath(options);
387
+ const stateDirectory = options.get('state-directory')?.at(-1);
388
+ const serviceName = options.get('service-name')?.at(-1);
389
+ const result = await decommissionRunnerHost({
390
+ configPath: path,
391
+ stateDirectory,
392
+ removeSystemdService: true,
393
+ serviceName,
394
+ });
395
+ console.log(
396
+ `Decommissioned runner host: removed ${result.removedPaths.length} path(s)${result.removedService ? ' and systemd service' : ''}`,
397
+ );
398
+ for (const warning of result.warnings) {
399
+ console.error(`Warning: ${warning}`);
400
+ }
344
401
  };
345
402
 
346
403
  export const runCli = async (arguments_: string[]): Promise<void> => {
@@ -362,6 +419,9 @@ export const runCli = async (arguments_: string[]): Promise<void> => {
362
419
  case 'once':
363
420
  await runDaemon(options, true);
364
421
  break;
422
+ case 'decommission-host':
423
+ await runDecommissionHost(options, flags);
424
+ break;
365
425
  case 'config': {
366
426
  const config = await loadRunnerConfig(configPath(options));
367
427
  console.log(JSON.stringify(maskRunnerConfig(config), null, 2));
package/ts/config.ts CHANGED
@@ -188,13 +188,18 @@ const validTimestamp = (value: string): boolean => {
188
188
  /**
189
189
  * Network modes enforceable by the Firecracker microVM runner:
190
190
  * - `none`: isolated guest namespace with loopback only.
191
- * Host-enforced `egress` guest transport is not yet wired into Firecracker/smartvm, so
192
- * advertising `egress` is rejected fail-closed instead of silently running egress jobs offline.
191
+ * - `egress`: host-enforced DNS/IP/port/SNI/Host allowlist proxy tunneled over Firecracker AF_VSOCK.
193
192
  */
194
193
  const requireEnforceableNetworks = (networks: readonly string[]): void => {
195
- if (networks.length !== 1 || networks[0] !== 'none') {
194
+ const valid = new Set(['none', 'egress']);
195
+ if (
196
+ networks.length === 0 ||
197
+ networks.length > 2 ||
198
+ new Set(networks).size !== networks.length ||
199
+ networks.some((entry) => !valid.has(entry))
200
+ ) {
196
201
  throw new ConfigurationError(
197
- 'oci.allowedNetworks must be ["none"]; Firecracker guest egress transport is not yet wired',
202
+ 'oci.allowedNetworks must be a non-empty subset of ["none", "egress"]',
198
203
  );
199
204
  }
200
205
  };