Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Register
    • Login

    Mailscanner UNOFFICIAL package for pfSense 2.3.x

    Scheduled Pinned Locked Moved pfSense Packages
    36 Posts 10 Posters 9.1k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • P
      poteh
      last edited by

      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.

      1 Reply Last reply Reply Quote 0
      • marcellocM
        marcelloc
        last edited by

        Does spamassassin –lint gets the same result?

        Treinamentos de Elite: http://sys-squad.com

        Help a community developer! ;D

        1 Reply Last reply Reply Quote 0
        • P
          poteh
          last edited by

          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>

          1 Reply Last reply Reply Quote 0
          • BismarckB
            Bismarck
            last edited by

            @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.

            1 Reply Last reply Reply Quote 0
            • P
              poteh
              last edited by

              still no result :( the same error

              1 Reply Last reply Reply Quote 0
              • marcellocM
                marcelloc
                last edited by

                
                #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.

                Treinamentos de Elite: http://sys-squad.com

                Help a community developer! ;D

                1 Reply Last reply Reply Quote 0
                • BismarckB
                  Bismarck
                  last edited by

                  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
                  ...
                  
                  1 Reply Last reply Reply Quote 0
                  • P
                    poteh
                    last edited by

                    @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!

                    1 Reply Last reply Reply Quote 0
                    • marcellocM
                      marcelloc
                      last edited by

                      @Bismarck:

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

                      fixed on install script.

                      https://github.com/marcelloc/Unofficial-pfSense-packages/commit/05e1b73d6b67411b1e6076b6a9c97ee5e3fbc956

                      Thanks for the feedback.

                      Treinamentos de Elite: http://sys-squad.com

                      Help a community developer! ;D

                      1 Reply Last reply Reply Quote 0
                      • M
                        mbassan
                        last edited by

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

                        clamd.PNG
                        clamd.PNG_thumb

                        1 Reply Last reply Reply Quote 0
                        • marcellocM
                          marcelloc
                          last edited by

                          Try on console to execute freshclam

                          Treinamentos de Elite: http://sys-squad.com

                          Help a community developer! ;D

                          1 Reply Last reply Reply Quote 0
                          • M
                            mbassan
                            last edited by

                            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:

                            1 Reply Last reply Reply Quote 0
                            • marcellocM
                              marcelloc
                              last edited by

                              @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?

                              Treinamentos de Elite: http://sys-squad.com

                              Help a community developer! ;D

                              1 Reply Last reply Reply Quote 0
                              • M
                                mbassan
                                last edited by

                                Great ! It has started, thaks a lot

                                1 Reply Last reply Reply Quote 0
                                • H
                                  healperci
                                  last edited by

                                  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.

                                  1 Reply Last reply Reply Quote 0
                                  • L
                                    logdog
                                    last edited by

                                    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.

                                    1 Reply Last reply Reply Quote 0
                                    • BismarckB
                                      Bismarck
                                      last edited by

                                      ClamAV – multiple vulnerabilities

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

                                      1 Reply Last reply Reply Quote 0
                                      • J
                                        jdeloach
                                        last edited by

                                        Any plans to update Mailscanner for pfSense 2.4.x?

                                        1 Reply Last reply Reply Quote 0
                                        • BismarckB
                                          Bismarck
                                          last edited by

                                          @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

                                          MailScanner.png
                                          MailScanner.png_thumb

                                          1 Reply Last reply Reply Quote 0
                                          • BismarckB
                                            Bismarck
                                            last edited by

                                            FYI MailScanner now has Milter support

                                            https://github.com/MailScanner/v5/blob/master/doc/MailScanner%20Milter%20Guide.pdf

                                            1 Reply Last reply Reply Quote 0
                                            • First post
                                              Last post
                                            Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.