GithubHelp home page GithubHelp logo

rsmuc / antispambox Goto Github PK

View Code? Open in Web Editor NEW
14.0 6.0 6.0 46 KB

A docker container to filter mails with rspamd and spamassassin via IMAP - (This is just a mirror repository: see codeberg.org)

Home Page: https://codeberg.org/antispambox/antispambox

License: MIT License

Dockerfile 31.20% Python 68.80%

antispambox's Introduction

antispambox

Status

under development

container should be working basically

About

Antispambox is based on the idea of IMAPScan. It's an Docker container including ISBG. With ISBG it's possible to scan remotely an IMAP mailbox for SPAM mails with spamassassin. So we are not dependent to the SPAM filter of our provider.

Antispambox does have two anti-spam-engines integrated. Spamassassin and RSpamd.

Why not IMAPScan?

(Thanks to dc55028 for adding the MIT license to the IMAPScan repository)

  • I prefer Python instead of Bash scripts
  • I made several modifications (see Features) and not all of the modifications would be compatible to the ideas of IMAPScan
  • I integrated push support
  • ...

Why not ISBG only?

ISBG is only supporting spamassassin as backend. Spamassassin is a very effective, but not very efficient SPAM filter. At home I'm running the docker container on a very small embedded PC with an Atom CPU. On my smartphone I'm using K9Mail with push support. So it is very important that the scanning for SPAM is very fast. With spamassassin it takes too long to filter the mails, so SPAM mails are shown on my smartphone before they are filterd out. The solution: rspamd.

But rspamd is not supported by ISBG and will not be supported to keep ISBG maintainable. So I forked ISBG and created IRSD.

Antispambox integrated both.

Why not IRSD only?

rspamd scans the mails on my machine very fast and efficient but the detection rate is not as good for me as spamassassin.

Features

  • Integration of ISBG (spamassassin)
  • Integration of IRSD (rspamd)
  • Integrated PUSH / IMAP IDLE support
  • integrated geo database and filters for it
  • focused on encrypted emails (header analysis only)
  • custom spamassassin rules for Germany and header analysis (my mails are prefiltered by mailbox.org - this container is only focused to the SPAM the MBO filter does not catch) - so the rules may not match your requirements
  • In future: Webinterface to configure everything
  • In future: Configure the rspamd webinterface
  • In future: Support multiple IMAP accounts within one container

Using the container

building the container

  • docker build -f Dockerfile -t antispambox . --no-cache

starting the container

  • sudo docker volume create bayesdb

  • sudo docker volume create accounts

  • sudo docker run -d --name antispambox --restart always -v bayesdb:/var/spamassassin/bayesdb -v accounts:/root/accounts antispambox

workflow and configuration

  • To configure the container run:
    • docker exec -i -t antispambox /bin/bash
    • use nano to configure the /root/accounts/imap_accounts.json
  • startup.py will be directly started with the docker container. To enable the scanning for spam, you need to set in /accounts/imap_accounts.json the enabled flag to True. By deafult this flag will be set to False until the configuration is finished.
  • First configure you mail account in /root/accounts/imap_accounts.json
  • Train spamassassinn and spamd:
    • To ensure that spamassassin and spamd bayes filtering is working you should train it at least with 200 SPAM and 200 HAM mails.

      To train the backends copy your SPAM and HAM messages in the IMAP folders you configured for SPAM_train and HAM_traing.

  • Set the enabled flag in /root/accounts/imap_accounts.json to True.
  • Restart the docker container
  • The docker container will not start with IMAP idle to your INBOX folder and check for new mails. If a SPAM mail is detected, Antispambox will move the SPAM to your JUNK folder.
  • Mails you move manually to SPAM_train will be learned as SPAM. Mails you move manually to HAM_train will learned as HAM. The backend services spamassassin and rspamd will learn improve their detection rate with each learned mail.

Hints

  • To see how many mails rspamd has already learned or detected as SPAM or HAM, just run: spamc stat

  • To see how many mails spamassassin has already learned run: sa-learn --dump magic

  • There is a logfile to see the IMAP idle and scanning process: /var/log/antispambox.log

TODOs

  • see features
  • PEP8 & static code analysis

License

MIT

see license text

antispambox's People

Contributors

rsmuc avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

antispambox's Issues

Password

Don't save the password in clear text in imap_accounts.txt.

Maintain the project

Hello ^^
I discovered today this project and i'm quite sad to see it's discontinued since 4 years now
I would really appreciate having more informations about how to get it work and maybe a WebUI, as i'm actually looking for a spamfilter for some of my mailboxes

With some time, help and donations would you accept to get back and maintain this repo?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.