Sovereignty: Why My Cloud Needs Agents
Nowadays, when people talk about agents, they usually mean AI agents. Cool technology, with its own purpose. When I talk about agents, I mean system agents: the small background processes that cloud providers install on their servers as a handy little entry point. This article is about that kind, and about why my own cloud ended up needing them.
Earlier, I described how a service catalog connects my cloud, and how Prometheus and Grafana monitor it. They show which services should exist and whether endpoints respond, but not what is mounted on each host, where a path is backed, or which proxy routes and certificates are configured.
I could SSH into each machine and look around. That works perfectly well during maintenance. It becomes less attractive when a central application needs to ask the same question regularly, across several hosts.
At that point I do not want to give the application a terminal. I want to give it an answer. That is why I introduced host agents, small local observers with a very narrow interface.
First, what kind of agent?
Not an AI agent. No language model, no reasoning loop and no autonomous administrator deciding that my NAS needs a quick reconfiguration.
This is a background process running on a machine that I own. It reads a specific piece of local state and exposes the result through an authenticated HTTPS API.
For this article, that API has one operation:
GET /mounts
The agent reports mounts. It does not create, repair or unmount them. It does not execute commands supplied by the caller.
My actual cloudagent does more than this, but those extra features are not required to explain the architecture. A mount-only observer keeps the responsibilities clear.
Why not just use Prometheus?
For machine metrics, I already have exporters. CPU usage, memory pressure and filesystem capacity belong in Prometheus. I do not want to build a second node exporter because I happen to enjoy Go.
The question here is different. I want a structured snapshot of the mount layout on a particular host: mount point, source, filesystem type and whether the mount is reported as read-only.
An exporter may already provide enough information for your use case. If it does, use it. An agent is justified when a concrete local observation is missing, not because an architecture diagram looks more impressive with agents on it.
In my case, the central application needs the host’s mount information as a small data document. That fits a request-and-response interface nicely.
Monitoring and the agent complement each other. Metrics can tell me that free space is disappearing. A mount snapshot can help explain which backing filesystem a path belongs to.
Some information is local
On Linux, /proc/self/mountinfo describes the mounts visible to the reading process. Reading it on Calculon tells me about that process’s view on Calculon. It does not tell me what is mounted on DiskStation.
Running the central application in a container adds another boundary. Its mount namespace can be different from the host’s. Looking at the container’s mount table and calling it the host’s storage layout would give me a convincing answer to the wrong question.
The host agent closes that gap. It runs in the host mount namespace, reads the local table and returns a consistent description.
That is also why deployment details matter. A container or a systemd sandbox that creates a different mount namespace can change what the agent observes. More isolation is not automatically better if it hides the state this particular process exists to report.
Keep installation separate from observation
SSH remains my tool for installation, troubleshooting and maintenance. I am not trying to replace it.
But there is an important difference between a deployment account and a runtime observation API. The deployment account may need to install binaries and configure services. The central collector only needs to ask for mounts.
I do not want those permissions to become the same thing.
Restricted SSH commands can also solve this problem. For my cloud, a dedicated API gives me one explicit contract across several hosts, without handing the runtime application a general remote execution mechanism.
Installing an observer is an administrative action. Calling an observer should not have to be one.
One collector, several agents
The central side keeps an inventory of known hosts. Each entry has a stable server identifier, an internal HTTPS endpoint and a reference to that host’s token.
The collector initiates the requests. Agents do not discover arbitrary destinations or accept target hosts supplied by a browser. This is a fixed inventory of machines I have deliberately enrolled.
Requests can run concurrently, with bounded parallelism and a deadline per host. If one NAS is unavailable, the other machines should still return their results.
The response carries a stable serverId, not just the operating system hostname. Hostnames can change. A stable identifier connects the configured host, the returned data and any stored snapshot.
A small response contract could look like this:
{
"schemaVersion": 1,
"serverId": "diskstation",
"hostname": "DiskStation",
"collectedAt": "2026-10-30T13:15:00Z",
"mounts": [
{
"mountPoint": "/volume1",
"source": "/dev/mapper/storage-volume",
"fileSystem": "btrfs",
"readOnly": false
}
]
}
This is illustrative, not the complete repository contract. It contains mount observations and enough metadata to interpret them. No directory listings, file contents, environment variables or raw mount options that could contain sensitive values.
The collector checks the schema version, expected server identifier and response structure before accepting a snapshot. A response carrying the wrong identity is an error, not something to silently file under a different host.
A refresh follows this path:
Here we Go again!
The agent has a boring job. I want its deployment to be equally boring.
Go provides an HTTP server, TLS, JSON handling and useful timeout primitives in the standard library. For this mount-only variant, there is no need for a web framework or an external command to read the mount table.
With CGO_ENABLED=0, I can build a self-contained Linux executable without requiring a Go installation or a matching libc on the destination. Cross-compilation lets me produce binaries for the CPU architectures I actually run.
That is useful when one host is a regular Linux server and another is a NAS with a less convenient software environment.
There are limits. The selected Go release still has kernel and architecture requirements. An amd64 label does not prove that a binary runs on every older NAS. Test on the real devices.
Just Pick your tool of choice! Python, Rust or .NET could also do this job. For a small network service on mixed Linux hosts, I thought of Go as a practical choice.
A private network is not authentication
Agents listen only on their configured private host addresses. They have no public reverse-proxy route or router port-forward.
Host firewalls should allow the agent port only from the actual collector addresses. The agent also checks an explicit source allowlist. With a containerized collector, account for the real Docker or NAT source address rather than assuming it will be the address you had in mind.
Do not treat a caller-supplied forwarding header as proof of origin.
These restrictions reduce exposure. They do not establish that every device on the LAN is trustworthy. I still need encryption, server authentication and permission to call the API.
Those are related, but they are not the same thing.
The CA establishes server identity
Each agent serves HTTPS with a certificate from my local Smallstep Certificate Authority (CA). The collector trusts the CA’s public root and checks the certificate chain, expiry and endpoint identity. The certificate needs an IP SAN when connecting by IP, or a DNS SAN when connecting by name. Never skip verification: a valid certificate for the wrong host is still wrong.
I verify the root certificate’s fingerprint over a trusted administrative connection before installing it. The CA issues certificates, but the collector validates them locally, so a CA outage affects issuance and renewal, not requests using valid certificates.
Each agent gets only its own certificate, private key and public trust material, never the CA signing key. The collector does not need that key either. My root key is not mounted in the online CA container, but it remains on the host and within the root and Docker administrators’ trust boundary.
A token authorizes the caller
The server certificate authenticates the agent to the collector. It does not, by itself, authorize the collector to call /mounts.
Each host therefore gets its own random bearer token. Generate a new one separately for every agent:
openssl rand -hex 32
That produces 32 random bytes represented as 64 hexadecimal characters. It is not a 32-character token, and hexadecimal encoding is not encryption.
The agent and collector hold matching copies for that host. The request sends it in the Authorization: Bearer ... header over verified HTTPS. The agent uses a constant-time credential comparison and rejects requests without a valid token.
Keep tokens out of URLs, source code, the catalog and logs; store them somewhere protected. Only the agent and collector need their own copies. A backend handles refresh requests, so the browser never needs an agent token or direct connection.
Leaking one host’s token does not expose the other agents. Compromising the central collector does: it holds all of its configured credentials.
This is server-authenticated TLS plus bearer authentication, not mutual TLS. Certificate renewal may use certificate-based client authentication to the CA; that is a separate exchange.
Keep the observer narrow
For this mount-only variant, reading the host mount table can normally be done by an unprivileged service account. There is no reason to grant Docker access or run as root just to read it. Verify the permissions and namespace on the actual operating system.
My full collector also reads Docker storage and protected host files, so it needs root-level access. Its API only returns data, but the process still has those permissions.
Accept only the fixed GET operation. Do not accept a command, filesystem path or remote URL to execute on behalf of the caller.
The agent should limit request time, header and response sizes, and the number of requests it handles at once. Logs should not contain credentials.
An answer needs an age
With multiple hosts, failures are normal: a machine may reboot, a certificate expire or a request time out. The collector replaces each host’s snapshot only with a valid response. Otherwise, it keeps the old snapshot marked as stale, or reports the data as unavailable if no snapshot exists.
A snapshot shows mount state, not if files are accessible or what permissions users have. Detecting a missing mount also requires a separate list of expected mounts. Configuration describes intent; the agent reports what is present, and the collector compares the two.
Do not forget the lifecycle
My agents renew certificates with their existing certificate and key, then validate and reload the replacement without a restart or bootstrap credentials. Monitor renewal: if a certificate expires, re-enroll the agent rather than disabling verification.
Token rotation is separate. Update the token on both sides through deployment; until that is complete, requests may fail, so keep old data marked stale. Limit access to the accounts and workflow secrets used to install agents. A narrow API does not make an unrestricted deployment pipeline safe.
Wrap up
The reason for having agents is not that every machine needs another service. It is that some useful observations are local, while the platform needs to understand them centrally.
A small agent gives me a defined way to ask for those observations without handing the caller a shell. A local CA establishes server identity, separate tokens authorize requests, and network restrictions limit who can reach the interface.
The collector handles multiple hosts, keeps their identities separate and makes failures and old data visible.
In the follow-up article, I build a small version: a local CA in Docker Compose, a mount-only Go agent and a collector that queries several hosts.
These little agents answer the questions I need, and leave the rest of the machine alone. Yay!
