Blue Flower

Monday, 06 July 2015 01:18

Turning off or changing ClamAV virus notifications

Written by

You can change the way qmail-scanner notifies you by editing your /usr/local/bin/ 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/ -g
# setuidgid qscand /var/qmail/bin/ -z
# setuidgid qscand /var/qmail/bin/ -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
cd import
run > output
create /home/backups/vpopusers
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
cd export
scp over the output file from the old mail server
mkdir /home/backups/vpopusers
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 (This will restore all users folders)

Monday, 06 July 2015 01:08

Removing old vpopmail user accounts easily

Written by

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/*

Just some helpful things I've found to help myself and hopefully you as well.

Monday, 06 July 2015 01:07

How to backup vpopmail with rsync/ssh

Written by

Setting up vpopmail with rsync and ssh

The reason why vpopmail just doesn't work with rsync is mainly because vpopmail has a chmod of 700 which means only the owner, vpopmail, can read it or root if you're logged in that way. Here is how to rsync vpopmail over a ssh connection.

Part of this documentation was taken from and also and

Setting up the ssh keys

On the server, Open up /etc/ssh/sshd_config and add PermitRootLogin without-password. Then you will want to restart sshd by running killall -HUP sshd. You will get kicked out of your terminal. If all is well, You should be able to login again. Root is now allowed to login only via a ssh key. Don't worry, there is some added security in the document as well.

The first thing we will want to do is generate the key on the client, or backup, machine. Run the following command:

ssh-keygen -t ed25519 -b 1024 -f id_dsa_vpopmail -C 'Some comment'

When you see 'Enter passphrase (empty for no passphrase):' Just hit enter and then when you see the confirmation that says 'Enter same passphrase again:' just hit enter again. After a few seconds, it should give you an output similar to the following:

Your identification has been saved in id_dsa_vpopmail.
Your public key has been saved in
The key fingerprint is:
88:da:e8:4c:50:5d:c5:95:b9:1e:6e:8f:96:82:c0:19 Some Comment

Now, the is the file we need to ssh over to your server. Here are the steps you will want to follow to get this over to your server to allow root logins via ssh:

# scp user@server:
user@server's password: |********************| 0 0:00
# ssh user@server:
user@server's password:
(You have to be root at this point to do the following steps)
# cat >> ~root/.ssh/authorized_keys2
# chmod 600 ~root/.ssh/authorized_keys2
# exit

This is not the only way to get the public key file into place. You could also copy it on a floppy disk, or email it to the system administrator and have them install it for you (remember this is the PUBLIC key, there is no security risk in sending it via normal email.)

Note that you can have multiple keys listed in the .ssh/authorized_hosts2 file- this is why the public keys have comments at the end, so you can easily tell which line in the file corresponds to which key.

To add a bit more security on the server, will will want to change the /root/.ssh/authorized_keys2 to look like so:

command="/root/.ssh/rsync-key" ssh-dss AAAAB3NzaAAA4fobEeQMoC6vRInbeNy5PukQ5fAkCc+Vr...

Then this is what is in the /root/.ssh/rsync-key file:

logger -t ssh-command "$SSH_ORIGINAL_COMMAND"
echo $SSH_ORIGINAL_COMMAND > /tmp/work.$$
if ! grep -q '^rsync --server ' /tmp/work.$$
exit 1
rm /tmp/work.$$

Then we need to chmod it properly so it runs:

chmod 755 /root/.ssh/rsync-key

Backing up vpopmail

Now that we have the keys in place for rsync via ssh to work, we can now setup a script to automate this for us and then we can put it into cron. Here is my script for this. I will call this

echo `date` starting >> /var/log/vpopmail-backup.log
rsync -aS --delete -e /path/to/backup-vpopmail-ssh root@HOST:/usr/home/vpopmail/ /backup/vpopmail/location
echo `date` done >> /var/log/vpopmail-backup.log

The '/path/to/backup-vpopmail-ssh' in the above file has this in it:

exec /usr/bin/ssh -i /path/to/id_dsa_vpopmail $*

Now we want to setup the chmod for the following files:

chmod 755
chmod 755 backup-vpopmail-ssh

Now lets give it a test!


If all goes well, It should pause there for a minute and then it will come back to the prompt. Check your vpopmail log in /var/log/vpopmail-backup.log and see if it started and stopped correctly.

Monday, 06 July 2015 01:06

How to get imap to work with mysql/vpopmail

Written by

If you have installed courier, stop all the courier services and remove startup scripts, config files, etc. Then, Follow the Slackware method for installing imap and it should work fine. You will need to add --with-mysql to the configure command in order for mysql authentication to work.

Page 12 of 23