{"id":858,"date":"2012-08-02T14:33:16","date_gmt":"2012-08-02T06:33:16","guid":{"rendered":"http:\/\/rmohan.com\/?p=858"},"modified":"2012-08-02T14:36:32","modified_gmt":"2012-08-02T06:36:32","slug":"installing-qmail-on-a-centos-5-8-system","status":"publish","type":"post","link":"https:\/\/mohan.sg\/?p=858","title":{"rendered":"Installing Qmail on a CentOS 5.8 system"},"content":{"rendered":"<p><strong>Reference from : http:\/\/www.ekrfs.com.au\/qmr\/home<\/strong><\/p>\n<p>BEST OF ALL REFERENCE IS<strong>:\u00a0 http:\/\/qmail.jms1.net\/<\/strong> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 i Love this author.<\/p>\n<p>&nbsp;<\/p>\n<p>I have compressed most of the required files into one file called <a title=\"QMR files part 1\" href=\"http:\/\/ekrfs.com.au\/qmr\/__data\/assets\/file\/0018\/5355\/qmr1.tar.gz#QMR%20files%20part%201\">qmr1.tar.gz<\/a> and <a title=\"QMR files part 2\" href=\"http:\/\/ekrfs.com.au\/qmr\/__data\/assets\/file\/0014\/5108\/qmr2.tar.gz#QMR%20files%20part%202\">qmr2.tar.gz<\/a>.\u00a0 You will need to download both then put them in the \/downloads\/qmr directory that you need to create on your Centos or Fedora box.<\/p>\n<p><strong>Attachments are:<\/strong><\/p>\n<p><a href=\"http:\/\/rmohan.com\/wp-content\/uploads\/2012\/08\/qmr1.tar.gz\">qmr1.tar<\/a><\/p>\n<p><a href=\"http:\/\/rmohan.com\/wp-content\/uploads\/2012\/08\/qmr2.tar.gz\">qmr2.tar<\/a><\/p>\n<p>If you are looking at installing Qmail on a\u00a0CentOS 5.8 system, you are at the right place.\u00a0 You can either follow the directions on the pages underCentOS 5.5 or just download the pdf install guide (under Qmail Files page).<\/p>\n<p>Either way, you should end up with a great working system.\u00a0 I caution you to please look at the screen output whilst doing the install.\u00a0 If you see errors pop up, google them to solve before moving on.\u00a0 If you do not, you will likely have problems later on.\u00a0 Each program interacts with other programs and if something is broken, the other bits will likely fail as well.<\/p>\n<p>&nbsp;<\/p>\n<p>Remember to use your logs as well.\u00a0 They are a great way of detecting problems or success.<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<div>\n<div>\n<p><strong>Part 1 &#8211; Checklist<\/strong><strong><\/strong><\/p>\n<p>1.\u00a0\u00a0\u00a0\u00a0\u00a0 Make sure you have Fedora installed.\u00a0 <strong>SELINUX is a huge problem with qmail and I had to firstly put it in permissive mode and then disable it altogether.\u00a0 I do however have a firewall on my router<\/strong>.\u00a0 Security is another topic.<\/p>\n<p>2.\u00a0\u00a0\u00a0\u00a0\u00a0 Make sure you have the following (on your system)<br \/>\n(Command line is \u201crpm \u2013qa | grep pkgname\u201d)<\/p>\n<p>Eg \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 rpm \u2013qa | grep php<br \/>\na.\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 http<\/p>\n<p>b.\u00a0\u00a0\u00a0\u00a0\u00a0 php<\/p>\n<p>c.\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 perl<\/p>\n<p>d.\u00a0\u00a0\u00a0\u00a0\u00a0 perl-suidperl<\/p>\n<p>e.\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 gcc<\/p>\n<p>f.\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 gcc-c++<\/p>\n<p>g.\u00a0\u00a0\u00a0\u00a0\u00a0 mysql<\/p>\n<p>h.\u00a0\u00a0\u00a0\u00a0\u00a0 openssl<\/p>\n<p>i.\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 openssl-devel<\/p>\n<p>j.\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 wget<\/p>\n<p>k.\u00a0\u00a0\u00a0\u00a0\u00a0 Personally I use midnight commander so I also install mc<\/p>\n<p>l.\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 patch<\/p>\n<p>&nbsp;<\/p>\n<p>3.\u00a0\u00a0\u00a0\u00a0\u00a0 If any are missing, install them.\u00a0 For example, to install php, type:<\/p>\n<p>yum install php<\/p>\n<p>4.\u00a0\u00a0\u00a0\u00a0\u00a0 Make sure you update your entire system with \u201c<strong>yum update\u201d <\/strong>after all this.<\/p>\n<p>I then run<br \/>\nperl \u2013MCPAN \u2013e shell (and go with it)<br \/>\nWhen you get cpan&gt;<br \/>\ntype \u201cinstall Bundle::CPAN\u201d<br \/>\nwhen you get it again, type \u201cinstall CDB_File\u201d<\/p>\n<p>Type exit when it comes up CPAN3&gt;<\/p>\n<p>This last bit takes a while and you have to answer a few questions \u2013 I just hit enter to accept the default Yes answers.<\/p>\n<p>This last bit is needed for Spamassassin.<\/p>\n<p>&nbsp;<\/p>\n<p><strong>Required Files to complete Setup<\/strong><\/p>\n<p>These can all be downloaded from the &#8220;QMR Files&#8221; page.<\/p>\n<p>Firstly however, create a directory for all the files to go into:<\/p>\n<p>mkdir \/downloads\/qmr<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<div>\n<div>\n<p><strong>Part 2 &#8211; Run Script to create the necessary users etc for qmail install <\/strong><\/p>\n<p>Run the following script to create all the necessary users and folders \/ files and also to patch qmail with John Simpsons latest patch (currently 7.10).\u00a0 You should go check that this is still the latest and if not, edit the script and download the latest patch.<\/p>\n<p><em>cd \/downloads\/qmr\/scripts\/install<br \/>\nqmr_install_with_jms1.script\u00a0 \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <\/em><em>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <\/em><\/p>\n<p>This script will:<\/p>\n<p>Make some necessary directories<br \/>\nCreate necessary users and groups<br \/>\nUnpack qmail-1.03 and patch it with John Simpsons 7.10 patch<br \/>\nUnpack ucspi-tcp and daemontools and put them in the correct places on the system<br \/>\nCreate logging directories and supervise script directories<\/p>\n<div>\n<div>\n<p><strong>Part 3 \u2013 Install Qmail (with John Simpsons patches already done)<\/strong><\/p>\n<p>Then go to the \/qmail-1.03-jms1-7.10 directory.<\/p>\n<p><em>make man &amp;&amp; make setup check<\/em><\/p>\n<p>Qmail is now installed but you still have a lot to do.\u00a0 When finished, type<\/p>\n<p><em>.\/config-fast rmohan.com<\/em><\/p>\n<p>For example<br \/>\n.\/config-fast <em>rmohan.com\u00a0 <\/em><\/p>\n<p># make clean<\/p>\n<p>We are now done getting qmail setup (for now)!<\/p>\n<\/div>\n<\/div>\n<p>&nbsp;<\/p>\n<div>\n<div>\n<p><strong>Part 4 \u2013 Install ucspi-tcp<\/strong><\/p>\n<p><em>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 cd \/usr\/src\/qmail\/ucspi-tcp-0.88<\/em><\/p>\n<p>We must also patch this file.<\/p>\n<p><em>patch &lt; \/downloads\/qmr\/patches\/ucspi-tcp-0.88.errno.patch <\/em><\/p>\n<p><em><\/em>It will display &#8220;pathching file error.h&#8221; &#8211; this is what we want (even though logically it sounds bad, it is not)<\/p>\n<blockquote dir=\"ltr\"><p>\u00a0\u00a0<em>make &amp;&amp; make setup check<\/em><\/p><\/blockquote>\n<p>That is all for this.\u00a0 Now to install qmail\u2026<\/p>\n<p>&nbsp;<\/p>\n<div>\n<div>\n<p><strong>Part 5 \u2013 Install Daemontools<\/strong><\/p>\n<p><em>cd \/package\/admin\/daemontools-0.76\/src<\/em><\/p>\n<p>We must patch this file as well<\/p>\n<p><em>patch &lt; \/downloads\/qmr\/patches\/daemontools-0.76.errno.patch<\/em><\/p>\n<p>It will display &#8220;pathching file error.h&#8221; &#8211; this is what we want (even though logically it sounds bad, it is not)<\/p>\n<p><em>cd ..<\/em><\/p>\n<p><em>package\/install<\/em><\/p>\n<p>That\u2019s it.<\/p>\n<div>\n<div>\n<p><strong>Part 6 \u2013 Install Ezmlm-idx<\/strong><\/p>\n<p>cd \/downloads\/qmr<br \/>\ntar zxvf ezmlm-idx-7.0.2.tar.gz<br \/>\ncd ezmlm-idx-7.0.2<br \/>\nmake &amp;&amp; make setup<\/p>\n<p>&nbsp;<\/p>\n<p><strong>Part 7 \u2013 Install Autorespond<\/strong><\/p>\n<p>cd \/downloads\/qmr<br \/>\ntar zxvf autorespond-2.0.5.tar.gz<br \/>\ncd autorespond-2.0.5<br \/>\nmake &amp;&amp; make install<\/p>\n<p>&nbsp;<\/p>\n<div>\n<div>\n<p><strong>Part 8 \u2013 Qmail-updater<\/strong><\/p>\n<p>cd \/var\/qmail\/supervise<\/p>\n<p>mkdir \u2013m 1755 qmail-updater<\/p>\n<p>mkdir \u2013m 755 qmail-updater\/log<\/p>\n<p>cd qmail-updater\/log<\/p>\n<p>cp \/downloads\/qmr\/service-any-log-run run<\/p>\n<p>chmod 755 run<\/p>\n<p>cd ..<\/p>\n<p>cp \/downloads\/qmr\/pipe-watcher pipe-watcher<\/p>\n<p>cp \/downloads\/qmr\/update-qmail update-qmail<\/p>\n<p>cp \/downloads\/qmr\/service-qmail-updater-run run<\/p>\n<p>chmod 755 pipe-watcher update-qmail run<\/p>\n<p>The last step here is to link the qmail-updater directory in the \/service directory so daemontools can run it.<\/p>\n<p>ln \u2013s \/var\/qmail\/supervise\/qmail-updater \/service\/<\/p>\n<p>Wait a few seconds then run:<\/p>\n<p>svstat \/service\/qmail-updater \/service\/qmail-updater\/log<\/p>\n<p>You should see output showing up for more than 3 seconds for both.<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<div>\n<div>\n<p><strong>Part 9 \u2013 Install Vpopmail with onchange<\/strong><\/p>\n<p>First we need to install Skel<\/p>\n<p><em>cd ~vpopmail<br \/>\ntar zxvf \/downloads\/qmr\/skel.tgz<br \/>\nchown \u2013R vpopmail:vchkpw skel<br \/>\nchmod \u2013R 700 skel\/<br \/>\nchmod 0600 skel\/.qmail skel\/mailfilter<\/em><\/p>\n<p>We want to install vpopmail with the onchange function enabled. The latest version is 5.4.30 currently.<\/p>\n<p><em>cd \/downloads\/qmr<br \/>\ntar zxvf vpopmail-5.4.30.tar.gz<br \/>\ncd vpopmail-5.4.30<br \/>\n.\/configure &#8211;enable-logging=p \u2013enable-onchange-script<\/em><\/p>\n<p><em>make install-strip<\/em><\/p>\n<p>If that all run without errors, vpopmail is configured and installed.\u00a0 Now we must get the onchange function working.<\/p>\n<p><em>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 cd \/~vpopmail\/etc<br \/>\ncp \/downloads\/qmr\/onchange onchange<\/em><\/p>\n<p>This is the script that vpopmail will execute when a user or domain is added or deleted from the system.\u00a0 You need to now set permissions:<\/p>\n<p><em>chown vpopmail:vchkpw ~vpopmail\/etc\/onchange<br \/>\nchmod 750 ~vpopmail\/etc\/onchange<br \/>\nchmod +x ~vpopmail\/etc\/onchange<\/em><\/p>\n<p>Now that the onchange script is in place we can test it with the qmail-updater log file.\u00a0 Open up another session (Ctrl+Alt+F2) and type<\/p>\n<p><em>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 tail \u2013f \/service\/qmail-updater\/log\/main\/current<\/em><\/p>\n<p>Go back to the original session (ctrl+Alt+F1) and add a domain and user and you should see your log file in the other session change \u2013 stuff goes in it.<\/p>\n<p><em>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 cd ~vpopmail\/bin<br \/>\n.\/vadddomain rmohan.com<br \/>\n.\/vadduser <a href=\"mailto:test@test.com.au\">test@rmohan.com<\/a> password<\/em><\/p>\n<p>If the log file fills up with stuff, congratulations.<\/p>\n<p>We need to make a slight modification to the vchkpw file to make it work with SMTP with ssl work.<\/p>\n<p><em>cd ~vpopmail\/bin<br \/>\nchmod 6711 vchkpw<br \/>\nchown vpopmail:vchkpw vchkpw<\/em><\/p>\n<p>&nbsp;<\/p>\n<div>\n<div>\n<p><strong>Part 10 &#8211; Validrccptto and Auth<\/strong><\/p>\n<p>We must then create the validrcptto and auth files which reside in \/var\/qmail\/control.<\/p>\n<p>To do this, we use the mkvalidrcptto and mkauth scripts.<\/p>\n<p><em>cd \/usr\/local\/bin<\/em><\/p>\n<p><em>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 wget <a href=\"http:\/\/qmail.jms1.net\/scripts\/mkvalidrcptto\">http:\/\/qmail.jms1.net\/scripts\/mkvalidrcptto<\/a><\/em><\/p>\n<p><em>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 wget <a href=\"http:\/\/qmail.jms1.net\/scripts\/mkauth\">http:\/\/qmail.jms1.net\/scripts\/mkauth<\/a><\/em><\/p>\n<p><em>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 chmod 755 mkvalidrcptto mkauth<\/em><\/p>\n<p>Then we run the scripts:<\/p>\n<p><em>mkvalidrcptto \u2013c \/var\/qmail\/control\/validrcptto.cdb<\/em><\/p>\n<p><em>mkauth \u2013c \/var\/qmail\/control\/auth.cdb<\/em><\/p>\n<p>To test<\/p>\n<p>ps axww | grep readproctitle<\/p>\n<p>the output should be something like<\/p>\n<p>0:0 read\u2026\u2026..service errors\u2026\u2026\u2026\u2026\u2026\u2026\u2026\u2026<br \/>\n\u2026\u2026\u2026\u2026\u2026\u2026\u2026\u2026\u2026\u2026\u2026\u2026\u2026\u2026\u2026\u2026\u2026\u2026\u2026\u2026\u2026\u2026\u2026\u2026\u2026.<br \/>\n\u2026\u2026\u2026\u2026\u2026\u2026\u2026\u2026\u2026\u2026\u2026\u2026\u2026\u2026\u2026\u2026\u2026\u2026\u2026\u2026\u2026\u2026\u2026\u2026\u2026.<\/p>\n<p>&nbsp;<\/p>\n<div id=\"content\">\n<div id=\"content_div_5297\">\n<p>Part 11 \u2013 Install Maildrop<\/p>\n<p>You need maildrop aside from anything else, for qmail-scanner &#8211; which needs reformime.<\/p>\n<p>Before you install maildrop, you need to install \u201cpcre\u201d.\u00a0 Download the file to the qmr directory.<\/p>\n<p>tar zxvf pcre-8.12<\/p>\n<p>cd \/downloads\/qmr\/pcre-8.12<br \/>\n.\/configure<br \/>\nmake<br \/>\nmake install<br \/>\nmake clean<\/p>\n<p>Then<\/p>\n<p>cd \/downloads\/qmr<br \/>\ntar xvf maildrop-2.5.5.tar.bz2<br \/>\ncd maildrop-2.5.5<br \/>\n.\/configure \u2013enable-maildrop-uid=root \u2013enable-maildrop-gid=vchkpw<br \/>\nmake install clean<br \/>\nWe now add logging options to maildrop.<\/p>\n<p>cd \/var\/qmail\/supervise<br \/>\nmkdir \u2013m 1755 maildrop-logger<br \/>\nmkdir \u2013m 755\u00a0 maildrop-logger\/log<br \/>\ncd maildrop-logger\/log<br \/>\ncp \/downloads\/qmr\/service-any-log-run run<br \/>\nchmod 755 run<br \/>\ncd ..<br \/>\ncp \/downloads\/qmr\/log-maildrop log-maildrop<br \/>\ncp \/downloads\/qmr\/pipe-watcher pipe-watcher<br \/>\ncp \/downloads\/qmr\/maildrop-logger-run run<br \/>\nchmod 755 pipe-watcher log-maildrop run<br \/>\ntouch \/tmp\/log-maildrop<br \/>\nchown vpopmail:vchkpw \/tmp\/log-maildrop<\/p>\n<p>Now we start the maildrop-logger service<\/p>\n<p>ln \u2013s \/var\/qmail\/supervise\/maildrop-logger \/service\/<\/p>\n<p>Wait a bit then check<\/p>\n<p>svstat \/service\/maildrop-logger \/service\/maildrop-logger\/log<\/p>\n<p>Again, it all should be running for more than 3 seconds<\/p>\n<\/div>\n<\/div>\n<div>\n<div>\n<p><strong>Part 12 \u2013 Uninstall Sendmail<\/strong><\/p>\n<p>To find out the version numbers to remove type<\/p>\n<p>rpm \u2013qa | grep sendmail<\/p>\n<p>Then<\/p>\n<p>\/etc\/rc.d\/init.d\/sendmail stop<\/p>\n<p>Then<\/p>\n<p>rpm \u2013e \u2013nodeps sendmail-x.x.x \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 (version number from results above)<br \/>\nrpm \u2013e \u2013nodeps sendmail-cf-x.x.x \u00a0\u00a0\u00a0\u00a0 (version number from results above)<\/p>\n<p>We now need to establist an artificial sendmail path \u2013 or a symbolic link to Qmails sendmail.\u00a0 This is needed to ensure the whole system is able to send mail.<\/p>\n<p>ln \u2013s \/var\/qmail\/bin\/sendmail \/usr\/lib\/sendmail<br \/>\nln \u2013s \/var\/qmail\/bin\/sendmail \/usr\/sbin\/sendmail<\/p>\n<p>That\u2019s it for this step.<\/p>\n<p>&nbsp;<\/p>\n<div>\n<div>\n<p><strong>Part 13 \u2013 Install Dovecot<\/strong><\/p>\n<p>Do not try to install any courier stuff as they do not support vpopmail any more.<\/p>\n<p>The latest stable version is dovecot-1.2.12.\u00a0 As always check this is the latest stable version. I did try the later version of 2.0.11 but that caused issues so I used 1.2.12.\u00a0 Your choice !<\/p>\n<p>cd \/downloads\/qmr<br \/>\ntar xzf dovecot-1.2.12.tar.gz<br \/>\ncd dovecot-1.2.12<br \/>\ncp \/downloads\/qmr\/configure.dovecot configure.dovecot<br \/>\nchmod 755 configure.dovecot<br \/>\n.\/configure.dovecot<\/p>\n<p>make<br \/>\nmake install<\/p>\n<p>There seems to be a few directories either weren&#8217;t created, or were created with bad permissions. The following commands fixed the problems:<\/p>\n<p>mkdir -m 0755 \/usr\/local\/var \/usr\/local\/var\/run \/usr\/local\/var\/run\/dovecot<\/p>\n<p>chmod go=u-w \/usr\/local\/share \/usr\/local\/share\/doc<\/p>\n<p>chmod -R go=u-w \/usr\/local\/lib\/dovecot \/usr\/local\/libexec\/dovecot \/usr\/local\/share\/doc\/dovecot<\/p>\n<p>The next step is to create a new non-root userid which is used to process authentication requests.<\/p>\n<p>This command is specific to Linux, and will probably need to be adjusted for other systems. The idea is to create a userid which cannot log in, which has no valid shell, and has no home directory- one which, if somebody were to &#8220;hack&#8221; into it, wouldn&#8217;t be able to do much.<\/p>\n<p>useradd -M -d \/nohome -s \/bin\/false -c &#8216;Dovecot user&#8217; dovecot<\/p>\n<p>________________________________________<\/p>\n<p><strong>Configuring Dovecot<\/strong><\/p>\n<p>Dovecot itself is configured using a single control file, which will is in<br \/>\n\/usr\/local\/etc\/dovecot.conf<br \/>\nWhen you install the software, it creates a dovecot-example.conf file in this directory, and the directions with the software tell you to rename or copy the file to dovecot.conf and then customize it.<\/p>\n<p>There is a customised dovecot.conf file (thanks to John Simpson). Note that an invalid IP, so you will need to customize the file before using it- either that, or use the dovecot-example.conf file and build your own configuration.<\/p>\n<p>The first thing you&#8217;ll need to do is adjust the &#8220;first_valid_uid&#8221; and &#8220;last_valid_uid&#8221; values in the file. Find the numeric uid of the vpopmail user&#8230;<\/p>\n<p>id -u vpopmail<\/p>\n<p>My result was 508<\/p>\n<p>To copy the dovecot.conf file (mentioned above, then<\/p>\n<p>cd \/usr\/local\/etc<br \/>\ncp \/downloads\/qmr\/dovecot.conf dovecot.conf<br \/>\nchown root:root dovecot.conf<\/p>\n<p>If the IMAP servers will ONLY be used for vpopmail accounts, make sure both of these values are set to that number (in this case, 508.) Also make sure both lines are un-commented (i.e. remove the &#8220;#&#8221; in front of the &#8220;last_valid_uid&#8221; line.)<\/p>\n<p>## Mail processes<\/p>\n<p>verbose_proctitle = yes<\/p>\n<p>first_valid_uid = 508<br \/>\nlast_valid_uid = 508<\/p>\n<p>You also need to change the ip addresses too your own.\u00a0 &#8211; (at ssl_listen twice)\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 eg 192.168.1.6<\/p>\n<p>Building the daemontools service(s)<\/p>\n<p>This shows how to set up a daemontools service which starts the main dovecot process, which will listen for incoming IMAP and\/or POP3 connections as specified in the dovecot.conf file.<\/p>\n<p>On my server, all of my daemontools physical service directories are in the<br \/>\n\/var\/qmail\/supervise directory.<\/p>\n<p>Your own server may be different- the physical directory can be anywhere on the system, except within the &#8220;\/service&#8221; directory itself.<\/p>\n<p>cd \/var\/qmail\/supervise<br \/>\nmkdir -m 0755 dovecot dovecot\/log<br \/>\ncd dovecot\/log<br \/>\ncp \/downloads\/qmr\/service-any-log-run run<br \/>\nchmod 0755 run<br \/>\ncd ..<br \/>\ncp \/downloads\/qmr\/service-dovecot-run run<br \/>\nchmod 0755 run<br \/>\nUse your text editor of choice.<\/p>\n<p>Like the other &#8220;service-blah-run&#8221; scripts, this one consists of configuration variables at the top, followed by code to build the final command line, and then run it. The variables are:<\/p>\n<p>\u2022\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 IP is the IP address you want to listen on. You can set it to &#8220;0&#8221; if you want it to listen on every IP attached to your system, however I don&#8217;t normally recommend doing things that way.<\/p>\n<p>\u2022\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 PORT is the TCP port number you want to listen on. The standard values are 143 for IMAP, 993 for SSL-IMAP, 110 for POP3, and 995 for SSL-POP3.<\/p>\n<p>I DO NOT RECOMMEND RUNNING NON-SSL POP3 OR IMAP SERVICES on any unsecured network (i.e. on the open Internet) because the authentication methods for both POP3 and IMAP involve sending the password across the wire in plain text. Remember, if some &#8220;bad person&#8221; happens to get one of your users&#8217; passwords, they not only have access to that user&#8217;s email, they will probably have the ability to use that ID and password with an SMTP AUTH command, and use your server as a relay.<\/p>\n<p>\u2022\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 MAX is the maximum number of concurrent connections allowed by this service. If this is blank, a default value of 40 will be used instead.<\/p>\n<p>\u2022\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 ACCESS_CDB gives the name of a .cdb file made by tcprules, which controls which clients are and are not allowed to connect. Note that if you plan to use rules involving remote userids (very few people do, because they are so easily forged) you will need to remove the &#8220;R&#8221; from the options of tcpserver and\/or sslserver within the script itself.<\/p>\n<p>\u2022\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 SVC_LOGIN is the full pathname of the service you wish to run. Normally this will be &#8220;imap-login&#8221; or &#8220;pop3-login&#8221;.<\/p>\n<p>\u2022\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 IS_SSL should be set to a number greater than zero if this is to be an SSL-secured service. This tells the script to use sslserver instead of tcpserver, exports the CERTFILE variable (needed by sslserver), and adds a flag to the end of the command line which tells imap-login or pop3-login that the connection is already encrypted.<\/p>\n<p>\u2022\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 CERTFILE should be set to the full pathname to the .pem file containing the server&#8217;s encryption key. You can point this to the same servercert.pem file used by qmail-smtpd if you like.<\/p>\n<p>________________________________________<\/p>\n<p><strong>Start up Dovecot<\/strong><\/p>\n<p>This is just like starting up any other daemontools service &#8211; create a symlink from \/service\/something to the physical service directory, wait about ten seconds, and make sure it&#8217;s running.<\/p>\n<p>ln -s \/var\/qmail\/supervice\/dovecot\/service\/<\/p>\n<p>Wait about ten seconds&#8230;<\/p>\n<p>svstat \/service\/dovecot \/service\/dovecot\/log<br \/>\n\/service\/dovecot: up (pid 23841) 8 seconds<br \/>\n\/service\/dovecot\/log: up (pid 23843) 8 seconds<\/p>\n<p>As we have not yet set up the certfile, the service will not run properly.\u00a0 If you check the log file in \/var\/qmail\/supervise\/dovecot\/log\/main\/current<\/p>\n<p>It will show an error about the certificate file.<\/p>\n<p>Fixing that is next\u2026<\/p>\n<p>&nbsp;<\/p>\n<div>\n<div>\n<p><strong>Part 14 \u2013 Install UCSPI-SSL create Certificates<\/strong><\/p>\n<p>Now we need to install ucspi-ssl so qmail will accept smtp connections with ssl.<\/p>\n<p>cd \/package<br \/>\ntar zxvf \/downloads\/qmr\/ucspi-ssl-0.70.tar.gz<br \/>\ncd host\/superscript.com\/net\/ucspi-ssl-0.70<\/p>\n<p>Compile the package<\/p>\n<p>package\/compile<\/p>\n<p>Run some tests: \u00a0Note There are some fatal cypher errors and broken pipe errors only, that is ok \u2013 ignore them.<\/p>\n<p>package\/rts<\/p>\n<p>Install the package<\/p>\n<p>package\/install<\/p>\n<p>That is that.\u00a0 <strong>Now we need to create the key:<\/strong><\/p>\n<p>cd \/var\/qmail\/control<br \/>\nopenssl req \u2013newkey rsa:1024 \u2013x509 \u2013nodes \u2013days 3650 \u2013out servercert.pem \u2013keyout servercert.pem<\/p>\n<p>Answer the questions and make sure the Common Name is the name of your mail server!!<\/p>\n<p>Now we give proper ownership<\/p>\n<p>chown root:nofiles servercert.pem<\/p>\n<p>The \u201cnofiles\u201d group is the group which qmaild belongs to.\u00a0 This combination of ownership and permissions allows qmail-smtpd to read the key but not change or delete it.<\/p>\n<p>chmod 640 servercert.pem<br \/>\ncp servercert.pem clientcert.pem<br \/>\nchown root:qmail clientcert.pem<br \/>\nchmod 640 clientcert.pem<\/p>\n<p>&nbsp;<\/p>\n<p>You can now go back and check that dovecot is working:<\/p>\n<p>svstat \/service\/dovecot \/service\/dovecot\/log<br \/>\n\/service\/dovecot: up (pid 23841) 8 seconds<br \/>\n\/service\/dovecot\/log: up (pid 23843) 8 seconds<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<div>\n<div>\n<p><strong>Part 14 \u2013 Finalise the qmail installation<\/strong><\/p>\n<p>There is a bit in this but it is not too difficult.\u00a0 I have modified a script from the old qmailrocks site to suit Fedora.\u00a0 To start with run a script which will:<\/p>\n<ol>\n<li>Copy all the supervise scripts to their correct locations<\/li>\n<li>Copy qmail.rc and qmailctl to the propper locations and create the necessary symbolic links.<\/li>\n<li>Set all needed permissions on the supervise scripts<\/li>\n<\/ol>\n<p>Ok.\u00a0 To get things going:<\/p>\n<p>cd \/ downloads\/qmr\/scripts\/finalise<br \/>\nchmod 755 finalize_linux.script<br \/>\n.\/finalize_linux.script<\/p>\n<p>&nbsp;<\/p>\n<p><strong>Configuring Qmail<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p>Now we will need to edit a few files to make them work on the new system for this new server.<\/p>\n<p>cd \/var\/qmail\/supervise\/qmail-pop3d<br \/>\nWe need to edit the run file.<\/p>\n<p>vi run \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 (or mc or whatever editor)<br \/>\nChange the mail server name (line 4 at the end) to your mail server.\u00a0 Eg mail.test.com.au \/<\/p>\n<p>cd \/var\/qmail\/supervise\/qmail-smtpd<br \/>\nvi run<\/p>\n<p>IP=1.2.3.4\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 (change this to your ip address obviously)<br \/>\nPort=25 (set the port number we will be listening on)<br \/>\nSSL=0 (This says do not run an SSL-only service)<br \/>\nFORCE_TLS=0 (Refuse to accept mail from clients who have not done STARTTLS)<br \/>\nDENY_TLS=0 (Do not refuse to process the STARTTLS command)<br \/>\nAUTH=0 (We are turning off auth on port 25 and only allow incomming mail)<br \/>\nRequire_Auth=0 (Refuse to accept mail from clients who have not done AUTH).<\/p>\n<p><strong>You must also uncomment the following line of the smtp run file or else no mail will be scanned by qmail scanner. Make it this: <\/strong><\/p>\n<p>QMAILQUEUE=\u201d$VQ\/bin\/qmail-scanner-queue.pl\u201d<\/p>\n<p>Now we need to set up some qmail aliases.\u00a0 Replace <a href=\"mailto:postmaster@test.com.au\">postmaster@test.com.au<\/a> with the addres you want the mail to go to:<\/p>\n<p>echo <a href=\"mailto:postmaster@test.com.au\">postmaster@test.com.au<\/a> &gt; \/var\/qmail\/alias\/.qmail-root<br \/>\necho <a href=\"mailto:postmaster@test.com.au\">postmaster@test.com.au<\/a> &gt; \/var\/qmail\/alias\/.qmail-postmaster<br \/>\necho <a href=\"mailto:postmaster@test.com.au\">postmaster@test.com.au<\/a> &gt; \/var\/qmail\/alias\/.qmail-mailer-daemon<\/p>\n<p>Now we set up selective relaying.<\/p>\n<p>mkdir \/etc\/tcp<br \/>\ncd \/etc\/tcp<br \/>\ncp \/downloads\/qmr\/etc-tcp-makefile Makefile<\/p>\n<p>Now create the smtp file.\u00a0 Add your ip address.\u00a0 If your ip address was<br \/>\n192.168.1.1, then it will go like this:<\/p>\n<p>vi \/etc\/tcp\/smtp<\/p>\n<p>Add the following to the new file:<\/p>\n<p>192.168.1.:allow,RELAYCLIENT=\u201d\u201d<br \/>\n:allow<\/p>\n<p>save this and then run:<\/p>\n<p>gmake<\/p>\n<p>You should get output saying<\/p>\n<p>tcprules smtp.cdb smtp.tmp &lt; smtp<br \/>\nchmod 644 smtp.cdb smtp<\/p>\n<p>&nbsp;<\/p>\n<p><strong>Setting up smtp with SSL<\/strong><\/p>\n<p>We need to edit the file<\/p>\n<p>vi \/var\/qmail\/supervise\/qmail-smtpd-ssl\/run<\/p>\n<p>Set the following values:<\/p>\n<p>IP=1.2.3.4\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 (change this to your own ip address obviously)<br \/>\nPort=465 (set the port number we will be listening on)<br \/>\nSSL=1 (This says to run an SSL-only service)<br \/>\nFORCE_TLS=0 (Ignored for ssl services)<br \/>\nDENY_TLS=0 (Ignored for ssl services)<br \/>\nAUTH=1 (Allow the AUTH command)<br \/>\nRequire_Auth=1 (Refuse to accept mail from clients who have not done AUTH).<\/p>\n<p><strong>You must also uncomment the following line of the smtp run file or else no mail will be scanned by qmail scanner. Make it this: <\/strong><\/p>\n<p>QMAILQUEUE=\u201d$VQ\/bin\/qmail-scanner-queue.pl\u201d<\/p>\n<p>Save the file\u00a0 then\u2026<\/p>\n<p>Creating the smtpssl file<\/p>\n<p>cd \/etc\/tcp<br \/>\nvi smtpssl<\/p>\n<p>in this new file, simply put the following and then save it.<\/p>\n<p>:allow<\/p>\n<p>Now you need to <strong>edit the Makefile and add smtpssl.cdb after smtp.cdb<\/strong>, save and exit.\u00a0 Now run:<\/p>\n<p>gmake<\/p>\n<p>The final step is to start the service running:<\/p>\n<p>ln \u2013s \/var\/qmail\/supervise\/qmail-smtpd-ssl \/service\/<\/p>\n<p>Now check that the service is running ok by:<\/p>\n<p>svstat \/service\/qmail-smtpd-ssl \/service\/qmail-smtpd-ssl\/log<\/p>\n<p>As usual, if you see the output is up for more than 3 seconds, all is OK<\/p>\n<p>Now we want to start qmail:<\/p>\n<p>qmailctl start<\/p>\n<p>You should get output like:<\/p>\n<p>Starting qmail\u2026<\/p>\n<p>Starting qmail-send<br \/>\nStarting qmail-smtpd<br \/>\nStarting qmail-pop3d<\/p>\n<p>To check to make sure it is running ok type:<\/p>\n<p>qmailctl stat<\/p>\n<p>As long as everything is up for more that say 3 seconds you have succeeded.\u00a0 Well done.<\/p>\n<p>That is all that finished.<\/p>\n<p>You could just operate a mail server with what you now have but lets install programs to make life much easier.\u00a0 For example, you could easily just manage all your mail accounts and domains with vpopmail.\u00a0 But using qmailadmin and vqadmin is much nicer and easier.\u00a0 Squirrelmail makes life easier for all your users as they can get their mail via a web browser.\u00a0 Clamav checks for viruses in mail and spamassassin gets rid of a lot of spam.<\/p>\n<p>Anyway lets get on with it\u2026..<\/p>\n<p>&nbsp;<\/p>\n<div>\n<div>\n<p><strong>Part 16 \u2013 Install Spamassassin<\/strong><\/p>\n<p>I have done this in two different ways \u2013 both worked. You can compile from source then install or<\/p>\n<p>The simplist way is just use yum to install it:<\/p>\n<p>yum install spamassassin<\/p>\n<p>Then go and edit \/etc\/mail\/spamassassin\/local.cf<\/p>\n<p>All you have to put in this file is<\/p>\n<p>required_score 3.2 \u00a0\u00a0\u00a0\u00a0\u00a0 (that is what I use)<\/p>\n<p>And if you want you can create a whitelist of good known email addresses \u2013 eg friends<\/p>\n<p>whitelist_from <a href=\"mailto:good@emailaddress.com.au\">good@emailaddress.com.au<\/a><\/p>\n<p>Now to set it up under daemontools.<\/p>\n<p>mkdir \u2013m 1755 \/var\/qmail\/supervise\/spamd<br \/>\nmkdir \u2013m 755 \/var\/qmail\/supervise\/spamd\/log<br \/>\ncd \/var\/qmail\/supervise\/spamd<br \/>\ncp \/downloads\/qmr\/spamd-run run<br \/>\nchmod 755 run<br \/>\ncd log<br \/>\ncp \/downloads\/qmr\/service-any-log-run run<br \/>\nchmod 755 run<\/p>\n<p>All we need to do now is create the service:<\/p>\n<p>ln \u2013s \/var\/qmail\/supervise\/spamd \/service\/<\/p>\n<p>Wait a bit then:<\/p>\n<p>svstat \/service\/spamd \/service\/spamd\/log<\/p>\n<p>Again, make sure the service is up for more than say 3 seconds.\u00a0 If issues, stop the service and then restart it.<\/p>\n<p>I also then type<\/p>\n<p>sa-update<\/p>\n<p>to update spamassassin<br \/>\nThat\u2019s it for spamassassin.<\/p>\n<p>&nbsp;<\/p>\n<div id=\"content\">\n<div id=\"content_div_5321\">\n<p>Part 17 &#8211; Install Clamav &#8211; Updated March 2012<br \/>\nFor the first time install of Clamav, you need to create a new user and group to your system:<\/p>\n<p>groupadd clamav<br \/>\ngroupadd qscand<br \/>\nuseradd \u2013g clamav \u2013s \/bin\/false \u2013c \u201cClam Antivirus\u201d clamav<br \/>\nuseradd \u2013g qscand \u2013s \/bin\/false \u2013c \u201cQscand\u201d qscand<\/p>\n<p>Now you need to download Clamav from clamav.net.\u00a0 Get the latest stable version which is currently 0.97.3<\/p>\n<p>cd \/downloads\/qmr<br \/>\nwget <a href=\"http:\/\/downloads.sourceforge.net\/clamav\/clamav-0.96.1.tar.gz\">http:\/\/downloads.sourceforge.net\/clamav\/clamav-0.97.3.tar.gz<\/a><br \/>\ntar zxvf clamav-x.x.x.tar.gz<br \/>\ncd clamav-x.x.x<br \/>\n.\/configure<br \/>\nmake<br \/>\nmake check<br \/>\nmake install<br \/>\nmake clean<\/p>\n<p>Now you need to create the clamd and freshclam service scripts.<\/p>\n<p>cd \/var\/qmail\/supervise<\/p>\n<p>mkdir \u2013m 1755 clamd<br \/>\nmkdir \u2013m 0755 clamd\/log<br \/>\ncd clamd<br \/>\ncp \/downloads\/qmr\/service-clamd-run run<br \/>\nchmod 755 run<br \/>\ncd log<br \/>\ncp \/downloads\/qmr\/service-any-log-run run<br \/>\nchmod 755 run<\/p>\n<p>cd \/var\/qmail\/supervise<\/p>\n<p>mkdir \u2013m 1755 freshclam<br \/>\nmkdir \u2013m 0755 freshclam\/log<br \/>\ncd freshclam<br \/>\ncp \/downloads\/qmr\/service-freshclam-run run<br \/>\nchmod 755 run<br \/>\ncd log<br \/>\ncp \/downloads\/qmr\/service-any-log-run run<br \/>\nchmod 755 run<\/p>\n<p>&nbsp;<\/p>\n<p>Now we need to edit the clamd.conf file so it will run correctly via daemontools.<\/p>\n<p>chmod 744 \/usr\/local\/etc\/clamd.conf<br \/>\nvi \/usr\/local\/etc\/clamd.conf\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 (or type mc and use midnight commander if you like)<\/p>\n<p>#Example \u2013 must be commented out<\/p>\n<p>#LogFile \u2013 comment out<\/p>\n<p>#LogSysLog no \u2013 comment out<\/p>\n<p>#PidFile \/var\/run\/clamav \u2013 comment out<\/p>\n<p>DatabaseDirectory \/usr\/local\/share\/clamav<\/p>\n<p>LocalSocket \/tmp\/clamd.socket \u2013 uncomment this<\/p>\n<p>FixStaleSocket yes &#8211; optional<\/p>\n<p>User qscand<\/p>\n<p>Foreground yes \u2013 this is absolutely required to run via daemontools<\/p>\n<p>chown \u2013R qscand:qscand \/usr\/local\/share\/clamav<\/p>\n<p>&nbsp;<\/p>\n<p><strong>Configuring freshclam<\/strong><\/p>\n<p>The freshclam program checks for updated virus definition files and, if it finds them, downloads and installs them automatically. It then sends a message to clamd, telling it to read the new definitions into memory, and can also call another program that we specify. We will be using this &#8220;call another program&#8221; capability to inform qmail-scanner and\/or simscan to update its version database, so the headers that they add to email messages will have accurate version numbers.<\/p>\n<p>To configure freshclam, we will edit a file called freshclam.conf, which will be found in the same directory where we found the clamd.conf file (above.) This is a list of the changes we need to make:<\/p>\n<p>chmod 744 \/usr\/local\/etc\/freshclam.conf<\/p>\n<p>vi \/usr\/local\/etc\/freshclam.conf\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 (or use mc as above)<\/p>\n<p>&nbsp;<\/p>\n<p>#Example \u2013 comment out<br \/>\nDatabaseDirectory \/usr\/local\/share\/clamav<br \/>\n#UpdateLogFile \u2013 comment out<br \/>\n#LogSyslog \u2013 no<br \/>\n#Pidfile \u2013 comment out<br \/>\nDatabaseOwner qscand<br \/>\nchecks 24<br \/>\nForeground yes<\/p>\n<p>Set up the services to start<\/p>\n<p>ln \u2013s \/var\/qmail\/supervise\/clamd \/service\/<br \/>\nln \u2013s \/var\/qmail\/supervise\/freshclam \/service\/<\/p>\n<p>Now check the services are running:<\/p>\n<p>svstat \/service\/clamd \/service\/clamd\/log<\/p>\n<p>and then<\/p>\n<p>svstat \/service\/freshclam \/service\/freshclam\/log<\/p>\n<p>make sure each is up for more than 3 seconds and all is ok.\u00a0 That is it for Clamav.<\/p>\n<\/div>\n<\/div>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<div id=\"content\">\n<div id=\"content_div_5325\">\n<p><strong>Part 18 \u2013 Install Qmail-scanner<\/strong><\/p>\n<p>The latest version (currently) is 2.10 as at March 2012 &#8211; you need to google the file to download<\/p>\n<p>cd \/downloads\/qmr<\/p>\n<p>tar zxvf qmailscanner-2.10.tar.gz<\/p>\n<p>cd qmailscanner-2.10<\/p>\n<p>cp \/downloads\/qmr\/qms-config qms-config<\/p>\n<p>Now you need to change the qms-config to match your settings. The bits in <strong>bold<\/strong> must be changed to your domain specific settings. If you have multiple domain names, in local-domains, separate them by a comma (no space).<\/p>\n<p>When you have made your changes, then make it executable and give it a test run:<\/p>\n<p>chmod 755 qms-config<\/p>\n<p>.\/qms-config<\/p>\n<p>When it asks you Continue? ([Y] \/ [N]) go ahead and hit Y<\/p>\n<p>It will ask this twice.\u00a0 If all goes well you will get Finished. and a bit more without error messages.<\/p>\n<p>If the above worked, then you will need to actually install:<\/p>\n<p>.\/qms-config install<\/p>\n<p>&nbsp;<\/p>\n<p><strong>Updating the qmail-scanner version files<\/strong><\/p>\n<p>The first one is the command that updates your version files.\u00a0 It updates your headers when you upgrade ClamAV or SpamAssassin.\u00a0 It also helps keep the \/var\/spool\/qscan folder clear when SMTP sessions are dropped.<\/p>\n<p>Put this one in a cron and run it once a day.<\/p>\n<p>setuidgid qscand \/var\/qmail\/bin\/qmail-scanner-queue.pl \u2013z<\/p>\n<p>Anytime you update qmail-scanner you should also run<\/p>\n<p>setuidgid qscand \/var\/qmail\/bin\/qmail-scanner-queue.pl \u2013g<\/p>\n<p>One final ownership check<\/p>\n<p>chown \u2013R qscand:qscand \/var\/spool\/qscan<\/p>\n<p><strong><br \/>\nTesting Qmail-scanner<\/strong><\/p>\n<p>Now before we finish, we need to test that it works.\u00a0 Make sure you have set up your main domain and email accounts (in particular the domain that you set the aliases to earlier) as these are where the test emails will go. Then run the following:<\/p>\n<p>\/downloads\/qmmr\/qmail-scanner-2.0.8\/contrib\/test_installation.sh \u2013doit<\/p>\n<p>When this runs, it will send 4 messages \u2013 2 with viruses, one standard message and a piece of junk mail. So when this runs, you should have 1 in \/var\/spool\/qscan\/quarantine\/viruses\/new , 1 message in \/var\/spool\/qscan\/quarantine\/policy\/new , 1 message in ~vpopmail\/domains\/domainXXX\/postmaster\/Maildir\/new and 1 in your ~vpopmail\/domains\/domainXXX\/postmaster\/Maildir\/.Spam\/new folder (or this will be in your maildir).<\/p>\n<p>All you need to do to finish is to restart qmail:<\/p>\n<p>qmailctl restart<\/p>\n<p>That\u2019s Qmail-scanner installed!\u00a0 Well done.<\/p>\n<p>&nbsp;<\/p>\n<div>\n<div>\n<p><strong>Part 19 \u2013 Install VqAdmin<\/strong><\/p>\n<p>VqAdmin is a nice simple web based interface that lets us manage Vpopmail.\u00a0 You can create new domains, new users, net quotas and more.<\/p>\n<p>cd \/downloads\/qmr<\/p>\n<p>tar zxvf vqadmin-X.x.x<\/p>\n<p>cd vqadmin-X.x.x<\/p>\n<p>.\/configure \u2013enable-cgibindir=\/var\/www\/cgi-bin \u2013enable-htmldir=\/var\/www\/html<\/p>\n<p>(If the paths above are not the same on your system, change them to match)<\/p>\n<p>make &amp;&amp; make install-strip<\/p>\n<p>If the installation is successful, VqAdmin will install itself in the cgi-bin directory of your website.<\/p>\n<p>Now you need to edit your apache file (or httpd.conf file).<\/p>\n<p>vi \/etc\/httpd\/conf\/httpd.conf<\/p>\n<p>Now, on about line 325 (of mine anyway) you need to change it to<br \/>\nAllowOverride ALL<\/p>\n<p>Also on about line 265, make sure your servername is defined.<\/p>\n<p>Insert (on mine I did it on line 575 but that does not really matter)<\/p>\n<p>&lt;Directory \u201c\/var\/www\/cgi-bin\/vqadmin\u201d&gt;<br \/>\ndeny from all<br \/>\nOptions ExecCGI<br \/>\nAllowOverride AuthConfig<br \/>\nOrder deny,allow<br \/>\n&lt;\/Directory&gt;<\/p>\n<p>That\u2019s that bit done.<\/p>\n<p>cd \/var\/www\/cgi-bin\/vqadmin<\/p>\n<p>Now you need to create a .htaccess file to password protect the vqadmin interface.\u00a0 There should already be a .htaccess file in the vqadmin directory, so all you need to do is configure it.<\/p>\n<p>vi .htaccess<\/p>\n<p>AuthType Basic<br \/>\nAuthUserFile \/etc\/httpd\/conf\/.htpasswd\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 (in fact you can put this wherever you like)<br \/>\nAuthName vQadmin<br \/>\nrequire valid-user<br \/>\nsatisy any<\/p>\n<p>Now change ownership<\/p>\n<p>chown apache .htaccess<\/p>\n<p>chmod 644 .htaccess<\/p>\n<p>Now you need to create a corresponding .htpasswd file that will contain the username and encrypted password for the VqAdmin administrator.<\/p>\n<p>htpasswd \u2013bc \/etc\/httpd\/conf\/.htpasswd admin admin-password<\/p>\n<p>chmod 644 \/etc\/httpd\/conf\/.htpasswd<\/p>\n<p>Make sure you leave the user admin as admin else it won\u2019t work.\u00a0 Obviously the admin-password should be a password.<\/p>\n<p>Now we need to restart apache.<\/p>\n<p>apachectl stop<\/p>\n<p>apachectl start<\/p>\n<p>If all has gone well, in you web browser, put:<\/p>\n<p><a href=\"http:\/\/www.yourdomain.com.au\/cgi-bin\/vqadmin\/vqadmin.cgi\">http:\/\/www.rmohan.com\/cgi-bin\/vqadmin\/vqadmin.cgi<\/a><\/p>\n<p>Enter admin and whatever password you created and hey presto.\u00a0 You can now add domains, users etc.\u00a0 If you get errors such as 500 Internal Server error, check permissions with vqadmin.cgi file.<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<\/div>\n<\/div>\n<div>\n<div>\n<p><strong>Part 19 \u2013 Installing Qmailadmin<\/strong><\/p>\n<p>This provides us with a nice web based interface for administering mail accounts once they are set up through Vpopmail or VqAdmin.<\/p>\n<p>cd \/downloads\/qmr<\/p>\n<p>tar zxvf qmailadmin-X.xx.x<\/p>\n<p>cd qmailadmin-X.x.x<\/p>\n<p>.\/configure \u2013enable-cgibindir=\/var\/www\/cgi-bin \u2013enable-htmldir=\/var\/www\/html \u2013enable-modify-spam &#8211;enable-ezmlm.idx<\/p>\n<p>make &amp;&amp; make install-strip<\/p>\n<p>Now to make sure when we add new users via qmailadmin that we want Spam Fighting turned on by default edit the following:<\/p>\n<p>vi \/usr\/local\/share\/qmailadmin\/html\/add_user.html<\/p>\n<p>find the line<br \/>\n&lt;input type=\u201dcheckbox\u201d name=\u201dspamcheck\u201d&gt;<\/p>\n<p>Change it to:<br \/>\n&lt;input type=\u201dcheckbox\u201d name=\u201dspamcheck\u201d checked&gt;<\/p>\n<p>That it for the install.<\/p>\n<p>Now open your web browser and go to:<\/p>\n<p><a href=\"http:\/\/www.yourdomain.com.au\/cgi-bin\/qmailadmin\">http:\/\/www.rmohan.com\/cgi-bin\/qmailadmin<\/a><\/p>\n<p>You all done here.<\/p>\n<p>&nbsp;<\/p>\n<div>\n<div>\n<p><strong>Part 21 &#8211; install Squirrelmail.<\/strong><\/p>\n<p>Squirrelmail is a web based program that allows you to access your email via a web browser.<\/p>\n<p>First you must check that you have PHP uploads turned on.<\/p>\n<p>vi \/etc\/php.ini<\/p>\n<p>The line you want to check \/ edit is:<\/p>\n<p>file_uploads = On<\/p>\n<p>That\u2019s that.\u00a0 Now on to installing Squirrelmail.<\/p>\n<p>cd \/var\/www\/html<br \/>\ntar zxvf \/downloads\/qmr\/squirrelmail-X.x.x.tar.gz<\/p>\n<p>Now rename the untared folder to something more friendly\u2026<\/p>\n<p>mv squirrelmail-X.x.x webmail<\/p>\n<p>Now we configure squirrelmail..<\/p>\n<p>mkdir \/var\/local\/squirrelmail<br \/>\nmkdir \/var\/local\/squirrelmail\/data<br \/>\nchown \u2013R apache:apache \/var\/local\/squirrelmail\/data<\/p>\n<p>cd webmail\/config<br \/>\n.\/conf.pl<\/p>\n<p>This will run the squirrelmail setup scriot which allows you to customise the installation and set your server settings.\u00a0 Most of the important things are in area #2 which is called \u201cServer Settings\u201d.<\/p>\n<p>You will be presented with a menu. Under 1 &#8211; Organization Preferences, Any one of the setings inside this window are optional. When you are done, hit S to save and then hit Enter and then hit R to go back to the Main Menu.<\/p>\n<p>Now we want to go to 2 &#8211; Server settings. Hit 1 for Domain and hit Enter on the keyboard. You can type the name of the server or the local IP or public IP, whichever you prefer. If your mailserver is behind a router\/firewall, I use the local IP. If you are on the public side of things, the hostname or the static IP will work fine.<\/p>\n<p>Under Server settings we want to use the following. Please change x.x.x.x to the IP of your mail server:<\/p>\n<p>1.\u00a0 Domain\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 : x.x.x.x<br \/>\n2.\u00a0 Invert Time\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 : false<br \/>\n3.\u00a0 Sendmail or SMTP\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 : Sendmail<\/p>\n<p>A.\u00a0 Update IMAP Settings\u00a0\u00a0 : localhost:143 (other)<br \/>\nB.\u00a0 Change Sendmail Config : \/var\/qmail\/bin\/sendmail<\/p>\n<p>Hit Y and then hit Enter. Hit S to save and then hit Enter again. Hit Q to quit and exit the menu.<\/p>\n<p>If you like there are other features you can customise but not critical.\u00a0 Once you are done here, we must configure Apache to serve our new webmail interface.<\/p>\n<p>Open up the httpd.conf file and add the following down the bottom under Virtual Domains..<\/p>\n<p>vi \/etc\/httpd\/conf\/httpd.conf<\/p>\n<p>&lt;VirtualHost 1.2.3.4:80&gt;<br \/>\nServerName mail.rmohan.com<br \/>\nServerAlias mail.*<br \/>\nServerAdmin <a href=\"mailto:postmaster@test.com.au\">postmaster@rmohan.com<\/a><br \/>\nDocumentRoot \/var\/www\/html<br \/>\n&lt;\/VirtualHost&gt;<\/p>\n<p>&nbsp;<\/p>\n<p>Now all you need to do is restart apache<\/p>\n<p>apachectl stop<br \/>\napachectl start<\/p>\n<p>Now in your browser:<\/p>\n<p><a href=\"http:\/\/www.yourdomain.com.au\/webmail\">http:\/\/www.rmohan.com\/webmail<\/a><\/p>\n<p>That is it.\u00a0 You now have a great qmail server with lots of useful extras.<\/p>\n<p>Now for Maintenance of everything we have set up\u2026<\/p>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<p>&nbsp;<\/p>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<p>&nbsp;<\/p>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<div id=\"content\">\n<div id=\"content_div_5341\">\n<p><strong>Part 22 \u2013 notes on Changing and Maintaining your new Qmail Server<\/strong><\/p>\n<p><strong>Services<\/strong><\/p>\n<p>To start, stop or restart a service (run under daemontools \u2013 ie the ones in the \/service directory):<\/p>\n<p><strong>To stop<\/strong><\/p>\n<p>svc \u2013d \/service\/name\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 (d is for down)<\/p>\n<p>eg \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 svc \/-d \/service\/spamd \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 will stop spamd<\/p>\n<p><strong>To start<\/strong><\/p>\n<p>svc \u2013u \/service\/name\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 (u is for up)<\/p>\n<p><strong>To restart<\/strong><\/p>\n<p>svc \u2013t \/service\/name<\/p>\n<p>To check all your services at once<\/p>\n<p>svstat \/service\/* \/service\/*\/log<\/p>\n<p>&nbsp;<\/p>\n<p><strong>Qmail-Scanner<\/strong><\/p>\n<p>I wanted the subject line to be altered with spam messages.\u00a0 To do this, you need to edit the qmail-scanner-queue.pl file in \/var\/qmail\/bin\u2026<\/p>\n<p>in this file on my system (line 258) says:<\/p>\n<p>my $spamc_subject=\u2019***Spam***\u2019 ;<\/p>\n<p>I set it to delete messages more than 5 over my limit of 3.2.\u00a0 You can edit this two lines below<\/p>\n<p>my $sa_quaratnine_over=\u20195\u2019 ;<\/p>\n<p>This is all I did.<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p><strong>Update Clamav<\/strong><\/p>\n<p>This would be the cause of most pain as it changes every 3 months or so.\u00a0 To see info about freshclam and if it is current type:\u00a0\u00a0\u00a0 freshclam -v<\/p>\n<p>Or you can look in the file \/service\/freshclam\/log\/main\/current and see if clamav is outdated.\u00a0 It will say so in the log.\u00a0 To upgrade your clamav, go to the clamav site and download the latest stable source file:<\/p>\n<p><a href=\"http:\/\/www.clamav.net\/lang\/en\/download.sources\">http:\/\/www.clamav.net\/lang\/en\/download.sources<\/a><\/p>\n<p>Now download the latest and put it in your downloads directory.\u00a0 For example, to download 96.1 version,<\/p>\n<p>cd \/downloads<br \/>\nwget <a href=\"http:\/\/downloads.sourceforge.net\/clamav\/clamav-0.96.1.tar.gz\">http:\/\/downloads.sourceforge.net\/clamav\/clamav-0.97.3.tar.gz<\/a><br \/>\ntar zxvf clamav-0.97.3.tar.gz<br \/>\ncd \/clamav-0.97.3<\/p>\n<p>I then backup the clamd.conf and freshclam.conf files to be sure.<\/p>\n<p>cd\/downloads<br \/>\ncp \/usr\/local\/etc\/freshclam.conf freshclam.conf<br \/>\ncp \/usr\/local\/etc\/clamd.conf clamd.conf<\/p>\n<p><strong>You must then stop qmail and clamav and also freshclam\u2026<\/strong><\/p>\n<p>qmailctl stop<br \/>\nsvc \u2013d \/service\/clamd<br \/>\nsvc \u2013d \/service\/freshclam<\/p>\n<p>Now we start the upgrade:<\/p>\n<p>.\/configure<br \/>\nmake\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 (This can take some time)<br \/>\nmake check\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 (Same \u2013 make sure the tests passed \u2013 ie no errors)<br \/>\nmake install<br \/>\nmake clean<\/p>\n<p>Check the conf files and if they are still the same (they should be unaltered).<\/p>\n<p>Start up the services again:<br \/>\nqmailctl start<br \/>\nsvc \u2013u \/service\/clamd<br \/>\nsvc \u2013u \/service\/freshclam<\/p>\n<p>You must now update qmail-scanner database<br \/>\nsetuidgid \/var\/qmail\/bin\/qmail-scanner-queue.pl \u2013g<\/p>\n<p>and also update the version number<br \/>\nsetuidgid \/var\/qmail\/bin\/qmail-scanner-queue.pl \u2013z<\/p>\n<p>Now type freshclam \u2013v and you will see the new version number.\u00a0 That\u2019s it for updating clamav.\u00a0 I just did this exactly and it worked perfectly on my system.<\/p>\n<\/div>\n<\/div>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Reference from : http:\/\/www.ekrfs.com.au\/qmr\/home<\/p>\n<p>BEST OF ALL REFERENCE IS: http:\/\/qmail.jms1.net\/ i Love this author.<\/p>\n<p>&nbsp;<\/p>\n<p>I have compressed most of the required files into one file called qmr1.tar.gz and qmr2.tar.gz. You will need to download both then put them in the \/downloads\/qmr directory that you need to create on your Centos or Fedora box.<\/p>\n<p>Attachments [&#8230;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[32],"tags":[],"_links":{"self":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/858"}],"collection":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=858"}],"version-history":[{"count":5,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/858\/revisions"}],"predecessor-version":[{"id":863,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/858\/revisions\/863"}],"wp:attachment":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=858"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=858"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=858"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}