[Dovecot] Dovecot + Xmail Setup Howto
Chris L. Franklin
cfranklin at nomadcf.com
Sun Jan 16 22:41:30 EET 2005
OK I finally found time to write this. (this is for dovecot 99.X and Xmail
1.X >= 1.17)
(in dovecot 1.0 it'll able to auth against Xmail via a auth script. aka
You'll only need to have 1 user account databases, XMAIL's YAY !!!)
Steps:
1. Install Dovecot. (rpm or Source)
>From Source : http://wiki.dovecot.org/CompilingSource
>From RPM : http://wiki.dovecot.org/PrebuiltBinaries
2. Edit config (my's listed below)
CODE
base_dir = /var/run/dovecot/
imap_listen = *
pop3_listen = *
info_log_path = /var/log/dovecot
login_dir = /var/run/dovecot/login
login = imap
login_executable = /usr/libexec/dovecot/imap-login
login = pop3
pop3_executable = /usr/libexec/dovecot/pop3
verbose_ssl = no
default_mail_env = /var/MailRoot/domains/%d/%n/Maildir
mail_cache_fields = Envelope MessagePart
client_workarounds = outlook-idle
mailbox_check_interval = 5
mailbox_idle_check_interval = 30
maildir_stat_dirs = no
maildir_copy_with_hardlinks = no
maildir_check_content_changes = yes
auth_mechanisms = plain
auth_userdb = static uid=97 gid=97 home=/var/MailRoot/domains/%d/%n/Maildir
auth_username_chars =
abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890.-_@
auth_passdb = passwd-file /var/MailRoot/dovecotusers.tab
3. Isnatll Xmail
>From Source : http://www.xmailserver.org/Readme.html#build
>From RPM : (rpm -i xmail-X.rpm)
4. Configure XMail, edit server.tab
Server.tab Config:
http://www.xmailserver.org/Readme.html#server_tab_variables
Heres Mine (with in all xmail files there are no SPACES only TABS !!!)
CODE
"RootDomain" "nomadcf.com"
"SmtpServerDomain" "nomadcf.com"
"POP3Domain" "nomadcf.com"
"HeloDomain" "nomadcf.com"
"PostMaster" "postmaster at nomadcf.com"
"ErrorsAdmin" "postmaster at nomadcf.com"
"SMTP-MaxErrors" "0"
"NoSenderBounce" "1"
"RemoveSpoolErrors" "1"
"NotifySendLogToSender" "1"
"ReceivedHdrType" "1"
"SmtpMsgIPBanSpammers" "Denied due to you being a F'in SPAMMER !!!!!"
"SmtpMsgIPBanSpamAddress" "550 Denied due inclusion of your email address in
our spam lists"
"SmtpMsgIPBanMaps" "550 Denied due inclusion of your IP in the following
map"
"EnableAuthSMTP-POP3" "0"
"AllowNullSender" "1"
"AllowSmtpVRFY" "1"
"AllowSmtpETRN" "1"
"CustMapsList"
"list.dsbl.org.:1,blackholes.mail-abuse.org.:1,dialups.mail-abuse.org.:0"
"SMTP-RDNSCheck" "1"
"CheckMailerDomain" "1"
"DefaultSmtpPerms" "MRVZ"
4.5 Setup Admin Account for Xmail
moreinfo : http://www.xmailserver.org/Readme.html#ctrlaccounts_tab
CODE (Replace BOB with you admin password, Replace ROOT with your Admin
userame)
cd /var/MailRoot/bin
./XMCrypt BOB | awk '{print "ROOT\t"$1"\n"}' > ../ctrlaccounts.tab
5. Setup your XMail Domains + Users
It's easy'st with a interface. Heres a list of some
Windows : http://www.alouria.com/
Web : http://dev.waaf.net/xmail/
Web : http://www.akxak.de/xpai/
Web : https://sourceforge.net/projects/phpxmail
6. Give Dovecot permission to the domains dir under MailRoot
I used acls to do this so that Xmail can still run as root and Dovecot could
still run as a non-root user. (if you rather not do this your other option
is tp run xmail as the same user a dovecot See non-Acls below)
CODE
setfact -R -m d:u:dovecot:rwx,d:g:dovecot:rwx;d:o:---,d:m:rwx
/var/MailRoot/domains
setfacl -R -m u:dovecot:rwx,g:dovecot:rwx;o:---,m:rwx /var/MailRoot/domains
7. Set Xmail to listen on another port then 110 for pop3.
Add "-Pp 20110 " to xmail startup options.
8. Setup User Accounts.
As of 99.X of dovecot it doesn't support using a external script to check
user acount info (user/password). So it needs a place to have it's own
useraccount storage place. For more ways dovecot can store user info see :
http://wiki.dovecot.org/Authentication
I use " passwd-file /var/MailRoot/dovecotusers.tab" and create it from a
modified xmail2smapost script called xmail2dovecot. (See xmail2dovecot
below)
9. Restart Xmail
10. Startup Dovecot
Non-Acls:
To allow Xmail to so it's thing + Allow dovecot Access to XMails MailRoot.
You'll need to run Xmail as the user Dovecot runs at. I found after some
trial and error that is pretty easy.
What you'll need.
1. Iptables
2. su
Setup
1. Disable Xmail from starting at boot.
2. Stop Xmail
3. edit the user dovecot and chnage there shell to /bin/bash
4. Create a IPtables rule to route port 25 to 20025
Example:
CODE
iptables -t nat -A PREROUTING -p tcp --dport 25 -j REDIRECT --to-port 20025
5. Change permissions in MailRoot from root.root to dovecot.dovecot
CODE
chown -R dovecot.dovecot *
6. Startup Xmail as so :
CODE
su - dovecot -c "/var/MailRoot/bin/XMail -Mr 24 -Pl -Ph -Sl -Ql -Yi
30 -Yl -Fl -Cl -Ll -PX 0 -Sp 20025 -Pp 20110 -Fp 20079 -Ms /var/MailRoot"
XMail2Dovecot Script:
This a script that was Org. used with smartpost. And was called
xmail2smartpost.php But I changed it to output All the user account info
into a simple passwd/Shadow. (user at domain:MD5-password)
Download From : http://xmail.nomadcf.com/info.php?program=xmail2dovecot
After Downloading it , extract it to the MailRoot/bin/ and then edit it.
And lastly Run it as like so :
CODE
cd /var/MailRoot/bin/
./xmail2dovecot.php > ../dovecotusers.tab
-- Chris L. Franklin --
More information about the dovecot
mailing list