<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Languid Onee-san/ryoooo</title>
    <description>The latest articles on DEV Community by Languid Onee-san/ryoooo (@ryoooo).</description>
    <link>https://dev.to/ryoooo</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F2878028%2F74718969-f60a-467d-ae09-fb83322b0a37.jpg</url>
      <title>DEV Community: Languid Onee-san/ryoooo</title>
      <link>https://dev.to/ryoooo</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/ryoooo"/>
    <language>en</language>
    <item>
      <title>I Built a Reasonably Secure OpenClaw Box with Spare PC Parts, NixOS, and microVMs</title>
      <dc:creator>Languid Onee-san/ryoooo</dc:creator>
      <pubDate>Wed, 25 Feb 2026 02:37:42 +0000</pubDate>
      <link>https://dev.to/ryoooo/i-built-a-reasonably-secure-openclaw-box-with-spare-pc-parts-nixos-and-microvms-2177</link>
      <guid>https://dev.to/ryoooo/i-built-a-reasonably-secure-openclaw-box-with-spare-pc-parts-nixos-and-microvms-2177</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;Lately everyone in the AI agent scene is spinning up Docker Sandbox on a Mac mini for an isolated environment. I get the appeal. But the cheapest Mac mini config is ¥94,800 (~$630). And with memory prices through the roof, buying or building any new PC hurts right now. So I built one from spare parts. A B360M motherboard and an RTX 3060 Ti that had been collecting dust in my closet.&lt;/p&gt;

&lt;p&gt;Now here's the thing. Did you know the Docker docs say this?&lt;br&gt;
&lt;strong&gt;"MicroVM-based sandboxes require macOS or Windows (experimental). Linux users can use legacy container-based sandboxes with Docker Desktop 4.57."&lt;/strong&gt;&lt;br&gt;
In other words, microVM sandboxes aren't available on Linux. What you're left with is the legacy approach — namespaces and cgroups sharing the host kernel. One kernel vulnerability and you're all the way through to the host.&lt;/p&gt;

&lt;p&gt;And here's another thing: what happens when that isolated environment breaks? You've been hand-crafting Docker images, placing secret keys with shell scripts, and calling it done because it works… but can you reproduce it? When a host OS update breaks everything, are you confident you can rebuild the same environment from scratch?&lt;/p&gt;

&lt;p&gt;There's only one point I want to make in this article. Isolation isn't just about "locking things in." Don't you want to be able to rebuild the same cage, anytime, as many times as you need? Declaratively defined isolation, reproduced with a single command. That's what I did with NixOS and microvm.nix, and that's what this article is about.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Kernel Isolation + Declarative Reproducibility
&lt;/h2&gt;

&lt;p&gt;Simon Willison has a concept he calls the "&lt;a href="https://simonwillison.net/2025/Jun/16/the-lethal-trifecta/" rel="noopener noreferrer"&gt;lethal trifecta&lt;/a&gt;": access to private data, processing untrusted content, and the ability to communicate externally. When all three come together, a system becomes fatally dangerous. AI agents structurally satisfy all three conditions. Doesn't that bother you?&lt;/p&gt;

&lt;p&gt;So you think containers will keep things contained? Think again. runc CVE-2024-21626, CVSS 8.6 — a vulnerability combining process.cwd handling and file descriptor leaks that lets you escape the container. And in November 2025, three runc CVEs dropped simultaneously: CVE-2025-31133, CVE-2025-52565, CVE-2025-52881. The &lt;a href="https://www.cncf.io/blog/2025/11/28/runc-container-breakout-vulnerabilities-a-technical-overview/" rel="noopener noreferrer"&gt;CNCF blog has a technical breakdown&lt;/a&gt;, and every one of them is a container breakout class issue. Containers share the host kernel by design, so a single kernel boundary vulnerability collapses the entire "containment." That's how it works.&lt;/p&gt;

&lt;p&gt;Here's the funny part: Docker knows this. The fact that Docker Sandbox adopted microVMs for macOS and Windows is practically an admission that container isolation isn't enough. Yet Linux is left behind with legacy containers. Ironic, isn't it?&lt;/p&gt;

&lt;p&gt;But kernel isolation alone doesn't make you safe. Isolation should be designed assuming it will be breached. The real question is how fast you can recover when it's compromised.&lt;/p&gt;

&lt;p&gt;Michael Stapelberg, known as the creator of the i3 window manager, wrote about a &lt;a href="https://michael.stapelberg.ch/posts/2026-02-01-coding-agent-microvm-nix/" rel="noopener noreferrer"&gt;microVM setup for AI agents in his February 2026 blog post&lt;/a&gt;. His philosophy is clear: VMs are disposable. If compromised, throw them away and rebuild. Make clean-state reconstruction the operational baseline.&lt;/p&gt;

&lt;p&gt;But this doesn't work if reconstruction is manual. Break it, throw it away, grow the same thing back in 30 seconds. To do that, the entire environment — OS configuration, service definitions, secret placement — must be declaratively defined. Recovery by reading a runbook and typing commands can't be "disposable." That's why declarative reproducibility matters.&lt;/p&gt;

