Saturday, July 27, 2013

Mail Server usng Postfix CentOS 6.4 - 5



Part 7
l  Chapter 16 Postfix Backup Mailserver
l  Chapter 17 Postfix Admin with MySQL


Chapter 16 Postfix Backup Mail server
1. DNS configuration
# vi /var/named/chul.zone
chul.com                 IN MX 10 ms1.chul.com
chul.com                 IN MX 20 ms2.chul.com
ms1                        IN  A           192.168.80.5
ms2                        IN  A           192.168.80.6
# service named restart
# host –a chul.com
2. In the backup server (ms2.chul.com)
# vi /etc/postfix/main.cf
§   myhostname = ms2.chul.com
§   mydomain = chul.com
§   myorigin = $mydomain
§   inet_interfaces = all
§   mydestination = ms2.chul.com
§   mynetworks = 127.0.0.1 192.168.80.0/24
§   relay_domains = hash:/etc/postfix/relaydomains
§   transport_m aps = hash:/etc/postfix/transport
§   relay_recipient_maps =
§  smtpd_recipient_restrictions=permit_sasl_authenficated,permit_mynetworks,reject_unauth_destinaton

2. In the backup server
# vi  /etc/postfix/relaydomains
chul.com                 OK
jeong.com    OK
linux.com     OK
# vi /etc/postfix/transport
chul.com                 smtp:ms1.chul.com:25
jeong.com    smtp:ms1.chul.com:25
linux.com     smtp:ms1.chul.com:25
# postmap /etc/postfix/relaydomains
# postmap /etc/postfix/transport; service postfix restart
3. Testing
a. Shutdown Primary mail server in ms1.chul.com
# service postfix stop
b. Mail sending and checking on Backup mail server
# mail –v –s “backup server” itc@chul.com, lee@jeong.com, park@linux.com
# postqueue –p
# postqueue -f

Chapter 17 Postfix Admin with MySQL
1.What is Postfix Admin?
§  supply to configure Postfix on Web based GUI.
§  Web Server and Database Server are also necessary to be installed
2.Download and install package
a. Create a database and user for PostfixAdmin
# mysql -u root -p
mysql> create database postfixadmin;
mysql> grant all privileges on postfixadmin.* to ‘postfixadmin’@'localhost' identified by 'password';
mysql> flush privileges;
b. Download package and move to Webserver directory
# yum-y install php-mysql php-imap
http://sourceforge.net/projects/postfixadmin/postfixadmin-2.3.6
# tar zxvf postfixadmin-2.3.6.tar.gz
# mv  postfixadmin-2.3.6 /var/www/html/postfixadmin

c. Postfixadmin configuration
# vi /var/www/html/postfixadmin/config.inc.php
$CONF['configured'] = true;
$CONF['default_language'] = ‘en';
$CONF['database_user'] = 'postfixadmin';
$CONF['database_password'] = 'password';
$CONF['database_name'] = 'postfixadmin';
# vi /etc/httpd/conf.d/postfixadmin.conf
<Directory /var/www/html/postfixadmin/>
   Order Deny,Allow
   Deny from all
   Allow from 127.0.0.1 192.168.80.0/24
</Directory>
#service httpd restart
3. PostfixAdmin Access
http://localhost/postfixadmin/setup.php
3. PostfixAdmin Access
http://localhost/postfixadmin/setup.php
1) Click ‘Lost Password’
2) Input setup password and generate password hash
3) Copy password hash and paste it to config.ini.php
31 $CONF[‘setup_password’] = ‘e84af77b4483dff5025ae85210b963a4:4a94735a0dd286b97cc38463b703ba77966effbb';
4) # service httpd restart
5) Create admin(e-mail) and password
6) Login as a admin in   http://localhost/postfixadmin/login.php
4. PostfixAdmin testing
1) Create virtual domain – jeong.com, linux.com
2) Create virtual users -  lee, park
3) Sending mail


Mail Server Setup using Postfix on CentOS 6.4
                            Summary
1. MTA Postfix
2. IMAP & POP3 using Dovecot
    Evolution, Thunderbird and Microsoft Outlook 2010
3. Postfix Aliases and Access Control
4. Mailman, SquirrelMail and Mailgraph
5. Postfix Authentication with SASL and TLS
6. Postfix Antispam and Antivirus with Spamassassin, Amavisd and ClamAV
7. Postfix backup and Admin with MySQL

5 comments:

  1. Thank you for all your lessons. Best regards

    ReplyDelete
  2. Dear Fedele You are welcome. Thanks for your comment.

    ReplyDelete
  3. I want to use the domain users (ldap) to authentication mail-server, but i don't know the configuration. Can you guide me?
    mc12anhom2@gmail.com
    TKS U FOR CMT!

    ReplyDelete
    Replies
    1. Dear nhom hai. For ldap usage about Postfix, I will upload the video about this later. But right now, I need more study about this part. If I complete to study and then upload this video to my youtube channel. Thanks

      Delete
  4. Dear Mr.Jeong Chul
    can u help me, cuz i lost my postfixadmin login so what can i do? for change or update the new password for user admin to loin postfixadmin

    ReplyDelete