Helpdesk (freescout)
Helpdesk on a Self Host Wizard box: the freescout piece, served at help.<apps domain>, forward sign-in, memory limit 310 MB.
At a glance
| Field | Value |
|---|---|
| Address | https://help.<apps domain> |
| Sign-in | forward: Caddy asks Authelia before the app sees a request (forward auth) |
| Memory limit | 310 MB (ram_mb: measured peak × 1.3) |
| Database | mariadb |
| Needs | lldap, authelia, mariadb, stalwart |
| Needed by | nothing |
| Containers | freescout |
Image: freescout | nfrastack/freescout:2.2.26@sha256:c6d6b78b9d3eb50e7ec8de6e891d03e31a603234899a5a7abf26d02d87c6fed1 |
| Set-up script after start | scripts/post-up.sh, daily |
| Licence (from the README) | several; see the notes below |
| Upstream (from the README) | https://freescout.net |
Turn it on
thx enable adds freescout and everything it needs to the box's state; thx apply then installs it. Apps are applied only once site_domain is set.
sudo thx enable freescout
sudo thx apply
Engineering notes (pieces/freescout/README.md)
FreeScout 2.2.26, AGPL-3.0. Shared mailboxes, conversations, assignment,
notes, saved replies. Image nfrastack/freescout:2.2.26 (nginx + php-fpm + Laravel scheduler under
s6), pinned by index digest sha256:c6d6b78b…fed1; the index has linux/arm64
(docker buildx imagetools inspect, 2026-11-25). We pull the upstream image unmodified and ship
compose, scripts and our own small Laravel module ThxAuth (scripts/ThxAuth, Apache-2.0).
How it is wired
- Login: Caddy forward auth (
auth = "forward"). FreeScout's OIDC, SAML and LDAP sign-in are paid modules, and the free core has no SSO. Every path is behind Authelia.ThxAuth's middleware readsRemote-Email,Remote-NameandRemote-Groupsand signs that person in as an agent, creating them at their first visit with a random password nobody knows. If a different Authelia user turns up in the same browser, the old session is dropped. Nobody types a FreeScout password. Trusting the headers is safe only because Caddy replaces client-sentRemote-*headers and no other piece shares this piece's network (docs/pieces.md §4). The test proves that a forgedRemote-Emailgets nobody in. Roles:
- LLDAP
admins→ FreeScout admin, who sees every mailbox and manages users. - Everyone else is a plain agent with access to the support mailbox of each
org-<org>they are in, and to no other. - Roles and mailbox access are re-synced at every sign-in.
- A suspended person is stopped by Authelia before the app.
- An agent an admin disables in FreeScout stays out.
- LLDAP
- Mailboxes:
post_upcreates one per company:support@<its first domain>, with its other domains as aliases. Ratings are off, because their footer links to this host, which sits behind the login. Mail, with no human setup. With this piece enabled, the stalwart piece keeps a local account
thx-help-<org>@<first domain>per company. It receives that company'ssupport@addresses (all of its domains) and may send as them, and as nothing else. FreeScout opens it as a master user:- login
thx-help-<org>@<first domain>%thx-freescout@<apps_domain>; - password: this piece's
ldap_passwordsecret; thx-freescout@<apps_domain>is an LLDAP service user that core keeps with that password. Stalwart lets it impersonate only while freescout is inTHX_PIECES.
Each mailbox fetches over IMAP from
mail.<apps_domain>:993and sends throughmail.<apps_domain>:465, both implicit TLS. Stalwart answers as that name on this piece's network, so the certificate verifies. Fetching readsINBOXandJunk Mail: customer mail from domains without SPF/DKIM is filed as spam by stalwart, and no ticket may be lost. FreeScout's Spam folder is the agents' filter. Customers get replies fromsupport@….- login
Certificates are checked both ways.
- IMAP:
in_validate_certis on. - SMTP: FreeScout's SMTP client turns certificate checks off for every connection (its
swiftmailer
StreamBufferoverride, upstream issue 2714).ThxAuth's service provider setsmail.streamback to verify, so the master password only goes to a server holding a valid certificate formail.<apps_domain>.
The mailbox passwords are stored encrypted with APP_KEY.
- IMAP:
- System mail (invites, notifications) goes out from
THX_MAIL_FROMthroughTHX_SMTP_HOST:THX_SMTP_PORTwith no auth. - Storage: MariaDB from the box (
db = "mariadb").THX_DATAat/dataholds uploads, attachments, storage and the modules folder. Secrets:
app_key: 32 bytes as 64 hex.scripts/entry.shturns it into Laravel'sbase64:key. It also encrypts stored mailbox passwords, so it must never change.ldap_password: the password of the LLDAP service userthx-freescout(see Mail).post-up.shhands it toconverge.phpthroughdocker exec -e NAME(by name, never on a command line).admin_password: for the admin the image's first start insists on creating (thxadmin@<apps_domain>). Nobody signs in with it.
- Entrypoint:
scripts/entry.shruns through/bin/sh, because scripts/ lands 0644. It installs the ThxAuth module into/data/Moduleson every start, so an update of the piece updates the module, then execs the image's/init.APP_DISABLE_UPDATINGis on, so there is no self-update or module download from freescout.net. - post_up (
scripts/post-up.sh→scripts/converge.php, run as the web user): activates ThxAuth, sets system mail, converges the mailboxes, and stores the org → mailbox map for the middleware (php-fpm does not see the container's environment). It clears FreeScout's caches only when something changed, and printschangedonly then.
Test (./test.sh)
HEAVY_CLASS=check ~/.cache/run-heavy.sh 6G pieces/freescout/test.sh. The limit bounds only the
test process; the containers run under docker. It runs two stacks one after the other.
**test.py.** testkit/thxtest.py is the lane stack: LLDAP, Authelia, Caddy with a test CA (the
box's forward-auth route and Remote-* strip), MariaDB, and Mailpit as stalwart. scripts/ lands
0644 as on the box.
It proves:
- The container gets healthy, and post_up prints
changedthen nothing on the second run. - With no Authelia session, every request is stopped, forged headers included.
- alice (org-acme) sees only the acme mailbox, bob (org-beta) only beta's, and boss (admins) both plus user admin.
- A client-sent
Remote-Emailcannot switch the signed-in user. - alice starts a conversation from
support@acme.test. - Each mailbox is wired to
mail.<apps>(993/465, TLS, certificate checks on) asthx-help-<org>%thx-freescout, with its passwords stored encrypted. - System mail arrives from
THX_MAIL_FROM. - The module and storage live in
THX_DATA. - There is no OOM kill.
**test/helpdesk.sh.** The stalwart piece's throwaway stack (../stalwart/test/stack.sh):
- LLDAP with
thx-freescout; - stalwart converged with the helpdesk accounts, with companies acme = a.test + c.test and beta = b.test;
- Mailpit as the outbound relay.
On top of it, MariaDB and FreeScout run as their own compose project on their own piece network,
where stalwart answers as mail.a.test. The agent's Remote-* headers are sent by hand to the
container, as Caddy would send them.
It proves:
- post_up prints
changed, then nothing on the second run. - Customer mail from outside (port 25) to
support@a.test,support@c.testandsupport@b.test, and a signed-in person's mail, become tickets in the right company's mailbox, and in no other. Customer mail sits in stalwart'sJunk Mail, which is fetched. - alice's reply to a fetched ticket, and her new conversation, leave through stalwart from
support@…and reach the relay. beta's mailbox sends assupport@b.test. - Without the test CA, FreeScout fetches nothing and its SMTP send is refused, so the master password goes nowhere.
- The master password is in no container or Laravel log, plain or base64.
Measured
RAM, dev PC (amd64), measured over the whole test including the first start's migrations. Sampled from the cgroup every 0.25 s, page cache excluded. Three runs (office3 lane, 2026-11-25) peaked at 196, 179 and 175 MiB.
With the mailboxes fetching and sending through stalwart (test/helpdesk.sh, mail lane, 2026-11-25),
the peak was 229 MiB under 255m and 238 MiB under 298m (docker stats every second, no OOM kill;
test.py in the same run peaked at 210). The scheduler's IMAP fetch and queue worker run next to
php-fpm.
ram_mb = 310 (238 × 1.3, rounded up), with mem_limit: 310m. php-fpm adds workers under load, so
re-measure on the box under real use.
Known gaps
- **Core must keep the LLDAP user
thx-freescout@<apps_domain>**, with the password of this piece'sldap_passwordsecret. Without it, the mailboxes cannot log in and nothing is fetched or sent. This is the mail lane's report: the same mechanism serves snappymail. - New mail is fetched by FreeScout's scheduler every minute, so there is no push.
- Laravel's own log lives in the container (
/logs), not inTHX_DATA; it is gone on recreate. - FreeScout's logout ends the FreeScout session only; the next request signs the person back in
from Authelia. Log out at
auth.<apps_domain>to leave.