# vmsan
**Repository Path**: lu9944_admin/vmsan
## Basic Information
- **Project Name**: vmsan
- **Description**: θͺε»Ίvmsan
- **Primary Language**: TypeScript
- **License**: Apache-2.0
- **Default Branch**: master
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 0
- **Forks**: 0
- **Created**: 2026-03-29
- **Last Updated**: 2026-06-10
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
vmsan
π₯ Firecracker microVM sandbox toolkit
[](https://npmjs.com/package/vmsan)
[](https://npm.chart.dev/vmsan)
[](https://bundlephobia.com/package/vmsan)
[](https://packagephobia.com/result?p=vmsan)
[](https://github.com/angelorc/vmsan/blob/main/LICENSE)
Create, manage, and connect to isolated [Firecracker](https://github.com/firecracker-microvm/firecracker) microVMs from the command line. Boot a sandboxed VM in milliseconds, run commands, transfer files β no SSH required.
> π **[Read the full documentation at vmsan.dev](https://vmsan.dev)**
## β¨ Features
- β‘ **Millisecond boot** β Firecracker microVMs start in < 200ms
- π **Security isolation** β jailer, seccomp, cgroups, and per-VM network namespaces
- π₯οΈ **Interactive shell** β WebSocket PTY with full terminal support
- π **File transfer** β upload and download without SSH
- π³ **Docker images** β build rootfs from any OCI image with `--from-image`
- π **Command execution** β run commands with streaming output, env injection, and sudo
- π§© **Multiple runtimes** β `base`, `node22`, `node24`, `python3.13`
- πΈ **VM snapshots** β save and restore VM state
- π **JSON output** β `--json` flag for scripting and automation
## π Prerequisites
- Linux (x86_64 or aarch64) with KVM support
- Root/sudo access (required for TAP device networking and jailer)
- Docker (for source installs, local runtime rebuilds, and `--from-image`)
## π Install
```bash
curl -fsSL https://vmsan.dev/install | bash
```
This downloads and installs everything into `~/.vmsan/`:
- Firecracker + Jailer (latest release)
- Linux kernel (vmlinux 6.1)
- Ubuntu 24.04 rootfs (converted from squashfs to ext4)
- vmsan CLI + in-VM agent
- Runtime images (`node22`, `node24`, `python3.13`) downloaded as prebuilt artifacts
Standard release installs download built-in runtimes from `https://artifacts.vmsan.dev/` and do not require Docker. Source installs still build runtimes locally.
Uninstall
```bash
curl -fsSL https://vmsan.dev/install | bash -s -- --uninstall
```
Development setup
If you want to build from source:
```bash
# Install dependencies
bun install
# Build the in-VM agent
cd agent && make install && cd ..
# Build the CLI
bun run build
# Link local build
mkdir -p ~/.vmsan/bin
ln -sf "$(pwd)/dist/bin/cli.mjs" ~/.vmsan/bin/vmsan
```
## π Usage
```bash
# Create and start a VM
vmsan create --runtime node22 --memory 512 --cpus 2
# Create a VM from a Docker image
vmsan create --from-image node:22-alpine
# List all VMs
vmsan list
# Execute a command inside a VM
vmsan exec ls -la
# Interactive exec with PTY
vmsan exec -i bash
# Connect to a running VM shell
vmsan connect
# Upload a file to a VM
vmsan upload ./local-file.txt -d /remote/path/
# Download a file from a VM
vmsan download /remote/path/file.txt -d ./local-file.txt
# Snapshot a running VM
vmsan snapshot create
# List snapshots
vmsan snapshot list
# Restore a VM from a snapshot
vmsan create --snapshot
# Stop a VM
vmsan stop
# Remove a VM
vmsan remove
```
### Global flags
| Flag | Description |
| ----------- | -------------------------- |
| `--json` | Output structured JSON |
| `--verbose` | Show detailed debug output |
### Commands
| Command | Alias | Description |
| ---------- | ----- | ------------------------------------- |
| `create` | | Create and start a new microVM |
| `list` | `ls` | List all VMs |
| `start` | | Start a stopped VM |
| `stop` | | Stop a running VM |
| `remove` | `rm` | Remove a VM |
| `exec` | | Execute a command inside a running VM |
| `connect` | | Open an interactive shell to a VM |
| `upload` | | Upload files to a VM |
| `download` | | Download files from a VM |
| `network` | | Update network policy on a running VM |
| `snapshot` | | Manage VM snapshots (create, list, delete) |
| `doctor` | | Check system prerequisites and installation health |
## β οΈ Known Limitations
- No inter-VM networking (planned for 0.4.0)
- No declarative config / `vmsan.toml` (planned for 0.5.0)
- No multi-host support (planned for 0.7.0)
- Uses `nftables` with atomic rule application for network isolation (since 0.2.0)
- No DNS or SNI filtering (planned for 0.3.0)
- ICMP blocked by default from VMs (prevents ICMP tunneling)
- UDP blocked by default except DNS (prevents UDP exfiltration; QUIC/HTTP3 will not work)
- NTP (UDP 123) blocked β kvm-clock used for time sync, long-running VMs may drift
- Host firewall (ufw/firewalld) may need explicit allow rules for vmsan traffic
- Linux only β requires KVM support
- Primary platform: Ubuntu 24.04 LTS
## π οΈ Development
```bash
# Build
bun run build
# Link local build
ln -sf "$(pwd)/dist/bin/cli.mjs" ~/.vmsan/bin/vmsan
# Dev mode (watch)
bun run dev
# Run tests
bun run test
# Type check
bun run typecheck
# Lint & format
bun run lint
bun run fmt
```
## ποΈ Architecture
```
bin/ CLI entry point
src/
commands/ CLI subcommands
services/ Firecracker client, agent client, VM service
lib/ Utilities (jailer, networking, shell, logging)
errors/ Typed error system
generated/ Firecracker API type definitions
agent/ Go agent that runs inside the VM
docs/ Documentation site (vmsan.dev)
```
### How it works
1. **vmsan** uses [Firecracker](https://github.com/firecracker-microvm/firecracker) to create lightweight microVMs with a jailer for security isolation
2. Each VM gets a TAP network device with its own `/30` subnet (`198.19.{slot}.0/30`)
3. A Go-based **agent** runs inside the VM, exposing an HTTP API for command execution, file operations, and shell access
4. The CLI communicates with the agent over the host-guest network
State is persisted in `~/.vmsan/`:
```
~/.vmsan/
vms/ VM state files (JSON)
jailer/ Chroot directories
bin/ Agent binary
kernels/ VM kernel images
rootfs/ Base root filesystems
registry/ Docker image rootfs cache
snapshots/ VM snapshots
```
## βοΈ How vmsan compares
| | vmsan | Docker | gVisor | Kata Containers | Vagrant |
|---|---|---|---|---|---|
| **Isolation level** | β
Hardware (KVM) | β Shared kernel | β οΈ User-space kernel | β
Hardware (QEMU/CH) | β
Hardware (VBox/VMware) |
| **Boot time** | β
~125ms | β
~50ms | β
~5ms | β οΈ ~200ms+ | β 30-60s |
| **Setup complexity** | β
One command | β
Low | β οΈ Medium | β High | β οΈ Medium |
| **Security model** | β
Jailer + seccomp + cgroups + dedicated kernel | β οΈ Namespaces + cgroups | β οΈ Syscall filtering | β
Full VM + nested containers | β
Full VM |
| **Network isolation** | β
Built-in policies (allow/deny/custom) | β Manual (iptables) | β οΈ Inherits Docker | β Manual | β οΈ NAT/bridged |
| **Docker image support** | β
`--from-image` | β
Native | β
Via runsc | β
Via containerd | β |
| **Interactive shell** | β
WebSocket PTY | β
exec | β
exec | β
exec | β
SSH |
| **File transfer** | β
Built-in upload/download | β
cp | β
cp | β
cp | β οΈ Shared folders / SCP |
| **JSON output** | β
All commands | β οΈ Partial | β | β οΈ Partial | β |
| **Memory overhead** | β
~5 MiB per VM | β
~1 MiB | β οΈ ~15 MiB | β ~30 MiB+ | β 512 MiB+ |
| **Best for** | π AI sandboxing, untrusted code, multi-tenant | General workloads | K8s hardening | K8s compliance | Dev environments |
**Why vmsan?** Docker shares the host kernel β a container escape means game over. gVisor intercepts syscalls in user-space, reducing attack surface but not eliminating it. Kata Containers provides real VM isolation but requires complex orchestration (containerd, shimv2, K8s). Vagrant boots full VMs that take 30+ seconds and hundreds of MBs.
vmsan gives you **hardware-level isolation** with Firecracker's minimal attack surface (< 50k lines of code), boots in **milliseconds**, and requires **zero configuration** β install and go.
## π License
[Apache-2.0](./LICENSE)
Published under the [APACHE-2.0](https://github.com/angelorc/vmsan/blob/main/LICENSE) license.
Made by [@angelorc](https://github.com/angelorc) and [community](https://github.com/angelorc/vmsan/graphs/contributors) π
---
_π€ auto updated with [automd](https://automd.unjs.io)_