GoAdmio

junk

Build Sieve filters that move suspected spam — failed SPF/DKIM, known spam phrases fetched from GoAdmio, known-bad sender IPs — into the Junk folder, or toggle the filter on and off

On this page: Overview · Quick start · Syntax · Options · Output · Examples · Troubleshooting · Details · See also


Overview

/go/junk generates two Sieve filter scripts that doveconf wires into Dovecot when the junk filter is enabled: one general ruleset (.sieve) and one sender-IP blocklist (.ip). It can also just toggle the feature on or off.

[!WARNING] Both sievec calls that compile the generated scripts into the binary form Dovecot actually loads run without sudo, and this script has no root self-elevation check at the top. Every other command in the script (mkdir, tee, wget, cp) does use sudo. If this command is ever run without already being fully root, the human-readable .sieve/.ip files are updated correctly, but compiling them can fail silently — leaving Dovecot running whatever rules were compiled the last time this succeeded with full privileges, with no error shown. Confirm this script always runs as root.

[!NOTE] Running /go/junk enable only flips a database flag and restarts mail — it does not generate .sieve/.ip itself. doveconf only wires the junk filter into Dovecot's configuration if those files already exist on disk. On a server where the no-argument form has never been run, enable has no actual effect on mail filtering.

The call is appended to /var/log/go/junk.log.


Quick start

# Build (or rebuild) the filter rules
/go/junk

# Then turn the feature on
/go/junk enable

Syntax

/go/junk
/go/junk enable
/go/junk disable
Form Behavior
/go/junk Regenerates /usr/local/goadmio/junk/.sieve and .ip from scratch and recompiles them.
/go/junk enable Sets Junk=1 in GoAdmio's configuration, regenerates dovecot.conf with doveconf, and restarts mail in the background.
/go/junk disable Same, with Junk=0.

Options

None.


Output

Configuring IP Filter...

is the only line the main (no-argument) path prints. enable/disable print nothing of their own.


Examples

# First-time setup: build the rules, then turn the feature on
/go/junk
/go/junk enable
# Refresh the rules later (new spam phrases, new blocked IPs) and recompile them
/go/junk
# Turn it off
/go/junk disable
# Add an IP to the per-server blocklist the main path reads from
sudo sqlite3 /var/lib/sqlite/junk.db "INSERT INTO Junk (Domain, IP) VALUES ('example.com', '203.0.113.5')"
/go/junk

Troubleshooting

Symptom Likely cause Fix
/go/junk enable doesn't seem to do anything The filter files were never generated. Run /go/junk (no arguments) at least once first, then enable.
New spam phrases or IPs you just added don't seem to be filtered The sievec compilation step may have failed silently (see the warning above), so Dovecot is still using an older compiled version. Confirm the command ran as root; check the actual compiled file's timestamp, and sievec's own exit status if you run it by hand.
Legitimate mail from a sender with no SPF record set up gets junked SPF result None (no record published at all) is treated the same as Fail (an explicit failure) — see Known issues. This is a deliberate, if aggressive, policy choice; remove that rule from .sieve if it's too broad for your mail traffic.
An IP reported as spam for one domain gets blocked for every other hosted domain too The IP blocklist is built server-wide; the Domain column in junk.db is read but not actually used to scope anything. Expected as currently written — see Known issues. There's no way to make a blocked IP apply to only one domain.
The generated .sieve file fails to compile after an update A phrase fetched from GoAdmio's remote lists contained a double-quote character, which isn't escaped before being embedded in the Sieve file, corrupting its syntax. Check /usr/local/goadmio/junk/.sieve for a broken string literal around where a new phrase was added, and run sievec by hand to see the error.
download.goadmio.com related copies never happen That path only exists on GoAdmio's own distribution server; on an ordinary customer server, this step is a silent no-op. Expected; not relevant to typical installs.

Details

What the main path builds

.sieve (general rules, checked in order, each one stopping further processing if it matches):

  1. Received-SPF: Fail → Junk
  2. Received-SPF: None → Junk (see Known issues)
  3. Authentication-Results containing dkim=fail → Junk
  4. Subject contains any of: disk quota, storage is almost full, plus whatever lines are currently published at https://www.goadmio.com/junk/subject.txt
  5. Body contains any of: advanced ai service, we are a leading software, plus whatever lines are currently published at https://www.goadmio.com/junk/body.txt

.ip (sender IP blocklist):

Both files are rebuilt from scratch every time, then compiled with sievec. If a server also hosts download.goadmio.com (GoAdmio's own infrastructure, not a typical customer server), the freshly built files are also copied there — presumably so the subject.txt/body.txt/IP lists can be served back out from that domain for other servers to fetch.

Why enable/disable restart mail but the main build doesn't

enable and disable change dovecot.conf itself (via doveconf), which needs Dovecot restarted to take effect — done in the background with screen, so the command returns immediately. The main build only changes the Sieve script content and recompiles it; Dovecot's Sieve plugin is normally re-checked per message delivery, so a successful recompile should take effect on the next incoming mail without a restart.

Known issues


See also

Command Description
doveconf Rebuild the Dovecot configuration for the installed Dovecot version, including SSL certificates for the hostname and each domain
autoresponders Install the autoresponse Postfix content filter
filter Manage per-domain email filters (Sieve)
spam Track spam email accounts in GoAdmio
installmail Install and configure webmail services (Postfix and Dovecot)
troubleshoot Troubleshoot email problems in GoAdmio