Golub

Configuration

Golub is configured only with environment variables. They are all checked at startup; if one is wrong or missing, Golub exits and names the variable, for example:

GOLUB_SECRET_KEY: must decode to 32 bytes, got 9

Required

VariableDescription
GOLUB_IMAP_HOSTHost name of the IMAP server. Use the name on its certificate.
GOLUB_SECRET_KEYKey that encrypts session cookies: 32 random bytes, base64. Create it with openssl rand -base64 32. Changing it signs everyone out.

Mail server

VariableDefaultDescription
GOLUB_IMAP_TLSstarttlsimplicit (TLS from the start), starttls or none.
GOLUB_IMAP_PORT993 with implicit, otherwise 143
GOLUB_SMTP_HOSTsame as GOLUB_IMAP_HOSTSubmission server for sending.
GOLUB_SMTP_TLSstarttlsSame values as GOLUB_IMAP_TLS.
GOLUB_SMTP_PORT465 with implicit, otherwise 587
GOLUB_TLS_CAPath to an extra CA bundle, for mail servers with a private certificate.

none is only accepted when the host resolves to a loopback or private address, so passwords never cross the internet unencrypted. Certificates are always verified.

Golub saves a copy of every sent message to the Sent folder over IMAP.

Web server

VariableDefaultDescription
GOLUB_LISTEN:8080Address and port to listen on.
GOLUB_TLS_CERTCertificate file (PEM, full chain). Set together with GOLUB_TLS_KEY to serve HTTPS.
GOLUB_TLS_KEYPrivate key file (PEM).
GOLUB_TRUST_PROXYComma-separated CIDRs of reverse proxies, like 127.0.0.1/32,172.16.0.0/12. Only these may set X-Forwarded-For and X-Forwarded-Proto.

See Installation for both HTTPS setups.

Sessions

VariableDefaultDescription
GOLUB_SESSION_TTL12hHow long a sign-in lasts, as a Go duration: 30m, 8h, 168h.

The session lives only in an encrypted cookie. There is no session store on the server, so restarting Golub does not sign anyone out.

Single sign-on

VariableDefaultDescription
GOLUB_SSO_SECRETShared secret for SSO tokens, at least 32 characters. Setting it turns SSO on.
GOLUB_MASTER_USERDovecot master user name. Required with SSO.
GOLUB_MASTER_PASSWORDDovecot master user password. Required with SSO.

How it works and how to create tokens: Single sign-on.

Defaults for new users

VariableDefaultValues
GOLUB_DEFAULT_LOCALEenen, sr-Latn, ar
GOLUB_DEFAULT_THEMEsystemsystem, light, dark

The language is picked in this order: the SSO token, the user's own choice, the browser's languages, then GOLUB_DEFAULT_LOCALE. Users can change both in Settings or on the login page.

Branding

VariableDefaultDescription
GOLUB_BRAND_NAMEGolubName in the browser tab and on the login page, up to 64 characters.
GOLUB_BRAND_LOGOPath to a .png, .jpg, .svg or .webp file, up to 512 KB.
GOLUB_BRAND_ACCENTAccent colour as #rrggbb, for example #2563eb.

More in Branding.

Logging

VariableDefaultValues
GOLUB_LOG_LEVELinfodebug, info, warn, error

Logs are JSON lines on standard output.

Complete example

services:
  golub:
    image: ghcr.io/stefanpejcic/golub:0.3.0
    restart: unless-stopped
    read_only: true
    ports:
      - "127.0.0.1:8080:8080"
    volumes:
      - ./logo.svg:/etc/golub/logo.svg:ro
    environment:
      GOLUB_IMAP_HOST: mail.example.com
      GOLUB_IMAP_TLS: implicit
      GOLUB_SMTP_TLS: implicit
      GOLUB_SECRET_KEY: ${GOLUB_SECRET_KEY}   # in .env, created once with: openssl rand -base64 32
      GOLUB_TRUST_PROXY: "127.0.0.1/32"
      GOLUB_SESSION_TTL: 8h
      GOLUB_DEFAULT_LOCALE: en
      GOLUB_DEFAULT_THEME: system
      GOLUB_BRAND_NAME: "Example Mail"
      GOLUB_BRAND_LOGO: /etc/golub/logo.svg
      GOLUB_BRAND_ACCENT: "#0f766e"

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