Self-hosted n8n: the 10-point security checklist
n8n self-hosted is a great fit for small teams — your data, your workflows, no per-task SaaS bill. It's also a box with API keys in it, exposed to the internet. Here's the checklist I actually run.
Network & access
- 1. SSH: keys only.
PasswordAuthentication no, root login off. Watch out: cloud-init drop-ins can silently override this. OpenSSH keeps the first value it reads, and drop-ins are read in filename order — so yours must sort before50-cloud-init.conf, e.g.00-hardening.conf. Verify withsshd -T, not by reading the file you edited. - 2. Firewall: default deny. Allow only what actually serves traffic — 22 and 443 on a typical setup, 80 only if you need the ACME challenge or a redirect.
ufw default deny incoming. - 3. fail2ban on SSH (and the n8n login if exposed).
- 4. n8n never on a public interface. Its listen address defaults to
::(all interfaces), so this is an explicit setting:N8N_LISTEN_ADDRESS=127.0.0.1, with a reverse proxy in front. In Docker, also publish on loopback:-p 127.0.0.1:5678:5678—-p 5678:5678publishes on every interface.
The app
- 5. HTTPS via Caddy. Auto-TLS, HSTS. No plain HTTP.
- 6. Postgres reachable only from n8n. With Docker, “localhost only” means the database port is not published at all (
ports:omitted; n8n reaches it over the compose network by service name). Publishing5432— even as127.0.0.1:5432:5432— is a decision, not a default. Strong, non-default password either way. - 7. Two different secrets, two different rules. The API keys your nodes use belong in credentials or environment variables, not pasted into workflow JSON. Separate from those is
N8N_ENCRYPTION_KEY, the instance key that encrypts stored credentials: it is generated on first start, it must be backed up on its own (losing it means losing every stored credential), and every instance and worker must share the same value. Since n8n 3.0 a second, rotatable data encryption key sits under it: rotate it from Settings → Data Encryption Keys (on 2.x enableN8N_ENV_FEAT_ENCRYPTION_KEY_ROTATION=trueon all instances first). Rotation is one-way — take a full database backup, and don't downgrade n8n afterwards. - 8. Authenticate at the app, not only at the proxy. n8n has its own user management (owner account, member accounts); use it. Basic auth on the reverse proxy is a second lock, not a substitute — and SSO through the proxy does not give n8n per-user identity.
The part everyone skips
- 9. Backups — and a tested restore. A backup you've never restored is a hope, not a backup. Run the restore once, on purpose.
- 10. Automatic security updates + monitoring. Unattended upgrades, and something that tells you when the box is down.
The rule
Self-hosting moves the responsibility to you. That's the deal: you get privacy and control, you take on patching, backups, and exposure. Most "self-hosted" boxes I look at are 80% done — the last 20% is exactly the list above.
Sources: n8n docs — deployment environment variables (N8N_ENCRYPTION_KEY, N8N_LISTEN_ADDRESS), rotating encryption keys.
Want it done properly? I set up and harden self-hosted n8n (Docker, Postgres, HTTPS, backups with a tested restore). Fixed price, documented, async. See services →