<?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: time-scout</title>
    <description>The latest articles on DEV Community by time-scout (@timescout).</description>
    <link>https://dev.to/timescout</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%2F3898912%2F1213577d-b7c3-4820-912e-e88a0b7daaaf.jpeg</url>
      <title>DEV Community: time-scout</title>
      <link>https://dev.to/timescout</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/timescout"/>
    <language>en</language>
    <item>
      <title>How I Secured an Autonomous AI Agent on Oracle’s Free Tier (Without MicroVMs)</title>
      <dc:creator>time-scout</dc:creator>
      <pubDate>Sun, 26 Apr 2026 14:59:55 +0000</pubDate>
      <link>https://dev.to/timescout/how-i-secured-an-autonomous-ai-agent-on-oracles-free-tier-without-microvms-1n5</link>
      <guid>https://dev.to/timescout/how-i-secured-an-autonomous-ai-agent-on-oracles-free-tier-without-microvms-1n5</guid>
      <description>&lt;p&gt;Oracle Cloud’s "Always Free" tier is an absolute goldmine for self-hosters. Getting an Ampere A1 ARM64 instance with 4 Cores and 24GB of RAM for exactly $0/month is perfect for running LLMs and AI agents.&lt;/p&gt;

&lt;p&gt;Recently, I decided to self-host &lt;strong&gt;OpenClaw&lt;/strong&gt;, an autonomous AI agent. But there was a massive catch. &lt;/p&gt;

&lt;p&gt;Autonomous AI agents are inherently dangerous. They execute LLM-generated code, interact with APIs, and hold your highly sensitive keys (OpenAI, Anthropic, Telegram). If an LLM gets tricked via a prompt injection, it could execute a malicious payload.&lt;/p&gt;

&lt;p&gt;The industry standard for isolating risky workloads is using &lt;strong&gt;MicroVMs&lt;/strong&gt; (like Firecracker KVM). &lt;br&gt;
&lt;strong&gt;The problem? Oracle’s Ampere A1 instances do not support nested virtualization or KVM.&lt;/strong&gt; &lt;/p&gt;

&lt;p&gt;If you just spin up a standard Docker container for your AI agent on Oracle Cloud, you are basically begging for a container escape or a Server-Side Request Forgery (SSRF) attack. &lt;/p&gt;

&lt;p&gt;Here is how I built a "Defense-in-Depth" architecture using Terraform and Ansible to lock down the AI agent without needing MicroVMs—and the hidden Oracle networking quirk that almost ruined it.&lt;/p&gt;


&lt;h2&gt;
  
  
  🛑 The SSRF Trap: Oracle’s Hidden &lt;code&gt;InstanceServices&lt;/code&gt; Chain
&lt;/h2&gt;

&lt;p&gt;My biggest fear wasn't just a container escape; it was SSRF. If an attacker tricks the AI agent into curling &lt;code&gt;http://169.254.169.254&lt;/code&gt; (the Cloud Instance Metadata Service - IMDSv2), they can steal the cloud IAM tokens and take over the entire Oracle account.&lt;/p&gt;

&lt;p&gt;To prevent this, I wrote an Ansible task to add a persistent &lt;code&gt;iptables&lt;/code&gt; rule that drops all traffic from the container's user to the metadata IP:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;iptables &lt;span class="nt"&gt;-A&lt;/span&gt; OUTPUT &lt;span class="nt"&gt;-m&lt;/span&gt; owner &lt;span class="nt"&gt;--uid-owner&lt;/span&gt; 232071 &lt;span class="nt"&gt;-d&lt;/span&gt; 169.254.169.254 &lt;span class="nt"&gt;-j&lt;/span&gt; DROP
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;(Note: 232071 is the SubUID mapped to the Rootless Docker container).&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;I thought I was safe. I ran a security audit on the live server, pinged the metadata IP from inside the container, and... &lt;strong&gt;it returned the cloud credentials.&lt;/strong&gt; The DROP rule completely failed.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why?&lt;/strong&gt; &lt;br&gt;
It turns out Oracle's default Ubuntu images come with a pre-configured, hidden &lt;code&gt;iptables&lt;/code&gt; chain called &lt;code&gt;InstanceServices&lt;/code&gt;. This chain explicitly ALLOWS traffic to the metadata API, and it sits at the very top of the routing logic. Because I used &lt;code&gt;-A&lt;/code&gt; (Append), my DROP rule was placed &lt;em&gt;after&lt;/em&gt; Oracle’s ALLOW rule. The traffic never even reached my block.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Fix:&lt;/strong&gt;&lt;br&gt;
I had to update the declarative configuration to use &lt;code&gt;-I&lt;/code&gt; (Insert) instead of Append. This forces the DROP rule to the absolute top of the &lt;code&gt;OUTPUT&lt;/code&gt; chain, successfully overriding Oracle’s default behavior and plugging the SSRF hole.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;iptables &lt;span class="nt"&gt;-I&lt;/span&gt; OUTPUT 1 &lt;span class="nt"&gt;-m&lt;/span&gt; owner &lt;span class="nt"&gt;--uid-owner&lt;/span&gt; 232071 &lt;span class="nt"&gt;-d&lt;/span&gt; 169.254.169.254 &lt;span class="nt"&gt;-j&lt;/span&gt; DROP
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  🛡️ The Defense-in-Depth Architecture
&lt;/h2&gt;

