Mailscanner UNOFFICIAL package for pfSense 2.3.x



  • Hi everybody.

    Here are install instructions for UNOFFICIAL mailscanner package for pfSense(R) software 2.3.x

    Under console/ssh, fetch the install script, check what it does if you want and then execute it.

    
    cd /root
    fetch https://raw.githubusercontent.com/marcelloc/Unofficial-pfSense-packages/master/pkg-mailscanner/files/install_mailscanner_23.sh
    sh ./install_mailscanner_23.sh
    
    

    Once you install, some cpan modules will be still missing . I consider they important to spamassassin to work properly but to install it on freebsd or pfSense, you will need gcc and other compile stuff installed.

    
    Mar 28 17:15:48.929 [92279] dbg: diag: [...] module not installed: Digest::SHA1 ('require' failed)
    Mar 28 17:15:48.929 [92279] dbg: diag: [...] module not installed: Geo::IP ('require' failed)
    Mar 28 17:15:48.929 [92279] dbg: diag: [...] module not installed: Net::CIDR::Lite ('require' failed)
    Mar 28 17:15:48.930 [92279] dbg: diag: [...] module not installed: Razor2::Client::Agent ('require' failed)
    Mar 28 17:15:48.931 [92279] dbg: diag: [...] module not installed: LWP::UserAgent ('require' failed)
    Mar 28 17:15:48.931 [92279] dbg: diag: [...] module not installed: Net::Patricia ('require' failed)
    
    

    If you decide to complete spamassassin features, run this second script to pfSense be able to compile cpan modules.

    
    cd /root
    fetch https://raw.githubusercontent.com/marcelloc/Unofficial-pfSense-packages/master/pkg-mailscanner/files/install_cpan_modules_23.sh
    sh ./install_cpan_modules_23.sh
    
    

    Once it finishes, all must be in place. If you do not see the menu after it finishes, try to install any pfSense package from GUI, like cron for example.

    WARNING

    Use it at your own risk.

    This script install packages from freebsd and change your config file.



  • I've include 7zip, rar and PDFID patch to mailscanner package, just re-run  install to get latest updates.

    Thanks for  Bismarck and danny at tweegy.nl



  • Sorry posted in postfix antispam thread by mistake…

    Updated but now have two 'Mailscanner' services menu items.. Looks like check_mailscanner_service.php is looking for menu item 'mailscanner' not 'Mailscanner'...



  • @danjeman:

    Sorry posted in postfix antispam thread by mistake…

    Updated but now have two 'Mailscanner' services menu items.. Looks like check_mailscanner_service.php is looking for menu item 'mailscanner' not 'Mailscanner'...

    Thanks, I'll fix it.



  • Thank for your job, marcelloc!

    Installed mailscanner with your script and installed cpan modules after that on fresh system.
    Try to check spamassasin in shell with GTUBE

    spamassassin -t < test.txt > spam.out

    Got:

    plugin: failed to parse plugin /usr/local/etc/mail/spamassassin/DecodeShortURLs.pm: Can't locate /usr/local/etc/mail/spamassassin/DecodeShortURLs.pm in @INC (you may need to install the ::usr::local::etc::mail::spamassassin::DecodeShortURLs module) (@INC contains: /usr/local/lib/perl5/site_perl /usr/local/lib/perl5/site_perl/mach/5.24 /usr/local/lib/perl5/5.24/mach /usr/local/lib/perl5/5.24) at /usr/local/lib/perl5/site_perl/Mail/SpamAssassin/PluginHandler.pm line 109.



  • Does spamassassin –lint gets the same result?



  • Yep, the same result

    May  5 13:46:22.245 [32795] warn: plugin: failed to parse plugin /usr/local/etc/mail/spamassassin/DecodeShortURLs.pm: Can't locate /usr/local/etc/mail/spamassassin/DecodeShortURLs.pm in @INC (you may need to install the ::usr::local::etc::mail::spamassassin::DecodeShortURLs module) (@INC contains: lib /usr/local/lib/perl5/site_perl /usr/local/lib/perl5/site_perl/mach/5.24 /usr/local/lib/perl5/5.24/mach /usr/local/lib/perl5/5.24) at /usr/local/lib/perl5/site_perl/Mail/SpamAssassin/PluginHandler.pm line 109, <data>line 717.</data>



  • @poteh:

    Yep, the same result

    May  5 13:46:22.245 [32795] warn: plugin: failed to parse plugin /usr/local/etc/mail/spamassassin/DecodeShortURLs.pm: Can't locate /usr/local/etc/mail/spamassassin/DecodeShortURLs.pm in @INC (you may need to install the ::usr::local::etc::mail::spamassassin::DecodeShortURLs module) (@INC contains: lib /usr/local/lib/perl5/site_perl /usr/local/lib/perl5/site_perl/mach/5.24 /usr/local/lib/perl5/5.24/mach /usr/local/lib/perl5/5.24) at /usr/local/lib/perl5/site_perl/Mail/SpamAssassin/PluginHandler.pm line 109, <data>line 717.</data>

    Try:

    fetch -q -o  /var/db/spamassassin/3.004001/DecodeShortURLs.pm https://raw.githubusercontent.com/smfreegard/DecodeShortURLs/master/DecodeShortURLs.pm
    

    or

    fetch -q -o  /usr/local/lib/perl5/site_perl/Mail/SpamAssassin/Plugin/DecodeShortURLs.pm https://raw.githubusercontent.com/smfreegard/DecodeShortURLs/master/DecodeShortURLs.pm
    

    both will work.



  • still no result :( the same error



  • 
    #install shorturl mailscanner plugin
    plugin_file=DecodeShortURLs.zip
    fetch -o $plugin_file https://github.com/smfreegard/DecodeShortURLs/archive/master.zip
    unzip -o $plugin_file
    cp DecodeShortURLs-master/*pm $plugin_dir/plugins/
    cp DecodeShortURLs-master/*cf $plugin_dir
    
    

    The install script looks ok for me. I'll test on a new install.



  • DecodeShortURLs.pm need to be side by side with DecodeShortURLs.cf or in spamassassin perl folder, like:

    /var/db/spamassassin/3.004001/DecodeShortURLs.pm

    /usr/local/lib/perl5/site_perl/Mail/SpamAssassin/Plugin/DecodeShortURLs.pm

    cp DecodeShortURLs-master/*pm $plugin_dir/plugins/

    will not work, because its:

    /var/db/spamassassin/3.004001/plugins/DecodeShortURLs.pm

    and DecodeShortURLs.cf is looking for:

    loadplugin Mail::SpamAssassin::Plugin::DecodeShortURLs DecodeShortURLs.pm

    ifplugin Mail::SpamAssassin::Plugin::DecodeShortURLs

    Its looking for Mail::SpamAssassin::Plugin::DecodeShortURLs or DecodeShortURLs.pm, both should work.

    spamassassin -D --lint
    ...
    May  5 17:31:19.423 [46111] dbg: config: fixed relative path: /var/db/spamassassin/3.004001/DecodeShortURLs.pm
    May  5 17:31:19.424 [46111] dbg: plugin: loading Mail::SpamAssassin::Plugin::DecodeShortURLs from /var/db/spamassassin/3.004001/DecodeShortURLs.pm
    ...
    


  • @Bismarck:

    DecodeShortURLs.pm need to be side by side with DecodeShortURLs.cf

    So I copied DecodeShortURLs.pm from /usr/local/etc/mail/spamassassin/plugins/ to /usr/local/etc/mail/spamassassin/ and now it's working!
    thank you guys for your help!





  • Hello guys,
    I have a problem: clamd don't want to start. I tried several times but without any appreciated result.
    Any suggestions ?




  • Try on console to execute freshclam



  • I got this error

    [2.3.4-RELEASE][admin@ids-pf.medidati.org]/root: freshclam
    ERROR: Can't open /var/log/clamav/freshclam.log in append mode (check permissions!).
    ERROR: Problem with internal logger (UpdateLogFile = /var/log/clamav/freshclam.log).

    [2.3.4-RELEASE][admin@ids-pf.medidati.org]/var/log/clamav: cat freshclam.log
    –------------------------------------
    ClamAV update process started at Tue Jun 13 13:18:30 2017
    Downloading main.cvd [100%]
    main.cvd updated (version: 58, sigs: 4566249, f-level: 60, builder: sigmgr)
    Downloading daily.cvd [100%]
    daily.cvd updated (version: 23469, sigs: 1736809, f-level: 63, builder: neo)
    Downloading bytecode.cvd [100%]
    bytecode.cvd updated (version: 303, sigs: 59, f-level: 63, builder: anvilleg)
    Database updated (6303117 signatures) from database.clamav.net (IP: 90.147.160.69)
    WARNING: Clamd was NOT notified: Can't connect to clamd through /var/run/clamav/clamd.sock: No such file or directory
    [2.3.4-RELEASE][admin@ids-pf.medidati.org]/var/log/clamav:



  • @mbassan:

    WARNING: Clamd was NOT notified: Can't connect to clamd through /var/run/clamav/clamd.sock: No such file or directory
    [2.3.4-RELEASE][admin@ids-pf.medidati.org]/var/log/clamav:

    This means that the daemon was stopped when freshclam finished. Did you tried to start it again after freshclam udpate?



  • Great ! It has started, thaks a lot



  • I installed the package, but don't know where to start

    I have this two configs for the same firewall:

    external mail server <– internal clients

    External mail server -->Internal server

    that i want to filter is possible to proxy this config??.

    Thanks a lot nice package.



  • 2.4.2-RELEASE-p1 (amd64)
    built on Tue Dec 12 13:45:26 CST 2017
    FreeBSD 11.1-RELEASE-p6

    [2.4.2-RELEASE][admin@pfSense.corp]/root: sh ./install_mailscanner_23.sh
    fetch: /ConfigDefs.pl.patch: No such file or directory
    Hmm…  I can't seem to find a patch in there anywhere.
    fetch: /Message.pm.patch: No such file or directory
    Hmm...  I can't seem to find a patch in there anywhere.
    fetch: /SweepContent.pm.patch: No such file or directory
    Hmm...  I can't seem to find a patch in there anywhere.



  • ClamAV – multiple vulnerabilities

    https://forum.pfsense.org/index.php?topic=143316.0



  • Any plans to update Mailscanner for pfSense 2.4.x?



  • @logdog:

    2.4.2-RELEASE-p1 (amd64)
    built on Tue Dec 12 13:45:26 CST 2017
    FreeBSD 11.1-RELEASE-p6

    [2.4.2-RELEASE][admin@pfSense.corp]/root: sh ./install_mailscanner_23.sh
    fetch: /ConfigDefs.pl.patch: No such file or directory
    Hmm…  I can't seem to find a patch in there anywhere.
    fetch: /Message.pm.patch: No such file or directory
    Hmm...  I can't seem to find a patch in there anywhere.
    fetch: /SweepContent.pm.patch: No such file or directory
    Hmm...  I can't seem to find a patch in there anywhere.

    @jdeloach:

    Any plans to update Mailscanner for pfSense 2.4.x?

    You can try this script, it should work with pfSense 2.4 and Mailscanner v5

    #!/bin/sh
    
    # *
    # * install_mailscanner_24.sh
    # *
    # * part of unofficial packages for pfSense(R) software
    # * Copyright (c) 2011-2017 Marcello Coutinho
    # * All rights reserved.
    # *
    # * Licensed under the Apache License, Version 2.0 (the "License");
    # * you may not use this file except in compliance with the License.
    # * You may obtain a copy of the License at
    # *
    # * http://www.apache.org/licenses/LICENSE-2.0
    # *
    # * Unless required by applicable law or agreed to in writing, software
    # * distributed under the License is distributed on an "AS IS" BASIS,
    # * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    # * See the License for the specific language governing permissions and
    # * limitations under the License.
    
    ASSUME_ALWAYS_YES=YES
    export ASSUME_ALWAYS_YES
    
    if [ "$(cat /etc/version | cut -c 1-3)" == "2.4" ]; then
    prefix=https://raw.githubusercontent.com/marcelloc/Unofficial-pfSense-packages/master/pkg-mailscanner/files
    
    check_service_file=check_mailscanner_service.php
    fetch -q -o /root/$check_service_file $prefix/$check_service_file
    
    # /usr/local files
    
    for file in 	www/mailscanner_about.php pkg/mailscanner.conf.template pkg/mailscanner.xml pkg/mailscanner_antispam.xml \
    		pkg/mailscanner_attachments.xml pkg/mailscanner_report.xml pkg/mailscanner.inc pkg/mailscanner_alerts.xml \
    		pkg/mailscanner_antivirus.xml pkg/mailscanner_content.xml pkg/mailscanner_sync.xml \
    		www/shortcuts/pkg_mailscanner.inc bin/sa-updater-custom-channels.sh bin/sa-wrapper.pl
    do
    	echo "fetching  /usr/local/$file from github"
    	fetch -q -o /usr/local/$file $prefix/usr/local/$file
    done
    
    # Enable freebsd Repo
    repo_dir=/root/repo.bkp
    mkdir -p $repo_dir
    rm -f $repo_dir/*conf
    cp /usr/local/etc/pkg/repos/*conf $repo_dir
    sed -i "" -E "s/(FreeBSD.*enabled:) no/\1 yes/" /usr/local/etc/pkg/repos/*conf
    
    #fix permission
    chmod +x /usr/local/bin/sa-updater-custom-channels.sh
    chmod +x /usr/local/bin/sa-wrapper.pl
    
    # Install mailscanner package
    # pkg lock pkg
    pkg update
    pkg install mailscanner bash dcc-dccd spamassassin p7zip rsync
    
    # restore repository configuration state
    cp $repo_dir/*conf /usr/local/etc/pkg/repos/.
    
    #install services and menus
    php /root/check_mailscanner_service.php
    
    #install spamassassin-extremeshok_fromreplyto
    plugin_dir=/usr/local/etc/mail/spamassassin
    plugin_file=extremeshok_fromreplyto.zip
    
    if [ ! -d $plugin_dir/plugins ];then
    	mkdir -p $plugin_dir/plugins
    fi
    
    cd root
    
    fetch -o $plugin_file https://github.com/extremeshok/spamassassin-extremeshok_fromreplyto/archive/master.zip
    unzip -o $plugin_file
    cp spamassassin-extremeshok_fromreplyto-master/plugins/*pm $plugin_dir/plugins/
    cp spamassassin-extremeshok_fromreplyto-master/01_extremeshok_fromreplyto.cf $plugin_dir
    
    #install shorturl mailscanner plugin
    plugin_file=DecodeShortURLs.zip
    fetch -o $plugin_file https://github.com/smfreegard/DecodeShortURLs/archive/master.zip
    unzip -o $plugin_file
    cp DecodeShortURLs-master/*pm $plugin_dir
    cp DecodeShortURLs-master/*cf $plugin_dir
    
    # Obsolete with MailScanner v5
    #install 7z and pdf patch
    #plugin_file=pdfid.zip 
    #fetch -o $plugin_file http://didierstevens.com/files/software/pdfid_v0_2_1.zip
    #unzip -o $plugin_file
    #cp p*py /usr/local/bin/
    #chmod +x /usr/local/bin/p*py
    ##fix python path
    #sed -i '.bak' "s@/usr/bin/env python@/usr/local/bin/python2@" /usr/local/bin/p*.py
    
    #install unofficial sigs for improving malware protection
    plugin_file=clamav-unofficial-sigs.zip
    fetch -o $plugin_file https://github.com/extremeshok/clamav-unofficial-sigs/archive/master.zip
    unzip -o $plugin_file
    script_file=/usr/local/sbin/clamav-unofficial-sigs.sh
    plugin_dir=clamav-unofficial-sigs
    cp ${plugin_dir}-master/clamav-unofficial-sigs.sh $script_file
    
    chmod +x $script_file
    sed -i '.bak' "s@!/bin/bash@!/usr/local/bin/bash@" $script_file
    for c_dir in /etc/$plugin_dir/ /var/log/$plugin_dir/
    do
            if [ ! -d $c_dir ];then
                    mkdir $c_dir
            fi
    done
    cp ${plugin_dir}-master/config/* /etc/$plugin_dir
    cp /etc/$plugin_dir/os.pfsense.conf /etc/$plugin_dir/os.conf
    sed -i '.bak' 's@clam_user=.*@clam_user="postfix"@' /etc/$plugin_dir/os.conf
    sed -i '.bak' 's@#user_configuration.*@user_configuration_complete="yes"@' /etc/$plugin_dir/user.conf
    
    # update spamassassin database
    rehash
    /usr/local/bin/sa-update -D
    
    fi
    
    # Obsolete with MailScanner v5
    #for PatchFile in ConfigDefs.pl.patch Message.pm.patch SweepContent.pm.patch
    #  do
    #  fetch -o - -q $prefix/$PatchFile | patch -N -b -p0
    #  done
    

    C&P this code in to a file called install_mailscanner_24.sh move it to /root

    sh ./install_mailscanner_24.sh
    
    cd /root
    
    fetch https://raw.githubusercontent.com/marcelloc/Unofficial-pfSense-packages/master/pkg-mailscanner/files/install_cpan_modules_23.sh
    
    sh ./install_cpan_modules_23.sh
    

    I have it working with pfSense 2.3.5p1 and Mailscanner v5, so I don't see any reason why it shouldn't work.

    Regards





 

© Copyright 2002 - 2018 Rubicon Communications, LLC | Privacy Policy