Difference between revisions of "SMEOptimizer"

From SME Server
Jump to navigationJump to search
Line 10: Line 10:
 
The first functionality is a SME dedicated DNS Blacklist which is partially based on the user contributions. With SME Optimizer you provide data about your spam rejects and in return you get access to a large DNS blacklist. This blacklist is both providing IP as well as URI based lists and comes as a configuration option to SpamAssassin. The DNS Blacklist has as of today (October 2016) around 1.4 mio. Spam, Malware and Ransomware IP addresses as well as around 350,000 URIs. These will be provided as part of the DNS Blacklist.
 
The first functionality is a SME dedicated DNS Blacklist which is partially based on the user contributions. With SME Optimizer you provide data about your spam rejects and in return you get access to a large DNS blacklist. This blacklist is both providing IP as well as URI based lists and comes as a configuration option to SpamAssassin. The DNS Blacklist has as of today (October 2016) around 1.4 mio. Spam, Malware and Ransomware IP addresses as well as around 350,000 URIs. These will be provided as part of the DNS Blacklist.
  
=====Remote Monitoring=====
+
=====Server Monitoring=====
 
The second functionality is remote monitoring of your SME server. The system will on a daily basis check whether your server (it IP address) is listed in international DNS blacklist. Further more it will on an hourly basis check whether your server for SMTP availability.
 
The second functionality is remote monitoring of your SME server. The system will on a daily basis check whether your server (it IP address) is listed in international DNS blacklist. Further more it will on an hourly basis check whether your server for SMTP availability.
  
Line 45: Line 45:
 
  ./SMEOptimizer.pl --initialize
 
  ./SMEOptimizer.pl --initialize
  
There is no further need for configuration or installation as the SMEOptimizer script automatically will get and install the qpsmtpd plugin that handles capturing the rejected spam messages and also the SpamAssassin configuration file which contains the DNS blacklist configuration. All action will be logged in the /var/log/smeoptimizer.log file.
+
Now in order to use the attachment filter you need to register with VirusTotal to get your personal API key. When you have this key you need to configure the system to use it.
 +
 
 +
./SMEOptimizer.pl --VTAPI=<API key>
 +
 +
Then there is no further need for configuration or installation as the SMEOptimizer script automatically will get and install the qpsmtpd plugin that handles capturing the rejected spam messages and also the SpamAssassin configuration file which contains the DNS blacklist configuration. All action will be logged in the /var/log/smeoptimizer.log file.
  
 
==Server Monitoring==
 
==Server Monitoring==
Line 60: Line 64:
 
You can check the current status by issued the command line option --status
 
You can check the current status by issued the command line option --status
  
  # ./SMEOptimizer.pl --status
+
  ./SMEOptimizer.pl --status
  
 
  Contact Email      :  jkn@swerts-knudsen.dk
 
  Contact Email      :  jkn@swerts-knudsen.dk
Line 72: Line 76:
 
You can always see the different configuration options by issuing the --help command.
 
You can always see the different configuration options by issuing the --help command.
  
  # ./SMEOptimizer.pl --help
+
  ./SMEOptimizer.pl --help
  
 
  Command line options:
 
  Command line options:

Revision as of 19:53, 24 May 2017

Maintainer

This contrib has been developed by Jesper Knudsen from SME Optimizer. If you have any question on its functionality or what it does, then just write me at jesper@swerts-knudsen.dk.

Description

SME Optimizer is an external service that generally enhances the functionality and efficiency of the e-mail system in SME Server.

SME Dedicated DNS Blacklist

The first functionality is a SME dedicated DNS Blacklist which is partially based on the user contributions. With SME Optimizer you provide data about your spam rejects and in return you get access to a large DNS blacklist. This blacklist is both providing IP as well as URI based lists and comes as a configuration option to SpamAssassin. The DNS Blacklist has as of today (October 2016) around 1.4 mio. Spam, Malware and Ransomware IP addresses as well as around 350,000 URIs. These will be provided as part of the DNS Blacklist.

Server Monitoring

The second functionality is remote monitoring of your SME server. The system will on a daily basis check whether your server (it IP address) is listed in international DNS blacklist. Further more it will on an hourly basis check whether your server for SMTP availability.

Attachment Filter

The system will (currently only on SME 9.2) check file attachments hashes up against a DNS based system. This will allow an extra check beyond the build-in ClamAV as this check contains malicious file hashes found by other AV engines. This functionality requires you to register for a free VirusTotal public API and configure the system to use it. This means that your system will, in the background, build up the has databases and all other users will benefit. This system is not expected to catch much (ClamAV does a fine job) but has show very efficient in the WannaCry attack where you will be dependent of more AV engines. This is currently in Beta, so reach out if you want to participate.

The next planned functionality is
  • Your suggestions... let me know...

Installation

mkdir /usr/local/smeoptimizer
cd /usr/local/smeoptimizer
wget -q http://smeoptimizer.com/SMEOptimizer.pl.updated -O SMEOptimizer.pl
chmod +x SMEOptimizer.pl

