How to disable spamfilter- and antivirus functions in ISPConfig 3

If you use a mailserver wil very low ram (< 500 MB) and a slow CPU then it might be nescessary to disable the spam- and antivirus filter functions in ISPConfig 3 as amavisd and clamav might be too heavy for your server hardware. The steps to disable clamav and amavisd are:

Edit postfix main.cf file

vi /etc/postfix/main.cf

and comment out these lines by adding a "#" in front of them:

# content_filter = amavis:[127.0.0.1]:10024
# receive_override_options = no_address_mappings

Then restart postfix:

/etc/init.d/postfix restart

Now stop and disable the services. The following commands are for Debian and Ubuntu, the commands for other Linux distributions may vary

/etc/init.d/clamav-daemon stop
/etc/init.d/clamav-freshclam stop
/etc/init.d/amavis stop

update-rc.d -f clamav-daemon remove
update-rc.d -f clamav-freshclam remove
update-rc.d -f amavis remove

P The normal mail receive and send functions will still work after this modification. But please be aware that disabling amavisd and clamav will disable all spam- and antivirus filtering so that the spamfiltering options that can be configured in the ispconfig interface will have any effect on mail delivery and no spam and viruses will get filtered.

The changes in postfix main.cf will get overwitten by a ispconfig software update when you select to reconfigure services during upadte, so you should comment out the lines again after you install a ispconfig update.

24 thoughts on “How to disable spamfilter- and antivirus functions in ISPConfig 3”

  1. I am trying to turn off all spam filter and antivirus because I am using another filter service. There are no lines in my postfix file to comment out like you have listed. I did all the rest of the steps, but I am still getting emails bounced back from the ispconfig 3 server. Any ideas.

    Reply
    • If ISPConfig 3 is installed on your server, then these lines muts be in main.cf. Please check again. If the lines are missing, then ISPConfig 3 is not installed properly and you should run the update.php script again and choose to reconfigure services.

      Reply
  2. How do you reverse this, mostly the commands for this part:

    update-rc.d -f clamav-daemon remove
    update-rc.d -f clamav-freshclam remove
    update-rc.d -f amavis remove

    Reply
    • Execute:

      update-rc.d clamav-daemon defaults
      update-rc.d clamav-freshclam defaults
      update-rc.d amavis defaults

      to add the start links again.

      Reply
  3. I use Google Apps for all of my domains, so I do not need to scan mail, but still require an outgoing server for web apps. I use this simple script after each update to disable main scanning:

    #!/bin/sh
    # this script removes spam filtering from ispconfig 3

    sed -i ‘/^content_filter*/ s/^/#/’ /etc/postfix/main.cf
    sed -i ‘/^no_address_mappings*/ s/^/#/’ /etc/postfix/main.cf

    /etc/init.d/postfix restart

    /etc/init.d/clamav-daemon stop
    #/etc/init.d/clamav-freshclam stop
    /etc/init.d/amavis stop

    update-rc.d -f clamav-daemon remove
    #update-rc.d -f clamav-freshclam remove
    update-rc.d -f amavis remove

    Uncomment freshclam if you don’t want it running. I use the scanner, so I need to keep it up-to-date.

    Reply
  4. What about if I want to have amavis running, but not clamav?

    I tried running:

    /etc/init.d/clamav-daemon stop
    /etc/init.d/clamav-freshclam stop
    update-rc.d -f clamav-daemon remove
    update-rc.d -f clamav-freshclam remove

    But then i keep getting these errors every 20 min. in the log:

    amavis[29867]: (29867-06) (!)ClamAV-clamd av-scanner FAILED: run_av error: Too many retries to talk to /var/run/clamav/clamd.ctl (Can’t connect to UNIX socket /var/run/clamav/clamd.ctl: No such file or directory) at (eval 117) line 375.\n
    amavis[29867]: (29867-06) (!!)WARN: all primary virus scanners failed, considering backups
    amavis[30191]: (30191-06) (!)ClamAV-clamd: Can’t connect to UNIX socket /var/run/clamav/clamd.ctl: No such file or directory, retrying (2)

    Btw, running Ubuntu 11.04.
    And could you tell me how to set child processe in amavis?

    Reply
  5. Is this still relevant with ISPConfig Version: 3.0.5.1? I stopped receiving mail after upgrading and found I had to start amavis.

    Reply
    • This information here is for all ispconfig 3 versions. spam filtering is on by default, if you turned if´t off manually by editing the postfix config files, then you might have to redo that after an update.

      Reply
  6. Till, I followed the above information as stated. I upgraded and rechecked. No other changes have been made. But without amavisd running email dosn’t work..

    Reply
  7. I did have to disable the spam filter, since it would take 6 hours to show the email on the mailbox after it have been received.

    It’s not a resources issue since the server has plenty for a mail server.
    Why would this be?

    Reply
    • If you have a lot of incoming emails, then simply set a higher server number for amavis in postfix master.cf and the amavisd config file (or 50-user file of amavis on Debian and Ubuntu).

      Reply
  8. For Ispconfig 3.1 needs to comment the addtional files
    cat /etc/postfix/tag_as_foreign.re
    #/^/ FILTER amavis:[127.0.0.1]:10024
    cat /etc/postfix/tag_as_originating.re
    #/^/ FILTER amavis:[127.0.0.1]:10026

    Reply
    • Thanks, I was looking for this as I was always getting this error in mail.log since the upgrade to 16.04 and ISP 3.1.2:
      postfix/qmgr[XXXX]: warning: connect to transport private/amavis: No such file or directory !

      Reply
    • This worked, also comment out amavis in /etc/postfix/master.cf

      #amavis unix – – – – 2 smtp
      # -o smtp_data_done_timeout=1200
      # -o smtp_send_xforward_command=yes
      # -o smtp_bind_address=

      Reply
  9. On Ubuntu 16.04 with ISPConfig 3.1 i encountered this problem https://www.howtoforge.com/community/threads/clamav-daemon-and-freshclam-keep-starting-at-bootime.71172/ and i have solved so:

    systemctl disable clamav-daemon.socket
    systemctl disable clamav-daemon.service
    systemctl disable clamav-freshclam.service
    systemctl disable bind9.service

    More info : https://www.digitalocean.com/community/tutorials/how-to-use-systemctl-to-manage-systemd-services-and-units

    Reply

Leave a Comment

*