# Hardening a self-hosted instance

A hardening checklist for a production Truetask instance: TLS, secrets at rest, sign-in, sessions, audit, retention, backups and outbound policy.

URL: https://docs.truetask.io/self-hosted/security

Self-hosted only.

Hardening a self-hosted Truetask instance for real work comes down to TLS in front, secrets kept safe, tight sign-in, an audit trail, backups, and a decision about what may leave the box.
Everything on this checklist is something the product gives you, with a link to the page that covers it properly.

## Deployment

**Put TLS in front.**
The bundled Caddy container listens on plain HTTP and does not terminate TLS.
Terminate it in your own proxy, load balancer or tunnel, and point that at `<host>:<PROXY_PORT>`.
See [Install](https://docs.truetask.io/self-hosted/install).

**Publish one port.**
Only the Caddy container publishes a port.
PocketBase, the API, the MCP server and the collaboration server talk to each other on an internal Docker network and should never be reachable from outside.

**Leave the PocketBase dashboard closed.**
`POCKETBASE_ADMIN_ENABLED` defaults to `false`, and Caddy answers `/_/` with a 404 while it is off.
Turn it on only to debug, and turn it off again.

**Keep the data directory outside the application directory.**
This is what the setup wizard insists on, and it is also what makes an update safe: the application directory is replaced, the data directory is not.

## Secrets

**Set a settings encryption key.**
`PB_ENCRYPTION_KEY` makes PocketBase encrypt the sensitive settings it stores in the database, including your SMTP password, OAuth2 client secrets and S3 keys.
The wizard generates one and recommends it.

> **It cannot be rotated**
>
> Change or lose `PB_ENCRYPTION_KEY` after the first start and every encrypted setting becomes unreadable.
> Store it with your other secrets, and keep it alongside any backup you might restore from.

**Keep `.env` out of reach.**
It holds the encryption key, the admin password and your web push private key.
The wizard also drops a copy in your data directory as a convenience.
Both are on the machine, so the authoritative copy belongs in your secret store.

**Know what the admin password protects.**
The secrets Truetask stores for outside services are encrypted: git connections (OAuth client secrets and the tokens from **Connect with GitHub / GitLab / Gitea**), Slack, Stripe, Twilio, WhatsApp and plugin settings.
Set `GIT_OAUTH_ENCRYPTION_KEY` in `.env` to give them a key of their own.
Without it, the key is derived from `POCKETBASE_ADMIN_PASSWORD`, and rotating that password means entering those secrets again.
Secrets stored before you set the key stay readable, until the admin password changes.
The admin password also signs the password cookie of protected public forms and published notes, and the one-click links clients answer requests from, unless `FORMS_TOKEN_SECRET`, `NOTES_TOKEN_SECRET` and `CLIENT_LINK_SECRET` are set, so rotating it ends those too.
Set the secrets of their own if you want to rotate them separately.

**AI provider keys stay on the server.**
Keys entered in **Settings > Integrations > AI** are stored by the instance and come back masked, never echoed to the browser.
See [AI settings](https://docs.truetask.io/admin/ai).

**Webhook signing secrets are write-only.**
A signing secret is stored encrypted and never shown again, as the field itself says.
You can replace one; nobody can read it back.
See [Webhooks](https://docs.truetask.io/integrations/webhooks).

## The admin account

The email and password you gave the setup wizard create two things on first install: the PocketBase superuser, and an app user with the **OWNER** role, already verified so it can sign in.

Two consequences worth knowing.

The superuser credentials are re-synced from `.env` at the next container start after they change, so changing `POCKETBASE_ADMIN_PASSWORD` there and restarting does change the superuser password.
It does not change the OWNER user's password in the app, which is managed from the profile dialog like anyone else's.

OWNER is the only role that can detach the license, and the only role that outranks ADMIN everywhere.
Give it to as few people as the work allows.
See [Roles and permissions](https://docs.truetask.io/reference/roles).

## Sign-in

**Turn on rate limiting.**
`POCKETBASE_RATE_LIMIT_ENABLED=true` turns on PocketBase's rate limiter at boot.
The wizard recommends it and defaults to yes.

**Use your identity provider.**
**Settings > Server > OAuth2** configures OAuth2 and OIDC providers with field mappings, and **Settings > Server > Active Directory** lets people sign in with their directory password and syncs accounts from the directory, with admin rights from the groups you pick.
A directory account always signs in with what the directory accepts today.
Both are available on a self-hosted instance with no gate.
See [Sign-in and identity](https://docs.truetask.io/admin/authentication).

**Configure mail before you need it.**
Password resets and sign-in codes are email.
An instance with broken SMTP is an instance where nobody locked out can get back in.
See [SMTP](https://docs.truetask.io/self-hosted/smtp).

## Watching and revoking

**Sessions.**
**Settings > Audit & Security > Active Sessions** lists every session with its user, IP address, browser and operating system, and when it signed in.
**Revoke** signs that person out of every device at once.

**Audit log.**
**Settings > Audit & Security > Audit Log** records changes across the workspace, plugin actions, calls carried through a Truetask Helper computer and directory sign-ins included.
It is filterable by user, board, entity type, action and date range, and exportable as CSV, JSON, Excel or a SOC 2 or ISO 27001 report.

**Logs.**
**Settings > Server > Logs** holds structured events from the API and the PocketBase hooks.
When a user reports a problem with an error reference like `ERR-a1b2c3`, that is how you find the entry behind it.

All three are covered in [Audit, sessions and logs](https://docs.truetask.io/admin/security).

## Data lifecycle

**Set retention deliberately.**
Audit logs default to 90 days, everything else to 30.
Lengthen the audit window if you have an obligation, and export before you ever shorten it.
See [Data retention](https://docs.truetask.io/self-hosted/data-retention).

**Get backups off the machine.**
Point **Backup storage** at a bucket, or copy the archives elsewhere yourself.
A backup on the same disk as the database protects you from mistakes, not from hardware.
Copy `<DATA_DIR>/plugins` with it if you use plugins: the archive does not hold their files.
See [Backups](https://docs.truetask.io/self-hosted/backups) and [S3 storage](https://docs.truetask.io/self-hosted/s3-storage).

**Remember the encryption key travels with the backup.**
An archive restored onto an instance with a different `PB_ENCRYPTION_KEY` cannot read its own encrypted settings.

## Outbound

**Decide what may leave the box.**
Both network switches are off on a fresh instance, and a no-outbound install is a supported configuration.
Turn on **Allow features that reach the internet** only if you want link previews, Unsplash or agents reading the web.
Turn on **Allow private network targets** only if a webhook or an automation genuinely has to reach your own network.
See [Network policy](https://docs.truetask.io/self-hosted/network), and [What leaves a self-hosted instance](https://docs.truetask.io/self-hosted/outbound-data) for every outbound call and its switch.

**Limit where data may go.**
**Settings > Integrations > Allowed domains** restricts automation HTTP steps and outgoing webhooks to the domains you list.
See [Audit, sessions and logs](https://docs.truetask.io/admin/security#allowed-domains).

**Keep each computer's host list short.**
A Truetask Helper computer can carry calls into your network only for the hosts an admin lists on it, and each one is in the audit log.
A loose list makes that computer a doorway into the network it sits on.
See [Truetask Helper](https://docs.truetask.io/helper/).

**Know the two reads Truetask makes itself.**
The plugin catalog obeys the internet switch.
The Truetask Helper release list does not; set `HELPER_RELEASE_MANIFEST=off`, or point it at your own copy, on a closed network.
See [Network policy](https://docs.truetask.io/self-hosted/network#hosts-truetask-itself-may-need).

**The guard underneath stays on.**
Whatever you allow, outbound calls are still limited to `http` and `https`, still re-check every redirect hop, and still stream against a size budget.

## Agents and programmatic access

**Give each agent only the boards it needs.**
An agent may do everything its board role allows, and its role on a board is never wider than its owner's.
Keep it off the boards it should not touch, and set how freely it works on a computer nobody is watching with its **Unattended runs** setting.
Proposing done for a person to approve is the protocol every agent follows, not a lock, so the board role is the real limit.
See [Creating an agent](https://docs.truetask.io/agents/creating) and [Human in the loop for AI agents](https://docs.truetask.io/agents/human-in-the-loop).

**Treat tokens as credentials.**
API tokens and MCP tokens act as the account that owns them.
Issue one per integration so you can revoke one without breaking the rest, and limit each to the boards it needs.
See [REST API](https://docs.truetask.io/integrations/api) and [MCP](https://docs.truetask.io/agents/mcp).

**Install plugins from the catalog.**
Catalog plugins are signed, and an archive whose checksum or signature does not match is refused.
Unsigned archives install only when `PLUGIN_ALLOW_UNSIGNED=true`, and then only by the workspace owner; leave it unset in production.
See [Plugins](https://docs.truetask.io/plugins/).

**An agent runs only on its owner's computers.**
A computer paired with [Truetask Helper](https://docs.truetask.io/helper/) runs agents only while **Run my agents here** is on for it, and a personal computer runs only its owner's agents.
A computer paired for the whole workspace never runs agents.
See [Your agents on your computer](https://docs.truetask.io/helper/agents).

## Public surfaces

**Public forms accept anonymous uploads.**
The extension allowlist and the per-submission file limit are configurable with `FORMS_UPLOAD_ALLOWED_EXTENSIONS` and `FORMS_MAX_FILES_PER_SUBMISSION`, and the default allows common image, document and archive types while always denying `html`, `svg`, `xml` and `js`.
A form can also be password protected.
See [Sharing and submissions](https://docs.truetask.io/forms/sharing).

**Published notes are public.**
Anything published from a note is readable by anyone with the link.
See [Access and publishing](https://docs.truetask.io/notes/publishing).

**A database key in a web page is public.**
Give a page a key that can do only what the page needs, usually reading one database, and revoke it from the database's **Share** dialog.
See [Database API keys](https://docs.truetask.io/boards/database-keys).

**Client pages answer only for their own workspace.**
A client domain is proved in the firm's DNS before anything is served on it, and your proxy should ask Truetask which hosts it may get a certificate for.
See [Install](https://docs.truetask.io/self-hosted/install#reverse-proxy-and-tls) and [Branding, email and domain](https://docs.truetask.io/clients/branding).

## Related

- [Audit, sessions and logs](https://docs.truetask.io/admin/security)
- [Sign-in and identity](https://docs.truetask.io/admin/authentication)
- [Network policy](https://docs.truetask.io/self-hosted/network)
- [What leaves a self-hosted instance](https://docs.truetask.io/self-hosted/outbound-data)
- [Backups](https://docs.truetask.io/self-hosted/backups)
- [Teams that keep everything on their own server](https://docs.truetask.io/guides/self-hosting-teams)
