Skip to content

Reject executable attachments; make virus scanning a setting - #44

Open
byjpr wants to merge 1 commit into
claude/admiring-planck-25cvzffrom
claude/fix-20-attachments-av
Open

byjpr wants to merge 1 commit into
claude/admiring-planck-25cvzffrom
claude/fix-20-attachments-av

Conversation

@byjpr

@byjpr byjpr commented Oct 9, 2026

Copy link
Copy Markdown
Owner

Closes #20

Changes

  • blockedAttachmentExtensions in settings.nix holds Gmail's list of blocked file types (exe, scr, js, vbs, bat, msi, iso, img, dmg, lnk, jar, hta, ps1, xll, …). An Rspamd multimap rule of type filename with skip_archives = false rejects messages carrying them:

    • including names inside zip/rar/7z archives;
    • and double extensions like invoice.pdf.exe.

    This works without ClamAV. The 550 message tells the sender to share a link instead.

  • Rspamd's built-in MIME_BAD_EXTENSION list was deliberately not promoted to reject: it also contains .html/.htm, which some legitimate senders use. It still adds to the spam score as before.

  • virusScanning setting (default false) turns on ClamAV through the mail module, with guidance on RAM (4 GB+). The README limitation is updated.

Testing

I ran Rspamd 4.0.1 locally with the generated config and real multipart messages:

Attachment Result
setup.exe reject (BLOCKED_ATTACHMENT[exe])
report.pdf not blocked
docs.zip containing payload.js reject (BLOCKED_ATTACHMENT[js])
invoice.pdf.exe reject (BLOCKED_ATTACHMENT[exe])

All 5 provider example systems build. nixfmt, shellcheck and tofu validate pass.

🤖 Generated with Claude Code

https://claude.ai/code/session_01G22o7QQ17GRtkCqpJNFr9B


Generated by Claude Code

An Rspamd multimap rule rejects attachments with extensions that are
almost exclusively malware (Gmail's blocked list: executables, scripts,
disk images, add-ins), including inside archives and double extensions,
independently of ClamAV. settings.virusScanning turns ClamAV on for
servers with enough RAM.

Closes #20

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01G22o7QQ17GRtkCqpJNFr9B
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Low] No virus scanning, and no way to turn it on from settings.nix

2 participants