First you will want to download the libcurl rpms. Below is a link:
Otherwise, this is what I did to install on Fedora Core 2.
# wget http://curl.haxx.se/download/libcurl3-7.14.0-1.i386.rpm
# wget http://curl.haxx.se/download/libcurl3-devel-7.14.0-1.i386.rpm
# rpm -e curl-devel
# yum install openssl096b.i386
# rpm -ivh libcurl3-7.14.0-1.i386.rpm
# rpm -ivh libcurl3-devel-7.14.0-1.i386.rpm
If all goes well, you should have the following files:
Special thanks to Marnitz Gray
Go to www.clamav.net and browse to binaries and ports under downloads
(or use wget to retrieve them. I used the ones from Petr Kristof)
Download clamav and clamav-devel rpms
vi /var/qmail/supervise/qmail-smtpd/run - comment out qmailqueue and save
run qmailctl stop - then qmailctl stat.
If qmail-send or others are running kill them
qmailctl start - fresh start without qmail-scanner operating
yum update zlib
rpm -e --nodeps clamav-devel
rpm -e --nodeps clamav
(you should see that clamd.conf and freshclam.conf are saved as .rpmsave)
rpm -Uvh clamav-0.84-1.rpm
rpm -Uvh clamav-devel-0.84-1.rpm
mv /etc/clamd.conf /etc/clamd.conf.new
mv /etc/freshclam.conf /etc/freshclam.conf.new
mv /etc/clamd.conf.rpmsave /etc/clamd.conf
mv /etc/freshclam.conf.rpmsave /etc/freshclam.conf
chown -R qscand:qscand /var/lib/clamav
/usr/bin/freshclam (make sure it works)
(follow prompts to generate a fresh qmail-scanner-queue.pl file)
setuidgid qscand /var/qmail/bin/qmail-scanner-queue.pl -zg
vi /var/qmail/supervise/qmail-smtpd/run - restore qmailqueue line
qmailctl stat (ensure everything stops, if not ... kill it)
some final checks :
tail /var/log/maillog (make sure no errors)
tail /var/spool/qmailscan/qms-events.log (again .. no errors to contend with)
send yourself a test message
How to display qmail stats using mrtg
How to get the qmail graphs working with mrtg.
graphs inclue rbl, validrcptto, jgreylist, and more
By William Olson http://freebsdrocks.net http://goodcleanemail.com
You will need to install the following 2 ports:
# cd /usr/ports/net-mgmt/mrtg
# make install clean
# cd /usr/ports/mail/qmailmrtg7
# make install clean
Pick the location to download the stats (preferably within your www folder) to and then download the tarball. Replace any of the /path/to folder names with the actual place you are storing qmailstats
# cd /path/to/stats
# fetch http://www.goodcleanemail.com/files/tarballs/qmailmrtg2.tgz
# tar zxvf qmailmrtg2.tgz
Run the following commands to start the graphs at 0
# echo " 0" > /tmp/rbl-found
# echo " 0" > /tmp/valid-found
# echo " 0" > /tmp/jgrey-found
# echo " 0" > /tmp/vir-found
Edit the following files and change the "hostname" to your hostname in each file at the bottom.
Now to set the correct file permissions:
# chmod 755 mrtg-clam
# chmod 755 mrtg-jgrey
# chmod 755 mrtg-rbl
# chmod 755 mrtg-valid
Now open up qmailmrtg.cfg and change the WorkDir at the top to the folder where the qmailmrtg will be saved
Change each instance of myhostname to your mailserver name or ip or whatever. Easiest way is to do it like so:
This is just a find and replace script. What this does is it replaces all instances of myhostname with newhostname
Scroll down to the end of qmailmrtg.cfg and change the following lines:
run /usr/local/bin/mrtg qmailmrtg.cfg and just make sure you don't have any errors.
Now to put the stats in cron:
*/5 * * * * /usr/local/bin/mrtg /path/to/qmailmrtg.cfg > /dev/null 2>&1
After about 15-20 minutes you should start seeing graphs.
Now to clean up the install:
# cd /path/to/stats
# rm qmailmrtg2.tgz
# rm install-*
This is a document to help you convert your apache certs to qmail.
Please note that the common name you used needs to match the server name in order for your clients not to get the nag screen when they send emails via SSL or TLS.
In order to convert your apache cert, it is important to create the cert correctly. Here is how to do it:
First, We create the key:
# openssl genrsa -out domain.xxx.key 2048
You can substitute 2048 with 4096 for stronger encryption and make sure you replace YOURDOMAIN with your actual domain name.
Next, We need to add a password. Go ahead and type it and confirm.
Now create a csr:
# openssl req -new -key YOURDOMAIN.key -out YOURDOMAIN.csr
It is important to note here to type in all information for your company. When it asks for Common Name (eg, YOUR name) : it is VERY IMPORTANT this field matches what your users are going to use for their mailserver name. If you are buying a cert for multiple domains, this will be the domain users use the most. When viewing a cert for multiple domains, the common will appear first and the others will show on the cert.
This is the csr you can you to generate your cert when asked by the domain you buy your cert from.
First lets backup the current /var/qmail/control folder first:
# mkdir /var/qmail/backup_control
# cp -Rp /var/qmail/control/* /var/qmail/backup_control
Please copy the .crt, .csr and the .key to the root folder. Then run the following to make a signed cert:
# cat /root/cert.key > /var/qmail/control/servercert.pem
# cat /root/cert.crt >> /var/qmail/control/servercert.pem
# cat /root/intermediate.crt >> /var/qmail/control/servercert.pem
And now lets set the permissions on the servercert.pem:
# chown root:qnofiles /var/qmail/control/servercert.pem
# chmod 640 /var/qmail/control/servercert.pem
Now lets create the clientcert.pem file and the permissions:
# cp /var/qmail/control/servercert.pem /var/qmail/control/clientcert.pem
# chown root:qmail /var/qmail/control/clientcert.pem
# chmod 640 /var/qmail/control/clientcert.pem
Now restart qmail in order to make the changes take effect:
# qmailctl restart
If you have any other services that reference the servercert.pem, you will want to restart those services as well. Such services could include smtpd-ssl and smtpd-tls (Just as an example)
Now if you decided to run imap, You can use the following to create imap certs as well.
# cp /var/qmail/control/servercert.pem /usr/local/share/courier-imap/imapd.pem
# cp /var/qmail/control/servercert.pem /usr/local/share/courier-imap/pop3d.pem
Now to restart the service(s)
# svc -t /service/courier-*
That will restart ALL the courier- services.
Now your customers will not get the annoying nag screen when people send mail via smtp-ssl, smtp-tls or via imap!
SSL Cert Generation and export
For primary server issuing the CSR -
Generate CSR for Godaddy:
Create a newcert directory
cd to newcert directory
# openssl req -new -newkey rsa:2048 -nodes -keyout mydomain.key -out mydomain.csr
Start cert generation or renewal on GoDaddy
In console cat the CSR to enter in GoDaddy
# cat mydomain.csr
Select and copy the text, paste into CSR box on GoDaddy
Add other servers to the list of SANs
Submit and wait for cert to be generated
Save the zip file with the cert and bundle to the primary server in newcert directory
Create an oldcert directory and copy old cert files into it for backup
Copy new key, crt and bundle.crt files into /etc/certs/
change filenames to suit and confirm they match the settings in httpd_ssl.conf
Confirm setting using apachectl configtest
Correct any errors until you get Syntax OK
Restart apache with apachectl restart
Tail the apache error log to ensure it resumed normal operations.
Bring web page up in browser - do a Ctrl+Refresh to ensure you get a clean load
Verify the Certificate information from the Lock icon
Provided all is good export the cert to Qmail (sslserver)
# cat mydomain.key > mydomain.pem
# cat mydomain.crt >> mydomain.pem
# cat gd_bundle.crt >> mydomain.pem
# chmod 640 mydomain.pem
Verify in your run script for the SSL SMTP Service
restart Qmail and tail smtpd-ssl current log to ensure it loaded the key
For WWW - copy the key and crt file to the server.
DO NOT use the bundle.crt file that is only for the server that issued the CSR.
follow same proceedure, match the file names in the httpd_ssl.conf file
check config and restart and verify load
then follow the same proceedure for installing.
The easiest way is via command line. The following is one line:
Spacial thanks to Andreas H
You can change the way qmail-scanner notifies you by editing your /usr/local/bin/qmail-scanner-queue.pl and changing the line that says:
If you just want the postmaster to be notified of the virus, use admin like so:
Please note: under $NOTIFY_ADDRS in most cases, sender notifies the sender of the message. THIS IS NOT RECOMMENDED!! The reason for this is most email viruses use bogus email addresses and that can cause bounces and double-bounces filling your postmaster mailbox full of them. The only exception to this is if you set your catchall to deleted. recips is for the postmaster notification which I would leave in there. I have not found a way to change this unless you change it in your qmail-scanner installation.
This will make Qmail-Scanner silently drop all the infected emails without sending any notification.
Save the file and run the following commands for your OS to update qmail-scanner.
# setuidgid qscand /var/qmail/bin/qmail-scanner-queue.pl -g
# setuidgid qscand /var/qmail/bin/qmail-scanner-queue.pl -z
# setuidgid qscand /var/qmail/bin/qmail-scanner-queue.pl -p (If you're using qmail-scanner 2.0 per domain)
Test it and then you should be all set.
The instructions below will backup all users and emails. This will NOT copy over ezmlm lists. This may happen in future releases.
On the old mailserver:
tar zxvf vpopmail_server_import_export.tgz
run backupemail.sh > output
This places all the backups of vpopmail into the /home/backups/vpopusers dir
before you scp this folder over to the new server, make SURE you chown the user:group to the user you will scp it over to
On the new mailserver run the following commands but before you import the users it would be a good idea to disable validrcptto in qmail-smtpd/run and then restart qmail. Import the users and then enable validrcptto and then rebuild the validrcptto.cdb file as you did in my vpopmail instructions.
tar zxvf vpopmail_server_import_export.tgz
scp over the output file from the old mail server
Please note: Depending on how many domains/users there are, the next few commands can take several hours. Please plan accordingly.
scp the /home/backups/vpopusers from the old mail server to /home/backups/vpopusers on the new server
run output (This will create all the domains/users)
run RestoreTheUserDir.sh (This will restore all users folders)
I was thinking about how much space was getting used up by inactive e-mail accounts just collecting spam or whatnot and I wondered if there was a tool to remove users that hadn't authenticated with vpopmail in a long time as shown in vqadmin next to each username under the column 'Last Logon' not knowing there was a tool to do this for me I did all of my removals by hand until I just couldn't take it anymore and decided I would just see if there was a binary that came with vpopmail to do this for me which there was! It's easy to use as well and saved me so much time.
You should be able to find the binary here /home/vpopmail/bin/vdeloldusers, you can easily incorporate a crontab to run every week to remove old e-mail accounts like I've done.
Just to remove e-mail accounts that haven't been authenticated in 6 months or 180 days you just execute...
# /home/vpopmail/bin/vdeloldusers -a 180 -e -D (this will remove all e-mail accounts that haven't been used in 180 days or 6 months on every virtual domain you host)
To see what would be removed you can easily just execute...
# /home/vpopmail/bin/vdeloldusers -a 180 -e -V (this will show you every virtual domain that you host with inactive e-mail accounts without removing them)
Just running /home/vpopmail/bin/vdeloldusers will give you all the options you can pass to it so don't be afraid to use this binary! I was a little hesistant at first since I host so many domains but it works like a charm, I didn't know if it would update the last logon when a user is just using webmail/imap authentication but it did and of course it updates when a user does smtp authentication that was what I was kind of skeptic about but it works great!
I needed to figure out how I was using so much disk space and was looking for a quick way to tell me which domain was the culprit to the usage and since I never really did any domain or user quota settings which I should of and still will eventually I was needing a quick way to tell so this is the fastest way I could find and the best output.
# du -ksh /home/vpopmail/domains/*
If you wanted you could pretty much add this to your qmail stats if you wanted to monitor the disk usage for your virtual domains, you can easily get down into the mailboxes disk usage as well just change the command to something like..
# du -ksh /home/vpopmail/domains/myhosteddomain.com/*
Just some helpful things I've found to help myself and hopefully you as well.