virtual mail BOX
-------------
ADD different DNS entry--------------Configure
[root@mail ~]# vi /etc/named.rfc1912.zones
24
25 zone "abc.com" IN {
26 type master;
27 file "abc.com.for";
28 allow-update { none; };
29 };
30
31
32 zone "xyz.com" IN {
33 type master;
34 file "xyz.com.for";
35 allow-update { none; };
36 };
37
[root@mail ~]# cd /var/named/
[root@mail named]# ls
[root@mail named]# cp named.localhost abc.com.for
[root@mail named]# cp named.loopback xyz.com.for
[root@mail named]# vi abc.com.for
$TTL 1D
@ IN SOA mail.abc.com. root.abc.com. (
0 ; serial
1D ; refresh
1H ; retry
1W ; expire
3H ) ; minimum
@ IN NS mail.abc.com.
@ IN MX 8 mail.abc.com.
mail IN A 192.168.80.81
[root@mail named]# vi xyz.com.for
$TTL 1D
@ IN SOA mail.abc.com. root.abc.com. (
0 ; serial
1D ; refresh
1H ; retry
1W ; expire
3H ) ; minimum
@ IN NS mail.abc.com.
@ IN MX 8 mail.abc.com.
mail IN A 192.168.80.81
[root@mail named]# service named restart
[root@mail named]# nslookup -type=MX abc.com
Server: 192.168.80.81
Address: 192.168.80.81#53
abc.com mail exchanger = 8 mail.abc.com.
[root@mail named]# nslookup -type=MX xyz.com
Server: 192.168.80.81
Address: 192.168.80.81#53
xyz.com mail exchanger = 10 mail.xyz.com.
---------------------------
https://www.howtoforge.com/virtual-users-and-domains-postfix-dovecot-mysql-centos4.5
Create User to Access Mailboxes
# groupadd -g 5000 vmail
# useradd -g vmail -u 5000 vmail
# mkdir -p /home/vhosts/abc.com
# chown vmail:vmail /home/vhosts/abc.com
useradd -s /sbin/nologin vmail
# grep vmail /etc/passwd
vmail:x:5000:5000::/home/vmail:/sbin/nologin
# groupadd -g 5000 vmail
# useradd -g vmail -u 5000 vmail
# mkdir /home/vhosts
# chown -R root:vmail /home/vhosts/
# mkdir -p /home/vhosts/abc.com
# mkdir -p /home/vhosts/xyz.com
# chown -R vmail:vmail /home/vhosts/abc.com
# chown -R vmail:vmail /home/vhosts/xyz.com
#main.cf
virtual_alias_maps=hash:/etc/postfix/vmail_aliases
virtual_alias_domains = abc.com, xyz.com
virtual_mailbox_domains = abc.com xyz.com virtual_mailbox_base = /home/vhosts/ virtual_mailbox_maps = hash:/etc/postfix/vmailbox
virtual_minimum_uid = 5000
virtual_uid_maps = static:5000
virtual_gid_maps = static:5000
# postmap /etc/postfix/vmailbox
------------
# vi /etc/postfix/vmailbox
info@abc.com abc.com/info/ info@xyz.com xyz.com/info/
u1@abc.com abc.com/u1/ u1@xyz.com xyz.com/u1/
#vim /etc/postfix/vmail_aliases
info@abc.com info@abc.com info@xyz.com foo@google.com
--------------------------
virtual_alias_domains = domain1.com domain2.com virtual_alias_maps = hash:/etc/postfix/virtual
------------------------------------
Install Dovecot
Install and Configure Postfix with Dovecot
Comming to the second part of tutorial on running Postfix with Dovecot. Let’s install Dovecot and make it start at boot.
[root@geekpeek ~]# yum install dovecot [root@geekpeek ~]# chkconfig dovecot on
11. Edit Main Dovecot Configuration File
Before making any changes to Dovecot configuration file make a backup of it.
Main Dovecot configuration file is “/etc/dovecot/dovecot.conf”, additional config files are located in “/etc/dovecot/conf.d” directory. Main Dovecot configuration file should look like this:
# Uncomment and edit this line protocols = imap pop3 # Uncomment and edit - make dovecot only listen on ipv4 listen = *
# Leave as it is dict { } !include conf.d/*.conf
12. Edit Additional Dovecot Configuration Files
There are additional Dovecot configuration files located in “/etc/dovecot/conf.d” directory. We need to edit some of them as follows.
/etc/dovecot/10-auth.conf
# Uncomment disable_plaintext_auth = yes
# Leave as it is auth_mechanisms = plain login
# Comment this line #!include auth-system.conf.ext
# Uncomment !include auth-passwdfile.conf.ext !include auth-checkpassword.conf.ext
/etc/dovecot/conf.d/10-logging.conf
# Uncomment and edit log_path = /var/log/dovecot.log auth_verbose = yes auth_verbose_passwords = no auth_debug = no auth_debug_passwords = no mail_debug = no verbose_ssl = no
# Leave as it is plugin { }
/etc/dovecot/conf.d/10-mail.conf
# Uncomment and edit to reflect previous configuration mail_location = maildir:/var/mail/vhosts/%d/%n mail_uid = 5000 mail_gid = 5000 mail_privileged_group = vmail
# Leave as it is mbox_write_locks = fcntl
/etc/dovecot/conf.d/10-master.conf
# Leave as it is service imap-login { inet_listener imap { } inet_listener imaps { } } service pop3-login { inet_listener pop3 { } inet_listener pop3s { } } # Comment this out #service lmtp { # unix_listener lmtp { # } #} # Leave as it is service imap { } service pop3 { } # Edit and change service auth { unix_listener auth-userdb { mode = 0600 user = postfix group = postfix } unix_listener /var/spool/postfix/private/auth { mode = 0666 user = postfix group = postfix } } service auth-worker { } service dict { unix_listener dict { } }
/etc/dovecot/conf.d/10-ssl.conf
# Uncomment ssl = yes # Leave this for now - we will change this in Step 16 ssl_cert = </etc/pki/dovecot/certs/dovecot.pem ssl_key = </etc/pki/dovecot/private/dovecot.pem
13. Generate Passwords for Dovecot Users
The Dovecot users password file location is defined in “/etc/dovecot/conf.d/auth-passwdfile.conf.ext”. By default this is “/etc/dovecot/users” file. We can generate a password for user using the following command:
[root@geekpeek ~]# doveadm pw -s SHA512-CRYPT Enter new password: Retype new password: {SHA512-CRYPT}$6$7iU6C9qP.Ba2R3bz$3cw0qRM4Q0s1Nh15xaJYzj8qA7AR4KjqQuE4vbMup4Ncg8rIFsnGGNvjH1huYw3.6ijkNWibp51N6N1FTxbJ01
We chose to use the strongest SHA512 encryption and as we can see, this command only encrypts the string you entered as password.
Next we need to edit or create a “/etc/dovecot/users” file and enter the information about a user as follows:
info@my-domain1.com:{SHA512-CRYPT}$6$7iU6C9qP.Ba2R3bz$3cw0qRM4Q0s1Nh15xaJYzj8qA7AR4KjqQuE4vbMup4Ncg8rIFsnGGNvjH1huYw3.6ijkNWibp51N6N1FTxbJ01::::
We must not forget to add the “::::” at the end of the line to make this work!!
Repeat the process for every mail user on the server.
14. Start Dovecot
We are finally ready to start Dovecot for the first time.
[root@geekpeek ~]# /etc/init.d/dovecot start Starting Dovecot Imap: [ OK ]
###########################################################################3