What about implementing dovecot sieve?

Thanks, @Raphael and @salnz.
What about integrating Rspamd into Hestia. If I were to take the time to write the edit-service scripts for Rspamd, as one example, and any other scripts that would be necessary to make Rspamd an alternate option in Hestia (the way ProFTPd is an alternate option for the FTP server), would you all be interested in that?
–Dan

2 Likes

Hi @fluidmindorg

Of course! Probaly checkout the both installers and adapt them, then just create a PR on GitHub with your changes and we’ll review, test and implement it. We’re open for all :smile:.

1 Like

Dig it. I’ve got too much job-related work to do over the next couple of days (including installing GitLab and migrating my company’s self-hosted Bitbucket repos over to it. Cutting down on expenses.) But I’ll see if I have any time over the weekend.

gitlab can be a pita, best of luck mate!

1+ for rspamd, would be nice to see that happen :wink:

Have been eyeing up rspamd for a couple of years, but assumed it would mess with the mail setup too much to try switching spamassassin with it. Looking forward to the tutorial.

This topic from sieve switched to discussion of SpamAssassin and Rspamd.
But this is not the only function of sieve to move marked as spam messages to spam folder.
Most important function is message sorting rules. This is not good to make it by mail client, not in 21st century.

As I see this situation, mailbox users do not have access in Hestia. So they will manage filter rules using RoundCube interface (using managesieve plugin) or even maybe using remote sieve protocol (on port 4190).

So, is there any plans to implement it Hestia or it have to be done ourselves for now?

Thanks,
Volodymyr

1 Like

There are no official plans to support it, but if you send us a PR with the code, we’ll review and probaly implement it.

2 Likes

OK, get it.
I will take a look into this feature.
But not sure that I can prepare correct PR because I am ordinary itops with quite basic dev skills.
Anyway, I have enough resources on hypervisors to try :slight_smile:

2 Likes

I would be very happy if you did.

This post has 1.7K views. I think that many people are interested in having sieve correctly implemented.

2 Likes

I sure would like that. I am not the best at server stuff and having this just work would sure help out. For me the important party is sieve. If the backend is SpamAssassin vs Rspamd ,makes no difference to me.

I followed your short tutorial but when I try to do click on “filter” in Roundcube I get:
Failed request: webmail.*****./?_task=settings&_action=plugin.managesieve
Now I didn’t install lmpd because it wasn’t mentioned in your short tutorial. Is that why?

Hello all!

I know I’m reviving something but I think it’s needed!
I’ve been fooling around a lot the past 2 days with Rspamd, after I receive alot of notifications from my customers that they were getting a bunch spam(fake bounce spam e-mails).
So I decided to tweak spamassassin more, try to counter the spam. Well that didn’t work out so we moved on to the next step!

Rspamd! And guess what I found this amazing topic about rspamd with enough information to start it.
After succesfully installing rspamd, changing some configs here and there. Fixing some permission issues. I finally managed to get rspamd working with automatic ham & spam learning!
Perfect, to be honest, this works so good. It covers way more spam than spamassassin ever could do.

I just wanted to say thanks to @fluidmindorg @salnz @martineliascz to convice & kinda help me get rspamd active :wink:

1 Like

Feel free to submit a pull request for all the required changes…

1 Like

I will try to find some time the next day’s to start a pull request regarding the changes, or at least a start for it :slight_smile:

But… that could mean the complete spamassassin config should be removed in the pull request?
I gotta figure it out a bit cause my own setup is a little bit different than usually but every pull request could help I think?

1 Like

Yes if we switch to spamassassin and the config should be removed it doesn’t make sense to keep them both available… The idea is to slim down the maintenance and not increasing it by creating 2 different spam filters…

Oke!

I will try to find some time to fix this the next days!

When I finish the files I will put it in a pull request.

I started working on a bash script to do this, but failed at the stage where I had to add things to exim config and hestia nginx config. For what its worth, here is my initial foray …

#!/bin/bash


# Are we root enough? 



## Install Redis as a pre-requisite 

# Get an updated version of redis
add-apt-repository -y ppa:chris-lea/redis-server
apt update 
apt install -y redis-server redis-tools 

# Edit config file
cp /etc/redis/redis.conf /etc/redis/redis.orig 
grep -v -e "^#" -e "^;" -e "^$" redis.orig > redis.conf

sed -i 's/^bind .*/bind 127.0.0.1 ::1/' /etc/redis/redis.conf
echo "maxmemory 100mb" >> /etc/redis/redis.conf
echo "maxmemory-policy volatile-ttl" >> /etc/redis/redis.conf
echo 1 > /proc/sys/vm/overcommit_memory

systemctl enable redis-server
systemctl restart redis-server


## Now install rspamd from repos. Ubuntu version way behind. 

