New distro

Remco Barendse mailscanner at barendse.to
Tue Jun 8 14:30:52 UTC 2021


OK, based on the instructions by Thom and with some help of L.P.H. van 
Belle pointing me in the right direction I have scripted the install a 
little bit. I re-grouped the instructions by Thom and divided it in a 
postfix part, a SpamAssassin part and a MailScanner part. Script will not 
give a working mailscanner system but helps someone to be able 
to simply copy/paste a lot of the stuff.

I yet need to figure out some things. Can I forward scanned mail to 
exchange by putting this in /etc/postfix/transport :
mynicedomain.com         smtp:[10.1.0.60]


#!/bin/sh
# Inspired on instructions from :
# 
https://vanderboon.net/2021/06/01/installing-mailscanner-5-4-with-postfix-on-ubuntu-20-04-lts/
# 
https://sites.google.com/site/wikirolanddelepper/mailscanner/configure-postfix-for-mailscanner
# 
https://serverfault.com/questions/280585/how-do-i-configure-postfix-to-deliver-mail-for-specified-domains-to-another-host

echo 'Install postfix - When asked choose “No configuration' ; sleep 5
sudo apt -y install postfix
# Example postfix (main.cf) : /usr/share/postfix/main.cf.debian
# To view Postfix configuration values, see postconf(1).

sudo touch /etc/postfix/header_checks
sudo echo "/^Received:/ HOLD" > /etc/postfix/header_checks
sudo touch /etc/postfix/acces
sudo touch /etc/postfix/relay_recipients
sudo touch /etc/postfix/transport
sudo touch /etc/postfix/virtual
sudo mkdir -p /var/spool/MailScanner/incoming
sudo mkdir /var/spool/postfix/hold
sudo mkdir /var/spool/postfix/incoming
sudo chown postfix. /var/spool/postfix/hold
sudo chown postfix. /var/spool/postfix/incoming
sudo chown postfix. /var/spool/MailScanner/incoming
sudo chown postfix. /var/spool/MailScanner/quarantine

sudo echo '#!/bin/sh' >  /usr/local/etc/postfix-db
sudo echo 'cd /etc/postfix' >>  /usr/local/etc/postfix-db
sudo echo 'newaliases' >>  /usr/local/etc/postfix-db
sudo echo '/usr/sbin/postmap /etc/postfix/virtual' >> 
/usr/local/etc/postfix-db
sudo echo '/usr/sbin/postmap /etc/postfix/transport' >> 
/usr/local/etc/postfix-db
sudo echo '/usr/sbin/postmap /etc/postfix/access' >> 
/usr/local/etc/postfix-db
sudo echo '/usr/sbin/postmap /etc/postfix/relay_recipients' >> 
/usr/local/etc/postfix-db
sudo chmod a+x  /usr/local/etc/postfix-db  # and we will start it later

sudo cat main.cf > /etc/postfix/main.cf
sudo sed -i 's/mail.yourdomain.com/gw1.mynicedomain.com/g' 
/etc/postfix/main.cf
sudo sed -i 's/10.0.0.0\/24/10.0.0.0\/8/g' /etc/postfix/main.cf
sudo sed -i 's/mydestination = $myhostname, localhost.$mydomain, 
localhost/mydestination = $gw1, localhost.$mynicedomain.com, localhost/g' 
/etc/postfix/main.cf
sudo sed -i 's/relay_domains = yourdomain.com yourotherdomain.com 
yourveryfantasticdomain.com/relay_domains = mynicedomain.com/g' 
/etc/postfix/main.cf

echo 'Install ClamAV' ; sleep 5
sudo apt install -y clamav clamav-daemon
sudo systemctl enable clamav-daemon
sudo systemctl enable clamav-freshclam
sudo systemctl stop clamav-daemon
sudo sed -i 's/LocalSocketGroup clamav/LocalSocketGroup mtagroup/g' 
/etc/clamav/clamd.conf
sudo chown -R postfix.mtagroup  /etc/clamav
sudo usermod -a -G mtagroup postfix ; sudo usermod -a -G mtagroup clamav
sudo systemctl restart clamav-daemon

echo 'SpamAssassin install' ; sleep 5
sudo apt -y install spamassassin
apt-get -y install libyaml-perl libtest-manifest-perl 
libbusiness-isbn-data-perl libbusiness-isbn-perl libtest-pod-perl 
libmodule-build-perl libinline-perl libencode-detect-perl libnet-ldap-perl 
libnet-cidr-lite-perl libio-string-perl 
libnet-dns-resolver-programmable-perl
# Couldn't find :
# Digest::SHA1 (think it's in libdigest-sha-perl ?)
# IP::Country (is it in libgeo-ipfree-perl ?)
# Mail::ClamAV
# Mail::SPF::Query (i think it's in spf-tools-perl ?)
# SAVI
sudo wget -O /etc/mail/spamassassin/KAM.cf 
https://www.pccc.com/downloads/SpamAssassin/contrib/KAM.cf
sudo wget -O /etc/cron.hourly/KAM.cf.sh 
https://dutchspamassassinrules.nl/DSR/contrib/KAM.cf.sh
sudo wget -O /etc/mail/spamassassin/DSR.cf 
https://dutchspamassassinrules.nl/DSR/DSR.cf
sudo wget -O /etc/cron.hourly/DSR.cf.sh 
https://dutchspamassassinrules.nl/DSR/DSR.cf.sh

