{"id":44,"date":"2008-11-20T16:29:30","date_gmt":"2008-11-20T09:29:30","guid":{"rendered":"http:\/\/blog.binus-edu.com\/?p=44"},"modified":"2009-04-17T13:53:00","modified_gmt":"2009-04-17T06:53:00","slug":"how-to-install-postfixpostfixadminmysqlcyrus-saslcourier-authlibcourier-imapsmtp-authsquirellmailmailscannerclamavspamassassinmailwatch-on-centos-52","status":"publish","type":"post","link":"https:\/\/adityo.blog.binusian.org\/?p=44","title":{"rendered":"How To Install Postfix+Postfixadmin+MySQL+Cyrus-SASL+Courier-Authlib+Courier-Imap+Smtp-Auth+Squirellmail+MailScanner+ClamAV+SpamAssassin+MailWatch on CentOS 5.2"},"content":{"rendered":"<p>What\u00a0 is Postfix,Postfixadmin,Cyrus-SASL,Courier-Authlib,Courier-Imap,Squirellmail,MailScanner,ClamAV,SpamAssassin,MailWatch ?<\/p>\n<ul>\n<li><em>Postfix<\/em> is a Mail Transport Agent (MTA), supporting LDAP, SMTP AUTH (SASL), TLS and running in a chroot environment. Postfix is Wietse Venema&#8217;s mailer that started life as an alternative to the widely-used Sendmail program.<\/li>\n<li><em>PostfixAdmin<\/em> is a web based interface to configure and manage a Postfix based email server for many users.<\/li>\n<li><em>Cyrus-SASL<\/em> is a software that provides different methods and mechanisms of authentication. This software is often used in conjunction with <a href=\"http:\/\/asg.web.cmu.edu\/cyrus\/imapd\/\" target=\"_top\">Cyrus IMAP Server<\/a> and is provided as standalone software<\/li>\n<li><em>Courier Authlib<\/em> is the Courier authentication library.<\/li>\n<li><em><span class=\"application\">Courier-IMAP<\/span><\/em> is a fast,     scalable, enterprise <acronym class=\"acronym\">IMAP<\/acronym> server that uses Maildirs. Many E-mail servwice providers use     <span class=\"application\">Courier-IMAP<\/span> to easy handle     hundreds of thousands of mail accounts. With its built-in     <acronym class=\"acronym\">IMAP<\/acronym> and <acronym class=\"acronym\">POP3<\/acronym> aggregation proxy, <span class=\"application\">Courier-IMAP<\/span> has practically infinite     horizontal scalability<\/li>\n<li><em>SquirrelMail<\/em> is a standards-based webmail package written in PHP. It includes built-in pure PHP support for the IMAP and SMTP protocols, and all pages render in pure HTML 4.0 (with no JavaScript required) for maximum compatibility across browsers<\/li>\n<li><em>Mailscanner<\/em> is an <a title=\"Open source\" href=\"http:\/\/en.wikipedia.org\/wiki\/Open_source\">open source<\/a> <a title=\"E-mail\" href=\"http:\/\/en.wikipedia.org\/wiki\/E-mail\">e-mail<\/a> security system for use on <a title=\"Unix\" href=\"http:\/\/en.wikipedia.org\/wiki\/Unix\">Unix<\/a> e-mail gateways and was first released in <a title=\"2001\" href=\"http:\/\/en.wikipedia.org\/wiki\/2001\">2001<\/a>. It protects against <a title=\"Computer virus\" href=\"http:\/\/en.wikipedia.org\/wiki\/Computer_virus\">viruses<\/a> and <a title=\"E-mail spam\" href=\"http:\/\/en.wikipedia.org\/wiki\/E-mail_spam\">spam<\/a>. It is distributed under the <a title=\"GNU General Public License\" href=\"http:\/\/en.wikipedia.org\/wiki\/GNU_General_Public_License\">GNU General Public License<\/a>.<\/li>\n<li><em>ClamAV<\/em> is an open source (GPL) anti-virus toolkit for UNIX, designed especially for e-mail scanning on mail gateways.<\/li>\n<li>Spam Assasins is a Perl-based spam filter using text analysis This package contains a script that is designed to be called from a user&#8217;s .forward or .procmailrc file, and acts to filter out all junk or spam e-mail. It also contains a daemon and client (written in C) designed for high load servers, reducing loading overhead. It includes automatic white-listing, RBL testing, and header and body testing for common spam contents. With librazor-perl, it also checks messages against an online collaborative database.<\/li>\n<li>MailWatch for MailScanner is a web-based front-end to MailScanner written in PHP, MySQL and JpGraph.<\/li>\n<\/ul>\n<p>I will install this on CentOS 5.2 , please prepare Anything. Download All Software and packages and store it in \/usr\/local\/src<\/p>\n<p>Postfix : http:\/\/mirrors.rootservices.net\/postfix\/official\/postfix-2.5.5.tar.gz<br \/>\nPostfix Admin :  http:\/\/waix.dl.sourceforge.net\/sourceforge\/postfixadmin\/postfixadmin-2.2.1.1.tar.gz<br \/>\nCyrus-SASL : ftp:\/\/ftp.andrew.cmu.edu\/pub\/cyrus-mail\/cyrus-sasl-2.1.22.tar.gz<br \/>\nCourier Authlib : http:\/\/prdownloads.sourceforge.net\/courier\/courier-authlib-0.61.0.tar.bz2<br \/>\nCourier-Imap : http:\/\/prdownloads.sourceforge.net\/courier\/courier-imap-4.4.1.tar.bz2<br \/>\nSquirellmail : http:\/\/www.squirrelmail.org\/countdl.php?fileurl=http%3A%2F%2Fprdownloads.sourceforge.net%2Fsquirrelmail%2Fsquirrelmail-1.4.16.tar.gz<\/p>\n<p><strong>Downloading all packages :<\/strong><\/p>\n<p><code>#cd \/usr\/local\/src <\/code><\/p>\n<p><code>#wget\u00a0 http:\/\/mirrors.rootservices.net\/postfix\/official\/postfix-2.5.5.tar.gz <\/code><\/p>\n<p><code>#wget http:\/\/waix.dl.sourceforge.net\/sourceforge\/postfixadmin\/postfixadmin-2.2.1.1.tar.gz <\/code><\/p>\n<p><code>#wget ftp:\/\/ftp.andrew.cmu.edu\/pub\/cyrus-mail\/cyrus-sasl-2.1.22.tar.gz <\/code><\/p>\n<p><code>#wget http:\/\/prdownloads.sourceforge.net\/courier\/courier-authlib-0.61.0.tar.bz2 <\/code><\/p>\n<p><code>#wget http:\/\/prdownloads.sourceforge.net\/courier\/courier-imap-4.4.1.tar.bz2 <\/code><\/p>\n<p><code>#wget http:\/\/www.squirrelmail.org\/countdl.php?fileurl=http%3A%2F%2Fprdownloads.sourceforge.net%2Fsquirrelmail%2Fsquirrelmail-1.4.16.tar.gz<\/code><\/p>\n<p><strong>Preparing All Server Dependency Packages<\/strong><\/p>\n<p><code>#<code class=\"geshifilter text\">yum install openldap-devel openldap-servers postgres-devel expect-devel postfix gamin-devel<\/code><\/code><\/p>\n<p><strong>Installing Apache,PHP,Mysql and rpm-build<br \/>\n<\/strong><\/p>\n<p><code>#<code class=\"geshifilter text\">yum install httpd* php* mysql* rpm-build*<\/code><\/code><\/p>\n<p><strong>Remove All Cyrus-SASL &amp; postfix\/sendmail packages <\/strong><\/p>\n<p>We need to remove sendmail or previous postfix installation, and since we will compile the Cyrus-SASL manually from the sourcecode we need to remove the default Cyrus-SASL component first,<\/p>\n<p>You can checked those package using <code class=\"geshifilter text\">rpm -qa|grep command<br \/>\n<\/code><\/p>\n<p><code>#<code class=\"geshifilter text\">rpm -qa|grep sendmail <\/code>#<code class=\"geshifilter text\">rpm -qa|grep postfix <\/code>#<code class=\"geshifilter text\">rpm -qa|grep cyrus<\/code><\/code><\/p>\n<p>If you see any sendmail , postfix cyrus packages we can safely remove it, you can use rpm -e command<\/p>\n<p><code>#rpm -e cyrus-sasl.1.x.x.x --nodeps #rpm -e sendmail.x.x.x --nodeps #rpm -e postfix.x.x.x --nodeps<\/code><\/p>\n<p>Installation<\/p>\n<p><strong>Installing Cyrus-SASL <\/strong><\/p>\n<p><code>#cd \/usr\/local\/src #tar -zxvf cyrus-sasl-2.1.22.tar.gz #cd cyrus-sasl-2.1.22<br \/>\n#export CPPFLAGS=\"-I\/usr\/include\/mysql\"<br \/>\n#export LDFLAGS=\"-L\/usr\/lib\/mysql -lmysqlclient -lz -lm\"<br \/>\n#.\/configure --enable-anon --enable-plain --enable-login --enable-sql<br \/>\n--disable-krb4 --disable-otp --disable-cram --disable-digest<br \/>\n--with-mysql=\/usr\/lib\/mysql --without-pam --without-saslauthd<br \/>\n--without-pwcheck --prefix=\/usr --with-plugindir=\/usr\/lib\/sasl2<br \/>\n#make -j2; make install<\/code><\/p>\n<p><strong>Installing Postfix :<\/strong><\/p>\n<p>Before we install the postfix we need to create postfix and postdrop id first, you can create it using this command:<\/p>\n<p><code>#useradd postfix <\/code><\/p>\n<p><code>#groupadd postdrop <\/code><\/p>\n<p><code>#usermod -a -G postdrop postfix<\/code><\/p>\n<p><code>now you can see the postfix id number<\/code><\/p>\n<p><code>#id postfix uid=500(postfix) gid=500(postfix) groups=500(postfix),501(postdrop)<\/code><\/p>\n<p>Start the installation :<\/p>\n<p><code># cd \/usr\/local\/src <\/code><\/p>\n<p><code># tar -zxvf postfix-2.5.5.tar.gz <\/code><\/p>\n<p><code># cd postfix-2.5.5 <\/code><\/p>\n<p><code># make makefiles 'CCARGS=-DHAS_MYSQL -I\/usr\/include\/mysql -DUSE_SASL_AUTH -DUSE_TLS -DUSE_CYRUS_SASL -I\/usr\/include\/sasl' 'AUXLIBS=-L\/usr\/lib\/mysql -lmysqlclient -lz -lm -L\/usr\/lib -lssl -lcrypto -lsasl2' <\/code><\/p>\n<p><code># make install<\/code><\/p>\n<p>after some compilation process, you will be prompt for a lot of question, don&#8217;t worry just enter it till the end<\/p>\n<p>Okay after you finish installing you need to edit Postfix main.cf :<\/p>\n<p>We need to add few lines below in the end of main.cf,\u00a0 you have create a postfix user before right you can see the id (id postfix) then\u00a0\u00a0 We&#8217;re going to punt and make all virtual mail users use the same UID:GID of Postfix. In my case the uid and gid is 500, 500 is postfix group id and user id<\/p>\n<p><code>#id postfix uid=500(postfix) gid=500(postfix) groups=500(postfix),501(postdrop)<\/code><\/p>\n<p><code>#cd \/etc\/postfix #vi main.cf<\/code><\/p>\n<p>then paste this :<\/p>\n<p><code>virtual_alias_maps = proxy:mysql:\/etc\/postfix\/mysql_virtual_alias_maps.cf <\/code><\/p>\n<p><code>virtual_gid_maps = static:500 <\/code><\/p>\n<p><code>virtual_mailbox_base = \/var\/vmail\/ <\/code><\/p>\n<p><code>virtual_mailbox_domains = proxy:mysql:\/etc\/postfix\/mysql_virtual_domains_maps.cf <\/code><\/p>\n<p><code>virtual_mailbox_limit = 112400000 <\/code><\/p>\n<p><code>virtual_mailbox_maps = proxy:mysql:\/etc\/postfix\/mysql_virtual_mailbox_maps.cf <\/code><\/p>\n<p><code>virtual_minimum_uid = 500 virtual_transport = virtual <\/code><\/p>\n<p><code>virtual_uid_maps = static:500 <\/code><\/p>\n<p><code>alias_maps = mysql:\/etc\/postfix\/mysql_virtual_alias_maps.cf\u00a0 <\/code><\/p>\n<p><code>#====================SASL======================== <\/code><\/p>\n<p><code>broken_sasl_auth_clients = yes <\/code><\/p>\n<p><code>smtpd_recipient_restrictions = permit_mynetworks,permit_sasl_authenticated,reject_invalid_hostname,reject_non_fqdn_hostname, reject_unknown_sender_domain,reject_non_fqdn_sender,reject_non_fqdn_recipient, reject_unknown_recipient_domain,reject_unauth_pipelining,reject_unauth_destination,permit<\/code><\/p>\n<p><code>smtpd_sasl_auth_enable = yes smtpd_sasl_local_domain = $myhostname smtpd_sasl_security_options = noanonymous smtpd_sasl_application_name = smtpd<br \/>\nsmtpd_banner=$myhostname ESMTP \"mail.lineabsolute.com\"\u00a0 <\/code><\/p>\n<p><code>smtp_use_tls = yes <\/code><\/p>\n<p><code>smtpd_use_tls = yes <\/code><\/p>\n<p><code>smtp_tls_note_starttls_offer = yes <\/code><\/p>\n<p><code>smtpd_tls_key_file = \/etc\/postfix\/ssl\/smtpd.key <\/code><\/p>\n<p><code>smtpd_tls_cert_file = \/etc\/postfix\/ssl\/smtpd.crt <\/code><\/p>\n<p><code>smtpd_tls_CAfile = \/etc\/postfix\/ssl\/cacert.pem <\/code><\/p>\n<p><code>smtpd_tls_loglevel = 1 <\/code><\/p>\n<p><code>smtpd_tls_received_header = yes <\/code><\/p>\n<p><code>smtpd_tls_session_cache_timeout = 3600s <\/code><\/p>\n<p><code>tls_random_source = dev:\/dev\/urandom<\/code><\/p>\n<p>\u00a0<\/p>\n<p><strong>Then we need to create file mysql_virtual_alias_maps.cf<\/strong><\/p>\n<p><code>$cd \/etc\/postfix <\/code><\/p>\n<p><code>$vi mysql_virtual_alias_maps.cf\u00a0 <\/code><\/p>\n<p><code>user = postfix <\/code><\/p>\n<p><code>password = password123 <\/code><\/p>\n<p><code>hosts = localhost <\/code><\/p>\n<p><code>dbname = postfix query = SELECT goto FROM alias WHERE address='%s' AND active = '1'<\/code><\/p>\n<p>\u00a0<\/p>\n<p><strong>Create file  mysql_virtual_domains_maps.cf<\/strong><\/p>\n<p><code>$vi mysql_virtual_domains_maps.cf\u00a0 <\/code><\/p>\n<p><code>user = postfix <\/code><\/p>\n<p><code>password = password123 <\/code><\/p>\n<p><code>hosts = localhost <\/code><\/p>\n<p><code>dbname = postfix query = SELECT domain FROM domain WHERE domain='%s' AND active = '1'<\/code><\/p>\n<p>\u00a0<\/p>\n<p><strong>Create file mysql_virtual_mailbox_maps.cf <\/strong><\/p>\n<p>\u00a0<code>$vi mysql_virtual_mailbox_maps.cf\u00a0 <\/code><\/p>\n<p><code>user = postfix <\/code><\/p>\n<p><code>password = password123 <\/code><\/p>\n<p><code>hosts = localhost <\/code><\/p>\n<p><code>dbname = postfix <\/code><\/p>\n<p><code>query = SELECT maildir FROM mailbox WHERE username='%s' AND active = '1'<\/code><\/p>\n<p>\u00a0<\/p>\n<p><strong>Afterwards we create the certificates for TLS :<\/strong><\/p>\n<p><code># mkdir \/etc\/postfix\/ssl <\/code><\/p>\n<p><code># cd \/etc\/postfix\/ssl\/ <\/code><\/p>\n<p><code># openssl genrsa -des3 -rand \/etc\/hosts -out smtpd.key 1024 <\/code><\/p>\n<p><code># chmod 600 smtpd.key <\/code><\/p>\n<p><code># openssl req -new -key smtpd.key -out smtpd.csr <\/code><\/p>\n<p><code># openssl x509 -req -days 3650 -in smtpd.csr -signkey smtpd.key -out smtpd.crt <\/code><\/p>\n<p><code># openssl rsa -in smtpd.key -out smtpd.key.unencrypted <\/code><\/p>\n<p><code># mv -f smtpd.key.unencrypted smtpd.key <\/code><\/p>\n<p><code># openssl req -new -x509 -extensions v3_ca -keyout cakey.pem -out cacert.pem -days 3650 <\/code><\/p>\n<p><code># chmod o= \/etc\/postfix\/ssl\/smtpd.key\u00a0 <\/code><\/p>\n<p><strong>Installing Courier Authlib :<\/strong><\/p>\n<p><code># cd \/usr\/local\/src <\/code><\/p>\n<p><code># rpmbuild -ta courier-authlib-0.61.0.tar.bz2<\/code><\/p>\n<p>if\u00a0 you see this <code>error: <\/code><\/p>\n<p><code># rpmbuild -ta courier-authlib-0.61.0.tar.bz2 error: Failed build dependencies:\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 libtool is needed by courier-authlib-0.61.0-1.i386\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 postgresql-devel is needed by courier-authlib-0.61.0-1.i386\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 gdbm-devel is needed by courier-authlib-0.61.0-1.i386\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 pam-devel is needed by courier-authlib-0.61.0-1.i386\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 gcc-c++ is needed by courier-authlib-0.61.0-1.i386\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 redhat-rpm-config is needed by courier-authlib-0.61.0-1.i386\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \/usr\/include\/ltdl.h is needed by courier-authlib-0.61.0-1.i386 <\/code><\/p>\n<p>\u00a0<\/p>\n<p>you need to install some dependencies first<br \/>\n<code># yum install libtool postgresql-devel gdbm-devel\u00a0 pam-devel gcc-c++ redhat-rpm-config libtool-ltdl-devel libtool-ltdl<\/code><\/p>\n<p>then run the rpmbuild again<\/p>\n<div class=\"geshifilter text\" style=\"font-family: monospace;\">\n<p><code># rpmbuild -ta courier-authlib-0.61.0.tar.bz2 <\/code><\/p>\n<p><code># cd \/usr\/src\/redhat\/RPMS\/i386\/ <\/code><\/p>\n<p><code># rpm -ivh courier-authlib*<\/code><\/div>\n<p><strong>Installing Courier-Imap :<\/strong><\/p>\n<p>you need to be user beside root to build the rpm packet, you need to add the courier user first:<br \/>\n<code># useradd courier <\/code><\/p>\n<p><code># su courier <\/code><\/p>\n<p><code>$ mkdir <\/code><\/p>\n<p><code>$HOME\/rpm <\/code><\/p>\n<p><code>$ mkdir $HOME\/rpm\/SOURCES $ mkdir $HOME\/rpm\/SPECS <\/code><\/p>\n<p><code>$ mkdir $HOME\/rpm\/BUILD <\/code><\/p>\n<p><code>$ mkdir $HOME\/rpm\/SRPMS <\/code><\/p>\n<p><code>$ mkdir $HOME\/rpm\/RPMS <\/code><\/p>\n<p><code>$ mkdir $HOME\/rpm\/RPMS\/i386 <\/code><\/p>\n<p><code>$ echo \"%_topdir $HOME\/rpm\" &gt;&gt; $HOME\/.rpmmacros <\/code><\/p>\n<p><code>$ mkdir $HOME\/downloads <\/code><\/p>\n<p><code>$ cd $HOME\/downloads <\/code><\/p>\n<p><code>$ cd \/usr\/local\/src <\/code><\/p>\n<p><code>$ sudo mv courier-imap*$HOME\/downloads<\/code><\/p>\n<p>password:\u00a0 &#8211;&gt; just type enter when you prompt by password<br \/>\n<code>$ rpmbuild -ta courier-imap*<\/code><\/p>\n<p>become root user again to compile the courier-imap<br \/>\n<code>$ su <\/code><\/p>\n<p><code># cd \/home\/courier\/rpm\/RPMS\/i386 <\/code><\/p>\n<p><code># rpm -ivh courier-imap*<\/code><\/p>\n<p><em>We need to edit the authmysqlrc file :<\/em><br \/>\n<code># cd \/etc\/authlib\/ <\/code><\/p>\n<p><code># mv authmysqlrc authmysqlrc.ori <\/code><\/p>\n<p><code># vi\u00a0 \/etc\/authlib\/authmysqlrc<\/code><\/p>\n<p>we need to add this line<\/p>\n<p><code>MYSQL_SERVER localhost <\/code><\/p>\n<p><code>MYSQL_USERNAME postfix <\/code><\/p>\n<p><code>MYSQL_PASSWORD <\/code><code>password123 <\/code><code> <\/code><\/p>\n<p><code>MYSQL_PORT 0 <\/code><\/p>\n<p><code>MYSQL_OPT 0 <\/code><\/p>\n<p><code>MYSQL_DATABASE postfix <\/code><\/p>\n<p><code>MYSQL_USER_TABLE mailbox <\/code><\/p>\n<p><code>MYSQL_CRYPT_PWFIELD password <\/code><\/p>\n<p><code>MYSQL_CLEAR_PWFIELD password <\/code><\/p>\n<p><code>MYSQL_UID_FIELD '500' <\/code><\/p>\n<p><code>MYSQL_GID_FIELD '500' <\/code><\/p>\n<p><code>MYSQL_LOGIN_FIELD username <\/code><\/p>\n<p><code>MYSQL_HOME_FIELD '\/var\/vmail\/' <\/code><\/p>\n<p><code>MYSQL_NAME_FIELD name <\/code><\/p>\n<p><code>MYSQL_MAILDIR_FIELD maildir<\/code><\/p>\n<p>\u00a0<\/p>\n<p><em>Edit authdaemonrc :<\/em><br \/>\n<code># mv authdaemonrc authdaemonrc.ori <\/code><\/p>\n<p><code># vi authdaemonrc<\/code><\/p>\n<p>add this line :<br \/>\n<code>authmodulelist=\"authmysql authpam\"<br \/>\nDEBUG_LOGIN=1<\/code><\/p>\n<p><em>Configuring SMTP-Auth :<\/em><br \/>\n<code># vi \/usr\/lib\/sasl2\/smtpd.conf<\/code><\/p>\n<p>add this line:<br \/>\n<code>pwcheck_method: authdaemond log_level: 3 mech_list: PLAIN LOGIN authdaemond_path:\/var\/spool\/authdaemon\/socket<\/code><\/p>\n<p><code># chmod o+x \/var\/spool\/authdaemon<\/code><\/p>\n<p><em>Create directory \/var\/vmail for save postfix user maildir data :<\/em><br \/>\n<code># mkdir \/var\/vmail<br \/>\n# chown -R postfix:postfix \/var\/vmail\/<\/code><\/p>\n<p><em>Starting Courier-authlib, Courier-Imap and Postfix :<\/em><br \/>\n<code># chkconfig --levels 235 courier-authlib on <\/code><\/p>\n<p><code># \/etc\/init.d\/courier-authlib start<\/code><\/p>\n<p><em>Starting Courier authentication services (authdaemond) :<\/em><br \/>\n<code><kbd># chkconfig --levels 235 courier-imap on <\/kbd><\/code><\/p>\n<p><code><kbd># \/etc\/init.d\/courier-imap start Starting Courier-IMAP server: imap generating-SSL-certificate... imap-ssl pop3 generating-SSL-certificate... pop3-ssl<\/kbd><\/code><\/p>\n<p>nb : it will automatically generate cert for imaps and pop3s<\/p>\n<p><code># chkconfig --levels 235 postfix on <\/code><\/p>\n<p><code># postfix start postfix\/postfix-script: starting the Postfix mail system<\/code><\/p>\n<p><strong><code>Common error <\/code><\/strong><\/p>\n<p>when you start the postfix later ( <code># postfix start )\u00a0<\/code> you will get this error<\/p>\n<p>#postfix start<\/p>\n<p>postfix: fatal: \/etc\/postfix\/main.cf, line 687: missing &#8216;=&#8217; after attribute name: &#8220;reject_unknown_sender_domain,reject_non_fqdn_sender,reject_non_fqdn_recipient,&#8221;<\/p>\n<p>the error was cause on <code>\/etc\/postfix\/main.cf, i use  to make the code fit to pages, it should be set to<br \/>\n<\/code><\/p>\n<p><code>smtpd_recipient_restrictions = permit_mynetworks,permit_sasl_authenticated,reject_invalid_hostname,reject_non_fqdn_hostname,reject_unknown_sender_domain,reject_non_fqdn_sender,reject_non_fqdn_recipient, reject_unknown_recipient_domain,reject_unauth_pipelining,reject_unauth_destination,permit<\/code><\/p>\n<p><strong>Installing Postfixadmin :<\/strong><br \/>\n<code># cd \/usr\/local\/src<br \/>\n# tar -zxvf  postfixadmin-2.2.1.1.tar.gz<br \/>\n# mv postfixadmin-2.2.1.1 postfixadmin<\/code><\/p>\n<p>move the postfixadmin to your current virtual host domain(usually you the setting was on httpd.conf<\/p>\n<p><code># mv postfixadmin \/var\/www\/html<\/code><\/p>\n<p><em>Create Postfixadmin Mysql DB username and password :<\/em><\/p>\n<p>i assume you have set your mysql service, root username and password if not you can run<\/p>\n<p><code>#service mysqld start #mysqladmin -u root pasword rootpassword<\/code><\/p>\n<p>go to mysql db as root<\/p>\n<p><code># mysql -u root -p mysql&gt; create database postfix; mysql&gt; grant all on postfix.* to postfix@'%' identified by '<\/code><code>password123<\/code><code>'; mysql&gt; exit<\/code><\/p>\n<p><em>Configure Postfix config.inc.php :<\/em><br \/>\n<code># cd \/var\/www\/html\/postfixadmin<br \/>\n# vi config.inc.php<\/code><\/p>\n<p>### modify few lines below ###<br \/>\n<code>$CONF['configured'] = true;<br \/>\n$CONF['database_type'] = 'mysql';<br \/>\n$CONF['database_host'] = 'localhost';<br \/>\n$CONF['database_user'] = 'postfix';<br \/>\n$CONF['database_password'] = '<\/code><code>password123<\/code><code>';<br \/>\n$CONF['database_name'] = 'postfix';<br \/>\n$CONF['database_prefix'] = '';<br \/>\n$CONF['encrypt'] = 'md5crypt';<\/code><\/p>\n<p><em>Setup Postfix Admin from Web URL :<\/em><br \/>\nExample : <a title=\"http:\/\/192.168.0.1\/postfixadmin\/setup.php\" href=\"http:\/\/192.168.0.1\/postfixadmin\/setup.php\">http:\/\/192.168.0.1\/postfixadmin\/setup.php<\/a><\/p>\n<p><img decoding=\"async\" src=\"http:\/\/blog.binus-edu.com\/wp-content\/uploads\/setup.jpg\" alt=\"\" \/><\/p>\n<p>there will be a script that checked the requirement for the script, there will be a warning such as php-mbstring is not available yet you need to install it first if youwant the script to worked (yum -y install php-mbstring), you suppose to see account creation box in the bottom, you can set your admin account to login. Don&#8217;t forget to delete the setup.php after you finished.<\/p>\n<p>\u00a0<\/p>\n<p>now you can login to the postfixadmin <a title=\"http:\/\/192.168.0.1\/postfixadmin\/setup.php\" href=\"http:\/\/192.168.0.1\/postfixadmin\/setup.php\">http:\/\/192.168.0.1\/postfixadmin\/login.php<\/a><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/blog.binus-edu.com\/wp-content\/uploads\/postfixadmin.jpg\" alt=\"\" width=\"525\" height=\"264\" \/><\/p>\n<p>\u00a0now you need to create a virtual domain inside the postfixadmin<\/p>\n<p><img decoding=\"async\" style=\"width: 524px; height: 185px;\" src=\"http:\/\/blog.binus-edu.com\/wp-content\/uploads\/postfixadmin2.jpg\" alt=\"\" \/><\/p>\n<p>you also need to create a new mailbox so we can test the postfix<\/p>\n<p><img decoding=\"async\" style=\"width: 517px; height: 261px;\" src=\"http:\/\/blog.binus-edu.com\/wp-content\/uploads\/postfixadmin3.jpg\" alt=\"\" \/><\/p>\n<p><strong>\u00a0Installing Squirellmail Webmail :<\/strong><\/p>\n<p># cd \/usr\/local\/src<br \/>\n# tar -zxvf squirrelmail-1.4.16.tar.gz<br \/>\n# mv squirrelmail-1.4.16 webmail<br \/>\n# mv webmail \/var\/www\/html<br \/>\nConfiguring Squirellmail :<br \/>\n# cd \/var\/www\/html\/webmail<br \/>\n# .\/configure<br \/>\n<code>type option 2<br \/>\ntype option A<br \/>\ntype option 6 for auth type \"login\"<br \/>\ntype option 8 and type courier<\/code><\/p>\n<p><code> <\/code><\/p>\n<p><code>type option B<br \/>\ntype option 7 for smtp auth \"login\"<br \/>\ntype S to save<br \/>\ntype Q to quit<\/code><br \/>\n\u00a0<\/p>\n<p><strong><em> Testing out Courier Authdaemon :<\/em><\/strong><br \/>\n<code># authtest -s smtp <span style=\"text-decoration: underline;\">test@lineabsolute.com<\/span> pass123 Authentication succeeded. Authenticated: <a href=\"mailto:ludwig@corebsd.com\"><span style=\"text-decoration: underline;\">test@lineabsolute.com<\/span><\/a> (uid 501, gid 501) Home Directory: \/var\/vmail\/ Maildir: <span style=\"text-decoration: underline;\">test@lineabsolute.com<\/span>\/ Quota: (none) Encrypted Password: $1$b6f3890b$IpwvW9Vh7bBvgbRm8CBw.0 Cleartext Password: pass123<\/code><br \/>\nOptions: (none)<\/p>\n<p><em><strong>Testing the postfix smtp:<\/strong><\/em><\/p>\n<p><code> # telnet localhost 25 Trying 127.0.0.1... Connected to localhost. Escape character is '^]'.<br \/>\n220 adityo.swiftco.com ESMTP \"mail.lineabsolute.com\"<br \/>\nehlo localhost<br \/>\n250-adityo.swiftco.com<br \/>\n250-PIPELINING<br \/>\n250-SIZE 10240000<br \/>\n250-VRFY<br \/>\n250-ETRN<br \/>\n250-STARTTLS<br \/>\n250-AUTH LOGIN PLAIN<br \/>\n250-AUTH=LOGIN PLAIN<br \/>\n250-ENHANCEDSTATUSCODES<br \/>\n250-8BITMIME<br \/>\n250 DSN<\/code><\/p>\n<p>as you can see the postfix smtp are working and we can see postfix already support Auth with Login and Plain,<br \/>\nPostfix also support STARTTLS which is mean postfix support SSL for smtp. if you cannot see the <code>250-STARTTLS , please checked the maillog ( tail -f \/var\/log\/maillog) if you get this error<br \/>\n<\/code><\/p>\n<p><code>Nov 18 03:40:20 adityo postfix\/master[12007]: fatal: bind 0.0.0.0 port 25: Address already in use<\/code><\/p>\n<p>it means that there are some other mailsystem on the server that using the port 25, please checked the ssl path on <code>\/etc\/postfix\/main.cf or regenerate the ssl on <\/code><code>\/etc\/postfix\/ssl\/<\/code>\u00a0 if you still cannot see the <code>250-STARTTLS<\/code><\/p>\n<p><em><strong>Testing the postfix imap:<\/strong><\/em><\/p>\n<p><code># telnet localhost 143 Trying 127.0.0.1... Connected to localhost. Escape character is '^]'. * OK [CAPABILITY IMAP4rev1 UIDPLUS CHILDREN NAMESPACE THREAD=ORDEREDSUBJECT THREAD=REFERENCES SORT QUOTA IDLE ACL ACL2=UNION STARTTLS] Courier-IMAP ready. Copyright 1998-2008 Double Precision, Inc.\u00a0 See COPYING for distribution information. <\/code><\/p>\n<p><code>a login test@lineabsolute.com test123 a OK LOGIN Ok.<\/code><\/p>\n<p><em><strong>Testing the postfix pop3:<\/strong><\/em><\/p>\n<p><code># telnet localhost 110 Trying 127.0.0.1... Connected to localhost. Escape character is '^]'. +OK Hello there. user test@lineabsolute.com +OK Password required. pass test123 +OK logged in. list +OK POP3 clients that break here, they violate STD53. 1 623\u00a0\u00a0\u00a0\u00a0\u00a0 ###---&gt; that was the email id that exist on your inbox 2 864 . quit +OK Bye-bye.<\/code><br \/>\n\u00a0<\/p>\n<p><strong><em>Testing Send and Receive email from webmail :<\/em><\/strong><\/p>\n<p>Open your web browser and type this url below<br \/>\nExample : <a title=\"http:\/\/192.168.0.1\/webmail\" href=\"http:\/\/192.168.0.1\/webmail\">http:\/\/192.168.0.1\/webmail<\/a><br \/>\nInput your email : test@lineabsolute.com<br \/>\nInput your password : test123<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/blog.binus-edu.com\/wp-content\/uploads\/squirrelmail.jpg\" alt=\"\" width=\"280\" height=\"190\" \/><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/blog.binus-edu.com\/wp-content\/uploads\/squirrelmail1(2).jpg\" alt=\"\" width=\"280\" height=\"190\" \/><\/p>\n<p><strong> Install ClamAV :<\/strong><br \/>\n<code># yum -y install clamav clamd unrar<\/code><\/p>\n<p>if your yum did not do anything it means that you basic repository did not found any clamav package, you need to add another repository first<\/p>\n<p><code># yum -y install yum-priorities # wget http:\/\/apt.sw.be\/redhat\/el5\/en\/i386\/RPMS.dag\/rpmforge-release-0.3.6-1.el <\/code><\/p>\n<p><code># rpm --import <a title=\"http:\/\/dag.wieers.com\/rpm\/packages\/RPM-GPG-KEY.dag.txt\" href=\"http:\/\/dag.wieers.com\/rpm\/packages\/RPM-GPG-KEY.dag.txt\">http:\/\/dag.wieers.com\/rpm\/packages\/RPM-GPG-KEY.dag.txt<\/a> <\/code><\/p>\n<p><code># rpm -K rpmforge-release-0.3.6-1.el5.rf.*.rpm # rpm -i rpmforge-release-0.3.6-1.el5.rf.*.rpm<\/code><\/p>\n<p>then try it again<\/p>\n<p><code># yum -y install clamav clamd unrar<\/code><\/p>\n<p>\u00a0<\/p>\n<p>Installing MailScanner :<\/p>\n<p><code># wget <a title=\"http:\/\/www.mailscanner.info\/files\/4\/rpm\/MailScanner-4.72.5-1.rpm.tar.gz\" href=\"http:\/\/www.mailscanner.info\/files\/4\/rpm\/MailScanner-4.72.5-1.rpm.tar.gz\">http:\/\/www.mailscanner.info\/files\/4\/rpm\/MailScanner-4.72.5-1.rpm.tar.gz<\/a> <\/code><\/p>\n<p><code># tar zxvf MailScanner-4.72.5-1.rpm.tar.gz <\/code><\/p>\n<p><code># .\/install.sh This will take a while...<\/code><br \/>\n#################################################################<br \/>\nSpamAssassin site rules found in \/etc\/mail\/spamassassin<br \/>\nTo activate MailScanner run the following commands:<br \/>\nservice sendmail stop<br \/>\nchkconfig sendmail off<br \/>\nchkconfig MailScanner on<br \/>\nservice MailScanner start<br \/>\n##################################################################<\/p>\n<p>Mailscanner Configuration :<br \/>\n<code># cd \/etc\/MailScanner\/ <\/code><\/p>\n<p><code># mv MailScanner.conf MailScanner.conf.orig <\/code><\/p>\n<p><code># cat MailScanner.conf.orig | egrep ^[^#] &gt; MailScanner.conf <\/code><\/p>\n<p><code># vi \/etc\/MailScanner\/MailScanner.conf<\/code><\/p>\n<p>Change some parameters so that they look like this:<\/p>\n<p><code>Run As User = postfix <\/code><\/p>\n<p><code>Run As Group = postfix <\/code><\/p>\n<p><code>Incoming Queue Dir = \/var\/spool\/postfix\/hold <\/code><\/p>\n<p><code>Outgoing Queue Dir = \/var\/spool\/postfix\/incoming <\/code><\/p>\n<p><code>MTA = postfix <\/code><\/p>\n<p><code>Incoming Work Group = clamav <\/code><\/p>\n<p><code>Incoming Work Permissions = 0640 <\/code><\/p>\n<p><code>Virus Scanners = clamd <\/code><\/p>\n<p><code>Clamd Socket = \/tmp\/clamd.socket <\/code><\/p>\n<p><code>Clamd Lock File = \/var\/lock\/subsys\/clamd <\/code><\/p>\n<p><code>SpamAssassin User State Dir = \/var\/spool\/MailScanner\/spamassassin <\/code><\/p>\n<p><code>Quarantine User = root <\/code><\/p>\n<p><code>Quarantine Group = apache <\/code><\/p>\n<p><code>Quarantine Permissions = 0660 <\/code><\/p>\n<p><code>Quarantine Whole Message = yes <\/code><\/p>\n<p><code>Quarantine Whole Message As Queue Files = no <\/code><\/p>\n<p><code>Detailed Spam Report = yes <\/code><\/p>\n<p><code>Include Scores In SpamAssassin Report = yes <\/code><\/p>\n<p><code>Spam Actions = store <\/code><\/p>\n<p><code>High Scoring Spam Actions = store <\/code><\/p>\n<p><code>Always Looked Up Last = &amp;MailWatchLogging Is Definitely Not Spam = &amp;SQLWhitelist Is Definitely Spam = &amp;SQLBlacklist Filename Rules = %etc-dir%\/filename.rules.conf Filetype Rules = %etc-dir%\/filetype.rules.conf Dangerous Content Scanning = %rules-dir%\/content.scanning.rules.conf <\/code><\/p>\n<p><code># mkdir \/var\/spool\/MailScanner\/spamassassin\/ <\/code><\/p>\n<p><code># chown -R postfix:postfix \/var\/spool\/MailScanner\/<\/code><\/p>\n<p>Install Spamassassin :<br \/>\nThe MailScanner manual recommends to install spamassassin from .tar.gz or via perl shell. Some users reported problems with the .rpm-version.<br \/>\n<code># rpm \u2013qa | grep spamassassin # rpm \u2013e spamassassin* # perl -MCPAN -e shell<\/code><br \/>\nAnswer &#8220;no&#8221; when you&#8217;re asked if you are ready for manual configuration.<br \/>\nEnter the following within the perl shell:<br \/>\n<code>o conf prerequisites_policy ask install Net::DNS<\/code><br \/>\nAnswer &#8220;no&#8221; when you&#8217;re asked if you want to enable the online tests.<br \/>\n<code>install Mail::SpamAssassin quit<\/code><\/p>\n<p>Postfix Configuration :<br \/>\n<code># touch \/etc\/postfix\/header_checks<br \/>\n# echo \"\/^Received:\/ HOLD\" &gt; \/etc\/postfix\/header_checks<br \/>\n# vi \/etc\/postfix\/main.cf<\/code><br \/>\nAdd the following line:<br \/>\n<code>header_checks = regexp:\/etc\/postfix\/header_checks<\/code><br \/>\nAfterwards stop postfix &amp; sendmail and start ClamAV.<br \/>\n<code># chkconfig postfix off <\/code><\/p>\n<p><code># \/etc\/init.d\/postfix stop <\/code><\/p>\n<p><code># chkconfig sendmail off <\/code><\/p>\n<p><code># service sendmail stop <\/code><\/p>\n<p><code># chkconfig clamd on <\/code><\/p>\n<p><code># \/etc\/init.d\/clamd start<\/code><\/p>\n<p>Install Mailwatch :<br \/>\nNeeded Package :<br \/>\n<code># yum -y install php-gd<\/code><\/p>\n<p>Get Mailwatch :<br \/>\nPlease have a look at <a title=\"http:\/\/mailwatch.sourceforge.net\" href=\"http:\/\/mailwatch.sourceforge.net\/\">http:\/\/mailwatch.sourceforge.net<\/a> to find out which is the latest version.<br \/>\n<code># cd \/usr\/local\/src\/ <\/code><\/p>\n<p><code># wget http:\/\/transact.dl.sourceforge.net\/sourceforge\/mailwatch\/mailwatch-1.0.4.tar.gz # tar xvzf mailwatch-1.0.4.tar.gz<\/code><\/p>\n<p>Mailwatch Database :<br \/>\nFirst we create and populate the mailwatch database.<br \/>\n<code># mysql -p &lt; \/usr\/local\/src\/mailwatch-1.0.4\/create.sql<\/code><br \/>\nNext open a MySQL shell.<br \/>\n<code># mysql -u root -p<\/code><br \/>\nCreate the MySQL user for the database.<br \/>\n<code>mysql&gt;<\/code><code>GRANT ALL ON mailscanner.* TO mailwatch@localhost IDENTIFIED BY 'pass123'; <\/code><code>mysql&gt;<\/code><code>FLUSH PRIVILEGES;<\/code><br \/>\n<code>mysql&gt;<\/code>quit;<br \/>\nAfter that we have to insert the account data from above into some files.<br \/>\n<code># vi \/usr\/local\/src\/mailwatch-1.0.4\/MailWatch.pm my($db_user) = 'mailwatch'; my($db_pass) = 'pass123';<\/code><\/p>\n<p><code># mv \/usr\/local\/src\/mailwatch-1.0.4\/MailWatch.pm \/usr\/lib\/MailScanner\/MailScanner\/CustomFunctions\/<\/code><br \/>\nAfterwards move the needed files for the webinterface to the right place &#8230;<br \/>\n<code># mv \/usr\/local\/src\/mailwatch-1.0.4\/mailscanner\/ \/var\/www\/html\/ # mkdir \/var\/www\/html\/mailscanner\/temp\/<\/code><br \/>\n&#8230; and change the ownership.<br \/>\n<code># chown -R apache:apache \/var\/www\/html\/mailscanner\/ <\/code><\/p>\n<p><code># chown root:apache \/var\/www\/html\/mailscanner\/images\/ \/var\/www\/html\/mailscanner\/images\/cache\/ <\/code><\/p>\n<p><code># chmod ug+rwx \/var\/www\/html\/mailscanner\/images\/ \/var\/www\/html\/mailscanner\/images\/cache\/ <\/code><\/p>\n<p><code># chmod ug+rw \/var\/www\/html\/mailscanner\/temp\/ <\/code><\/p>\n<p><code># vi \/var\/www\/html\/mailscanner\/conf.php.example define(DB_USER, 'mailwatch'); define(DB_PASS, 'pass123'); define(QUARANTINE_USE_FLAG, true);<\/code><\/p>\n<p><code># mv \/var\/www\/html\/mailscanner\/conf.php.example \/var\/www\/html\/mailscanner\/conf.php<br \/>\n# vi \/tmp\/mailwatch-1.0.4\/SQLBlackWhiteList.pm<br \/>\nmy($db_user) = 'mailwatch';<br \/>\nmy($db_pass) = 'pass123';<\/code><\/p>\n<p><code># mv \/tmp\/mailwatch-1.0.4\/SQLBlackWhiteList.pm \/usr\/lib\/MailScanner\/MailScanner\/CustomFunctions\/<\/code><\/p>\n<p>Mailwatch Web Administrator<br \/>\nNow open a MySQL shell with the mailwatch MySQL user.<br \/>\n<code># mysql mailscanner -u mailwatch -p<\/code><br \/>\nCreate the web admin account.<br \/>\n<code>mysql&gt;<\/code><tt><code> <\/code>INSERT INTO users VALUES ('admin',md5('pass123'),'admin','A','0','0','0','0','0'); <code>mysql&gt;<\/code>quit;<\/tt><br \/>\nNotes :<br \/>\nWhere \u201cadmin\u201d is web user name<br \/>\nWhere \u201cpass123\u201d is web password<br \/>\nMailwatch VHost :<br \/>\nCreate a vhost like this in httpd.conf and restart httpd :<\/p>\n<p><code>&lt;VirtualHost 201.99.196.186:80&gt;\u00a0 <\/code><\/p>\n<p><code>ServerName mailwatch.lineabsolute.com <\/code><\/p>\n<p><code>ServerAdmin admin@lineabsolute.com <\/code><\/p>\n<p><code>DocumentRoot \/var\/www\/html\/mailscanner\/\u00a0 <\/code><\/p>\n<p><code>php_admin_flag <\/code><\/p>\n<p><code>short_open_tag On <\/code><\/p>\n<p><code>php_admin_flag safe_mode Off <\/code><\/p>\n<p><code>php_admin_flag register_globals Off <\/code><\/p>\n<p><code>php_admin_flag magic_quotes_gpc On <\/code><\/p>\n<p><code>php_admin_flag magic_quotes_runtime Off <\/code><\/p>\n<p><code>php_admin_flag session.auto_start 0 <\/code><\/p>\n<p><code>php_admin_flag allow_url_fopen On\u00a0 <\/code><\/p>\n<p><code>LogLevel warn ErrorLog logs\/mailwatch-error_log <\/code><\/p>\n<p><code>CustomLog logs\/mailwatch-access_log combined <\/code><\/p>\n<p><code>&lt;\/VirtualHost&gt;<\/code><\/p>\n<p>\u00a0<\/p>\n<p>Spamassassin Configuration :<br \/>\n<code># vi \/etc\/MailScanner\/spam.assassin.prefs.conf<\/code><br \/>\nChange:<br \/>\n<code>#bayes_path \/etc\/MailScanner\/bayes\/bayes <\/code><\/p>\n<p><code># bayes_file_mode 0770<\/code><br \/>\nTo:<br \/>\n<code>bayes_path \/var\/spool\/MailScanner\/spamassassin\/bayes bayes_file_mode 0660<\/code><br \/>\nAnd modify the directory permissions:<br \/>\n<code># chown postfix:apache \/var\/spool\/MailScanner\/spamassassin\/ \/var\/spool\/MailScanner\/spamassassin\/bayes\/ <\/code><\/p>\n<p><code># chmod g+rws \/var\/spool\/MailScanner\/spamassassin\/ # chmod g+rw \/var\/spool\/MailScanner\/spamassassin\/bayes_*<\/code><br \/>\nTest the spamassassin configuration.<br \/>\n<code># spamassassin -D -p \/etc\/MailScanner\/spam.assassin.prefs.conf --lint<\/code><br \/>\nYou should see lines like the following in the output:<br \/>\ndbg: config: using &#8220;\/etc\/MailScanner\/spam.assassin.prefs.conf&#8221; for user prefs file<br \/>\ndbg: bayes: tie-ing to DB file R\/O \/var\/spool\/MailScanner\/spamassassin\/bayes_toks<br \/>\ndbg: bayes: tie-ing to DB file R\/O \/var\/spool\/MailScanner\/spamassassin\/bayes_seen<br \/>\ndbg: bayes: found bayes db version 3<br \/>\ndbg: config: score set 0 chosen.<\/p>\n<p>GeoIP Bugfix :<br \/>\nIn order that the geoip database update in the Mailwatch webinterface will work we have to fix a little bug.<br \/>\n<code># vi \/var\/www\/html\/mailscanner\/geoip_update.php<\/code><br \/>\nChange:<br \/>\ndbquery(&#8220;LOAD DATA INFILE &#8216;&#8221;.$base.&#8217;\/&#8217;.$file2.&#8221;&#8216; INTO TABLE geoip_country FIELDS TERMINATED BY &#8216;,&#8217; ENCLOSED BY &#8216;&#8221;&#8216;&#8221;);<br \/>\nTo:<br \/>\ndbquery(&#8220;LOAD DATA LOCAL INFILE &#8216;&#8221;.$base.&#8217;\/&#8217;.$file2.&#8221;&#8216; INTO TABLE geoip_country FIELDS TERMINATED BY &#8216;,&#8217; ENCLOSED BY &#8216;&#8221;&#8216;&#8221;);<\/p>\n<p>Cronjobs :<br \/>\nMailScanner Quarantine :<br \/>\n<code># vi \/etc\/cron.daily\/clean.quarantine<\/code><br \/>\nMake sure that it&#8217;s disabled &#8211; the corresponding line should look like this:<br \/>\n$disabled = 1;<\/p>\n<p>Mailwatch Quarantine :<br \/>\n<code># vi \/usr\/local\/src\/mailwatch-1.0.4\/tools\/db_clean.php<\/code><br \/>\nChange the first line that it looks like this:<br \/>\n<code>#!\/usr\/bin\/php -q<\/code><\/p>\n<p><code># cp \/usr\/local\/src\/mailwatch-1.0.4\/tools\/quarantine_maint.php \/usr\/local\/bin\/<br \/>\n# cp \/usr\/local\/src\/mailwatch-1.0.4\/tools\/db_clean.php \/usr\/local\/bin\/<br \/>\n# chmod +x \/usr\/local\/bin\/quarantine_maint.php \/usr\/local\/bin\/db_clean.php<br \/>\n# echo \"\/usr\/local\/bin\/quarantine_maint.php --clean\" &gt; \/etc\/cron.daily\/mailwatch_quarantine_maint.sh<br \/>\n# echo \"\/usr\/local\/bin\/db_clean.php\" &gt; \/etc\/cron.daily\/mailwatch_db_clean.sh<br \/>\n# chmod +x \/etc\/cron.daily\/mailwatch*<\/code><\/p>\n<p>Mail Queue Watcher :<br \/>\nFirst copy the mail queue watcher script.<br \/>\n<code># cp \/usr\/local\/src\/mailwatch-1.0.4\/mailq.php \/usr\/local\/bin\/<\/code><br \/>\nAfterwards we create a new cronjob.<br \/>\n<code># crontab -e<\/code><br \/>\nAdd the following line:<br \/>\n0-59 * * * * \/usr\/local\/bin\/mailq.php<\/p>\n<p>Quarantine Release Fix :<br \/>\nIn order that a released email is not checked again (it would be quarantined again) we have to add\/modify some rules.<\/p>\n<p>WhiteList SQL Database :<br \/>\nConnect to phpmyadmin (<a title=\"http:\/\/your-server\/phpmyadmin\" href=\"http:\/\/your-server\/phpmyadmin\">http:\/\/your-server\/phpmyadmin<\/a>) and log in as mailwatch. Afterwards select the database &#8220;mailscanner&#8221; and then the table &#8220;whitelist&#8221;. Create a new record:<br \/>\nto_address = default<br \/>\nto_domain = default<br \/>\nfrom_address = 127.0.0.1<\/p>\n<p>MailScanner Rules :<br \/>\nNote that the entries in all lines of the following files have to be separated with tabs!<br \/>\n<code># cd \/etc\/MailScanner\/<br \/>\n# touch filename.rules.conf filetype.rules.conf filename.rules.allowall.conf filetype.rules.allowall.conf rules\/content.scanning.rules.conf<br \/>\n# vi filename.rules.conf<\/code><br \/>\nFrom: 127.0.0.1 \/etc\/MailScanner\/filename.rules.allowall.conf<br \/>\nFromOrTo: default \/etc\/MailScanner\/filename.rules.conf<\/p>\n<p><code># vi filetype.rules.conf<\/code><br \/>\nFrom: 127.0.0.1 \/etc\/MailScanner\/filetype.rules.allowall.conf<br \/>\nFromOrTo: default \/etc\/MailScanner\/filetype.rules.conf<\/p>\n<p><code># vi filename.rules.allowall.conf<\/code><br \/>\nallow .* &#8211; &#8211;<\/p>\n<p><code># vi filetype.rules.allowall.conf<\/code><br \/>\nallow .* &#8211; &#8211;<\/p>\n<p><code># vi rules\/content.scanning.rules.conf<\/code><br \/>\nFrom: 127.0.0.1 no<br \/>\nFromOrTo: default yes<\/p>\n<p>Now adjust the permissions for the quarantine directory.<\/p>\n<p><code># chown -R postfix:apache \/var\/spool\/MailScanner\/quarantine\/<br \/>\n# chmod g+rws \/var\/spool\/MailScanner\/quarantine\/<\/code><br \/>\nNote: The needed MailScanner settings were already included in earlier step.<\/p>\n<p>Start service :<br \/>\n<code># chkconfig --level 2345 MailScanner on<br \/>\n# service MailScanner start &amp;&amp; tail -f \/var\/log\/maillog<\/code><br \/>\nYou should see lines like the following in the output:<br \/>\nNov 13 07:33:21 server1 MailScanner[8594]: Config: calling custom init function SQLBlacklist<br \/>\nNov 13 07:33:21 server1 MailScanner[8594]: Starting up SQL Blacklist<br \/>\nNov 13 07:33:21 server1 MailScanner[8594]: Read 0 blacklist entries<br \/>\nNov 13 07:33:21 server1 MailScanner[8594]: Config: calling custom init function MailWatchLogging<br \/>\nNov 13 07:33:21 server1 MailScanner[8594]: Started SQL Logging child<br \/>\nNov 13 07:33:21 server1 MailScanner[8594]: Config: calling custom init function SQLWhitelist<br \/>\nNov 13 07:33:21 server1 MailScanner[8594]: Starting up SQL Whitelist<br \/>\nNov 13 07:33:21 server1 MailScanner[8594]: Read 1 whitelist entries<\/p>\n<p>Remaining Configuration :<br \/>\nKeep in mind that the commands to start, stop or restart postfix have changed!<br \/>\nTo start MailScanner &amp; Postfix:<br \/>\n<code># service MailScanner start<\/code><br \/>\nTo restart MailScanner &amp; Postfix:<br \/>\n<code># service MailScanner restart<\/code><br \/>\nTo stop MailScanner &amp; Postfix:<br \/>\n<code># service MailScanner stop<\/code><\/p>\n<p>Mailwatch Webinterface<br \/>\nNow you can access the mailwatch webinterface via <a title=\"http:\/\/mailwatch.example.com\" href=\"http:\/\/mailwatch.example.com\/\">http:\/\/mailwatch.example.com<\/a>. or if you still don&#8217;t have domain you can use\u00a0 http:\/\/201.99.196.186\/mailscanner\/ Log in with the username &amp; password that you created already.<\/p>\n<p>First you should update the SpamAssassin rule descriptions and the GeoIP database. You&#8217;ll find both options when you click on the &#8220;Tools\/Links&#8221; button.<\/p>\n<p>\u00a0<\/p>\n<p><img decoding=\"async\" style=\"width: 645px; height: 291px;\" src=\"http:\/\/blog.binus-edu.com\/wp-content\/uploads\/mailwatch.jpg\" alt=\"\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>What\u00a0 is Postfix,Postfixadmin,Cyrus-SASL,Courier-Authlib,Courier-Imap,Squirellmail,MailScanner,ClamAV,SpamAssassin,MailWatch ? Postfix is a Mail Transport Agent (MTA), supporting LDAP, SMTP AUTH (SASL), TLS and running in a chroot environment. Postfix is Wietse Venema&#8217;s mailer that started life as an alternative to the widely-used Sendmail program. PostfixAdmin is a web based interface to configure and manage a Postfix based email server for [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1360],"tags":[912],"class_list":["post-44","post","type-post","status-publish","format-standard","hentry","category-postfix","tag-postfix-on-centos"],"_links":{"self":[{"href":"https:\/\/adityo.blog.binusian.org\/index.php?rest_route=\/wp\/v2\/posts\/44","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/adityo.blog.binusian.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/adityo.blog.binusian.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/adityo.blog.binusian.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/adityo.blog.binusian.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=44"}],"version-history":[{"count":2,"href":"https:\/\/adityo.blog.binusian.org\/index.php?rest_route=\/wp\/v2\/posts\/44\/revisions"}],"predecessor-version":[{"id":307,"href":"https:\/\/adityo.blog.binusian.org\/index.php?rest_route=\/wp\/v2\/posts\/44\/revisions\/307"}],"wp:attachment":[{"href":"https:\/\/adityo.blog.binusian.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=44"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/adityo.blog.binusian.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=44"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/adityo.blog.binusian.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=44"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}