Postfix complete install

(in progress)


aptitude install postfix
pilih: internet site

aptitude install postfix-mysql mysql-client mysql-server
aptitude install courier-authdaemon courier-authmysql
aptitude install courier-imap courier-imap-ssl courier-pop courier-pop-ssl
create dir for web based admin: Yes

dpkg -r --force-depends gamin libgamin0
aptitude install fam libfam0
aptitude install libsasl2-modules-sql

------------


aptitude install postfixadmin

service apache2 restart

Buka pake browser: http://ip.address/postfixadmin/setup.php

masukin password, submit, copas ke /etc/postfixadmin/config.inc.php

 $CONF['setup_password'] = 'bla bla bla';

ubah juga:
 $CONF['domain_path'] = 'YES';
$CONF['quota'] = 'YES';


masukin password tadi, masukin email login admin dan passwordnya

Buka pake browser: http://ip.address/postfixadmin/

Tambahin domain dan mailbox

------------

Liat password db di /etc/postfixadmin/dbconfig.inc.php


vi /etc/postfix/mysql_virtual_alias_maps.cf




user = postfixadmin
password = bjCxZeSlTxv2
hosts = 127.0.0.1
dbname = postfixadmin
table = alias
select_field = goto
where_field = address







vi /etc/postfix/mysql_virtual_domains_maps.cf



user = postfixadmin
password = bjCxZeSlTxv2
hosts = 127.0.0.1
dbname = postfixadmin
table = domain
select_field = domain
where_field = domain
#additional_conditions = and backupmx = '0' and active = '1'





vi /etc/postfix/mysql_virtual_mailbox_maps.cf



user = postfixadmin
password = bjCxZeSlTxv2
hosts = 127.0.0.1
dbname = postfixadmin
table = mailbox
select_field = maildir
where_field = username
#additional_conditions = and active = '1'


vi /etc/postfix/mysql_virtual_mailbox_limit_maps.cf


user = postfixadmin
password = bjCxZeSlTxv2
hosts = 127.0.0.1
dbname = postfixadmin
table = mailbox
select_field = quota
where_field = username
#additional_conditions = and active = '1'




vi /etc/postfix/mysql_relay_domains_maps.cf


user = postfixadmin
password = bjCxZeSlTxv2
hosts = 127.0.0.1
dbname = postfixadmin
table = domain
select_field = domain
where_field = domain
additional_conditions = and backupmx = '1'


chgrp postfix /etc/postfix/mysql_*.cf
chmod 640 /etc/postfix/mysql_*.cf


groupadd -g 5000 vmail


useradd -m -g vmail -u 5000 -d /home/vmail -s /bin/bash vmail



vi /etc/postfix/main.cf

Tambahin:




# Virtual Mailbox Domain Settings

virtual_alias_maps = mysql:/etc/postfix/mysql_virtual_alias_maps.cf
virtual_mailbox_domains = mysql:/etc/postfix/mysql_virtual_domains_maps.cf
virtual_mailbox_maps = mysql:/etc/postfix/mysql_virtual_mailbox_maps.cf
virtual_mailbox_limit = 51200000
virtual_minimum_uid = 5000
virtual_uid_maps = static:5000
virtual_gid_maps = static:5000
virtual_mailbox_base = /home/vmail
virtual_transport = virtual

# Additional for quota support

#virtual_create_maildirsize = yes
virtual_maildir_extended = yes
virtual_mailbox_limit_maps = mysql:/etc/postfix/mysql_virtual_mailbox_limit_maps.cf
virtual_mailbox_limit_override = yes
virtual_maildir_limit_message = Sorry, the your maildir has overdrawn your diskspace quota, please free up some of spaces of your mailbox try again.
virtual_overquota_bounce = yes


usermod -G sasl postfix
 
-----------
 
 
aptitude install courier-authlib-mysql


vi /etc/courier/authdaemonrc


ubah menjadi

authmodulelist="authmysql"
 
 
 
vi  /etc/courier/authmysqlrc 
 
MYSQL_SERVER 127.0.0.1
MYSQL_USERNAME postfixadmin
MYSQL_PASSWORD bjCxZeSlTxv2
MYSQL_DATABASE postfixadmin
MYSQL_USER_TABLE mailbox
MYSQL_LOGIN_FIELD username
MYSQL_NAME_FIELD name
MYSQL_CRYPT_PWFIELD password
#MYSQL_CLEAR_PWFIELD     password
MYSQL_MAILDIR_FIELD maildir
MYSQL_QUOTA_FIELD concat(quota,'S')
MYSQL_HOME_FIELD        '/home/vmail'
MYSQL_UID_FIELD '5000'
MYSQL_GID_FIELD '5000'

 
 
 /etc/init.d/courier-authdaemon restart 
/etc/init.d/courier-imap restart
/etc/init.d/courier-pop restart

/etc/init.d/postfix restart





 
 
Untuk testing, masukkan user saat tambah domain dan mailbox via postfixadmin 
 authtest test@linuxindo.com biji
 

---------
 
Patch postfix to support quota:

apt-get build-dep postfix
 
Download patch sesuai versi postfix 
wget http://vda.sourceforge.net/VDA/postfix-vda-v11-2.9.3.patch

cd postfix-2.9.3/

patch -p1 < ../postfix-vda-v11-2.9.3.patch

vi debian/rules
 export DEB_BUILD_HARDENING=0

  dpkg-buildpackage
 
cd ..
ls -l
 
 
 dpkg -i postfix-mysql_2.9.3-2ubuntu2.1_i386.deb postfix_2.9.3-2ubuntu2.1_i386.deb
 



---------
 
Postfix sasl
 
vi  /etc/postfix/sasl/smtpd.conf 
 
pwcheck_method: auxprop
auxprop_plugin: sql
mech_list: plain login cram-md5 digest-md5
sql_engine: mysql
sql_hostnames: 127.0.0.1
sql_user: postfixadmin
sql_passwd: bjCxZeSlTxv2
sql_database: postfixadmin
sql_select: select password from mailbox where username='%u@%r' and active = 1 
 
vi /etc/postfix/main.cf 
#sasl
smtpd_sasl_auth_enable = yes
broken_sasl_auth_clients = yes
smtpd_sasl_security_options = noanonymous
smtpd_sasl_local_domain =

smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination

Comments

Popular posts from this blog

Optimize SSD on Linux

Manually clean up zimbra zmcat/zmcpustat exploit

Ports to allow for whatsapp call