Skip to content

RTFM · Healthchecks

lb.saphira.imap: will it open the mailbox hall?

The IMAP server greets you and lists what it can do, and the check leaves without ever logging in. Greeting plus CAPABILITY is the whole transaction; no credentials, no mailbox state, no residue.

Saphira Linux dragon mascot

What it proves

A valid IMAP session start: the * OK greeting and the server's CAPABILITY announcement. Authentication is never attempted. This proves the IMAP state machine is alive end to end; the failure mode where the port accepts connections but the mail store behind it is wedged is exactly what greeting checks surface.

How it works

The whole check
exec curl --silent --max-time "$LB_TIMEOUT" "imap://${LB_REAL}:${PORT}/" >/dev/null

curl connects, reads the greeting, issues its own CAPABILITY as part of connection setup, and closes without AUTH. Output is discarded; the exit code is the verdict.

Configuration

Knobs
VariableDefaultMeaning
LB_SAPHIRA_TIMEOUT3Session deadline
(target port)$4, else 143993 (implicit TLS) exercises the TLS handshake as part of the greeting

Wiring it up

ldirectord
# ldirectord.cf
virtual = 203.0.113.10:143
    protocol = tcp
    scheduler = wlc
    real = 192.168.20.25:143 gate 1
    checktype = external
    checkcommand = "/var/lib/lb/saphira/lb.saphira.imap"

Run it by hand

Manual run
/var/lib/lb/saphira/lb.saphira.imap mail-pool 143 192.168.20.25 143
echo $?
# 0 = greeted with a valid IMAP greeting
# 1 = no greeting or session stalled

Failure modes

  • Immediate close after connect; the daemon runs but its backend store is unavailable: the classic greeting failure
  • Timeout: socket accepted, server silent: often a wedged TLS layer or exhausted worker pool

Did we miss something?

If this page left something unanswered, found an error, or there is another subject you would like documented, tell us. Saphira’s documentation grows from real problems people need to solve.

Send feedback or request a new section →

Prefer not to do it yourself?

Everything needed to do the work yourself is documented here and remains free; we charge for human time, not for withholding knowledge. Sometimes the missing resource is simply time. The same people who build Saphira can provide paid professional help with implementation, migration, troubleshooting and administration.

Ask about professional support →