Can I remove Amavis(installed during perfect server)?

Discussion in 'Installation/Configuration' started by schwim, Feb 23, 2021.

  1. schwim

    schwim Member

    Hello there!

    I've got a fresh Perfect Server installed on Deb 10. Ever since the initial install, Amavis continually shuts down, and monit, my resource monitor restarts it. This continues for hours or days until mail just stops working. I have spent weeks trying to find out why and nothing's getting logged and I've run out of things to try to fix.

    I only use the mail on this server for these monitoring email so I don't need a content filter in the mail process. Could someone tell me how I would remove Amavis from the install while retaining the mail functions? I'm Googling but not finding the steps I need to take.

    Thanks for your time!
     
  2. Th0m

    Th0m ISPConfig Developer Staff Member ISPConfig Developer

    You could remove the filter from the main.cf, and use the new custom template system () so these changes stay. But Amavis crashing is usually because you are out of memory - could that be the case?

    I also had a issue once because of a faulty setup of incron, if you are using incron, what is the content you see after running
    Code:
    sudo incrontab -e
     
  3. schwim

    schwim Member

    Results in an empty file. I do remember installling incrontab during the perfect server process.
     
  4. Th0m

    Th0m ISPConfig Developer Staff Member ISPConfig Developer

    How's your memory usage?
     
  5. till

    till Super Moderator Staff Member ISPConfig Developer

  6. schwim

    schwim Member

    Here's what my load average and memory usage looks like for the recent past. Is this sufficient for what you're needing to know?

    [​IMG]

    [​IMG]
     
  7. Th0m

    Th0m ISPConfig Developer Staff Member ISPConfig Developer

    Thats looks fine. Switching to rspamd might be a option?
     
  8. schwim

    schwim Member

  9. Th0m

    Th0m ISPConfig Developer Staff Member ISPConfig Developer

    It was made because rspamd is seen as the new standard, and we started supporting it.
     
  10. schwim

    schwim Member

    Thank you. Is removing amavis without any replacement an option or is it necessary for the mail delivery process? As stated above, the only mail being sent on this server is from the server itself to a forwarding address that only gets used for server reports. The address is unposted, never actually used anywhere so no spam should be routed to the address.
     
  11. Th0m

    Th0m ISPConfig Developer Staff Member ISPConfig Developer

    No, as this will break delivery and potentially sending. Or, as said, you need to change the postfix config not to relay it through filters, as stated in #2
     
  12. schwim

    schwim Member

    Thanks guys, followed the how-to and rspamd is up and running on the server. Was somewhat surprised that it uses over half a gig of memory just sitting idle. Also, had to do a crappy workaround to monitor the service as rspamd doesn't create a pid file to check for. It's a bummer but am looking forward to a service that doesn't constantly fail.


    Thank you guys a bunch for your help!
     
  13. MaxT

    MaxT Member HowtoForge Supporter

    I have amavis working in a little vps, eating only 256mb.

    Can I ask, Have you disabled clamav?.
    Disabling clamav can make the big difference if you need more memory resources. In example, to use a VPS only with 1 or 2 gb RAM. Also, clamav is quite useless in practical terms if you already have mail filters configured for dangerous attachments
     
  14. schwim

    schwim Member

    I've not disabled it. The server is 2gb so there's not a lot of resources to spare but the server sees little use so it's not critical.

    Could I safely remove clamav without breaking the rest of the services? To clarify with an example, would mail break if clamav couldn't be used?
     
  15. MaxT

    MaxT Member HowtoForge Supporter

    then your hardware is very similar to my little vps.

    Yes, you can disable clamav without any problem for mail. You should do a few modifications

    stop and uninstall:
    Code:
    # /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
    
    # apt-get remove --auto-remove clamav-daemon
    # apt-get remove --auto-remove clamav-freshclam
    
    Then:
    1 - Edit /etc/amavis/conf.d/15-av_scanners
    comment this segment:
    Code:
    ### http://www.clamav.net/
    #['ClamAV-clamd',
    #\&ask_daemon, ["CONTSCAN {}\n", "/var/run/clamav/clamd.ctl"],
    #qr/\bOK$/, qr/\bFOUND$/,
    #qr/^.*?: (?!Infected Archive)(.*) FOUND$/ ],
    
    and this:
    Code:
    ### http://www.clamav.net/ - backs up clamd or Mail::ClamAV
    #['ClamAV-clamscan', 'clamscan',
    #"--stdout --disable-summary -r --tempdir=$TEMPBASE {}",
    #[0], qr/:.*\sFOUND$/, qr/^.*?: (?!Infected Archive)(.*) FOUND$/ ],
    
    2 - Add a new file /etc/amavis/conf.d/90-custom with the following content:
    Code:
    use strict;
    
    @bypass_virus_checks_maps  = (1);
    
    #------------ Do not modify anything below this line -------------
    1;  # insure a defined return
    
    and restart amavisd.
    Code:
    # service amavis restart
    
    maybe you would see a warning inside /var/log/syslog, you can ignore it:
    Code:
    host amavis-mc[1043]: Not starting amavis-mc - edit /etc/default/amavis-mc to enable it ... (warning).
    host amavisd-snmp-subagent[1052]: Not starting amavisd-snmp-subagent - edit /etc/default/amavisd-snmp-subagent to enable it ... (warning).
    
    Also read this and following:
    https://www.howtoforge.com/communit...amassassin-check-in-amavis.52114/#post-290537

    after changes better review the mail log messages and syslog
    Code:
    # tail -f /var/log/mail.log
    #tail -f /var/log/syslog
    
    * unfortunately no possibility to uninstall amavis or DKIM signatures will not work. Another option is install rspamd like other people said, although I dont' know about the memory resources
     
    Last edited: Feb 24, 2021
    Jesse Norell likes this.

Share This Page