postfix + vm-pop3d howto - YourNews
Postfix + vm-pop3d
Last updated: 10/19/02
This HOWTO covers version 1.1.6 of vm-pop3d and all versions of Postfix (as far as I know)
Assuming you already have postfix installed and running im going to start with instructions on getting vm-pop3d setup.
First you need to untar everything like so:
tar -zxvf vm-pop3d-1.1.6.tar.gz
cd vm-pop3d-1.1.6
./configure
This will set the basic configuration for vm-pop3d, but you need todo some editing to vm-pop3d.h
#define VIRTUAL_UID 8
#define VIRTUAL_MAILPATH "/var/spool/virtual"
#define VIRTUAL_PASSWORDS_PATH "/etc/virtual"
#define VIRTUAL_PASSWORD_FNAME "passwd"
The VIRTUAL_UID setting is what user you want to own the virtual mailboxes, I personally use nobody on my FreeBSD server but its up to you.
The VIRTUAL_MAILPATH is where you want the mailboxes for the virtual users to go, if you used the above it would be /var/spool/virtual/domain/user
The VIRTUAL_PASSWORD_PATH is where the passwd files are kept, /etc/virtual/domain/passwd
The VIRTUAL_PASSWORD_FNAME is the name of the passwd file in /etc/virtual/domain, I would leave this be if I were you. No need to change it.
After you have changed those settings all you need todo is:
make install
Now congrats you have both vm-pop3d and postfix configured and running, now comes the adding of virtual accounts part.
(for all examples i'll be using foo@bar.com)
First you need to edit your postfix virtual file to reflect:
foo@bar.com foo.bar.com
Next, you need to edit your postfix aliases file to reflect:
foo.bar.com: /var/mail/virtual/bar.com/foo
Then run:
postalias hash:aliases
postmap hash:virtual
To create the DBs for the files.
Then, go into /etc/virtual/bar.com and do:
htpasswd -bc passwd foo passwordforfoo
To login you will need to have your username as foo@bar.com or foo:bar.com or foo!bar.com
After that is all done try and login and it should work, if you check your logs it will say its using /dev/null for your mailbox buts that because on hasn't been created. When you receive your first email it will be created.
Here are 3 shell scripts to add a virtual mail account remove a virtual mail account AND setup a virtual mail account for a real account so to speak.
It adds a passwd and links the original mailbox for the real user so you can login with username@domain.
The scripts are customized for me so you would have to change them around.
vm-pop3d uses dot-locking, which means that a mailboxfile is locked by
creating a "mbox.lock" file. Postfix by default uses flock or fcntl
on most systems. So in the case, that postfix tries to deliver a mail
at the same time while a user is retrieving his mail via vm-pop3d the
newly delivered mail will be appended to a mbox-file which is being
changed at the same time. This will discard the new mail and possibly
leave the mbox in a corrupt state.
To make Postfix use the same locking mechanism as vm-pop3d does, you
have to specify this in main.cf:
virtual_mailbox_lock = dotlock
In this case, Postfix will honor an existing mbox.lock-file and defer
the maildelivery if the vm-pop3d is retrieving and/or otherwise
modifying the mailbox.
Contributed by Hrvoje Husic
I have been receiving alot of emails about people who are having permission denied errors. Make SURE that the owner of your virtual mailbox's is the same person who you specified in the vm-pop3d.h file.
If you have any comments, problems or needed support email me at tyler@cagelink.com