Now make sure to install the two Perl modules which is not part of the SME core but can be downloaded from the epel repository. If you cannot get them at epel, then see download instructions below.

yum install --enablerepo=epel perl-Digest-MD5-File perl-JSON

Create and configure the MySQL database

mysqladmin create smeoptimizer
mysql smeoptimizer

Now configure the database which will be used for configuration and logging.

Important.png Note:
Please note that you *have* to use the below credentials (database, user and password).


GRANT ALL PRIVILEGES ON smeoptimizer.* TO 'smeoptimizer'@'localhost' IDENTIFIED BY 'password';
FLUSH PRIVILEGES; 
EXIT

Now initialize which will start the cron jobs that checks for new functionality and reports spam. Notice that each individual server need to be registered with its SME server unique ID.

./SMEOptimizer.pl --initialize

Now in order to use the attachment filter you need to register with VirusTotal to get your personal API key. When you have this key you need to configure the system to use it.

./SMEOptimizer.pl --VTAPI=<API key>

Then there is no further need for configuration or installation as the SMEOptimizer script automatically will get and install the qpsmtpd plugin that handles capturing the rejected spam messages and also the SpamAssassin configuration file which contains the DNS blacklist configuration. All action will be logged in the /var/log/smeoptimizer.log file.

Server Monitoring

SMEOptimizer will from remote monitor whether your server is online by on a regularly basis checking access to SMTP. SMEOptimizer will also on a daily basis check whether your server has been listed in a international DNS Blacklist. Currently the daily check is up against ~80+ different blacklists. If your server experience SMTP problems or gets listed in a DNS blacklist you will receive an alert from the system.

When a server is seen in a DNS blacklist, the admin will get the following type of e-mail:

SMEOptimizerBlacklist.PNG

When (and if) the server is not listed anymore, another mail will be sent to the administrator notifying about the release.

Check Status of SMEOptimizer

You can check the current status by issued the command line option --status

./SMEOptimizer.pl --status
Contact Email       :   jkn@swerts-knudsen.dk
Alerts              :   Yes
Spam Reports        :   87
Registered          :   2016-10-07 16:03:52
Last SpamReports    :   2016-10-09 18:23:02
Attachment Filter   :   Enabled

SMEOptimizer Configuration

You can always see the different configuration options by issuing the --help command.

./SMEOptimizer.pl --help
Command line options:
-help:                   Shows this help
-initialize:             Register and retrieve the configuration and enable the cronjob services.
                         When the registration has been confirmed, then all services will be activated automatically.
-status:                 Shows the current status of the SME Optimizer.
-alerts=[Yes|No]:        Enable checks and alerts for SME server downtime or registration in DNS Blacklist - default Yes.
-contact=[Email]:        Set the contact email address where alerts are sent to - default admin@<your domain>.
-VTAPI=[API Key]:        This is the VirusTotal public API key used to check attachments (will remain local).

FAQ

  • Question: What is transferred from my server to the central server as part of the spam report that is used to build the DNS Blacklist?
    • Answer: The qpsmtpd plugin captures the sender domain and the sending ipaddress, the qpsmtpd plugin which rejected the mail and the plugins return text.

Uninstall SMEOptimizer

If you want to uninstall the script again then please just remove the following files and expand templates.

rm -rf /usr/local/smeoptimizer
rm /etc/e-smith/templates/etc/crontab/smeoptimizer.cron.template
rm /etc/e-smith/templates/var/service/qpsmtpd/config/peers/0/01smeoptimizer
rm /etc/mail/spamassassin/smeoptimizer.cf
rm /usr/share/qpsmtpd/plugins/smeoptimizer
/sbin/e-smith/expand-template /etc/crontab
/sbin/e-smith/expand-template /var/service/qpsmtpd/config/peers/0
sv t spamd
sv t qpsmtpd

RPM Download instructions

If you do not use the epel repository, then the needed Perl modules can be downloaded here.

For SME 8.x

wget http://smeoptimizer.com/downloads/SME8/perl-Digest-MD5-File-0.07-1.el5.rf.noarch.rpm
wget http://smeoptimizer.com/downloads/SME8/perl-JSON-2.50-1.el5.rf.noarch.rpm
yum localinstall perl-Digest-MD5-File-0.07-1.el5.rf.noarch.rpm perl-JSON-2.50-1.el5.rf.noarch.rpm

For SME 9.x

wget http://smeoptimizer.com/downloads/SME9/perl-Digest-MD5-File-0.07-1.el6.rf.noarch.rpm
wget http://smeoptimizer.com/downloads/SME9/perl-JSON-2.50-1.el6.rfx.noarch.rpm
yum localinstall perl-Digest-MD5-File-0.07-1.el6.rf.noarch.rpm perl-JSON-2.50-1.el6.rfx.noarch.rpm