&lt;h2&gt;
  
  
  Locking It Down with microvm.nix + Nix
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fno86rs6unhlo7mn4uyeq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fno86rs6unhlo7mn4uyeq.png" alt="Architecture diagram" width="800" height="502"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I'm not denying that Docker Sandbox is a valid option. It's perfectly practical on macOS. But if you want the same or better on Linux, microvm.nix offers four distinct advantages.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Kernel isolation.&lt;/strong&gt; What Docker Sandbox does with microVMs on macOS — isolation via independent kernels — microvm.nix brings to Linux. Cloud Hypervisor spins up lightweight VMs on KVM, each running its own kernel separate from the host. Inter-VM communication is controlled by nftables: only SSH from the OpenClaw VM to the gogcli VM is permitted; everything else, including the reverse direction, is dropped. Lateral movement is structurally eliminated.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;An observable cage.&lt;/strong&gt; Locking things in isn't enough if you can't see what's happening inside. This setup captures audit logs at three layers. The nftables egress chain logs every outbound VM connection to syslog with a &lt;code&gt;microvm-egress:&lt;/code&gt; prefix. Unbound logs every DNS query. auditd monitors reads, writes, and attribute changes to secrets files. Docker Sandbox only provides domain-level logs via its HTTP/HTTPS proxy, blocking all other protocols outright. With microvm.nix, you get L3/L4 conntrack logs across all protocols. You see not just what was blocked, but what was attempted.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Declarative reproducibility.&lt;/strong&gt; This is the most important part. &lt;code&gt;flake.nix&lt;/code&gt; contains everything: VM definitions, networking, secret injection, plugins, ML servers. &lt;code&gt;flake.lock&lt;/code&gt; records cryptographic hashes of all inputs, so the same lockfile guarantees the same output. A single &lt;code&gt;nixos-rebuild switch&lt;/code&gt; reconstructs the host, VMs, networking, and firewall rules all at once. &lt;code&gt;git clone&lt;/code&gt; onto another machine, run the same command, and an identical isolation environment comes up. This is fundamentally different from Docker's &lt;code&gt;ubuntu:latest&lt;/code&gt; changing contents day to day. Nix doesn't give you "we think it's reproducible" — it guarantees reproduction via cryptographic hashes. …Though it's not perfect. Some packages depend on upstream binaries, which falls outside Nix's guarantees. This has been &lt;a href="https://discourse.nixos.org/t/nix-does-not-guarantee-reproducibility/61662" rel="noopener noreferrer"&gt;discussed on NixOS Discourse&lt;/a&gt;, but I should be honest about it. Even so, incident response is just &lt;code&gt;systemctl stop&lt;/code&gt; → &lt;code&gt;nixos-rebuild switch&lt;/code&gt;. Since there's no mutable state, you never have to wonder "is this actually clean?"&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Disposability.&lt;/strong&gt; This only works because of declarative reproducibility. An environment you can't declaratively rebuild is an environment you can't throw away. The prerequisite for disposable VMs is being able to grow the same thing back anytime. I get it — it's hard to destroy an environment you've carefully nurtured. I can't even keep houseplants alive, though.&lt;/p&gt;

&lt;p&gt;One last thing. I'm also running prompt injection defense. nyosegawa's &lt;a href="https://github.com/nyosegawa/openclaw-defender" rel="noopener noreferrer"&gt;openclaw-defender&lt;/a&gt; provides three-layer defense, and I just &lt;a href="https://github.com/ryoooo/nix-openclaw-defender" rel="noopener noreferrer"&gt;packaged it for NixOS&lt;/a&gt;. See &lt;a href="https://nyosegawa.github.io/posts/openclaw-defender/" rel="noopener noreferrer"&gt;nyosegawa's writeup&lt;/a&gt; for details.&lt;/p&gt;

&lt;h2&gt;
  
  
  Closing Thoughts
&lt;/h2&gt;

&lt;p&gt;Docker Sandbox on a Mac — that's a reasonable choice. The microVM-based sandbox works properly on macOS, and for most people that's plenty. I'm not telling anyone to go install NixOS.&lt;/p&gt;

&lt;p&gt;But if you're running AI agents on Linux with full permissions inside kernel-sharing containers… that's a little scary, isn't it?&lt;br&gt;
If you want kernel isolation, microvm.nix isn't the only answer. Firecracker or QEMU will separate kernels just fine. But when combined with Nix's declarative model, "break it, throw it away, instantly regrow it" becomes an operational reality. There's a meaningful difference between a VM you recover by following a runbook and one you reconstruct with &lt;code&gt;nixos-rebuild switch&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;The configuration is on &lt;a href="https://github.com/ryoooo/microvm-openclaw.nix" rel="noopener noreferrer"&gt;GitHub&lt;/a&gt; — feel free to use it as reference.&lt;/p&gt;

&lt;p&gt;This is far from perfect, so if you have suggestions for improvement, reach out to me at &lt;a href="https://x.com/ryooo8244311427" rel="noopener noreferrer"&gt;@ryooo8244311427&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;…Well, for a box built from spare parts, I'd say it turned out to be a reasonably decent cage.&lt;/p&gt;

&lt;h2&gt;
  
  
  References
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://buduroiu.com/blog/openclaw-microvm/" rel="noopener noreferrer"&gt;buduroiu — OpenClaw microVM&lt;/a&gt; — Security patterns for running OpenClaw in microvm.nix isolation&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://nyosegawa.github.io/posts/openclaw-defender/" rel="noopener noreferrer"&gt;nyosegawa — openclaw-defender&lt;/a&gt; — Three-layer prompt injection defense explained&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://zenn.dev/ryorn/articles/62cc63fe84c98b" rel="noopener noreferrer"&gt;Original article (Japanese)&lt;/a&gt; — この記事の日本語原典&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>openclaw</category>
      <category>ai</category>
      <category>microvm</category>
      <category>nixos</category>
    </item>
  </channel>
</rss>