echo 'MailScanner install' ; sleep 5
sudo echo "# For use with MailScanner" >> /etc/apparmor.d/usr.sbin.clamd
sudo echo "/var/spool/MailScanner/** rw," >> 
/etc/apparmor.d/usr.sbin.clamd
sudo echo "/var/spool/MailScanner/incoming/** rw," >> 
/etc/apparmor.d/usr.sbin.clamd

sudo wget -O /tmp/MailScanner.noarch.deb 
https://github.com/MailScanner/v5/releases/download/5.3.4-3/MailScanner-5.3.4-3.noarch.deb
sudo apt -y install /tmp/MailScanner.noarch.deb

#Complete config of PostFix + MailScanner, then
sudo mkdir /var/spool/MailScanner/spamassassin
sudo chown postfix.postfix /var/spool/MailScanner/spamassassin
sudo /usr/local/etc/postfix-db
sudo systemctl enable postfix
sudo systemctl restart postfix

sudo sed -i 's/run_mailscanner=0/run_mailscanner=1/g' 
/etc/MailScanner/defaults

sudo systemctl enable mailscanner
sudo systemctl start mailscanner



On Tue, 1 Jun 2021, Thom van der Boon wrote:

> Hi,
> 
> This how-to is not complete yet:
> 
> https://vanderboon.net/2021/06/01/installing-mailscanner-5-4-with-postfix-on-ubuntu-20-04-lts/
> 
> Met vriendelijke groet, Mit freundlichen Grüßen, Best regards,
> 
> 
> Thom van der Boon
> E-Mail: thom at vdb.nl
> 
> Catalogus 2020 (NL): https://vdb.eu/media/VDB_Catalogus_NL_2020_web.pdf
> Katalog 2020 (Deutsch): https://vdb.eu/media/VDB_Katalog_DE_2020_web.pdf
> 
> =====
> 
> 
> 
> Thom.H. van der Boon b.v.
> Transito 4
> 6909 DA  Babberich
> Tel.: +31 (0)88 4272727
> Fax: +31 (0)88 4272789
> Home Page: http://www.vdb.nl/
> 
> __________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
> Van: "Josep M Gorro" <jmgorro at gmail.com>
> Aan: "MailScanner Discussion" <mailscanner at lists.mailscanner.info>
> Verzonden: Maandag 31 mei 2021 16:31:43
> Onderwerp: Re: New distro
> 
> Really great Thom.
> Waiting for this doc.
> 
> Missatge de Thom van der Boon <thom at vdb.nl> del dia dl., 31 de maig 2021 a les 16:13:
>       Hi Josep,
> 
> I am currently writing a install how-to for MailScanner with Postfix on Ubuntu 20.04 LTS. Should be ready later today
> 
> Met vriendelijke groet, Mit freundlichen Grüßen, Best regards,
> 
> 
> Thom van der Boon
> 
> __________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
> Van: "Josep M Gorro" <jmgorro at gmail.com>
> Aan: "MailScanner Discussion" <mailscanner at lists.mailscanner.info>
> Verzonden: Maandag 31 mei 2021 15:24:52
> Onderwerp: New distro
> 
> Hello list.
> Worried about what to do once RedHat announced Centos8 becomes pre-release version, I'm planning to migrate to Ubuntu LTS version. But any documentation has been found using Google search engine.
> I have MailScanner with ClamAV and Postfix running fine but I would like to upgrade to MailScanner 5 over an stable Linux distro.
> Are there any documentation to use Ubuntu instead of Centos?
> Why the User's guide have not been updated since 2007?
> Thanks for your help.
> 
> 
> 
> --
> MailScanner mailing list
> mailscanner at lists.mailscanner.info
> http://lists.mailscanner.info/mailman/listinfo/mailscanner
> 
> 
> --
> MailScanner mailing list
> mailscanner at lists.mailscanner.info
> http://lists.mailscanner.info/mailman/listinfo/mailscanner
> 
> 
> 
> --
> 
> http://www.linkedin.com/in/jmgorro
> 
> 
> 
> --
> MailScanner mailing list
> mailscanner at lists.mailscanner.info
> http://lists.mailscanner.info/mailman/listinfo/mailscanner
> 
> --
> This message has been scanned for viruses and
> dangerous content by MailScanner, and is
> believed to be clean.
>
-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.



More information about the MailScanner mailing list