MailScanner.v7
| Installing | New Server | Mrepo | smartd | RAID | Hardening | YUM | Crontabs | LogWatch | systemctl | firewalld | CentOS 7 | |
|
Apache | Bind | Cacti | DHCP | mariadb | Samba | Sarg | Sendmail | Smokeping | Rsync | Work Apps | |
| Problems | VPN | VPN Win | Extras | Bash | MailScanner | Horde | Google CE | Wake Up | KVM | |||
| Other | Computer Lab | ISO2USB | aiContact | Google CE | Android | USB Live | SRS XML |
Contents
Setting up Sendmail
SELinux
Turn of right now:
setenforce 0
Still seems to ne more owrk than it appears worth.
emacs /etc/selinux/config SELINUX=disabled
YUM
yum remove spamassassin
yum install perl-IO-Socket-INET6 perl-Razor-Agent perl-Archive-Zip \ perl-Archive-Tar perl-IO-Zlib perl-IO-Socket-INET6 \ perl-IO-Socket-SSL rpm-build php-gd tnef GeoIP perl-Mail-SPF. \ perl-Convert-TNEF gcc-c++ perl-Crypt-OpenSSL-Random perl-Crypt-OpenSSL-RSA \ bzip2 bzip2-libs bzip2-devel perl-CPAN perl-Geo-IP perl-Encode-Detect
Installing perl modules
perl -MCPAN -e shell
More than is needed, have not edited down yet. (order is important) (I generally have to run this twice)
install AnyDBM_File install Archive::Tar install Archive::Zip install bignum install Business::ISBN install Business::ISBN::Data install Carp install Compress::Zlib install Test::Most install Convert::BinHex install Convert::TNEF install Data::Dump install Data::Dumper install Date::Parse install DBD::SQLite install DB_File install DBI install Digest install Digest::HMAC install Digest::MD5 install Digest::SHA1 install DirHandle install Encode::Detect (yum install perl-Encode-Detect) install Error install ExtUtils::CBuilder install ExtUtils::Constant install ExtUtils::ParseXS install Fcntl (force needed did not install 27/10/2015) install File::Basename (force needed did not install 27/10/2015) install File::Copy (force needed did not install 27/10/2015) install FileHandle install File::Path install Filesys::Df install File::Temp install Getopt::Long install HTML::Entities install HTML::Parser install HTML::TokeParser install Inline install IO install IO::File install IO::Pipe install IO::Socket::INET6 install IO::Socket::SSL install IO::String install IO::Zlib install IP::Country install IP::Country::Fast install Mail::ClamAV (ERROR) install Mail::DKIM install Mail::DomainKeys install Mail::Header install Mail::SpamAssassin install Mail::SpamAssassin::Plugin::DCC install Mail::SpamAssassin::Plugin::Pyzor install Mail::SpamAssassin::Plugin::Razor2 install Mail::SPF (ERROR) install Mail::SPF::Query install Mail::SPF::Test (ERROR) install Math::BigInt install Math::BigRat install MIME::Base64 install MIME::Decoder install MIME::Decoder::UU install MIME::Head install MIME::Parser install MIME::QuotedPrint install MIME::Tools install module install Module::Build install NetAddr::IP install Net::CIDR install Net::CIDR::Lite install Net::DNS install Net::DNS::Resolver::Programmable install Net::Ident install Net::IP install Net::LDAP install Net::Patricia install OLE::Storage_Lite install Parse::RecDescent install Pod::Escapes install Pod::Simple install POSIX (ERROR) install Razor2::Client::Agent install SAVI (ERROR Unsupported GNU C/C++ target hardware platform) install Scalar::Util install Socket install Storable install Sys::Hostname::Long install Sys::Syslog install Test::Harness install Test::Manifest install Test::More install Test::Pod install Test::Simple install Text::Balanced install Time::HiRes install Time::localtime install URI install version install YAML install Encoding::FixLatin
MailScanner
http://www.mailscanner.info/downloads.html
https://s3.amazonaws.com/mailscanner/release/v4/rpm/MailScanner-4.85.2-3.rpm.tar.gz
Oct 2015 current version 4.85.2-3
export MSver=4.85.2-3 mkdir /zone/MailScanner -p cd /zone/MailScanner wget https://s3.amazonaws.com/mailscanner/release/v4/rpm/MailScanner-$MSver.rpm.tar.gz tar zxf MailScanner-$MSver.rpm.tar.gz -C . cd MailScanner-$MSver ./install.sh
Accept Y for everything.
- Post Install
pico /etc/MailScanner/MailScanner.conf
%org-name% = PapakowhaiSchool
%org-long-name% = Papakowhai School
%web-site% = www.papakowhai.school.nz
Always Looked Up Last = &MailWatchLogging
Detailed Spam Report = yes
Quarantine Whole Message = yes
Quarantine Whole Message As Queue Files = no
Include Scores In SpamAssassin Report = yes
Quarantine User = root
Quarantine Group = apache (this should be the same group as your web server)
Quarantine Permissions = 0660
Spam Actions = deliver header "X-Spam-Status: Yes" store
High Scoring Spam Actions = deliver header "X-Spam-Status: Yes" store
Is Definitely Not Spam = &SQLWhitelist
Is Definitely Spam = &SQLBlacklist
Virus Scanners =
Monitors for ClamAV Updates = /usr/local/share/clamav/*.cld /usr/local/share/clamav/*.cvd
# changed the above Oct 2009
Spam Subject Text = {Spam Minor _SCORE_}
High Scoring Spam Subject Text = {Spam BAD _SCORE_}
Spam List = spamhaus-ZEN spamcop.net ORDB-RBL
- Spam Domain List = RFC-IGNORANT-DSN, dsn.rfc-ignorant.org.
- Spam Domain List = RFC-IGNORANT-POSTMASTER, postmaster.rfc-ignorant.org.
- Spam Domain List = RFC-IGNORANT-ABUSE, abuse.rfc-ignorant.org.
- Spam Domain List = RFC-IGNORANT-WHOIS, whois.rfc-ignorant.org.
/etc/MailScanner/spam.assassin.prefs.conf
emacs /etc/MailScanner/spam.assassin.prefs.conf
envelope_sender_header X-asinMailSanner-MailScanner-From
eg
bayes_ignore_header X-BackupGeek-MailScanner bayes_ignore_header X-BackupGeek-MailScanner-SpamCheck bayes_ignore_header X-BackupGeek-MailScanner-SpamScore bayes_ignore_header X-BackupGeek-MailScanner-Information
and
envelope_sender_header X-BackupGeek-MailScanner-From
pyzor
Check for the latest version on http://sourceforge.net/projects/pyzor/
cd /home/strider mkdir Downloads cd Downloads wget http://downloads.sourceforge.net/project/pyzor/pyzor/0.7.0/pyzor-0.7.0.tar.bz2
bunzip2 pyzor-0.7.0.tar.bz2 tar xf pyzor-0.7.0.tar -C . cd pyzor-0.7.0
python setup.py build python setup.py install
ll /usr/bin/pyzor
Change setup:
emacs /etc/MailScanner/spam.assassin.prefs.conf # paths to utilities ifplugin Mail::SpamAssassin::Plugin::Pyzor pyzor_path /usr/bin/pyzor endif
Remove the Hashes
/etc/procmailrc
rm -fr /etc/procmailrc /bin/cat << EOF >> /etc/procmailrc # /etc/procmailrc for redhat (c) 2003 Tero.Karvinen atsign iki.fi DROPPRIVS=1 # Not needed #:0fw:spamassassin.lock #* < 256000 #|/usr/bin/spamassassin :0 * ^X-ai_net_nz-MailScanner-SpamScore: ssssssssss /dev/null :0 * ^X-Spam-Status: Yes $HOME/mail/spam #:0: #* ^Subject:.Cron <root@mail>* #/dev/null EOF
pico /etc/procmailrc
If you are using Maildir, which I want to move all users to then this is what procmail will look like.
# /etc/procmailrc for redhat (c) 2003 Tero.Karvinen atsign iki.fi DROPPRIVS=1 # Not needed #:0fw:spamassassin.lock #* < 256000 #|/usr/bin/spamassassin :0 * ^X-ai_net_nz-MailScanner-SpamScore: ssssssssss /dev/null :0 * ^X-Spam-Status: Yes $HOME/Maildir/.JUNK/ # Now we want all mail to go to a /Maildir/ rather than let sendmail finish # default rule, drops messages into the default box :0 * .* $HOME/Maildir/
Checking the Install
spamassassin -D --lint
Look for module not installed
MailScanner -v
Look for Missing
MailScanner --lint
Errors
ERROR: The "envelope_sender_header" in your spam.assassin.prefs.conf ERROR: is not correct, it should match X-WizWireless-MailScanner-From
Edit emacs /etc/MailScanner/spam.assassin.prefs.conf to comply
ISSUES
When looking at maillog:
Could not use Custom Function code /usr/share/MailScanner/MailScanner/CustomFunctions/MailWatch.pm,
it could not be "require"d. Make sure the last line is "1;" and the module is correct with perl -wc
(Error: Can't locate Encoding/FixLatin.pm in @INC
(@INC contains: /usr/sbin /usr/sbin/MailScanner /usr/share/MailScanner
/usr/share/MailScanner /usr/local/lib64/perl5 /usr/local/share/perl5
/usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5
/usr/share/perl5) at /usr/share/MailScanner/MailScanner/CustomFunctions/MailWatch.pm line 28.
To over come this:
perl -MCPAN -e shell
cpan[1]>install Encoding::FixLatin
Default to MaiScanner
systemctl disable sendmail systemctl stop sendmail systemctl start MailScanner systemctl status MailScanner
Set a script to start on reboot.
Mysql
Mailwatch has crashed.
Table './mailscanner/maillog' is marked as crashed and last (automatic?) repair failed
This following command will repair the table, that has most likely failed due to being too big.
myisamchk -r --force --safe-recover /var/lib/mysql/mailscanner/maillog.MYI
Once you have run this you really need to run
php /usr/local/bin/db_clean.php
Setting up Mailscanner
systemctl
systemctl stop sendmail.service systemctl disable sendmai.service systemctl status sendmai.service systemctl start MailScanner.service systemctl enable MailScanner.service
Does not seem to work. So when server restarted make sure service is started.
systemctl status MailScanner.service
Setting up Mailwatch
http://ai.net.nz/wiki/index.php?title=HowTo:MailWatch
- Did you find this page useful?
- Do you have an issue that you have not yet fixed?
We can do this for you.
I am available for technical support. Please follow this link. Tech Support Request.
+64-6-880-0000 : ++1-808-498-7146 : help@ai.net.nz
Getting us to help you