http://www.postfixvirtual.net/postfixantivirus.html#amavisdnew
yum install openssl
yum install openssl-devel
yum groupinstall 'Development Tools'
yum install ncurses-devel
yum install ncurses
DOVECOT
mkdir /usr/local/dovecot-1.1.7
ln -s dovecot-1.1.7 dovecot/a
configure --prefix=/usr/local/dovecot --with-mysql
if the configure bombs with message stating libmysqlclient not found,
then install mysql and set the ldflags to the mysql libraries:
LDFLAGS='-L/usr/lib64/mysql -L/usr/local/mysql/lib/mysql' \
./configure --prefix=/usr/local/dovecot --with-mysql
follow guide http://workaround.org/articles/ispmail-etch/
copy over the mysql files
edit postfix/main.cf
create /etc/postfix/ssl
http://www.projektfarm.com/en/support/howto/postfix_smtp_auth_tls.html
Edit /usr/local/dovecot/etc/dovecot.conf and /usr/local/dovecot/etc/dovecot-sql.conf.
dovecot-sql.conf contents:
driver = mysql
connect = host=127.0.0.1 dbname=mailserver user=mailuser password=mailuser2008
default_pass_scheme = PLAIN-MD5
password_query = SELECT email as user, password FROM view_users WHERE email='%u';
cmusieve
./configure --with-dovecot=../dovecot-1.1.7 --prefix=/usr/local/dovecot/plugin/cmusieve
mysql
mkdir /usr/local/mysql-5.1.30
cd /usr/local
ln -s mysql-5.1.30 mysql
groupadd mysql
useradd -g mysql mysql
./configure --prefix=/usr/local/mysql --with-plugins=innobase
make
make install
mkdir /usr/local/mysql/data
cp a my.cnf to /etc/my.cnf, modify
set basedir=/usr/local/mysql
set datadir=/usr/local/mysql/data
chown -R mysql:mysql /usr/local/mysql
cd /usr/local/mysql
bin/mysql_install_db --user=mysql --datadir=/usr/local/mysql/data
chown -R root .
chown -R mysql data
bin/mysqld_safe --user=mysql &
logging with bin/mysql
add to .bashrc export PATH=${PATH}:/usr/local/mysql/bin
cp support-files/mysql.server /etc/init.d
chkconfig --add /etc/init.d/mysql.server
POSTFIX
yum install db4-devel
--Build Src
p122: make -f Makefile.init makefiles 'CCARGS=-DUSE_SASL_AUTH -DDEF_SERVER_SASL_TYPE=\"dovecot\" -DUSE_TLS -I/usr/include/openssl -DHAS_MYSQL -I/usr/include/mysql' 'AUXLIBS=-L/usr/lib64/mysql -lmysqlclient -lz -lm -L/usr/lib64 -lssl -lcrypto'
--ops1:
make -f Makefile.init makefiles 'CCARGS=-DUSE_SASL_AUTH -DDEF_SERVER_SASL_TYPE=\"dovecot\" -DUSE_TLS -I/usr/include/openssl -DHAS_MYSQL -I/usr/local/mysql/include/mysql' 'AUXLIBS=-L/usr/local/mysql/lib/mysql -lmysqlclient -lz -lm -L/usr/lib64 -lssl -lcrypto'
# mv /usr/sbin/sendmail /usr/sbin/sendmail.OFF
# mv /usr/bin/newaliases /usr/bin/newaliases.OFF
# mv /usr/bin/mailq /usr/bin/mailq.OFF
# chmod 755 /usr/sbin/sendmail.OFF /usr/bin/newaliases.OFF \
/usr/bin/mailq.OFF
postfix:x:1000:1000:Postfix User:/no/where:/sbin/nologin
postfix:x:1000:
postdrop:x:1001:
make
ldconfig /usr/local/mysql/lib/mysql
make install
AMAVIS
http://www.postfixvirtual.net/postfixantivirus.html#amavisdnew
Stored copy
yum install CPAN
yum install perl-Archive-Tar perl-Archive-Zip
yum install perl-Convert-UUlib
yum install perl-MIME-tools
yum install perl-Net-Server
yum install perl-IO-Socket-SSL
yum install perl-IO-stringy
yum install perl-MailTools
yum install perl-Unix-Syslog
yum install perl-BerkeleyDB
yum install perl-DBD-MySQL perl-DBI
yum install perl-Convert-TNEF
yum install perl-Crypt-OpenSSL-RSA
yum install perl-Crypt-OpenSSL-Random
yum install perl-Mail-DKIM
yum install spamassassin
---Start
/etc/init.d/amavis start
--Send spam
sendmail email@email.email < /usr/share/doc/spamassassin-3.2.5/sample-nonspam.txt sendmail dude@email.email
SpamAssassin
yum install spamassissin
BashRC
Add the the /root/.bashrc file:
export PATH=${PATH}:/usr/local/mysql/bin
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/lib64/mysql:/usr/local/apr/lib
export JAVA_HOME=/usr/local/java
ulimit -n 10000
Insert New users
# mysql -p (xedysp#qts)
# use mailserver
# insert into virtual_users (domain_id,user,password) values (1,'virusalert',MD5('xxxxxx'));
# insert into virtual_aliases (domain_id,source,destination) values (1,'virusalert','t@example.com');
COMPILE CLAMAV
#cd /usr/local/src
#groupadd clamav
#useradd -g clamav -s /bin/false -c "Clam Antivirus" clamav
#tar -zxf clamav-0.88.2.tar.gz
#cd clamav-0.88.2
#./configure --sysconfdir=/etc
#make
#make install
#mkdir /var/lib/clamav
#chown clamav:clamav /var/lib/clamav
Clamav is installedl Lets make a test to see how clamav is working. We are doing our test under /usr/local/clamav-88.2 directory which
contains sample virus-like files. This test will write the output into scan.txt file.
#/usr/local/bin/clamscan -r -l scan.txt /usr/local/clamav-0.88.2
Edit /etc/clamav.conf and modify variables like below; Don't forget to put "#" in front of "Example" text. #Example
LogFile /tmp/clamd.log
DatabaseDirectory /var/lib/clamav
User amavis
UPDATING CLAMAV VIRUS DATABASELogFile /tmp/clamd.log
DatabaseDirectory /var/lib/clamav
User amavis
Every second a new virus/worm is created, we must update our virus database. Freshclam program does this for us.
Before running freshclam edit /etc/freshclam.conf file and modify the line "Example" like below. (Put # in front of it)
#Example
No create necessary log file and run freshclam;#touch /var/log/clam-update.log
#chmod 600 /var/log/clam-update.log
#chown amavis /var/log/clam-update.log
#/usr/local/bin/freshclam --datadir=/var/lib/clamav -l /var/log/clam-update.log
CLAMAV IN CRONTAB#chmod 600 /var/log/clam-update.log
#chown amavis /var/log/clam-update.log
#/usr/local/bin/freshclam --datadir=/var/lib/clamav -l /var/log/clam-update.log
Create a crontab entry so that clamav will update its database everyday at 08:00 regularly. Put these lines into
your crontab
06 08 * * * /usr/local/bin/freshclam --quiet -l /var/log/clam-update.log
02,03,04 etc. minutes instead of 10 multiples (00,10,20)
RUN CLAMD
#/usr/local/sbin/clamd