[root@ns1 root]# apt-get build-dep postfix
[root@ns1 root]# su - camel
[camel@ns1 camel]$ apt-get source postfix
[camel@ns1 camel]$ vi rpm/SPECS/postfix.spec

#
Release: 0vl5.1sasl
%build
make tidy
make makefiles \
 CCARGS="-DMAX_DYNAMIC_MAPS \
 -DUSE_SASL_AUTH -I/usr/include/sasl \
 -DHAS_LDAP \
 -DHAS_PCRE -I/usr/include/pcre \
 -DHAS_MYSQL -I/usr/include/mysql \
 -DHAS_PGSQL -I/usr/include/pgsql" \
 AUXLIBS="-L/usr/lib/sasl2 -lsasl2"
#
Esc :wq

[camel@ns1 camel]$ cd rpm/SPECS
[camel@ns1 SPECS]$ ls
postfix.spec

[camel@ns1 SPECS]$ rpmbuild -bb postfix.spec
[camel@ns1 SPECS]$ cd /home/camel/rpm/RPMS/i386
[camel@ns1 i386]$ su
[root@ns1 i386]# ls
postfix-2.0.20-0vl5.1sasl.i386.rpm

[root@ns1 i386]# rpm -Uvh postfix-2.0.20-0vl5.1sasl.i386.rpm
[root@ns1 i386]# /usr/sbin/postfix check
[root@ns1 i386]# apt-get install cyrus-sasl cyrus-sasl-devel cyrus-sasl-md5 cyrus-sasl-plain db4-devel
[root@ns1 i386]# /etc/init.d/saslauthd start
[root@ns1 i386]# /sbin/chkconfig saslauthd on
[root@ns1 i386]# /usr/sbin/saslpasswd2 -u errorz.net -c camel
Password:
Again (for verification):

[root@ns1 i386]# vi /usr/lib/sasl2/smtpd.conf

pwcheck_method: auxprop
auxprop_plugin: sasldb
mech_list: cram-md5 digest-md5 plain login
Esc :wq

[root@ns1 i386]# chown -R root:postfix /etc/sasldb2
[root@ns1 i386]# chmod 640 /etc/sasldb2
[root@ns1 i386]# /etc/init.d/saslauthd restart
[root@ns1 i386]# vi /etc/postfix/main.cf

#
myhostname = ns1.errorz.net

mydomain = errorz.net

myorigin = $mydomain

inet_interfaces = all

mydestination = $myhostname, localhost.$mydomain $mydomain

unknown_local_recipient_reject_code = 550
#unknown_local_recipient_reject_code = 450

mynetworks = 192.168.0.0/24, 127.0.0.0/8

relay_domains = $mydestination

relayhost = [provid.ne.co.jp]:587

home_mailbox = Maildir/

#mail_spool_directory = /var/spool/mail

#mailbox_command = /some/where/procmail -a "$EXTENSION"

smtp_sasl_auth_enable = yes

smtpd_sasl_auth_enable = yes

smtp_sasl_password_maps = hash:/etc/postfix/isp_auth

smtp_sasl_security_options = noanonymous

smtpd_recipient_restrictions =
 permit_mynetworks,
 permit_sasl_authenticated,
 reject_unauth_destination

smtpd_banner = $myhostname ESMTP unknown

smtpd_sasl_local_domain = $mydomain

allow_percent_hack = yes

broken_sasl_auth_clients = yes

#
Esc :wq

[root@ns1 i386]# vi /etc/postfix/isp_auth

[provid.ne.co.jp]:587 XYZ1234223:*********

Esc :wq

[root@ns1 i386]# postmap /etc/postfix/isp_auth
[root@ns1 i386]# vi /etc/postfix/master.cf

#
smtp inet  n  -  n  -  -  smtpd

submission inet n  -  n  -  -  smtpd
  -o smtpd_etrn_restrictions=reject
  -o smtpd_client_restrictions=permit_sasl_authenticated,reject

#
Esc :wq

[root@ns1 i386]# /etc/init.d/postfix restart
[root@ns1 i386]# /etc/init.d/courier-imap restart

cp