As soon as n8n and agents move to a VPS, API keys pile up there too: Telegram bots, OpenRouter, client services. Storing them as plaintext in a database is the most common and the most expensive mistake. A solution case from an n8n community meetup: a secrets manager in a Docker container next to n8n — two keys and zero plaintext.
Why a manager of your own at all
In the version of n8n without a paid subscription there is no convenient built-in key storage — variables are available only in the paid versions. The demo’s author Alexey went through the ready-made options: Google and GitHub offered nothing convenient, Vaultwarden requires two-factor authentication and two keys — “too much fuss.” The result is a mini-project of his own: a Docker container next to n8n or on a separate server, written not in Python — “the simplest tools,” so it consumes few resources. The project is useful for storing the tokens of several Telegram bots and client keys.
Alexey’s path is also telling as a selection checklist: before writing his own, he honestly tried other people’s — cloud storage did not fit on convenience, and a mature password manager proved excessive in ceremony. His own solution won not on features but on minimalism: less code means fewer points of failure, fewer dependencies, and a smaller attack surface.
The community names the scheme honestly: a self-written secrets manager is a stopgap until a convenient built-in storage appears in your version of n8n. Stopgap does not mean useless: it is exactly what removes the main risk today, and when the native mechanism arrives, moving the keys into it is easier than restoring them after a leak.
Two keys: access and encryption
The scheme rests on separation: an access key (authentication) and an encryption key. Secrets are encrypted inside the DB: if only the database leaks, decrypting them will not work — the attacker does not have the encryption key. Compromise of the whole server, alas, reveals everything: the encryption key lives there too, next to the application. That is why the manager is not an alternative to basic server protection but a second line of defense after it. The functions are minimal and sufficient: show all keys, add a record, filters (string start/end/contains), bulk deletion.
The functions look modest but are matched to the real cycle of working with bots: filters by string start and end help quickly find the key of a specific client or a specific bot, and bulk deletion revokes at once everything that belonged to a finished project.
A demo at the meetup: the OpenRouter keys of three users (Alexey, Andrey, Slava) — the node reads the keys and makes three parallel requests, each with its own key; the request times were 19/18/18 s. The demonstration shows the main thing: the workflow receives secrets on request, without copying tokens into node fields and environment variables. Examples of production scenarios around n8n — in our piece on n8n automations.
Where plaintext hides most often
- Node fields and workflow variables: the value is written straight into the node and travels with the workflow export — that is exactly how the keys ended up on GitHub in the case below.
- A database “the simple way”: the string is stored as is, and a database dump reads like ordinary text.
- Chats and email: the key is sent “for five minutes” to a colleague or to yourself — and stays in the history forever; in the second variant of the case below, the keys left exactly by email.
- Workflow logs: if the node prints the request parameters, the token ends up in the logs that are checked first when debugging errors.
Postgres encrypts nothing by itself
From the discussion of the demo: writing keys into Postgres is “sketchy” — Postgres encrypts nothing by itself. As alternatives, Claude in the discussion advised Vladimir to use Docker Secrets and encrypted files. The point is the same: a database is not a safe. Encryption is done at the application level, with a separate key that does not sit next to the data; then a dump leak without an encryption key leak remains unreadable garbage.
Docker Secrets in this logic is a ready-made platform mechanism: the secret is delivered into the container by Docker itself, not through a variable in an open config. Encrypted files are the most minimalist option: the dump is not in the open, and without the key it is useless. The choice between a self-written manager, Docker Secrets, and encrypted files is a question of scale: the fewer secrets, the less sense a separate service makes.
A warning case: 10 minutes to theft
The price of carelessness is known: a member accidentally posted keys on GitHub together with a workflow or sent them in an email — within ~10 minutes the keys were stolen, and ~200 spam emails were sent from his mailbox. The incident is covered in detail in our piece on API key theft. The moral for a VPS owner: keys must not end up in git, in chats, or in workflow logs.
Note the speed: about ten minutes passed between publication and theft — “I will delete it later” does not work, a leak gets noticed faster than you can fix it yourself. The only reliable reaction to a leak is reissuing the key at the provider immediately, and better still — a scheme in which the key never leaves your server at all.
A short VPS hardening checklist
A secrets manager is not a replacement for basic server protection. In the community this has become a separate topic: participants noted that people focus on “making it work,” and then it will be “one big sieve” — two members even ran two online meetings, “the basic minimum for vibe coders, not for programmers,” on server and application security. The minimal set, from typical guides like “how to secure SSH on Ubuntu/Debian: keys, fail2ban, UFW” and hardening checklists:
- a sudo user instead of root; login only via ed25519 SSH keys, PasswordAuthentication no;
- UFW with a whitelist of ports: SSH, HTTP, and HTTPS;
- fail2ban against brute force — including jails that ban through UFW;
- automatic updates; optionally TOTP-2FA;
- a separate narrow user only for the tunnel — the tunnel key is limited by its permissions.
A few words on why the items are exactly these. Disabling password login closes brute force at the root: password guessing is the noisiest and the most common attack scenario against a fresh server, and fail2ban with a jail that bans through UFW cuts it off automatically. The port whitelist in UFW is compensation for that same “sieve” of open ports that has already been observed on live projects in the community. The narrow user for the tunnel is the principle of least privilege: even if the tunnel is compromised, the rest of the system is not visible from it. Why agents should not live on a machine with work files at all — in our piece on isolation and sandboxes, and how not to pick up a malicious skill from other people’s “specialists” — in the breakdown of defense against malicious skills.
If the server is lost: a recovery plan
A separate budget line is backups: at providers this is usually a paid option (at RUVDS, for example, both backups and DDoS protection cost extra), and its absence comes to light exactly at the moment the server is lost, when there is no backup to take. Losing the machine with the secrets manager is not only losing data: reissuing keys at all providers means contacting every client and every bot at once. Describe the recovery plan in advance: where the copy of the container and the encrypted dump lives, which keys are reissued and in what order, how n8n, the manager, and the bots come back up. Then an incident turns from a scramble into a checklist.
The bottom line: two keys — the access key and the encryption key — turn a database leak from a catastrophe into an inconvenience: a dump without the encryption key remains garbage. Bring up the container next to n8n, move the workflows off plaintext variables to the secrets manager, and run the checklist above against your server — start with disabling password login: it is one line in the SSH config. And describe the recovery plan in advance: container backups, key reissuing, the order in which services come back up. The scheme and the demo come from an n8n community meetup, current as of fall 2026.
