Sentora 1.0.3 SpamAssassin Setup & Training Scripts

I’m making some changes to my hosting services, I’ve been testing Sentora, as it’s much more user friendly, if a little more limited in what it’s capable of doing, vs my go-to admin panel over the past 6+ years, Virtualmin.

I noticed that SpamAssassin isn’t set up on a Sentora server by default, so here’s a script that will get things working under a fresh Sentora install in CentOS 7:

After this script has run, some mail server settings will be changed, and the master.cf configuration file for Postfix will be backed up just in case it craps out.

Make sure the SpamAssassin daemon is running on port 783 with this command:

Testing is easy, send an email to an address hosted by Sentora with the following in the subject line:

If SpamAssassin is working correctly, this will be tagged with a spam score of 999.

A useful script is below, this trains SpamAssassin on the mail in the current server mailboxes. I’ve been using a version of this for a long time, this one is slightly modified to operate with Sentora’s vmail system. All mail for all domains & users will be fed into SpamAssassin in this script. I set this to run nightly in cron.

 

4 thoughts on “Sentora 1.0.3 SpamAssassin Setup & Training Scripts

  1. IZteCh says:

    Thanks for the guide.
    For the training where is it reading the mail from. Are you creating a mailbox that has spam that is selected manually?

    I am assuming you need to set up IMAP for this.

    Reply
    1. The Engineer says:

      Hi,

      It’s reading the spam mail files directly from /var/sentora/vmail/*/*/.Junk/, and the ham from /var/sentora/vmail/*/*/{cur}, where the wildcard asterisks will be the domain name & username. This doesn’t require IMAP to work as it’s operating at filesystem level.

      Reply
  2. IZteCh says:

    I think I have something wrong here.

    master.cf

    smtp inet n – n – – smtpd
    -o smtpd_sasl_auth_enable=yes
    -o receive_override_options=no_address_mappings
    -o content_filter=smtp-amavis:127.0.0.1:10024

    below in the file …

    spam/virus section
    #
    smtp-amavis unix – – y – 2 smtp
    -o smtp_data_done_timeout=1200
    -o disable_dns_lookups=yes
    -o smtp_send_xforward_command=yes
    127.0.0.1:10025 inet n – y – – smtpd
    -o content_filter=
    -o smtpd_helo_restrictions=
    -o smtpd_sender_restrictions=
    -o smtpd_recipient_restrictions=permit_mynetworks,reject
    -o mynetworks=127.0.0.0/8
    -o smtpd_error_sleep_time=0
    -o smtpd_soft_error_limit=1001
    -o smtpd_hard_error_limit=1000
    -o receive_override_options=no_header_body_checks
    -o smtpd_helo_required=no
    -o smtpd_client_restrictions=
    -o smtpd_restriction_classes=
    -o disable_vrfy_command=no
    -o strict_rfc821_envelopes=yes
    #
    # Dovecot LDA
    dovecot unix – n n – – pipe
    flags=DRhu user=vmail:mail argv=/usr/libexec/dovecot/deliver -d ${recipient}
    #
    # Vacation mail
    vacation unix – n n – – pipe
    flags=Rq user=vacation argv=/var/spool/vacation/vacation.pl -f ${sender} — ${recipient}

    spamassassin unix – n n – – pipe flags=R user=spamd argv=/usr/bin/spamc -e /usr/sbin/sendmail -oi -f ${sender} ${re$

    Reply

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.