Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable ClamAV #48

Open
pipe01 opened this issue Jan 2, 2019 · 7 comments
Open

Disable ClamAV #48

pipe01 opened this issue Jan 2, 2019 · 7 comments

Comments

@pipe01
Copy link

pipe01 commented Jan 2, 2019

Is it possible to completely disable ClamAV from starting? The official methods don't seem to work.

@lejmr
Copy link
Owner

lejmr commented Jan 3, 2019

This is a feature to be implemented with the upcoming upgrade of container.. I am planning to add a set of env variables allowing to disable certain services, e.g., clamav, sogo, monitoring subsystem, etc.. from starting.

@pipe01
Copy link
Author

pipe01 commented Jan 3, 2019 via email

@digitalap3
Copy link

Is there a way to do this manually? I tried removing the clam*.sh scripts from static-files and rebuilding the image but I could not send or receive emails. The RAM usage is huge for something I don't need.

@lejmr
Copy link
Owner

lejmr commented Aug 17, 2020

If you upgrade to 1.3 version you can enter the container and using command supervisorctl control all services.

However, there is a chance there will be an impact of the functionality of iRedMail. Especially, for core components such as ClamAV.

@digitalap3
Copy link

Thank you!

@LennyLip
Copy link

LennyLip commented May 25, 2021

Enter the container.

#docker exec -it iredmail bash
iredmail#vi /etc/amavisd/amavisd.conf
# controls running of anti-virus/spam code: 0 -> enabled, 1 -> disabled.
@bypass_virus_checks_maps = (0);
@bypass_spam_checks_maps  = (0);

Change 0 to 1 in these lines, save.
Disable clamd:

systemctl disable --now clamd@amavisd
yum remove clamav clamav-lib

Exit the container and restart it (we can't use systemctl to restart services until we create the container with --privileged mode) :
docker restart iredmail

You need to do it every time you recreate the container. Memory using is decreased from 900Mb to 500Mb for me.

+ disable [program:clamav-daemon], [program:clamav-freshclam], and [program:spamassassin] sections in /etc/supervisord.d/mta.ini

[group:mta]
#programs=postfix,amavis,clamav-daemon,dovecot,clamav-freshclam,iredapd,spamassassin
programs=postfix,dovecot,iredapd

via:
https://docs.iredmail.org/completely.disable.amavisd.clamav.spamassassin.html
Stop virus/spam scanning, keep DKIM signing/verification and Disclaimer

@siarheidudko
Copy link

I had the same problem, I was running a container in a kubernetes cluster. The container either consumed almost 2GB of memory, or clamav went into an eternal reboot and the container began to consume more than one dedicated core. I tried many ways, in the end I just turned off the service.
/etc/supervisor/conf.d/clamav.conf

;
;This file is managed by iRedMail Team <[email protected]> with Ansible,
;please do __NOT__ modify it manually.
;

[program:clamav]
command=/usr/sbin/clamd -c /etc/clamav/clamd.conf --foreground
priority=999
startsecs=0
autostart=false
autorestart=false
stdout_syslog=true
stderr_syslog=true

Changes

  • priority 20->999 (lower)
  • autostart true->false
  • autorestart true->false

To save the changes, attach the modified configuration file to the container. An example for kubernetes:

apiVersion: apps/v1
kind: Deployment
metadata:
  namespace: iredmail-server
  name: iredmail
  labels:
    app: iredmail
spec:
  replicas: 1
  strategy:
    type: Recreate
  selector:
    matchLabels:
      app: iredmail
  template:
    metadata:
      labels:
        app: iredmail
    spec:
      containers:
        - name: iredmail
          image: iredmail/mariadb:stable
          env:
            - name: FIRST_MAIL_DOMAIN
              value: $YOUR_DOMAIN
            - name: FIRST_MAIL_DOMAIN_ADMIN_PASSWORD
              value: $YOUR_PASSWORD
            - name: HOSTNAME
              value: $YOUR_HOSTNAME
            - name: MLMMJADMIN_API_TOKEN
              value: $(openssl rand -base64 32)
            - name: ROUNDCUBE_DES_KEY
              value: $(openssl rand -base64 24)
          ports:
            - containerPort: 80
            - containerPort: 443
            - containerPort: 110
            - containerPort: 995
            - containerPort: 143
            - containerPort: 993
            - containerPort: 25
            - containerPort: 465
            - containerPort: 587
          resources: {}
          volumeMounts:
            - mountPath: /var/vmail/backup/mysql
              subPath: backup_mysql
              name: iredmail-data
            - mountPath: /var/vmail/vmail1
              subPath: vmail1
              name: iredmail-data
            - mountPath: /var/vmail/mlmmj
              subPath: mlmmj
              name: iredmail-data
            - mountPath: /var/vmail/mlmmj-archive
              subPath: mlmmj-archive
              name: iredmail-data
            - mountPath: /var/vmail/imapsieve_copy
              subPath: imapsieve_copy
              name: iredmail-data
            - mountPath: /opt/iredmail/custom
              subPath: custom
              name: iredmail-data
            - mountPath: /opt/iredmail/ssl
              subPath: ssl
              name: iredmail-data
            - mountPath: /var/lib/mysql
              subPath: mysql
              name: iredmail-data
            - mountPath: /var/lib/clamav
              subPath: clamav
              name: iredmail-data
            - mountPath: /var/lib/spamassassin
              subPath: spamassassin
              name: iredmail-data
            - mountPath: /var/spool/postfix
              subPath: postfix
              name: iredmail-data
            - mountPath: /opt/iredmail/ssl/cert.pem
              subPath: tls.crt
              name: iredmail-certs
            - mountPath: /opt/iredmail/ssl/key.pem
              subPath: tls.key
              name: iredmail-certs
            - mountPath: /opt/iredmail/ssl/combined.pem
              subPath: tls-combined.pem
              name: iredmail-certs
            - mountPath: /etc/supervisor/conf.d/clamav.conf
              subPath: configs/supervisor/clamav.conf
              name: iredmail-data
      hostname: localhost
      restartPolicy: Always
      volumes:
        - name: iredmail-data
          persistentVolumeClaim:
            claimName: iredmail
        - name: iredmail-certs
          secret:
            secretName: iredmail-certs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants