1. Добавим репозитарий:
nano /etc/apt/sources.list deb http://volatile.debian.org/debian-volatile etch/volatile main contrib non-free
Инсталим DSPAM:
wget http://www.debian.org/volatile/etch-volatile.asc -O- | apt-key add - apt-get update && apt-get upgrade apt-get install dspam dspam-doc libdspam7-drv-mysql
на вопрос про пароль к базе вводим пароль на mysql
на вопрос про пароль к libdspam7-drv-mysql, оставляем поле пустым - пароль генерится автоматом
2. Сконфигурируем:
nano /etc/dspam/dspam.conf
StorageDriver /usr/lib/dspam/libmysql_drv.so DeliveryHost 127.0.0.1 DeliveryPort 10026 DeliveryIdent localhost DeliveryProto SMTP Preference "spamSubject=SPAM" Opt out TrackSources spam virus ParseToHeaders on ChangeModeOnParse on ChangeUserOnParse off ServerPID /var/run/dspam.pid ServerMode auto ServerPass.Relay1 "secret" ServerParameters "--deliver=innocent" ServerIdent "localhost.localdomain" ServerDomainSocketPath "/var/spool/postfix/var/run/dspam.sock" ClientHost /var/spool/postfix/var/run/dspam.sock ClientIdent "secret@Relay1"
nano /var/spool/dspam/group
dspam:shared:*.example.com
/etc/init.d/dspam start nano /etc/default/dspam
Измените START=no на START=yes
3. Настройка постфикса:
nano /etc/postfix/master.cf
Измените:
smtp inet n - - - - smtpd
на:
smtp inet n - - - - smtpd -o content_filter=lmtp:unix:/var/run/dspam.sock 127.0.0.1:10026 inet n - - - - smtpd -o content_filter= -o receive_override_options=no_unknown_recipient_checks,no_header_body_checks -o smtpd_helo_restrictions= -o smtpd_client_restrictions= -o smtpd_sender_restrictions= -o smtpd_recipient_restrictions=permit_mynetworks,reject -o mynetworks=127.0.0.0/8 -o smtpd_authorized_xforward_hosts=127.0.0.0/8
Далее рестартуем пстфикс и проверяем работает ли.
4. Создаем тестового юзверя:
mysql -u root -p USE mail; INSERT INTO `domains` (`domain`) VALUES ('example.com'); INSERT INTO `users` (`email`, `password`) VALUES ('test@example.com', VALUES('$1$cAQYxkMl$eZUpnv.gXBbPMYBoaO07Z0'));
5. "Тренировка" DSPAM:
apt-get install bzip2 cd /tmp wget http://spamassassin.apache.org/publiccorpus/20050311_spam_2.tar.bz2 wget http://spamassassin.apache.org/publiccorpus/20030228_easy_ham_2.tar.bz2 tar xvfj 20050311_spam_2.tar.bz2 tar xvfj 20030228_easy_ham_2.tar.bz2 dspam_train test spam_2/ easy_ham_2/
6. Ставим и настраиваем Clamav:
apt-get install clamav-daemon nano /etc/clamav/clamd.conf
#LocalSocket /var/run/clamav/clamd.ctl TCPSocket 3310
/etc/init.d/clamav-daemon restart
7. Правим Dspam для поддержки Clamav:
nano /etc/dspam/dspam.conf
ClamAVPort 3310 ClamAVHost 127.0.0.1 ClamAVResponse reject
/etc/init.d/dspam restart