Help us shape the future of Go! Take the 2026 Go Developer Survey

yarilo

module
v1.99.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 20, 2026 License: GPL-3.0

README

yarilo

yarilo logo

Production-grade IMAP / POP3 / LMTP / ManageSieve / Submission mail server written in Go. Multi-binary architecture — each protocol component is a separate process. Full Dovecot 2.3 protocol compatibility. Kubernetes-native via Helm.

CI Go 1.26 Platform


Architecture

Yarilo is a multi-binary server. Each protocol and infrastructure role is a separate compiled binary — no mode flags, no combined processes. Deployment topology is configured purely through Helm values; the same binaries serve standalone and clustered installations.

  Internet
     |
     | IMAPS :993 / IMAP :143 / POP3S :995 / POP3 :110
     | LMTP :24 / ManageSieve :4190 / SASL :4190
     v
+------------------------+  +------------------------+
|  yarilo-imap-login     |  |  yarilo-pop3-login     |  login pods (TLS termination,
|  yarilo-lmtp-login     |  |  yarilo-managesieve-   |  HAProxy / XCLIENT, passdb,
|  yarilo-submission-    |  |  login                 |  anvil rate-limit, fd-passing)
|  login / sasl-login    |  +------------------------+
+------------------------+
         |  Unix fd-passing (SCM_RIGHTS) after auth
         v
+------------------------+  +------------------------+
|  yarilo-imap           |  |  yarilo-pop3           |  session pods (mailbox,
|  yarilo-lmtp           |  |  yarilo-managesieve    |  index, Sieve execution,
|  yarilo-submission     |  |  yarilo-backend-api    |  quota, ACL)
+------------------------+  +------------------------+
         |
         | cross-process write coordination (TCP mTLS)
         v
+------------------------+  +------------------------+
|  yarilo-locks          |  |  yarilo-auth           |  shared services
|  yarilo-anvil          |  |  Redis (dict / locks)  |
+------------------------+  +------------------------+
         |
         | NFS PV (RWX) — shared by all session pods in a tag
         v
  [ Mailbox + Index files ]

Login pods — terminate TLS (SNI per-domain), authenticate via passdb, enforce per-user connection limits (anvil), pass the raw fd to session pods via SCM_RIGHTS. Stateless; scale independently.

Session pods — full mail processing: IMAP / POP3 / LMTP / Sieve / Submission / ManageSieve. Each protocol scales as a separate StatefulSet so IMAP can scale independently of LMTP.

yarilo-auth — shared passdb chain (MySQL / Postgres / SQLite / LDAP), auth-token cache, SASL dispatch, master protocol for userdb lookups.

yarilo-locks — cross-process write coordination. TCP mTLS :9104, Redis-backed state. All Kubernetes deployments (standalone and backend) use remote mode — embedded Unix-socket mode is reserved for unit tests and single-process CLI runs.

yarilo-anvil — connection rate limiting and penalty tracking. Shared across all login pods.


Protocol support

Protocol Standard Extensions Status
IMAP4rev2 RFC 9051 IDLE, MOVE, CONDSTORE, QRESYNC, UNSELECT, NAMESPACE, QUOTA, ACL, BINARY, UIDPLUS, SORT, THREAD, ESEARCH, NOTIFY, URLAUTH, SPECIAL-USE ✅
POP3 RFC 1939 STLS, UIDL, CAPA, XCLIENT ✅
LMTP RFC 2033 per-recipient status, HAProxy, XCLIENT, STARTTLS, Delivered-To, Sieve delivery ✅
ManageSieve RFC 5804 full script management ✅
Sieve RFC 5228 fileinto, reject, vacation, notify, include, variables, date, relational, imap4flags, editheader, extlists, vnd.dovecot.* ✅
Submission RFC 6409 STARTTLS, SASL PLAIN, SIZE, PIPELINING, relay to upstream MTA ✅
SASL — PLAIN, LOGIN, SCRAM-SHA-256, XOAUTH2, OAUTHBEARER, GSSAPI ✅
JMAP RFC 8620/8621 — planned

Storage

Layer Backend Status
Mailbox Maildir ✅
Mailbox sdbox (single-file dbox with GUID metadata) ✅
Mailbox mdbox (multi-message dbox, higher density) ✅
Mailbox obox (S3-compatible object storage) planned
Index FileIndex (binary mail-index v7.3 wire format, .index / .index.log / .index.names) ✅

All index mutations go through the cross-process mailbox lock (yarilo-locks). Sessions sharing a pod serialise on an in-process sync.RWMutex — the Redis lock is only ever contested across pods, not within a single pod.


