filter
Reset the server-wide email filter list to the built-in spam and virus keyword rules
- Command:
/go/filter - Category: Mail
- Required arguments: None
- Output: None (silent)
- Last updated: 2026-11-19
[!NOTE] The index describes this command as "Manage per-domain email filters (Sieve)". The script documented here does not touch Sieve or any per-domain setting. It deletes and rebuilds the server-wide filter database
/var/lib/sqlite/filter.dbwith a fixed list of rules. Either update the index description to match this page, or check that this is the script you meant to document.
On this page: Overview · Quick start · Syntax · Output · Default rules · Examples · Troubleshooting · Details · See also
Overview
/go/filter resets the server's list of email filter rules to the built-in defaults. It:
- deletes
/var/lib/sqlite/filter.db, including every rule that was added by hand or by the panel - creates the
Filtertable again - inserts 42 default rules: keyword patterns for spam and virus-warning emails
The command only rewrites the database. It does not rebuild or reload any mail configuration, so the new list is used only when another command or service reads filter.db.
[!WARNING] Running this command erases all custom filter rules. Back up
/var/lib/sqlite/filter.dbfirst if you have added your own.
Quick start
/go/filter
Syntax
/go/filter
The command has no arguments or options. Any arguments are logged and ignored.
Output
The command prints nothing and always exits with code 0. To check the result, read the database:
sqlite3 /var/lib/sqlite/filter.db "SELECT COUNT(*) FROM Filter"
Logging
Every run is appended to /var/log/go/filter.log.
The Filter table
| Column | Type | Notes |
|---|---|---|
FilterID |
Integer, primary key | Assigned automatically. |
Type |
Text | Always Header for the default rules. |
Keyword |
Text | A regular expression of the form .*(?i)<text>. The (?i) makes the match case-insensitive. |
Description |
Text | Spam detected or Virus alert. |
The pair Type and Keyword must be unique.
Default rules
All 42 rules have the type Header. Each keyword below is stored with the prefix .*(?i).
| Description | Rules |
|---|---|
Virus alert |
5 |
Spam detected |
37 |
Virus alert: Anti-Virus, BANNED FILENAME, detected virus, AntiVirus detected, AntiVirus
Spam detected: Make Money, Get paid, Double your income, Cash bonus, Lottery, Winner, Mortgage, Credit.*Score, $$ (see the note below), Limited Time, Final warning, Act now, Last chance, Expires today, Verify your account, Security alert, Miracle, No risk, Guaranteed, Claim your, You won, Congratulations, Weight loss, Viagra, Cialis, Prescription, Medication, HR Benefits, Document shared with you, Business Proposal Request, Your storage is nearly full, 100% guaranteed, Limited Time Offer, LOAN FUNDING, casino, Top Deals, ED Treatments
Rules to know about
- The
$$rule is wrong. In the script,$$is the shell's process ID, so the stored keyword is.*(?i)followed by a random number that changes on every run. It does not match a dollar sign. - Some keywords are too broad. For example,
Cialisalso matches the words specialist and socialist, andED Treatmentsmatches any text ending in "ed treatments", such as "limited treatments".AntiVirusandAnti-Virusalso appear in the headers that legitimate virus scanners add to clean mail. - Some phrases appear in normal mail. Examples are
Security alert,Verify your account,Document shared with you,Your storage is nearly full,Congratulations,Mortgage,Prescription, andMedication. Real notifications from banks, cloud services, pharmacies, and clinics can contain them. - Some rules overlap.
Limited Timealready coversLimited Time Offer,AntiViruscoversAntiVirus detected, andGuaranteedcovers100% guaranteed.
If the rules are applied as header checks, they match any header line, not just the subject. Check how your mail configuration uses filter.db before relying on these rules.
Examples
# Reset the filter list to the defaults
/go/filter
# Count the rules
sqlite3 /var/lib/sqlite/filter.db "SELECT COUNT(*) FROM Filter"
# Show all rules
sqlite3 /var/lib/sqlite/filter.db "SELECT FilterID, Keyword, Description FROM Filter"
# Back up the current list before resetting
cp /var/lib/sqlite/filter.db /root/filter.db.bak
Troubleshooting
| Symptom | Likely cause | Fix |
|---|---|---|
| Custom filter rules disappeared | The command deletes the database before it rebuilds it. | Add the rules again, or restore your backup of filter.db. |
Legitimate mail is flagged as Spam detected or Virus alert |
A default keyword is too broad. | Remove the rule, for example sqlite3 /var/lib/sqlite/filter.db "DELETE FROM Filter WHERE Keyword LIKE '%Cialis%'". Running /go/filter again brings it back. |
| A rule with a number in it appears | The $$ rule. The number is the process ID of the run. |
Delete it. See Rules to know about. |
| New rules don't seem to apply | This command doesn't rebuild or reload any mail configuration. | Run the command that rebuilds the mail setup, then check that the rules are active. |
| Nothing is printed | By design. | Check the result with the SELECT COUNT(*) query above. |
| Per-domain Sieve filters were not changed | This command doesn't touch Sieve. | See junk for the Junk folder filters. |
Details
What it does
- Logs the call to
/var/log/go/filter.log. - Deletes
/var/lib/sqlite/filter.db. - Creates the table
Filter (FilterID, Type, Keyword, Description)with a unique pair ofTypeandKeyword. - Inserts the 42 default rules, one
sqlite3call each, usingINSERT OR IGNORE. Because the database was just deleted, nothing is ignored.
Notes for maintainers
| Issue | Why it matters | Suggested fix |
|---|---|---|
| The database is deleted on every run | All custom rules are lost. | Keep the file and insert only the missing defaults, or add a --reset option and an IsDefault column. |
| The rebuild is not atomic | Between the delete and the last insert, a reader sees an empty or partial list. | Build a temporary database and mv it into place. |
$$ in double quotes becomes the process ID |
The rule is a random number. | Write \$\$ in the shell, and \$\$ in the pattern for a literal dollar sign. |
| Patterns are too broad | Normal mail is rejected (for example Cialis in "specialist", ED Treatments, AntiVirus in scanner headers). |
Add word boundaries (\b), limit rules to the Subject header, and drop the scanner words. |
| Phrases from legitimate notifications are included | Real alerts and shared-document mails are treated as spam. | Remove or soften them, and score messages instead of rejecting them. |
| Overlapping rules | Redundant rows. | Remove Limited Time Offer, AntiVirus detected, and 100% guaranteed, or keep only the more specific ones. |
42 separate sqlite3 calls, each with sudo |
Slow and noisy. | Run one sqlite3 call with all inserts in a single transaction. |
| Nothing rebuilds or reloads the mail configuration | Changes may not take effect. | Call the step that applies filter.db at the end. |
| The index describes per-domain Sieve filters, the script writes a global list | Users expect something different. | Fix the description, or rename the script. |
See also
| Command | Description |
|---|---|
junk |
Enable, disable, or rebuild the Sieve filters for the Junk folder |
spam |
Track spam email accounts in GoAdmio |
postfwd |
Build the Postfwd rate-limiting rules |
antivirus |
Built-in GoAdmio antivirus |
clamav |
Open-source antivirus engine for malware, viruses, trojans, and threats |
installmail |
Install and configure webmail services (Postfix and Dovecot) |