Self Host Wizard Documentación

Mesa de ayuda (freescout)

Mesa de ayuda en una caja Self Host Wizard: la pieza freescout, en help.<dominio de apps>, ingreso forward, límite de memoria 310 MB.

De un vistazo

DatoValor
Direcciónhttps://help.<dominio de apps>
Ingresoforward: Caddy le pregunta a Authelia antes de que la app vea el pedido (forward auth)
Límite de memoria310 MB (ram_mb: pico medido × 1,3)
Base de datosmariadb
Necesitalldap, authelia, mariadb, stalwart
La necesitannada
Contenedoresfreescout
Imagen: freescoutnfrastack/freescout:2.2.26@sha256:c6d6b78b9d3eb50e7ec8de6e891d03e31a603234899a5a7abf26d02d87c6fed1
Script de configuración al arrancarscripts/post-up.sh, diario
Licencia (según el README)varias; mirá las notas de abajo
Proyecto original (según el README)https://freescout.net

Cómo activarla

thx enable agrega freescout y todo lo que necesita al estado de la caja; después thx apply la instala. Las apps se aplican recién cuando site_domain está definido.

sudo thx enable freescout
sudo thx apply

Notas técnicas (pieces/freescout/README.md)

Las notas técnicas de cada pieza están en inglés, tal como están en el repositorio.

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 reads Remote-Email, Remote-Name and Remote-Groups and 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-sent Remote-* headers and no other piece shares this piece's network (docs/pieces.md §4). The test proves that a forged Remote-Email gets 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.
  • Mailboxes: post_up creates 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's support@ 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_password secret;
    • thx-freescout@<apps_domain> is an LLDAP service user that core keeps with that password. Stalwart lets it impersonate only while freescout is in THX_PIECES.

    Each mailbox fetches over IMAP from mail.<apps_domain>:993 and sends through mail.<apps_domain>:465, both implicit TLS. Stalwart answers as that name on this piece's network, so the certificate verifies. Fetching reads INBOX and Junk 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 from support@….

  • Certificates are checked both ways.

    • IMAP: in_validate_cert is on.
    • SMTP: FreeScout's SMTP client turns certificate checks off for every connection (its swiftmailer StreamBuffer override, upstream issue 2714). ThxAuth's service provider sets mail.stream back to verify, so the master password only goes to a server holding a valid certificate for mail.<apps_domain>.

    The mailbox passwords are stored encrypted with APP_KEY.

  • System mail (invites, notifications) goes out from THX_MAIL_FROM through THX_SMTP_HOST:THX_SMTP_PORT with no auth.
  • Storage: MariaDB from the box (db = "mariadb"). THX_DATA at /data holds uploads, attachments, storage and the modules folder.
  • Secrets:

    • app_key: 32 bytes as 64 hex. scripts/entry.sh turns it into Laravel's base64: key. It also encrypts stored mailbox passwords, so it must never change.
    • ldap_password: the password of the LLDAP service user thx-freescout (see Mail). post-up.sh hands it to converge.php through docker 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.sh runs through /bin/sh, because scripts/ lands 0644. It installs the ThxAuth module into /data/Modules on every start, so an update of the piece updates the module, then execs the image's /init. APP_DISABLE_UPDATING is 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 prints changed only 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 changed then 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-Email cannot 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) as thx-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.test and support@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's Junk 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 as support@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's ldap_password secret. 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 in THX_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.

Los datos de esta página salen de estos archivos del repositorio selfhostwizard:

  • pieces/freescout/piece.toml
  • pieces/freescout/compose.yaml
  • pieces/freescout/README.md
  • internal/piece/piece.go

Esta página se genera desde el código al compilar el sitio, así que cambia cuando cambia el código.