Cluster components

Binary Role Status
yarilo-imap IMAP4rev2 session server ✅
yarilo-imap-login IMAPS / IMAP login proxy — TLS termination, passdb, fd-passing ✅
yarilo-pop3 POP3 session server ✅
yarilo-pop3-login POP3S / POP3 login proxy ✅
yarilo-lmtp LMTP delivery server (Sieve, quota) ✅
yarilo-lmtp-login LMTP login proxy — HAProxy, XCLIENT, preamble strip ✅
yarilo-managesieve ManageSieve script management server ✅
yarilo-managesieve-login ManageSieve login proxy — STARTTLS, HAProxy ✅
yarilo-submission Submission relay server ✅
yarilo-submission-login Submission login proxy ✅
yarilo-sasl-login SASL auth socket for Postfix / Exim relay ✅
yarilo-auth Passdb chain, auth cache, SASL dispatch, master userdb ✅
yarilo-anvil Connection rate limiting + penalty ✅
yarilo-locks Cross-process write coordination — Redis-backed, TCP mTLS ✅
yarilo-quota-status Quota policy socket (Postfix quota check) ✅
yarilo-backend-api HTTP admin API (dict, ACL, folder, quota, rebuild) ✅
yarilo-admin CLI control tool — director and backend planes ✅
yarilo-monitor Backend health sidecar for director ring ✅
yarilo-migrate Offline mailbox migration (Maildir ↔ dbox ↔ mdbox) ✅
yarilo-director Consistent-hashing ring, sticky sessions, failover planned

All intra-cluster protocols are TAB-delimited text with LF termination and a version handshake. Full wire-format specification: INTERNALS.md.


Quick start (Helm)

# Add the chart (local checkout)
helm upgrade --install yarilo ./helm \
  -f helm_values/values-sandbox.yaml \
  -n yarilo --create-namespace

See INSTALL.md for a full Kubernetes walkthrough with cert-manager, Let's Encrypt, and an external MySQL passdb.

Minimal yarilo.yaml for bare-metal single-node:

hostname: mail.example.com

auth:
  passdb:
    - driver: mysql
      dsn: "yarilo:secret@tcp(127.0.0.1:3306)/yarilo"

storage:
  persistence:
    enabled: true
    size: 50Gi

locks:
  mode: embedded   # single-node only; use remote in k8s
LOG_LEVEL=debug yarilo-imap -config yarilo.yaml

Mailbox migration

yarilo-migrate \
  --from /var/mail/vhosts \
  --to   /var/mail/dbox \
  --format dbox   # or mdbox; --dry-run to preview

Documentation

Document Contents
PLAN.md Implementation plan, phases, timelines
INTERNALS.md Wire-format specs for all internal protocols
ARCHITECTURE.md Code-level architecture, process model, storage contract
docs/DEPLOYMENT.md K8s topology, sizing, HA strategy, sharding via tags
docs/GENERAL.md general: SSL, HAProxy, XCLIENT, connection limits
docs/SERVICES.md services: per-listener config
docs/IMAP.md protocol.imap: IDLE, line length, ACL, NAMESPACE
docs/NAMESPACE.md IMAP namespaces (RFC 2342 / 9051): personal / shared / other_users
docs/SUBMISSION.md protocol.submission: hostname, size, relay
docs/LMTP.md protocol.lmtp: delivery, HAProxy, XCLIENT, TLS, headers
docs/POP3.md protocol.pop3: UIDL, soft-delete, migration
docs/AUTH.md auth.passdb: SQL backends, password schemes
docs/SMOKE.md End-to-end smoke test
docs/DIRECTOR.md director_service: ring, peers, HAProxy, XCLIENT, mTLS
docs/MONITOR.md yarilo-monitor: health probes, Prometheus metrics
docs/DIRECTOR-API.md Director HTTP admin API
docs/BACKEND-API.md Backend HTTP admin API
docs/YARILO-ADMIN.md yarilo-admin CLI reference
docs/DICT.md pkg/dict KV-store abstraction: drivers, YAML schema

License

GNU General Public License v3.0 — see LICENSE.

Directories

Path Synopsis
app
smoketest command
smoketest verifies a live yarilo deployment.
smoketest verifies a live yarilo deployment.
smoketest-e2e command
smoketest-e2e drives a live yarilo instance end-to-end:
smoketest-e2e drives a live yarilo instance end-to-end:
smoketest-e2e/seed command
seed creates the yarilo_users table (if missing) and inserts a single user with a bcrypt-hashed password.
seed creates the yarilo_users table (if missing) and inserts a single user with a bcrypt-hashed password.
yarilo command
yarilo-admin command
yarilo-admin is the unified yarilo operator CLI.
yarilo-admin is the unified yarilo operator CLI.
yarilo-anvil command
yarilo-anvil is the connection-accounting service for the yarilo mail server.
yarilo-anvil is the connection-accounting service for the yarilo mail server.
yarilo-auth command
yarilo-auth is the standalone authentication service for the yarilo mail server.
yarilo-auth is the standalone authentication service for the yarilo mail server.
yarilo-backend-api command
yarilo-backend-api is the backend-plane admin HTTP API.
yarilo-backend-api is the backend-plane admin HTTP API.
yarilo-director command
yarilo-director is the consistent-hash routing service for the yarilo mail server.
yarilo-director is the consistent-hash routing service for the yarilo mail server.
yarilo-imap command
yarilo-imap is the IMAP/IMAPS backend for the yarilo mail server.
yarilo-imap is the IMAP/IMAPS backend for the yarilo mail server.
yarilo-imap-login command
yarilo-imap-login is the IMAP/IMAPS login proxy for the yarilo mail server.
yarilo-imap-login is the IMAP/IMAPS login proxy for the yarilo mail server.
yarilo-lmtp command
yarilo-lmtp is the LMTP backend for the yarilo mail server.
yarilo-lmtp is the LMTP backend for the yarilo mail server.
yarilo-lmtp-login command
yarilo-lmtp-login is the LMTP login proxy for the yarilo mail server.
yarilo-lmtp-login is the LMTP login proxy for the yarilo mail server.
yarilo-locks command
yarilo-locks is the cross-process write-coordination service for yarilo.
yarilo-locks is the cross-process write-coordination service for yarilo.
yarilo-managesieve command
yarilo-managesieve is the ManageSieve backend for the yarilo mail server.
yarilo-managesieve is the ManageSieve backend for the yarilo mail server.
yarilo-managesieve-login command
yarilo-managesieve-login is the ManageSieve (RFC 5804) login proxy.
yarilo-managesieve-login is the ManageSieve (RFC 5804) login proxy.
yarilo-migrate command
yarilo-migrate converts a per-user mailbox tree from one storage shape to another.
yarilo-migrate converts a per-user mailbox tree from one storage shape to another.
yarilo-monitor command
yarilo-monitor is a sidecar health checker for yarilo-director pods.
yarilo-monitor is a sidecar health checker for yarilo-director pods.
yarilo-pop3 command
yarilo-pop3 is the POP3/POP3S backend for the yarilo mail server.
yarilo-pop3 is the POP3/POP3S backend for the yarilo mail server.
yarilo-pop3-login command
yarilo-pop3-login is the POP3/POP3S login proxy for the yarilo mail server.
yarilo-pop3-login is the POP3/POP3S login proxy for the yarilo mail server.
yarilo-quota-status command
yarilo-quota-status is a Postfix policy service that rejects incoming messages to recipients whose mailbox is over quota.
yarilo-quota-status is a Postfix policy service that rejects incoming messages to recipients whose mailbox is over quota.
yarilo-sasl-login command
yarilo-sasl-login proxies Postfix SASL authentication to yarilo-auth.
yarilo-sasl-login proxies Postfix SASL authentication to yarilo-auth.
yarilo-submission command
yarilo-submission is the SMTP submission proxy for the yarilo mail server.
yarilo-submission is the SMTP submission proxy for the yarilo mail server.
yarilo-submission-login command
yarilo-submission-login is the SMTP submission login proxy for the yarilo mail server.
yarilo-submission-login is the SMTP submission login proxy for the yarilo mail server.
internal
anvil
Package anvil implements the yarilo-anvil TCP+mTLS connection-accounting server.
Package anvil implements the yarilo-anvil TCP+mTLS connection-accounting server.
auth/client
Package client implements the yarilo-auth TAB-delimited client protocol.
Package client implements the yarilo-auth TAB-delimited client protocol.
auth/oauth2
Package oauth2 validates OAuth 2.0 bearer tokens for the SASL OAUTHBEARER mechanism (RFC 7628) and exposes the result as a passdb.Passdb so OAuth-authenticated logins flow through the regular yarilo-auth pipeline (chain ordering, caching, penalty, policy, audit log — all work unchanged).
Package oauth2 validates OAuth 2.0 bearer tokens for the SASL OAUTHBEARER mechanism (RFC 7628) and exposes the result as a passdb.Passdb so OAuth-authenticated logins flow through the regular yarilo-auth pipeline (chain ordering, caching, penalty, policy, audit log — all work unchanged).
auth/policy
Package policy implements a wforce-compatible HTTP policy client.
Package policy implements a wforce-compatible HTTP policy client.
auth/protocol
Package protocol implements the yarilo-auth TCP+mTLS protocol.
Package protocol implements the yarilo-auth TCP+mTLS protocol.
auth/scram
Package scram is the session-layer glue between the SCRAM SASL server (in our forked go-sasl) and the per-protocol IMAP / POP3 / Submission session handlers in yarilo.
Package scram is the session-layer glue between the SCRAM SASL server (in our forked go-sasl) and the per-protocol IMAP / POP3 / Submission session handlers in yarilo.
auth/sql
Package sql implements SQL passdb/userdb for yarilo-auth.
Package sql implements SQL passdb/userdb for yarilo-auth.
backend
Package backend wires all server components for the backend (or single) mode.
Package backend wires all server components for the backend (or single) mode.
backendapi
Package backendapi is the backend-plane admin HTTP API.
Package backendapi is the backend-plane admin HTTP API.
cluster/proto
Package proto implements the yarilo-director TAB-delimited wire protocol.
Package proto implements the yarilo-director TAB-delimited wire protocol.
cluster/ring
Package ring implements consistent hashing for yarilo-director.
Package ring implements consistent hashing for yarilo-director.
connlimit
Package connlimit provides per-user@IP connection counting for IMAP/POP3/SMTP.
Package connlimit provides per-user@IP connection counting for IMAP/POP3/SMTP.
director
Package director — PeerDialer connects to sibling director replicas and propagates ring and user-directory changes so all replicas converge on the same state without a central coordinator.
Package director — PeerDialer connects to sibling director replicas and propagates ring and user-directory changes so all replicas converge on the same state without a central coordinator.
imap
Package imap wires go-imap/v2 to yarilo's mailbox and index backends.
Package imap wires go-imap/v2 to yarilo's mailbox and index backends.
lmtp
Package lmtp implements an LMTP server (RFC 2033) for local mail delivery.
Package lmtp implements an LMTP server (RFC 2033) for local mail delivery.
lmtplogin
Package lmtplogin implements the yarilo-lmtp-login service.
Package lmtplogin implements the yarilo-lmtp-login service.
login
Package login implements the yarilo mail-protocol login proxy.
Package login implements the yarilo mail-protocol login proxy.
loginproto
Package loginproto defines the internal login-pod → backend preamble protocol.
Package loginproto defines the internal login-pod → backend preamble protocol.
managesieve
Package managesieve implements the RFC 5804 ManageSieve backend.
Package managesieve implements the RFC 5804 ManageSieve backend.
monitor
Package monitor implements yarilo-monitor: a sidecar health checker that probes backend pods via IMAP/POP3/LMTP login and reports state changes to the director (BACKEND-FLUSH on failure, BACKEND-UP on recovery).
Package monitor implements yarilo-monitor: a sidecar health checker that probes backend pods via IMAP/POP3/LMTP login and reports state changes to the director (BACKEND-FLUSH on failure, BACKEND-UP on recovery).
pop3
Package pop3 implements a POP3 server (RFC 1939).
Package pop3 implements a POP3 server (RFC 1939).
quotastatus
Package quotastatus implements the Postfix policy service protocol (RFC-style text key=value over TCP) for quota enforcement.
Package quotastatus implements the Postfix policy service protocol (RFC-style text key=value over TCP) for quota enforcement.
sasllogin
Package sasllogin proxies Postfix SASL authentication to yarilo-auth.
Package sasllogin proxies Postfix SASL authentication to yarilo-auth.
storage/index/file
Package file is the per-folder index implementation that underlies every yarilo storage driver (maildir, dbox, mdbox).
Package file is the per-folder index implementation that underlies every yarilo storage driver (maildir, dbox, mdbox).
storage/mailbox/dbox/v1legacy
Package v1legacy is a read-only reader for yarilo's pre-Phase-3 dbox format.
Package v1legacy is a read-only reader for yarilo's pre-Phase-3 dbox format.
storage/mailbox/dboxv2
Package dboxv2 is the Dovecot-compliant single-message dbox (sdbox) storage driver, replacing yarilo's pre-Phase-3 internal/storage/ mailbox/dbox implementation.
Package dboxv2 is the Dovecot-compliant single-message dbox (sdbox) storage driver, replacing yarilo's pre-Phase-3 internal/storage/ mailbox/dbox implementation.
storage/mailbox/maildir
Package maildir implements MailboxBackend for Maildir format.
Package maildir implements MailboxBackend for Maildir format.
storage/mailbox/mdbox
Package mdbox is the multi-message dbox (mdbox) storage driver.
Package mdbox is the multi-message dbox (mdbox) storage driver.
storage/mailbox/mdbox/mdboxmap
Package mdboxmap implements the global per-user multi-message dbox map (on-disk file: `dovecot.map.index`).
Package mdboxmap implements the global per-user multi-message dbox map (on-disk file: `dovecot.map.index`).
storage/mailbox/mdbox/v1legacy
Package v1legacy is a read-only reader for yarilo's pre-Phase-5 mdbox format.
Package v1legacy is a read-only reader for yarilo's pre-Phase-5 mdbox format.
storage/mailindex
Package mailindex is a wire-compatible Go implementation of the mail-index binary format (major=7 minor=3).
Package mailindex is a wire-compatible Go implementation of the mail-index binary format (major=7 minor=3).
submission
Package submission implements the submission servers (port 587 / 465).
Package submission implements the submission servers (port 587 / 465).
submission/proxy
Package proxy implements the outbound submission proxy.
Package proxy implements the outbound submission proxy.
telemetry
Package telemetry exposes /healthz, /readyz, and /metrics on a dedicated port.
Package telemetry exposes /healthz, /readyz, and /metrics on a dedicated port.
userstate/acl
Package acl persists per-mailbox ACL state in a yarilo-acl file inside the folder's index directory (the same dir holding yarilo.index*).
Package acl persists per-mailbox ACL state in a yarilo-acl file inside the folder's index directory (the same dir holding yarilo.index*).
userstate/specialuse
Package specialuse persists per-user RFC 6154 special-use overrides set via IMAP CREATE (USE ...).
Package specialuse persists per-user RFC 6154 special-use overrides set via IMAP CREATE (USE ...).
userstate/subs
Package subs persists the set of mailbox names a user has SUBSCRIBE'd.
Package subs persists the set of mailbox names a user has SUBSCRIBE'd.
xclient
Package xclient implements the XCLIENT SMTP extension (Postfix-compatible).
Package xclient implements the XCLIENT SMTP extension (Postfix-compatible).
pkg
authclient
Package authclient is the Go client for the yarilo-auth master protocol.
Package authclient is the Go client for the yarilo-auth master protocol.
authtoken
Package authtoken implements the one-time session token store used by yarilo-auth to hand off authenticated sessions to backend pods without replaying credentials.
Package authtoken implements the one-time session token store used by yarilo-auth to hand off authenticated sessions to backend pods without replaying credentials.
build
Package build exposes build-time metadata stamped via -ldflags.
Package build exposes build-time metadata stamped via -ldflags.
dict
Package dict is yarilo's pluggable key-value store abstraction.
Package dict is yarilo's pluggable key-value store abstraction.
dict/dicttest
Package dicttest is a contract test suite that any pkg/dict driver can run against.
Package dicttest is a contract test suite that any pkg/dict driver can run against.
dict/drivers/all
Package all blank-imports every in-tree dict driver so a single import enables all of them in the importing binary.
Package all blank-imports every in-tree dict driver so a single import enables all of them in the importing binary.
dict/fail
Package fail is a dict driver that fails every operation.
Package fail is a dict driver that fails every operation.
dict/file
Package file is a JSON-backed local-filesystem dict driver.
Package file is a JSON-backed local-filesystem dict driver.
dict/memory
Package memory is an in-process dict driver backed by a sync.Map.
Package memory is an in-process dict driver backed by a sync.Map.
dict/redis
Package redis is a Redis-backed dict driver.
Package redis is a Redis-backed dict driver.
dict/sql
Package sql is a database/sql-backed dict driver.
Package sql is a database/sql-backed dict driver.
dict/varexpand
Package varexpand performs %-variable substitution for templated path / prefix strings used by dict drivers.
Package varexpand performs %-variable substitution for templated path / prefix strings used by dict drivers.
locks
Package locks is the single cross-process write-coordination abstraction for yarilo.
Package locks is the single cross-process write-coordination abstraction for yarilo.
mtls
Package mtls provides helpers for building mutual-TLS configs used between yarilo components (auth, anvil, director, imap-login → imap, etc.).
Package mtls provides helpers for building mutual-TLS configs used between yarilo components (auth, anvil, director, imap-login → imap, etc.).
quota
Package quota implements per-user storage and message-count quota tracking and enforcement.
Package quota implements per-user storage and message-count quota tracking and enforcement.
retry
Package retry provides a simple exponential-backoff retry helper for startup-time dials that must succeed before a service can accept traffic.
Package retry provides a simple exponential-backoff retry helper for startup-time dials that must succeed before a service can accept traffic.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL