Golub

Installation

Golub is published as a container image for linux/amd64 and linux/arm64:

ghcr.io/stefanpejcic/golub
TagMeaning
stableLatest release.
0.3Latest 0.3.x release; gets fixes, never breaking changes.
0.3.0One exact release. Recommended for production.

Images are signed with cosign and carry an SBOM and build provenance. Every build is scanned with Trivy.

What you need

  • An IMAP server (Dovecot or any other) and an SMTP submission server for sending.
  • A random secret for session cookies: openssl rand -base64 32.

Golub needs no database and writes no files, so it can run with a read-only file system and be restarted or moved at any time.

Docker Compose

Point Golub at your mail server by the name on its TLS certificate:

services:
  golub:
    image: ghcr.io/stefanpejcic/golub:0.3.0
    restart: unless-stopped
    ports:
      - "8080:8080"
    environment:
      GOLUB_IMAP_HOST: mail.example.com
      GOLUB_IMAP_TLS: implicit          # port 993
      GOLUB_SMTP_TLS: implicit          # port 465
      GOLUB_SECRET_KEY: "paste the output of: openssl rand -base64 32"

Start it and open http://localhost:8080. Sign in with a full mailbox address and its password.

Login page

Mail server on the same Docker network

If Golub and the mail server share a private network, use the mail server's container name. When the server has no certificate for that name, turn TLS off; Golub only allows this for private and loopback addresses:

    environment:
      GOLUB_IMAP_HOST: mailserver
      GOLUB_IMAP_TLS: none
      GOLUB_SMTP_TLS: none

With docker-mailserver, starttls on ports 143 and 587 also works when the certificate matches the name you use.

Mail server with a private certificate

Mount your CA certificate and point GOLUB_TLS_CA at it, so Golub can verify the server. There is deliberately no option to skip verification.

    volumes:
      - ./my-ca.pem:/etc/golub/ca.pem:ro
    environment:
      GOLUB_TLS_CA: /etc/golub/ca.pem

HTTPS

Let your proxy (nginx, Caddy, Traefik) handle certificates and forward to port 8080. Tell Golub which addresses the proxy uses, so it trusts X-Forwarded-For and X-Forwarded-Proto from them and nobody else:

    environment:
      GOLUB_TRUST_PROXY: 172.16.0.0/12

Golub then marks its cookie Secure whenever the proxy says the request came over HTTPS.

nginx example:

location / {
    proxy_pass http://127.0.0.1:8080;
    proxy_set_header Host $host;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $scheme;
    # new mail is pushed over a long-lived stream
    proxy_buffering off;
    proxy_read_timeout 1h;
}

proxy_buffering off matters for live updates: Golub pushes new mail over Server-Sent Events at /api/events. When the stream can't get through, Golub still checks for new mail on the interval set in Settings.

Golub serves HTTPS itself

Mount a certificate and key and set both variables:

    ports:
      - "443:8443"
    volumes:
      - /etc/letsencrypt/live/mail.example.com:/certs:ro
    environment:
      GOLUB_LISTEN: ":8443"
      GOLUB_TLS_CERT: /certs/fullchain.pem
      GOLUB_TLS_KEY: /certs/privkey.pem

Golub reloads the certificate when the files change (checked at most once a minute) and on SIGHUP, so renewals by certbot or another ACME client need no restart. If a reload fails, the old certificate keeps working and an error is logged. TLS 1.2 is the minimum and HSTS is sent.

Checking that it runs

curl http://localhost:8080/healthz
{"status":"ok","version":"0.3.0"}

Next steps

Edit this page on GitHub

Your mail server deserves a better webmail.

The real interface with made-up mail. Nothing to install, no sign-up.

Golub showing the inbox with an open message