&lt;p&gt;Since KVM wasn't an option, I had to build a multi-layered security onion. I packaged the entire setup into a &lt;strong&gt;Zero-Touch IaC template&lt;/strong&gt; using Terraform (for the cloud hardware) and Ansible (for OS hardening and container deployment).&lt;/p&gt;

&lt;p&gt;Here are the 3 pillars of this setup:&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Extreme Container Isolation (Rootless Docker)
&lt;/h3&gt;

&lt;p&gt;Running the Docker daemon as root was out of the question. &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  &lt;strong&gt;Rootless Mode:&lt;/strong&gt; The entire Docker daemon runs in user space. Even if a payload achieves root &lt;em&gt;inside&lt;/em&gt; the container, it only has unprivileged user access (UID 1000) on the host.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Immutable FS &amp;amp; No-Exec RAM:&lt;/strong&gt; The agent's root filesystem is mounted as &lt;code&gt;read_only: true&lt;/code&gt;. Temporary directories (&lt;code&gt;/tmp&lt;/code&gt;) are mounted in RAM but strictly flagged with &lt;code&gt;noexec&lt;/code&gt; and &lt;code&gt;nosuid&lt;/code&gt;. Even if malware is downloaded, it cannot be executed.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Privilege Dropping:&lt;/strong&gt; All Linux capabilities are dropped (&lt;code&gt;cap_drop: ALL&lt;/code&gt;).&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  2. Zero-Trust Networking (Tailscale)
&lt;/h3&gt;

&lt;p&gt;I wanted the agent to be completely invisible to the public internet.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  &lt;strong&gt;Default Deny:&lt;/strong&gt; The Oracle VCN (Virtual Cloud Network) blocks all inbound traffic except SSH (which is guarded by Fail2Ban).&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;WireGuard Mesh:&lt;/strong&gt; The OpenClaw API port is bound strictly to &lt;code&gt;127.0.0.1&lt;/code&gt;. The only way to securely access the agent's web UI or API is through a &lt;strong&gt;Tailscale&lt;/strong&gt; private mesh network provisioned automatically via Ansible.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  3. Messenger Whitelisting
&lt;/h3&gt;

&lt;p&gt;The agent receives commands via Telegram using Long Polling (no open inbound ports). Authorization is highly deterministic: any message from a Telegram ID not explicitly whitelisted in the environment variables is silently dropped before the LLM even sees it.&lt;/p&gt;




&lt;h2&gt;
  
  
  🚀 Open Source Release
&lt;/h2&gt;

&lt;p&gt;I’ve open-sourced the complete, sterile Terraform + Ansible templates. You can deploy this entire hardened architecture on your own Oracle Free Tier instance in about 5 minutes with just two commands (&lt;code&gt;terraform apply&lt;/code&gt; and &lt;code&gt;ansible-playbook&lt;/code&gt;).&lt;/p&gt;

&lt;p&gt;🔗 &lt;strong&gt;GitHub Repository:&lt;/strong&gt; &lt;a href="https://github.com/time-scout/openclaw-oracle-secure-quickdeploy" rel="noopener noreferrer"&gt;time-scout/openclaw-oracle-secure-quickdeploy&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  I Need Your Help! (Challenge)
&lt;/h3&gt;

&lt;p&gt;While I consider this a highly secure balance for running AI agents without MicroVMs, I know there is always room for improvement. &lt;/p&gt;

&lt;p&gt;If you are a DevOps or Security engineer, I challenge you to review the Rootless Docker + iptables setup. I’ve opened a few &lt;code&gt;good first issue&lt;/code&gt; tickets in the repo (including adding AWS Free Tier support and writing automated tests for the SSRF rules). &lt;/p&gt;

&lt;p&gt;Let me know what you think in the comments or drop a star on the repo if you found the Oracle &lt;code&gt;InstanceServices&lt;/code&gt; quirk interesting!&lt;/p&gt;

</description>
      <category>agents</category>
      <category>ai</category>
      <category>openclaw</category>
      <category>security</category>
    </item>
  </channel>
</rss>
