This shows you the differences between two versions of the page.
— |
setup_clamav_with_postfix_on_debian_lenny_in_a_chroot [2018/12/06 21:47] (current) abeverley created |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== Setup clamav with Postfix on Debian Lenny in a chroot ====== | ||
+ | |||
+ | Quick and dirty instructions on setting up Postfix to scan messages using clamav on Debian Lenny. | ||
+ | |||
+ | Install clamav and clamav-milter: | ||
+ | |||
+ | <code> | ||
+ | apt-get install clamav | ||
+ | apt-get install clamav-daemon | ||
+ | apt-get install clamav-milter | ||
+ | </code> | ||
+ | |||
+ | Edit /etc/default/clamav-milter and uncomment the following lines | ||
+ | |||
+ | <code> | ||
+ | USE_POSTFIX='yes' | ||
+ | SOCKET=local:/var/spool/postfix/clamav/clamav-milter.ctl | ||
+ | </code> | ||
+ | If you don't want the postmaster and sender to be emailed each time a virus is detected then add the letter q to the OPTIONS line at the beginning of the file as such: | ||
+ | |||
+ | <code> | ||
+ | OPTIONS="--max-children=2 -olq" | ||
+ | </code> | ||
+ | Create somewhere within the Postfix chroot for the clamav-milter socket to sit. The default location cannot be seen by Postfix when it is in a chroot jail. | ||
+ | |||
+ | <code> | ||
+ | mkdir -p /var/spool/postfix/clamav/ | ||
+ | chown clamav:postfix /var/spool/postfix/clamav/ | ||
+ | chmod g+s /var/spool/postfix/clamav/ | ||
+ | </code> | ||
+ | |||
+ | Restart the milter: | ||
+ | |||
+ | <code> | ||
+ | /etc/init.d/clamav-milter restart | ||
+ | </code> | ||
+ | |||
+ | Add the following lines to /etc/postfix/main.cf to enable the milter (assumes you want to accept emails on milter failure): | ||
+ | |||
+ | <code> | ||
+ | milter_connect_macros = i b j _ {daemon_name} {if_name} {if_addr} | ||
+ | smtpd_milters = unix:/clamav/clamav-milter.ctl | ||
+ | milter_default_action = accept | ||
+ | </code> | ||
+ | |||
+ | Restart Postfix: | ||
+ | |||
+ | <code> | ||
+ | /etc/init.d/postfix restart | ||
+ | </code> | ||