PDA

View Full Version : Removing amavisd-new, spamassassin, clamav


MrM
2nd July 2009, 17:16
Hi,

I have recently installed ISPConfig 3.0.1.3, following the Perfect Server Guide (http://www.howtoforge.com/perfect-server-ubuntu-9.04-ispconfig-3). When done, I noticed that more than half the RAM was being used, with no load on the server at all (it only has 512M of RAM in total). After a closer inspection I found that most of the memory was used by clamav and amavisd-new.

Since most of the e-mail needs will be offloaded to Google Apps for this server, I would like to disable/remove these services. What is the easiest way to do this?

I tried running aptitude purge amavisd-new spamassassin clamav clamav-daemon clamav-docs, but I don't like the look of this:
The following packages will be REMOVED:
amavisd-new{p} clamav{p} clamav-base{u} clamav-daemon{p}
clamav-docs{p} clamav-freshclam{u} libarchive-zip-perl{u}
libberkeleydb-perl{u} libclamav6{u} libconvert-binhex-perl{u}
libconvert-tnef-perl{u} libconvert-uulib-perl{u}
libcrypt-openssl-bignum-perl{u} libcrypt-openssl-rsa-perl{u}
liberror-perl{u} libio-socket-inet6-perl{u} libio-stringy-perl{u}
libmail-dkim-perl{u} libmail-spf-perl{u} libmime-tools-perl{u}
libnetaddr-ip-perl{u} libsocket6-perl{u}
libsys-hostname-long-perl{u} libsys-syslog-perl{u} libtommath0{u}
libunix-syslog-perl{u} logrotate{u} pax{u} re2c{u} spamassassin{p}
spamc{u}
0 packages upgraded, 0 newly installed, 31 to remove and 0 not upgraded.
It seems like a lot of packages will be removed if I do this. Particularly, why will logrotate be removed?

Is it safe to remove all these packages? Is there a better way of disabling these services? I would much rather just disable them and not completely remove them from the system.

Mark_NL
2nd July 2009, 18:06
I see no problems in removing those packages.. all of them are perl modules.

the only one i don't get is "logrotate" so better install it again after you removed it.

i'd use apt-get remove amavisd-new spamassassin clamav clamav-daemon clamav-docs

if you'd rather disable them instead of uninstalling then use:

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

this way the init scripts are not run when the server boots ..

MrM
2nd July 2009, 18:26
Thanks Mark!

I've disabled these services as well as courier with update-rc.d like this:
update-rc.d -f amavis remove
update-rc.d -f spamassassin remove
update-rc.d -f clamav-daemon remove
update-rc.d -f clamav-freshclam remove
update-rc.d -f courier-authdaemon remove
update-rc.d -f courier-imap remove
update-rc.d -f courier-imap-ssl remove
update-rc.d -f courier-pop remove
update-rc.d -f courier-pop-ssl remove

It seems to have done the trick. My memory usage is down to 168M now.

Just one more question. How do I re-enable these services, if I ever decide to provide e-mail services locally?

Mark_NL
2nd July 2009, 18:39
take a look at: update-rc.d --help (or man update-rc.d for more detailed info)

In most cases the following will be fine:
update-rc.d amavis defaults
"amavis" is the exact name of the file in /etc/init.d

MrM
2nd July 2009, 18:44
That's exactly what I wanted to know. Whether 'defaults' will suffice or not. I had looked at 'man update-rc.d' before, I just forgot to mention it in my post. ;)

Thanks for your help, Mark!

MrM
3rd July 2009, 12:51
I think that Postfix stopped working after disabling these services. Are they necessary for Postfix to work properly?

Even though I will not provide mail services on this server, I still need Postfix for sending e-mail through scripts (e.g. PHP). How can I make Postfix work without amavisd-new, spamassassin and clamav?

Mark_NL
3rd July 2009, 13:01
at first postfix is configged to use amavis etc .. now that those are not running anymore, postfix will start throwing errors in the logs (see /var/log/mail.log)

i think with "dpkg-reconfigure postfix" you can solve this.
just select the appropriate option

MrM
3rd July 2009, 13:21
at first postfix is configged to use amavis etc .. now that those are not running anymore, postfix will start throwing errors in the logs (see /var/log/mail.log)

These are the kind of errors I'm getting in mail.log:
Jul 3 11:55:01 prod postfix/smtpd[17713]: connect from localhost.localdomain[127.0.0.1]
Jul 3 11:55:01 prod postfix/smtpd[17713]: lost connection after CONNECT from localhost.localdomain[127.0.0.1]
Jul 3 11:55:01 prod postfix/smtpd[17713]: disconnect from localhost.localdomain[127.0.0.1]
Jul 3 11:55:39 prod postfix/qmgr[2373]: 1F3331CF1EE: from=<********************>, size=305, nrcpt=1 (queue active)
Jul 3 11:55:39 prod postfix/smtp[17896]: connect to 127.0.0.1[127.0.0.1]:10024: Connection refused
Jul 3 11:55:39 prod postfix/smtp[17896]: 1F3331CF1EE: to=<*****************>, relay=none, delay=1158, delays=1158/0.01/0/0, dsn=4.4.1, status=deferred (connect to 127.0.0.1[127.0.0.1]:10024: Connection refused)

i think with "dpkg-reconfigure postfix" you can solve this.
just select the appropriate option

I tried running dpkg-reconfigure postfix, but there was no option regarding amavis. After completing the reconfigure process (with defaults), the file /etc/postfix/main.cf has not changed. What options should I look out for?

Mark_NL
3rd July 2009, 13:27
open up master.cf

and remove the lines that look like these (i've copied them from my own config):

amavis unix - - - - 2 smtp
-o smtp_data_done_timeout=1200
-o smtp_send_xforward_command=yes
127.0.0.1:10025 inet n - - - - smtpd
-o content_filter=
-o local_recipient_maps=
-o relay_recipient_maps=
-o smtpd_restriction_classes=
-o smtpd_client_restrictions=
-o smtpd_helo_restrictions=
-o smtpd_sender_restrictions=
-o smtpd_recipient_restrictions=permit_mynetworks,rej ect
-o mynetworks=127.0.0.0/8
-o strict_rfc821_envelopes=yes
-o receive_override_options=no_unknown_recipient_chec ks,no_header_body_checks
-o smtpd_bind_address=127.0.0.1

or comment them out, putting a # in front of them.

and restart postfix :)

MrM
3rd July 2009, 13:39
I found this line in /etc/postfix/main.cf:
content_filter = amavis:[127.0.0.1]:10024

After commenting it out, I think it started working again. Is this ok, or should I comment out all the lines you listed as well?

Mark_NL
3rd July 2009, 14:05
Well when installing amavisd you must add all those lines, but if it works it should be oke like this :)

You know what they say: If it ain't broke, don't fix it! :)

MrM
3rd July 2009, 14:11
Well when installing amavisd you must add all those lines, but if it works it should be oke like this :)

OK, I'll just leave it like that then.

You know what they say: If it ain't broke, don't fix it! :)

Indeed :)

Thanks for all your help, Mark!