SpamAssassin and ClamAV, an email spam filter and antivirus respectively, can be very useful for keeping annoying or dangerous emails out of your email domain.
When you install a HestiaCP server with less than a certain amount of memory, some services are not installed so that the server continues to run smoothly.
If you have just created a server with the minimum resources and it does not yet contain any content, the most practical approach if you need these services is to create a server with 4 GB of RAM, or 2 GB if you only need SpamAssassin, and then resize the server to the resources you need.
Bear in mind that running these services with the minimum resources can cause slowdowns. This article is therefore particularly recommended if you have been adding email accounts and websites to your server, gradually increasing its resources, and now need spam filtering and antivirus protection.
Checking the server
To check whether these services are installed on your server, go to settings and look for them in the list of services. If they appear as shown in the screenshot, they are already installed. If they do not appear, you will need to install them manually.
Installation
First, update the repositories:
# apt updateFirst, you need to install clamav:
# apt install clamav-daemonOnce clamav is installed, you will need to modify its configuration file. To do this, use the following command:
# mv /etc/clamav/clamd.conf /etc/clamav/clamd.conf.oldOnce you have renamed the old file to keep it as a backup, use the following command:
# nano /etc/clamav/clamd.confThen copy the following content:
#Automatically Generated by clamav-daemon postinst
#To reconfigure clamd run #dpkg-reconfigure clamav-daemon
#Please read /usr/share/doc/clamav-daemon/README.Debian.gz for details
LocalSocket /var/run/clamav/clamd.ctl
FixStaleSocket true
LocalSocketGroup clamav
LocalSocketMode 666
# TemporaryDirectory is not set to its default /tmp here to make overriding
# the default with environment variables TMPDIR/TMP/TEMP possible
User clamav
ScanMail true
ScanArchive true
ArchiveBlockEncrypted false
MaxDirectoryRecursion 15
FollowDirectorySymlinks false
FollowFileSymlinks false
ReadTimeout 180
MaxThreads 12
MaxConnectionQueueLength 15
LogSyslog false
LogRotate true
LogFacility LOG_LOCAL6
LogClean false
LogVerbose true
PreludeEnable no
PreludeAnalyzerName ClamAV
DatabaseDirectory /var/lib/clamav
OfficialDatabaseOnly false
SelfCheck 3600
Foreground false
Debug false
ScanPE true
MaxEmbeddedPE 10M
ScanOLE2 true
ScanPDF true
ScanHTML true
MaxHTMLNormalize 10M
MaxHTMLNoTags 2M
MaxScriptNormalize 5M
MaxZipTypeRcg 1M
ScanSWF true
ExitOnOOM false
LeaveTemporaryFiles false
AlgorithmicDetection true
ScanELF true
IdleTimeout 30
CrossFilesystems true
PhishingSignatures true
PhishingScanURLs true
PhishingAlwaysBlockSSLMismatch false
PhishingAlwaysBlockCloak false
PartitionIntersection false
DetectPUA false
ScanPartialMessages falseFinally, run the following commands to apply the changes:
# update-rc.d clamav-daemon defaults
# service clamav-daemon restartOnce you have Clamav, you need to install SPAMASSASSIN:
# apt install spamassassinOnce SpamAssassin is installed, you need to enable it:
# update-rc.d spamassassin defaults
# sed -i "s/ENABLED=0/ENABLED=1/" /etc/default/spamassassin
# service spamassassin restartExim configuration:
For exim to detect the changes, you will need to uncomment the section of its configuration file that enables the use of SpamAssassin and ClamAV:
# sed -i "s/^#SPAMASSASSIN/SPAMASSASSIN/g" /etc/exim4/exim4.conf.template
# sed -i "s/^#CLAMD/CLAMD/g" /etc/exim4/exim4.conf.template
# sed -i "s/^#SPAM_SCORE/SPAM_SCORE/g" /etc/exim4/exim4.conf.template
# service exim4 restartHestiaCP configuration
To see the services in the HestiaCP settings panel, you will need to modify the configuration file:
# echo "ANTIVIRUS_SYSTEM='clamav-daemon'" >> /usr/local/hestia/conf/hestia.conf
# echo "ANTISPAM_SYSTEM='spamassassin'" >> /usr/local/hestia/conf/hestia.confAntivirus protection and spam filtering will now be available:
Remember, if you have any questions about this or any other issue related to your servers on Clouding, feel free to email soporte@clouding.io We are here for whatever you need. Get in touch!