Monday, December 15, 2014

Config postfixamdin on Debian 7.7 (postfix+mysql+dovecot)

Read on:
1. debian-wheezy-mail-server-postfix-dovecot-sasl-mysql-postfixadmin-roundcube-spamassassin-clamav-greylist-nginx-php5
2. http://rimuhosting.com/knowledgebase/linux/mail/postfixadmin


1. fix multi domain can't send mail
Error:
: unknown user: “maxime”

fix mydestination = localhost

2. create Local DNS for test mail

setup-dns-server-debian-7-wheezy

     2.1 cat /etc/bind/named.conf.local
//
// Do any local configuration here
//

// Consider adding the 1918 zones here, if they are not used in your
// organization
//include "/etc/bind/zones.rfc1918";
zone    "nanyang.com"   {
        type master;
        file    "/etc/bind/nanyang.com";
 };
zone    "sirivatana.com"   {
        type master;
        file    "/etc/bind/sirivatana.com";
 };

zone   "122.168.192.in-addr.arpa"        {
       type master;
       file    "/etc/bind/db.192.168.122";
 };

zone   "122.168.192.si.in-addr.arpa"        {
       type master;
       file    "/etc/bind/db.192.168.122.si";
 };
------------------------------------------------------------------------
     2.2 cat /etc/bind/nanyang.com
;
; BIND data file for local loopback interface
;
$TTL    604800
@       IN      SOA     pop3s.nanyang.com. root.nanyang.com. (
                         121220143      ; Serial
                         604800         ; Refresh
                          86400         ; Retry
                        2419200         ; Expire
                         604800 )       ; Negative Cache TTL

        IN      A       192.168.122.10
;
@       IN      NS      pop3s.nanyang.com.
@       IN      MX      10      pop3s.nanyang.com.
@       IN      A       192.168.122.10
@       IN      AAAA    ::1
pop3s   IN      A       192.168.122.10
mail    IN      A       192.168.122.10
dns     IN      A       192.168.122.10
www     IN      A       192.168.122.10
--------------------------------------------------------------------------
     2.3 cat /etc/bind/db.192.168.122
;
; BIND reverse data file for local loopback interface
;
$TTL    604800
@       IN      SOA     pop3s.nanyang.com. root.pop3s.nanyang.com. (
                         121220142      ; Serial
                         604800         ; Refresh
                          86400         ; Retry
                        2419200         ; Expire
                         604800 )       ; Negative Cache TTL
;
@       IN      NS      pop3s.
@       IN      A       192.168.122.10
10      IN      PTR     pop3s.nanyang.com.

3. setup Superuser postfixadmin

3.1#cp config.inc.php.bak config.inc.php
--------------------------Edit file----------------------
$CONF['configured'] = true; $CONF['postfix_admin_url'] = 'https://192.168.122.10/postfixadmin';
$CONF['database_type'] = 'mysqli'; $CONF['database_host'] = 'localhost'; $CONF['database_user'] = 'postfix_admin'; $CONF['database_password'] = ''; $CONF['database_name'] = 'postfix'; $CONF['domain_path'] = 'YES'; $CONF['domain_in_mailbox'] = 'NO'; $CONF['fetchmail'] = 'NO';
------------------------------------------------

3.2 run setup.php from browser: https://192.168.122.10/postfixadmin/setup.php
Step 1 Click Generate password hash


Step 2 add Gen passwd to config.inc.php

add $CONF['setup_password'] = '13a402059836b65b6531a7a16d66dfbb:223b34da76ccf8daeb193737e2266be3dc2e7e6b'; to file config.inc.php and save and then create Supper user postfixadmin



Step 3 add Super user postfixadmin done!
* ในการสร้าง user จะมีพาสเวิร์ด 2 ส่วนคือ
1. ส่วน Setup password ต้องจำให้ได้ว่า ตอนแรกใส่พาวเวิร์ดอะไรไว้ เพราะมันเข้ารหัสไว้ เช่น '13a402059836b65b6531a7a16d66dfbb:223b34da76ccf8daeb193737e2266be3dc2e7e6b';
2. Password Admin: พาสเวิร์ดที่ตั้งไว้ให้กับ Super Admin


4. Dovecot

You really want to change in /etc/dovecot/conf.d/10-mail.conf:

mail_location = maildir:/home/vmail/%d/%n:INDEX=/home/vmail/%d/%n/indexes
to
mail_location = maildir:/home/vmail/%Ld/%Ln:INDEX=/home/vmail/%Ld/%Ln/indexes

otherwise if someone will send you email with mixed case such as AbCdE@ExAmPle.com then dovecot will create a NEW directories for the same user.

5. vacation
postfixadmin-setup-with-correct-vacation-settings-on-freebsd

Error: Command output: Can't locate
    MIME/EncWords.pm
#apt-get install libmime-encwords-perl

Command output: Can't locate
    Email/Valid.pm
#apt-get install libemail-valid-perl

Command output: Can't locate
    Mail/Sender.pm
Run command....
# perl -MCPAN -e shell
Y to all

  cpan> install Mail::Sender
  cpan> quit

#apt-get install libmail-sendmail-perl libdbd-pg-perl libemail-valid-perl libmime-tools-perl liblog-log4perl-perl liblog-dispatch-perl libgetopt-argvfile-perl libmime-charset-perl libmime-encwords-perl