CODENAME=`lsb_release -c -s`
wget -O- https://rspamd.com/apt-stable/gpg.key | apt-key add -
echo "deb [arch=amd64] http://rspamd.com/apt-stable/ $CODENAME main" > /etc/apt/sources.list.d/rspamd.list
echo "deb-src [arch=amd64] http://rspamd.com/apt-stable/ $CODENAME main" >> /etc/apt/sources.list.d/rspamd.list
apt-get update
apt-get --no-install-recommends install rspamd

# Add config files

cat <<'EOF' > /etc/rspamd/local.d/redis.conf
write_servers = "127.0.0.1:6379";
read_servers = "127.0.0.1:6379";
EOF

cat <<'EOF' > /etc/rspamd/local.d/history_redis.conf
nrows = 1000;
EOF

## How to set the password from command line ... ?
cat <<'EOF' > /etc/rspamd/local.d/worker-controller.inc
password = "$uytati8srfxwzre7ewrgcep9gzcho1b";
EOF

cat <<'EOF' > /etc/rspamd/local.d/options.inc
history_rows = 1000;
EOF

cat <<'EOF' > /etc/rspamd/local.d/multimap.conf
# local.d/multimap.conf
# create the map files in /var/lib/rspamd with _rspamd:_rspamd ownership. 

CUSTOM_WHITELIST_DOMAIN {
  type = "from";
  filter = "email:domain";
  map = "/var/lib/rspamd/CUSTOM_whitelist_domain.map";
  action = "accept"; 
  description = "Accept if sender is from domains in this list";
}

CUSTOM_BLACKLIST_DOMAIN {
  type = "from";
  filter = "email:domain";
  map = "/var/lib/rspamd/CUSTOM_blacklist_domain.map";
  action = "accept"; 
  description = "Hard reject if sender is from domains in this list";
}

CUSTOM_WHITELIST_EMAILADD {
  type = "from";
  filter = "email";
  map = "/var/lib/rspamd/CUSTOM_whitelist_emailadd.map";
  score = -5.0
  description = "Score -5 if recipient is in this list";
}

CUSTOM_WHITELIST_IP {
  type = "ip";
  filter = true;
  map = "/var/lib/rspamd/CUSTOM_whitelist_ip.map";
  action = "accept" ;
  description = "Accept if sender IP address is in this list";
}

CUSTOM_BLACKIST_TLD {
  type = "from";
  filter = "email";
  map = "/var/lib/rspamd/CUSTOM_blacklist_tld.map";
  regexp = true;
  action = "reject";
  description = "Reject from .icu domain and friends (regex)";
}
EOF


# Set up Custom multimaps
cat <<'EOF' > /var/lib/rspamd/CUSTOM_blacklist_domain.map
# local blacklist domain map
# Rejects emails from these domains. No further processing
# see /etc/rspamd/local.d/multimap.conf
# Put the whold domain in eg
# example.com
EOF

cat <<'EOF' > /var/lib/rspamd/CUSTOM_blacklist_tld.map
# local blacklist TLD domain map
# Rejects emails from an ENTIRE TLD. No further processing
# see /etc/rspamd/local.d/multimap.conf
# Use a regex with care eg this will block [email protected]
# .+@.+\.xyz$
EOF

cat <<'EOF' >  /var/lib/rspamd/CUSTOM_whitelist_domain.map
# local whitelist domain map
# bypasses all checks. Sets score = 0.0
# see /etc/rspamd/local.d/multimap.conf
# Put the whold domain in eg
# example.com
EOF

cat <<'EOF' >  /var/lib/rspamd/CUSTOM_whitelist_emailadd.map
# local whitelist email address map
# alters score -5
# see /etc/rspamd/local.d/multimap.conf
# Add whole email addresses. eg
# [email protected]
EOF

cat <<'EOF' >  /var/lib/rspamd/CUSTOM_whitelist_ip.map
# local whitelist ip map
# Bypasses scanning, sets score = 0.0
# see /etc/rspamd/local.d/multimap.conf
# Enter whole IP addresses eg
# 200.100.50.88
EOF

chown _rspamd:_rspamd /var/lib/rspamd/CUSTOM*.map

systemctl restart rspamd

## Now change Exim config 
# Not sure ... maybe need blocks of conditional code in exim.conf and set RSPAMD=YES at the top. 


# Disable spamassassin. (if running?)
systemctl restart exim4
systemctl stop spamassassin
systemctl disable spamassassin

## Change Hestia Config

sed -i "s/^ANTISPAM_SYSTEM=.*/ANTISPAM_SYSTEM='rspamd'/" /usr/local/hestia/conf/hestia.conf

cp /usr/local/hestia/nginx/conf/nginx.conf /usr/local/hestia/nginx/conf/nginx.conf.save

# Add block to bottom of nginx.config, just before final two }} 

# location /rspamd/ {
#             proxy_pass       http://localhost:11334/;
#             proxy_set_header Host      $host;
#             proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
#             auth_basic "Restricted Content";
#             auth_basic_user_file /etc/apache2/admin.passwd;
#         }

systemctl restart hestia